+ $lxdebug->leave_sub();
+
+}
+
+sub display_rows {
+ my ($init) = @_;
+ $lxdebug->enter_sub();
+
+ $form->{totaldebit} = 0;
+ $form->{totalcredit} = 0;
+ my $chart = $form->{chart};
+ $chart = $form->unquote($chart);
+ $form->{taxchart} = $form->unquote($form->{taxchart});
+ $taxchart = $form->{taxchart};
+
+ my @old_project_ids = ();
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+
+ $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids });
+
+ my %project_labels = ();
+ my @project_values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@project_values, $item->{"id"});
+ $project_labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+
+ for $i (1 .. $form->{rowcount}) {
+
+ $source = qq|
+ <td><input name="source_$i" value="$form->{"source_$i"}" size="16" tabindex=|
+ . ($i + 11 + (($i - 1) * 8)) . qq|></td>|;
+ $memo = qq|
+ <td><input name="memo_$i" value="$form->{"memo_$i"}" size="16" tabindex=|
+ . ($i + 12 + (($i - 1) * 8)) . qq|></td>|;
+
+ if ($init) {
+ $accno = qq|
+ <td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
+ . ($i + 5 + (($i - 1) * 8)) . qq|>$form->{chartinit}</select></td>|;
+ $tax =
+ qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px" tabindex=|
+ . ($i + 10 + (($i - 1) * 8))
+ . qq|>$form->{taxchart}</select></td>|;
+
+ $korrektur =
+ qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
+ . ($i + 9 + (($i - 1) * 8))
+ . qq|></td>|;
+ if ($form->{transfer}) {
+ $fx_transaction = qq|
+ <td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
+ |;
+ }
+
+ } else {
+ if ($form->{"debit_$i"} != 0) {
+ $form->{totaldebit} += $form->{"debit_$i"};
+ if (!$form->{taxincluded}) {
+ $form->{totaldebit} += $form->{"tax_$i"};
+ }
+ } else {
+ $form->{totalcredit} += $form->{"credit_$i"};
+ if (!$form->{taxincluded}) {
+ $form->{totalcredit} += $form->{"tax_$i"};
+ }
+ }
+
+ for (qw(debit credit tax)) {
+ $form->{"${_}_$i"} =
+ ($form->{"${_}_$i"})
+ ? $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2)
+ : "";
+ }
+
+ if ($i < $form->{rowcount}) {
+
+ $accno = $chart;
+ $chart_selected = $form->{"accno_$i"};
+ $accno =~
+ s/value=\"$chart_selected\"/value=\"$chart_selected\" selected/;
+ $accno =
+ qq|<td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:200px" tabindex=|
+ . ($i + 5 + (($i - 1) * 8))
+ . qq|>$accno</select></td>|;
+ $tax = $taxchart;
+ $tax_selected = $form->{"taxchart_$i"};
+ $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
+ $tax =
+ qq|<td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
+ . ($i + 10 + (($i - 1) * 8))
+ . qq|>$tax</select></td>|;
+
+ if ($form->{transfer}) {
+ $checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
+ $x = ($checked) ? "x" : "";
+ $fx_transaction = qq|
+ <td><input type=hidden name="fx_transaction_$i" value="$checked">$x</td>
+ |;
+ }
+ $checked = ($form->{"korrektur_$i"}) ? "checked" : "";
+ $korrektur =
+ qq|<td><input type="checkbox" name="korrektur_$i" value="1" $checked tabindex=|
+ . ($i + 9 + (($i - 1) * 8))
+ . qq|></td>|;
+ $form->hide_form("accno_$i");
+
+ } else {
+
+ $accno = qq|
+ <td><select name="accno_$i" onChange="setTaxkey(this, $i)" style="width:300px" tabindex=|
+ . ($i + 5 + (($i - 1) * 8)) . qq|>$chart</select></td>|;
+ $tax = qq|
+ <td><select id="taxchart_$i" name="taxchart_$i" tabindex=|
+ . ($i + 10 + (($i - 1) * 8)) . qq|>$taxchart</select></td>|;
+
+ $korrektur =
+ qq|<td><input type="checkbox" name="korrektur_$i" value="1" tabindex=|
+ . ($i + 9 + (($i - 1) * 8))
+ . qq|></td>|;
+ if ($form->{transfer}) {
+ $fx_transaction = qq|
+ <td><input name="fx_transaction_$i" class=checkbox type=checkbox value=1></td>
+ |;
+ }
+ }
+ }
+ my $debitreadonly = "";
+ my $creditreadonly = "";
+ if ($i == $form->{rowcount}) {
+ if ($debitlock) {
+ $debitreadonly = "readonly";
+ } elsif ($creditlock) {
+ $creditreadonly = "readonly";
+ }
+ }
+
+ my $projectnumber =
+ NTI($cgi->popup_menu('-name' => "project_id_$i",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels,
+ '-default' => $form->{"project_id_$i"} ));
+
+ print qq|<tr valign=top>
+ $accno
+ $fx_transaction
+ <td><input name="debit_$i" size=8 value="$form->{"debit_$i"}" accesskey=$i tabindex=|
+ . ($i + 6 + (($i - 1) * 8)) . qq| $debitreadonly></td>
+ <td><input name="credit_$i" size=8 value="$form->{"credit_$i"}" tabindex=|
+ . ($i + 7 + (($i - 1) * 8)) . qq| $creditreadonly></td>
+ <td><input name="tax_$i" size=6 value="$form->{"tax_$i"}" tabindex=|
+ . ($i + 8 + (($i - 1) * 8)) . qq|></td>
+ $korrektur
+ $tax
+ $source
+ $memo
+ <td>$projectnumber</td>
+ </tr>
+
+ |;
+ }
+
+ $form->hide_form(qw(rowcount selectaccno));