From: Moritz Bunkus Date: Mon, 6 Oct 2008 10:39:24 +0000 (+0000) Subject: Bei Berechnung des absoluten Rabattes den Rundungsfehler mit einbeziehen. X-Git-Tag: release-2.6.0beta2~249 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=21717dcdc5c4da65aee616af66271b9f6fc164eb;p=kivitendo-erp.git Bei Berechnung des absoluten Rabattes den Rundungsfehler mit einbeziehen. --- diff --git a/SL/IS.pm b/SL/IS.pm index 7e52b2bea..b782fef26 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -213,8 +213,10 @@ sub invoice_details { my $decimalplaces = max 2, length($dec); my $parsed_discount = $form->parse_amount($myconfig, $form->{"discount_$i"}); - my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor}, $decimalplaces); - my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}, 2); + my $linetotal_exact = $form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}; + my $linetotal = $form->round_amount($linetotal_exact, 2); + my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor} - ($linetotal - $linetotal_exact), + $decimalplaces); my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2); $form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); diff --git a/SL/OE.pm b/SL/OE.pm index 81b9b0ab7..6013d24c5 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1011,8 +1011,10 @@ sub order_details { my $decimalplaces = max 2, length($dec); my $parsed_discount = $form->parse_amount($myconfig, $form->{"discount_$i"}); - my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor}, $decimalplaces); - my $linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}, 2); + my $linetotal_exact = $form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}; + my $linetotal = $form->round_amount($linetotal_exact, 2); + my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor} - ($linetotal - $linetotal_exact), + $decimalplaces); my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2); $form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2);