From bed583a0d8035afabcf7fdf276e0b5cee5f62e04 Mon Sep 17 00:00:00 2001 From: Philip Reetz Date: Fri, 28 Oct 2005 15:16:41 +0000 Subject: [PATCH] Aenderungen beim Dialogbuchen: Layout der Maske angepasst. Es kann nur eine Seite gesplittet werden, nur eine Seite kann Steuer haben --- bin/mozilla/gl.pl | 139 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 116 insertions(+), 23 deletions(-) diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 3433b47f0..0c7f7350c 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -899,11 +899,16 @@ sub update { $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}) { @@ -916,6 +921,36 @@ sub update { 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"} @@ -1027,9 +1062,13 @@ sub display_rows { } } 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"} = @@ -1102,14 +1141,23 @@ sub display_rows { } } } + my $debitreadonly = ""; + my $creditreadonly = ""; + if ($i == $form->{rowcount}) { + if ($debitlock) { + $debitreadonly = "readonly"; + } elsif ($creditlock) { + $creditreadonly = "readonly"; + } + } print qq| $accno $fx_transaction + . ($i + 6 + (($i - 1) * 8)) . qq| $debitreadonly> + . ($i + 7 + (($i - 1) * 8)) . qq| $creditreadonly> $korrektur @@ -1241,10 +1289,10 @@ sub form_header { - +
| . $locale->text('Reference') . qq|| . $locale->text('Reference') . qq| - +
$button1 @@ -1258,7 +1306,7 @@ sub form_header {
| . $locale->text('Date') . qq|| . $locale->text('Belegnummer') . qq| - +
@@ -1272,8 +1320,8 @@ sub form_header { if ($form->{id}) { print qq| - - + +
| . $locale->text('Buchungsdatum') . qq| {gldate} $readonly>
| . $locale->text('Description') . qq|$description| . $locale->text('Description') . qq|$description @@ -1294,8 +1342,8 @@ sub form_header { } else { print qq| - - + +
| . $locale->text('Description') . qq|$description| . $locale->text('Description') . qq|$description @@ -1308,6 +1356,7 @@ sub form_header { } print qq| + +
+ + + + +
| @@ -1343,11 +1392,19 @@ sub form_footer { map { $form->{$_} = - $form->format_amount(\%myconfig, $form->{$_}, $decimalplaces, " ") + $form->format_amount(\%myconfig, $form->{$_}, 2, " ") } qw(totaldebit totalcredit); print qq| +
$form->{totaldebit} $form->{totalcredit}
+
{path}> @@ -1463,11 +1520,16 @@ sub post { # 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}) { @@ -1480,6 +1542,37 @@ sub post { 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"} -- 2.20.1