From 4c438c0a3e69b9e8f98d8e61b84c14421435b560 Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Tue, 21 Aug 2012 15:54:36 +0200 Subject: [PATCH] Rundungsfehler in Verkaufsbericht In der Verkaufsbericht gab es je nach Anzeigeoptionen noch Rundungsfehler. qty wird nun auf 2 Stellen gerundet und weight auf 3 Stellen. --- bin/mozilla/vk.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index c49bea964..a89fa0242 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -344,6 +344,12 @@ sub invoice_transactions { $ar->{marge_total} = $ar->{sellprice_total} ? $ar->{sellprice_total}-$ar->{lastcost_total} : 0; $ar->{discount} *= 100; # für Ausgabe formatieren, 10% stored as 0.1 in db + #adapt qty to the chosen unit + $ar->{qty} *= $basefactor; + + #weight is the still the weight per part, but here we want the total weight + $ar->{weight} *= $ar->{qty}; + # Anfangshauptüberschrift if ( $form->{l_headers_mainsort} eq "Y" && ( $idx == 0 or $ar->{ $form->{'mainsort'} } ne $form->{AR}->[$idx - 1]->{ $form->{'mainsort'} } )) { my $headerrow; @@ -422,14 +428,8 @@ sub invoice_transactions { # wird laufend bei jeder Position neu berechnet $totals{marge_percent} = $totals{sellprice_total} ? ( ($totals{sellprice_total} - $totals{lastcost_total}) / $totals{sellprice_total} ) * 100 : 0; - #passt die qty an die gewählte Einheit an - #qty wurde bisher noch für andere Berechnungen benötigt und daher erst am Schluss überschrieben - $ar->{qty} *= $basefactor; - - #weight is the still the weight per part, but here we want the total weight - $ar->{weight} *= $ar->{qty}; - - map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent); + map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty); + map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 3) } qw(weight); map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice sellprice_total lastcost_total); my $row = { }; @@ -521,8 +521,8 @@ sub create_subtotal_row_invoice { $row->{description}->{data} = $locale->text('Total') . ' ' . $name; }; - map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } qw(marge_total marge_percent weight); - map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 0) } qw(qty); + map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } qw(marge_total marge_percent qty); + map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 3) } qw(weight); map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, $form->{decimalplaces}) } qw(lastcost sellprice sellprice_total lastcost_total); -- 2.20.1