From 9feb246dea491959ab77055a5a1985ae64c9776f Mon Sep 17 00:00:00 2001 From: Philip Reetz Date: Wed, 9 Nov 2005 15:25:25 +0000 Subject: [PATCH] Bug#205 behoben. Beim Dialogbuchen werden nun auch MwSt. inkl. Buchungen korrekt verarbeitet --- bin/mozilla/gl.pl | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index da2da5b37..734e9c4a6 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -160,6 +160,13 @@ sub edit { if ($tax && ($ref->{accno} eq $taxaccno)) { $form->{"tax_$j"} = abs($ref->{amount}); $form->{"taxchart_$j"} = $ref->{taxkey} . "--" . $ref->{taxrate}; + if ($form->{taxincluded}) { + if ($ref->{amount} < 0) { + $form->{"debit_$j"} += $form->{"tax_$j"}; + } else { + $form->{"credit_$j"} += $form->{"tax_$j"}; + } + } } else { $form->{"accno_$i"} = "$ref->{accno}--$ref->{accnotaxkey}"; for (qw(fx_transaction source memo)) { $form->{"${_}_$i"} = $ref->{$_} } @@ -1068,10 +1075,14 @@ sub display_rows { } else { if ($form->{"debit_$i"} != 0) { $form->{totaldebit} += $form->{"debit_$i"}; - $form->{totaldebit} += $form->{"tax_$i"}; + if (!$form->{taxincluded}) { + $form->{totaldebit} += $form->{"tax_$i"}; + } } else { $form->{totalcredit} += $form->{"credit_$i"}; - $form->{totalcredit} += $form->{"tax_$i"}; + if (!$form->{taxincluded}) { + $form->{totalcredit} += $form->{"tax_$i"}; + } } for (qw(debit credit tax)) { @@ -1596,6 +1607,11 @@ sub post { } if ($form->{taxincluded}) { $form->{"tax_$i"} = $amount / ($rate + 1) * $rate; + if ($debitcredit) { + $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"}; + } else { + $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"}; + } } else { $form->{"tax_$i"} = $amount * $rate; } @@ -1629,8 +1645,12 @@ sub post { )); } if ($form->{taxincluded}) { - $debit += $dr; - $credit += $cr; + if ($dr) { + $debit += $dr + $tax; + } + if ($cr) { + $credit += $cr + $tax; + } $taxtotal += $tax; } else { if ($dr) { -- 2.20.1