From 474247d8447c579cfe44d92c97bb17302aff4521 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 5 Feb 2010 14:21:58 +0100 Subject: [PATCH] =?utf8?q?DATEV-Export:=20Rundungsfehler=20ber=C3=BCcksich?= =?utf8?q?tigen=20&=20Codevereinfachung?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DATEV.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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] ]; -- 2.20.1