From: Moritz Bunkus Date: Fri, 5 Feb 2010 13:21:58 +0000 (+0100) Subject: DATEV-Export: Rundungsfehler berücksichtigen & Codevereinfachung X-Git-Tag: release-2.6.1beta1~58 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=474247d8447c579cfe44d92c97bb17302aff4521;p=kivitendo-erp.git DATEV-Export: Rundungsfehler berücksichtigen & Codevereinfachung --- diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 5da44499f..56c3e82d8 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -482,13 +482,14 @@ sub _get_transactions { $absumsatz += -1 * $new_trans{'amount'}; } else { - my $unrounded = $trans->[$j]->{'amount'} * (1 + $tax_rate) * -1; # + $rounding_error; + my $unrounded = $trans->[$j]->{'amount'} * (1 + $tax_rate) * -1 + $rounding_error; my $rounded = $form->round_amount($unrounded, 2); - $rounding_error += $unrounded - $rounded; + + $rounding_error = $unrounded - $rounded; $new_trans{'amount'} = $rounded; - $new_trans{'umsatz'} = abs($form->round_amount(($trans->[$j]->{'amount'} * (1 + $tax_rate)), 2)) * $ml; - $trans->[$j]->{'umsatz'} = abs($form->round_amount(($trans->[$j]->{'amount'} * (1 + $tax_rate)), 2)) * $ml; - $absumsatz += $form->round_amount($trans->[$j]->{'amount'} + $trans->[$j]->{'amount'} * $tax_rate, 2); + $new_trans{'umsatz'} = abs($rounded) * $ml; + $trans->[$j]->{'umsatz'} = $new_trans{umsatz}; + $absumsatz -= $rounded; } push @{ $form->{DATEV} }, [ \%new_trans, $trans->[$j] ];