From: Stephan Köhler Date: Fri, 25 Nov 2005 11:54:47 +0000 (+0000) Subject: Merge von 611,612,616 aus unstable: Bugfix zu Splitbuchungen X-Git-Tag: release-2.2.0~99 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=cb9ded864a5b5f6fa6da8a04e37983bd3e6cdf63;p=kivitendo-erp.git Merge von 611,612,616 aus unstable: Bugfix zu Splitbuchungen -Bug #205 behoben. Beim Dialogbuchen werden nun auch MwSt. inkl. Buchungen korrekt verarbeitet -Bug #204 behoben: Storno geht jetzt auch bei Splitbuchungen -Bug gefixed #206 Fehler beim Dialogbuchen wenn Korrektur und Steuerinklusive --- diff --git a/SL/GL.pm b/SL/GL.pm index 8772ec9e0..455066079 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -541,7 +541,7 @@ sub transaction { } # get tax description - $query = qq| SELECT * FROM tax t|; + $query = qq| SELECT * FROM tax t order by t.taxkey|; $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); $form->{TAX} = (); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 0c7f7350c..f7c3ee5d5 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->{$_} } @@ -170,6 +177,7 @@ sub edit { $form->{totalcredit} += $ref->{amount}; $form->{"credit_$i"} = $ref->{amount}; } + $form->{"taxchart_$i"} = "0--"; $i++; } if ($ref->{taxaccno} && !$tax) { @@ -1047,10 +1055,10 @@ sub display_rows { qq||; - if ($form->{selectprojectnumber}) { - $project = qq| - |; - } +# if ($form->{selectprojectnumber}) { +# $project = qq| +# |; +# } $korrektur = qq|{"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)) { @@ -1095,14 +1107,14 @@ sub display_rows { . ($i + 10 + (($i - 1) * 8)) . qq|>$tax|; - if ($form->{selectprojectnumber}) { - $form->{"projectnumber_$i"} = "" - if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/; - - $project = $form->{"projectnumber_$i"}; - $project =~ s/--.*//; - $project = qq|$project|; - } +# if ($form->{selectprojectnumber}) { +# $form->{"projectnumber_$i"} = "" +# if $form->{selectprojectnumber} !~ /$form->{"projectnumber_$i"}/; +# +# $project = $form->{"projectnumber_$i"}; +# $project =~ s/--.*//; +# $project = qq|$project|; +# } if ($form->{transfer}) { $checked = ($form->{"fx_transaction_$i"}) ? "1" : ""; @@ -1116,7 +1128,7 @@ sub display_rows { qq||; - $form->hide_form("accno_$i", "projectnumber_$i"); + $form->hide_form("accno_$i"); } else { @@ -1126,10 +1138,10 @@ sub display_rows { $tax = qq| |; - if ($form->{selectprojectnumber}) { - $project = qq| - |; - } +# if ($form->{selectprojectnumber}) { +# $project = qq| +# |; +# } $korrektur = qq| |; } $form->hide_form(qw(rowcount selectaccno)); - print qq| -|; +# print qq| +# |; $lxdebug->leave_sub(); } @@ -1531,6 +1542,19 @@ sub post { my @flds = qw(accno debit credit projectnumber fx_transaction source memo tax taxchart); + if ($form->{storno}) { + for my $i (1 .. $form->{rowcount}) { + unless (($form->{"debit_$i"} eq "") && ($form->{"credit_$i"} eq "")) { + if ($form->{"debit_$i"} ne "") { + $form->{"credit_$i"} = $form->{"debit_$i"}; + $form->{"debit_$i"} = ""; + } elsif ($form->{"credit_$i"} ne "") { + $form->{"debit_$i"} = $form->{"credit_$i"}; + $form->{"credit_$i"} = ""; + } + } + } + } for my $i (1 .. $form->{rowcount}) { @@ -1592,12 +1616,23 @@ 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; } } else { $form->{"tax_$i"} = 0; } + } elsif ($form->{taxincluded}) { + if ($debitcredit) { + $form->{"debit_$i"} = $form->{"debit_$i"} - $form->{"tax_$i"}; + } else { + $form->{"credit_$i"} = $form->{"credit_$i"} - $form->{"tax_$i"}; + } } for (@flds) { $a[$j]->{$_} = $form->{"${_}_$i"} } @@ -1625,8 +1660,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) {