From: Moritz Bunkus Date: Thu, 8 Jan 2009 10:29:04 +0000 (+0000) Subject: Beim Buchen von Kreditoren- und Debitorenbuchungen immer die richtigen Steuerschlüsse... X-Git-Tag: release-2.6.0beta2~199 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=39da7f8cf4f0db564e9e6e9d8f5bd8aedcc5aaea;p=kivitendo-erp.git Beim Buchen von Kreditoren- und Debitorenbuchungen immer die richtigen Steuerschlüssel in acc_trans eintragen. Vorher konnte es den Fall geben, dass bei mehreren Einträgen für ein Konto in einer Kreditoren- oder Debitorenbuchung mit unterschiedlichen Steuerschlüssel zwar die richtigen Steuersätze berechnet aber die falschen Steuerschlüssel gespeichert wurden. --- diff --git a/SL/AP.pm b/SL/AP.pm index 1b7c1d84a..514324522 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -96,10 +96,7 @@ sub post_transaction { qq|ORDER BY c.accno|; $sth = $dbh->prepare($query); $sth->execute($form->{"tax_id_$i"}) || $form->dberror($query . " (" . $form->{"tax_id_$i"} . ")"); - ($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = - $sth->fetchrow_array; - $form->{AP_amounts}{"tax_$i"}{taxkey} = $form->{"taxkey_$i"}; - $form->{AP_amounts}{"amount_$i"}{taxkey} = $form->{"taxkey_$i"}; + ($form->{AP_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = $sth->fetchrow_array(); $sth->finish; if ($form->{taxincluded} *= 1) { @@ -212,7 +209,6 @@ sub post_transaction { if ($form->{"amount_$i"} != 0) { my $project_id; $project_id = conv_i($form->{"project_id_$i"}); - $taxkey = $form->{AP_amounts}{"amount_$i"}{taxkey}; # insert detail records in acc_trans $query = @@ -222,7 +218,7 @@ sub post_transaction { qq| ?, ?, ?, ?)|; @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"}, $form->{"amount_$i"}, conv_date($form->{transdate}), - $project_id, $taxkey); + $project_id, $form->{"taxkey_$i"}); do_query($form, $dbh, $query, @values); if ($form->{"tax_$i"} != 0) { @@ -234,7 +230,7 @@ sub post_transaction { qq| ?, ?, ?, ?)|; @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"}, $form->{"tax_$i"}, conv_date($form->{transdate}), - $project_id, $taxkey); + $project_id, $form->{"taxkey_$i"}); do_query($form, $dbh, $query, @values); } diff --git a/SL/AR.pm b/SL/AR.pm index c7965f8d5..14fa809c4 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -86,9 +86,6 @@ sub post_transaction { $query = qq|SELECT c.accno, t.taxkey, t.rate FROM tax t LEFT JOIN chart c ON (c.id = t.chart_id) WHERE t.id = ? ORDER BY c.accno|; ($form->{AR_amounts}{"tax_$i"}, $form->{"taxkey_$i"}, $form->{"taxrate_$i"}) = selectrow_query($form, $dbh, $query, $form->{"tax_id_$i"}); - $form->{AR_amounts}{"tax_$i"}{taxkey} = $form->{"taxkey_$i"}; - $form->{AR_amounts}{"amounts_$i"}{taxkey} = $form->{"taxkey_$i"}; - if ($form->{taxincluded} *= 1) { $tax = $form->{"korrektur_$i"} ? $form->{"tax_$i"} @@ -172,19 +169,20 @@ sub post_transaction { for $i (1 .. $form->{rowcount}) { if ($form->{"amount_$i"} != 0) { my $project_id = conv_i($form->{"project_id_$i"}); - $taxkey = $form->{AR_amounts}{"amounts_$i"}{taxkey}; # insert detail records in acc_trans $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|; - @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"amount_$i"}), conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id, conv_i($taxkey)); + @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"amount_$i"}), conv_i($form->{"amount_$i"}), conv_date($form->{transdate}), $project_id, + conv_i($form->{"taxkey_$i"})); do_query($form, $dbh, $query, @values); if ($form->{"tax_$i"} != 0) { # insert detail records in acc_trans $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id, taxkey) VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?, ?, ?)|; - @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"tax_$i"}), conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id, conv_i($taxkey)); + @values = (conv_i($form->{id}), conv_i($form->{AR_amounts}{"tax_$i"}), conv_i($form->{"tax_$i"}), conv_date($form->{transdate}), $project_id, + conv_i($form->{"taxkey_$i"})); do_query($form, $dbh, $query, @values); } }