]> wagnertech.de Git - mfinanz.git/commitdiff
netprice auf Anzahl von Nachkommastellen von sellprice runden
authorG. Richardson <information@kivitendo-premium.de>
Wed, 3 Sep 2014 14:19:20 +0000 (16:19 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Wed, 3 Sep 2014 14:19:20 +0000 (16:19 +0200)
Es geht um die Anzeige der Einzelpreise von Positionen der
Druckvorlagen.

Bisher wurde netprice hart auf 2 Nachkommastellen gerundet, was zu
Problemen bei Subcentpreisen führte. Dies hatte den Effekt, daß z.B.
Menge 1000 und Sellprice 0.0036 eine linetotal von 3.6 ergab, und
netprice mit 3.6/1000 auf 2 Nachkommastellen gerundet zu 0 wurde. In der
Druckvorlage wurde dadurch der effektive Einzelpreis zu 0.  Rundet man
auf die Anzahl der Nachkommastellen von sellprice (in diesem Beispiel
4), wird daraus wieder 0.0036 und kann in der Druckvorlage korrekt
angezeigt werden.

SL/IS.pm
SL/OE.pm

index f429034e8c6bc36b0f47302749348bfe5ec8b95f..6c5aa9ffe70e6826c07a58dd426faaca4167266f 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -238,7 +238,7 @@ sub invoice_details {
 
       my $discount_round_error       = $discount + ($linetotal_exact - $nodiscount_exact_linetotal); # not used
 
-      $form->{"netprice_$i"}   = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2);
+      $form->{"netprice_$i"}   = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, $decimalplaces);
 
       push @{ $form->{TEMPLATE_ARRAYS}->{netprice} },       ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : '';
       push @{ $form->{TEMPLATE_ARRAYS}->{netprice_nofmt} }, ($form->{"netprice_$i"} != 0) ? $form->{"netprice_$i"} : '';
index 279b08cce9bc3a00236995f6b295d2d5d7bcaeac..52a5a61d683565b7c8e876d134b01636eda1d365 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -1236,7 +1236,7 @@ sub order_details {
 
       my $discount_round_error       = $discount + ($linetotal_exact - $nodiscount_exact_linetotal); # not used
 
-      $form->{"netprice_$i"}   = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2);
+      $form->{"netprice_$i"}   = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, $decimalplaces);
 
       push @{ $form->{TEMPLATE_ARRAYS}->{netprice} },       ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : '';
       push @{ $form->{TEMPLATE_ARRAYS}->{netprice_nofmt} }, ($form->{"netprice_$i"} != 0) ? $form->{"netprice_$i"} : '';