+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ my %chart_labels = ();
+ my @chart_values = ();
+ my %charts = ();
+ my $taxchart_init;
+ foreach my $item (@{ $form->{ALL_CHARTS} }) {
+ if ($item->{charttype} eq 'H'){ #falls überschrift
+ next; #überspringen (Bug 1150)
+ }
+ my $key = $item->{accno} . "--" . $item->{tax_id};
+ $taxchart_init = $item->{tax_id} unless (@chart_values);
+ push(@chart_values, $key);
+ $chart_labels{$key} = $item->{accno} . "--" . $item->{description};
+ $charts{$item->{accno}} = $item;
+ }
+
+ my %taxchart_labels = ();
+ my @taxchart_values = ();
+ my %taxcharts = ();
+ foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
+ my $key = $item->{id} . "--" . $item->{rate};
+ $taxchart_init = $key if ($taxchart_init == $item->{id});
+ push(@taxchart_values, $key);
+ $taxchart_labels{$key} = $item->{taxdescription} . " " . $item->{rate} * 100 . ' %';
+ $taxcharts{$item->{id}} = $item;
+ }
+
+ my ($source, $memo, $source_hidden, $memo_hidden);
+ for my $i (1 .. $form->{rowcount}) {
+ if ($form->{show_details}) {
+ $source = qq|
+ <td><input name="source_$i" value="$form->{"source_$i"}" size="16"></td>|;
+ $memo = qq|
+ <td><input name="memo_$i" value="$form->{"memo_$i"}" size="16"></td>|;
+ } else {
+ $source_hidden = qq|
+ <input type="hidden" name="source_$i" value="$form->{"source_$i"}" size="16">|;
+ $memo_hidden = qq|
+ <input type="hidden" name="memo_$i" value="$form->{"memo_$i"}" size="16">|;
+ }
+
+ my $selected_accno_full;
+ my ($accno_row) = split(/--/, $form->{"accno_$i"});
+ my $item = $charts{$accno_row};
+ $selected_accno_full = "$item->{accno}--$item->{tax_id}";
+
+ my $selected_taxchart = $form->{"taxchart_$i"};
+ my ($selected_accno, $selected_tax_id) = split(/--/, $selected_accno_full);
+ my ($previous_accno, $previous_tax_id) = split(/--/, $form->{"previous_accno_$i"});
+
+ if ($previous_accno &&
+ ($previous_accno eq $selected_accno) &&
+ ($previous_tax_id ne $selected_tax_id)) {
+ my $item = $taxcharts{$selected_tax_id};
+ $selected_taxchart = "$item->{id}--$item->{rate}";
+ }
+
+ $selected_accno = '' if ($init);
+ $selected_taxchart ||= $taxchart_init;
+
+ my $accno = qq|<td>| .
+ NTI($cgi->popup_menu('-name' => "accno_$i",
+ '-id' => "accno_$i",
+ '-onChange' => "setTaxkey($i)",
+ '-style' => 'width:200px',
+ '-values' => \@chart_values,
+ '-labels' => \%chart_labels,
+ '-default' => $selected_accno_full))
+ . $cgi->hidden('-name' => "previous_accno_$i",
+ '-default' => $selected_accno_full)
+ . qq|</td>|;
+ my $tax_ddbox = qq|<td>| .
+ NTI($cgi->popup_menu('-name' => "taxchart_$i",
+ '-id' => "taxchart_$i",
+ '-style' => 'width:200px',
+ '-values' => \@taxchart_values,
+ '-labels' => \%taxchart_labels,
+ '-default' => $selected_taxchart))
+ . qq|</td>|;
+
+ my ($fx_transaction, $checked);