-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr>
- <th align=right>|.$locale->text('Reference').qq|</th>
- <td><input name=reference size=20 value="$form->{reference}" tabindex="1" $readonly></td>
- <td align=left>
- <table width=100%>
- <tr>
- <th align=right nowrap>|.$locale->text('Date').qq|</th>
- $button1
- </tr>
- </table>
- </td>
- </tr>|;
-if ($form->{id}) {
- print qq|
- <tr>
- <th align=right>|.$locale->text('Belegnummer').qq|</th>
- <td><input name=id size=20 value="$form->{id}" $readonly></td>
- <td align=left>
- <table width=100%>
- <tr>
- <th align=right width=50%>|.$locale->text('Buchungsdatum').qq|</th>
- <td align=left><input name=gldate size=11 title="$myconfig{dateformat}" value=$form->{gldate} $readonly></td>
- </tr>
- </table>
- </td>
- </tr>|;
- }
- print qq|
- $department|;
-if ($form->{id}) {
- print qq|
- <tr>
- <th align=right>|.$locale->text('Description').qq|</th>
- <td>$description</td>
- <td align=left>
- <table width=100%>
- <tr>
- <th align=right width=50%>|.$locale->text('Mitarbeiter').qq|</th>
- <td align=left><input name=employee size=11 value=$form->{employee} $readonly></td>
- </tr>
- </table>
- </td>
- </tr>|;
- } else {
- print qq|
- <tr>
- <th align=right>|.$locale->text('Description').qq|</th>
- <td colspan=3>$description</td>
- </tr>|;
- }
- print qq|
- <tr>
- <th align=right>|.$locale->text('Betrag').qq|</th>
- <td>$amount</td>
- <td align=left colspan=2>
- <table>
- <tr>
- <th align=left>|.$locale->text('MwSt. inkl.').qq|</th>
- <td><input type=checkbox name=taxincluded value=1 tabindex="8" $taxincluded></td>
- </tr>
- </table>
- </td>
- </tr>|;
- if ($form->{debit_splited}) {
- print qq|
- <tr>
- <th align=right>|.$locale->text('Debit').qq|</th>
- <td>Betrag gesplittet</td>
- <td><input name=debit size=10 value="|.$form->format_amount(\%myconfig, $form->{debit}, 2).qq|" readonly> EUR</td>
- <td><input class=submit type=submit name=action value="|.$locale->text('Split Debit').qq|"></td>
- <input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Credit').qq|</th>
- <td><select name=creditchartselected tabindex="6">$form->{creditchart}</select></td>
- <td><input name=credit size=10 value="|.$form->format_amount(\%myconfig, $form->{credit},2).qq|" readonly > EUR</td>
- <input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
- </tr>
- |;
- } elsif ($form->{credit_splited}) {
- print qq|
- <tr>
- <th align=right>|.$locale->text('Debit').qq|</th>
- <td><select name=debitchartselected tabindex="6">$form->{debitchart}</select></td>
- <td><input name=debit size=10 value="|.$form->format_amount(\%myconfig, $form->{debit}, 2).qq|" readonly> EUR</td>
- <input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Credit').qq|</th>
- <td>Betrag gesplittet</td>
- <td><input name=credit size=10 value="|.$form->format_amount(\%myconfig, $form->{credit},2).qq|" readonly > EUR</td>
- <td><input class=submit type=submit name=action value="|.$locale->text('Split Credit').qq|"></td>
- <input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
- |;
- } else {
- print qq|
- <tr>
- <th align=right>|.$locale->text('Debit').qq|</th>
- <td><select name=debitchartselected tabindex="6">$form->{debitchart}</select></td>
- <td><input name=debit size=10 value="|.$form->format_amount(\%myconfig, $form->{debit}, 2).qq|" readonly> EUR</td>
- <td><input class=submit type=submit name=action value="|.$locale->text('Split Debit').qq|"></td>
- <input name=debit_splited type=hidden size=10 value=$form->{debit_splited}>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Credit').qq|</th>
- <td><select name=creditchartselected tabindex="6">$form->{creditchart}</select></td>
- <td><input name=credit size=10 value="|.$form->format_amount(\%myconfig, $form->{credit},2).qq|" readonly > EUR</td>
- <td><input class=submit type=submit name=action value="|.$locale->text('Split Credit').qq|"></td>
- <input name=credit_splited type=hidden size=10 value=$form->{credit_splited}>
- </tr>
- <tr>
- <th align=right>|.$locale->text('Tax').qq|</th>
- <td><select name=taxchartselected tabindex="7">$form->{taxchart}</select></td>
- <td><input name=tax size=10 value="|.$form->format_amount(\%myconfig, $form->{tax},2).qq|" readonly > EUR</td>
- <td></td>
- </tr>|;
+ $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);
+ if ($init) {
+ 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"};