Angleichung Verkaufsbericht an Verkauf-Berichte-Rechnungen
authorNiclas Zimmermann <niclas@kivitendo-premium.de>
Thu, 22 Nov 2012 10:11:05 +0000 (11:11 +0100)
committerNiclas Zimmermann <niclas@kivitendo-premium.de>
Thu, 22 Nov 2012 10:11:05 +0000 (11:11 +0100)
Der Ertrag/Einkaufsbetrag/Verkaufsbetrag wurde bisher im
Verkaufsbericht anders berechnet als in Verkauf-Berichte-
Rechnungen.

Behebt Bug #1990.

bin/mozilla/vk.pl

index fe28838..dd0a9b6 100644 (file)
@@ -336,8 +336,8 @@ sub invoice_transactions {
     # discount was already accounted for in db sellprice
     $ar->{sellprice}       = $ar->{sellprice}  / $ar->{price_factor} / $basefactor;
     $ar->{lastcost}        = $ar->{lastcost}   / $ar->{price_factor} / $basefactor;
-    $ar->{sellprice_total} = $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) / $ar->{price_factor};
-    $ar->{lastcost_total}  = $ar->{qty} * $ar->{lastcost} * $basefactor;
+    $ar->{sellprice_total} = $form->round_amount( $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) / $ar->{price_factor}, 2);
+    $ar->{lastcost_total}  = $form->round_amount( $ar->{qty} * $ar->{lastcost} * $basefactor, 2);
     # marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug)
     $ar->{marge_percent} = $ar->{sellprice_total} ? (($ar->{sellprice_total}-$ar->{lastcost_total}) / $ar->{sellprice_total} * 100) : 0;
     # marge_total neu berechnen
@@ -428,9 +428,9 @@ 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;
 
-    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty);
+    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(marge_total marge_percent qty sellprice_total lastcost_total);
     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);
+    map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, $form->{"decimalplaces"} )} qw(lastcost sellprice);
 
     my $row = { };