$form->{oldtransdate} = $form->{transdate};
}
- my @a = ();
- my $count = 0;
- my $debittax = 0;
- my $credittax = 0;
- my @flds =
+ my @a = ();
+ my $count = 0;
+ my $debittax = 0;
+ my $credittax = 0;
+ my $debitcount = 0;
+ my $creditcount = 0;
+ $debitlock = 0;
+ $creditlock = 0;
+
+ my @flds =
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
for my $i (1 .. $form->{rowcount}) {
push @a, {};
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
+ if ($debitcredit) {
+ $debitcount++;
+ } else {
+ $creditcount++;
+ }
+
+ if (($debitcount >= 2) && ($creditcount == 2)) {
+ $form->{"credit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $creditcount--;
+ $creditlock = 1;
+ }
+ if (($creditcount >= 2) && ($debitcount == 2)) {
+ $form->{"debit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $debitcount--;
+ $debitlock = 1;
+ }
+ if (($creditcount == 1) && ($debitcount == 2)) {
+ $creditlock = 1;
+ }
+ if (($creditcount == 2) && ($debitcount == 1)) {
+ $debitlock = 1;
+ }
+ if ($debitcredit && $credittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
+ if (!$debitcredit && $debittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
$amount =
($form->{"debit_$i"} == 0)
? $form->{"credit_$i"}
}
} else {
-
- $form->{totaldebit} += $form->{"debit_$i"};
- $form->{totalcredit} += $form->{"credit_$i"};
+ if ($form->{"debit_$i"} != 0) {
+ $form->{totaldebit} += $form->{"debit_$i"};
+ $form->{totaldebit} += $form->{"tax_$i"};
+ } else {
+ $form->{totalcredit} += $form->{"credit_$i"};
+ $form->{totalcredit} += $form->{"tax_$i"};
+ }
for (qw(debit credit tax)) {
$form->{"${_}_$i"} =
}
}
}
+ my $debitreadonly = "";
+ my $creditreadonly = "";
+ if ($i == $form->{rowcount}) {
+ if ($debitlock) {
+ $debitreadonly = "readonly";
+ } elsif ($creditlock) {
+ $creditreadonly = "readonly";
+ }
+ }
print qq|<tr valign=top>
$accno
$fx_transaction
<td><input name="debit_$i" size=10 value="$form->{"debit_$i"}" accesskey=$i tabindex=|
- . ($i + 6 + (($i - 1) * 8)) . qq|></td>
+ . ($i + 6 + (($i - 1) * 8)) . qq| $debitreadonly></td>
<td><input name="credit_$i" size=10 value="$form->{"credit_$i"}" tabindex=|
- . ($i + 7 + (($i - 1) * 8)) . qq|></td>
+ . ($i + 7 + (($i - 1) * 8)) . qq| $creditreadonly></td>
<td><input name="tax_$i" size=8 value="$form->{"tax_$i"}" tabindex=|
. ($i + 8 + (($i - 1) * 8)) . qq|></td>
$korrektur
<td>
<table width=100%>
<tr>
- <th align=right>| . $locale->text('Reference') . qq|</th>
+ <th align=left>| . $locale->text('Reference') . qq|</th>
<td><input name=reference size=20 value="$form->{reference}" tabindex="1" $readonly></td>
<td align=left>
- <table width=100%>
+ <table>
<tr>
<th align=right nowrap>| . $locale->text('Date') . qq|</th>
$button1
<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%>
+ <table>
<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>
if ($form->{id}) {
print qq|
<tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td>$description</td>
+ <th align=left width=1%>| . $locale->text('Description') . qq|</th>
+ <td width=1%>$description</td>
<td>
<table>
<tr>
} else {
print qq|
<tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td colspan=2>$description</td>
+ <th align=left width=1%>| . $locale->text('Description') . qq|</th>
+ <td width=1%>$description</td>
<td>
<table>
<tr>
}
print qq|
<tr>
+ <td colspan=4>
<table width=100%>
<tr class=listheading>
<th class=listheading style="width:15%">|
map {
$form->{$_} =
- $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces, " ")
+ $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
} qw(totaldebit totalcredit);
print qq|
+ <tr class=listtotal>
+ <td></td>
+ <th align=right class=listtotal> $form->{totaldebit}</th>
+ <th align=right class=listtotal> $form->{totalcredit}</th>
+ <td colspan=5></td>
+ </tr>
</table>
+ </td>
+ </tr>
</table>
<input type=hidden name=path value=$form->{path}>
# check project
&check_project;
- my @a = ();
- my $count = 0;
- my $debittax = 0;
- my $credittax = 0;
- my @flds =
+ my @a = ();
+ my $count = 0;
+ my $debittax = 0;
+ my $credittax = 0;
+ my $debitcount = 0;
+ my $creditcount = 0;
+ $creditlock = 0;
+ $debitlock = 0;
+
+ my @flds =
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
for my $i (1 .. $form->{rowcount}) {
push @a, {};
$debitcredit = ($form->{"debit_$i"} == 0) ? "0" : "1";
+
+ if ($debitcredit) {
+ $debitcount++;
+ } else {
+ $creditcount++;
+ }
+
+ if (($debitcount >= 2) && ($creditcount == 2)) {
+ $form->{"credit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $creditcount--;
+ $creditlock = 1;
+ }
+ if (($creditcount >= 2) && ($debitcount == 2)) {
+ $form->{"debit_$i"} = 0;
+ $form->{"tax_$i"} = 0;
+ $debitcount--;
+ $debitlock = 1;
+ }
+ if (($creditcount == 1) && ($debitcount == 2)) {
+ $creditlock = 1;
+ }
+ if (($creditcount == 2) && ($debitcount == 1)) {
+ $debitlock = 1;
+ }
+ if ($debitcredit && $credittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
+ if (!$debitcredit && $debittax) {
+ $form->{"taxchart_$i"} = "0--0.00";
+ }
$amount =
($form->{"debit_$i"} == 0)
? $form->{"credit_$i"}