X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fvk.pl;h=fe28838f873a5bbdcb3fa338babc882fc4c173e8;hb=7adc5519c0e80de857987eff6a9a97f3f4e5a6ce;hp=c49bea964c1c4abc03f66b860431fea59083935f;hpb=c0318621a7eb2c05cfec74d2fbbd37025a03dc3d;p=kivitendo-erp.git diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index c49bea964..fe28838f8 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -334,8 +334,8 @@ sub invoice_transactions { $ar->{price_factor} = 1 unless $ar->{price_factor}; # calculate individual sellprice # discount was already accounted for in db sellprice - $ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor} / $basefactor; - $ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor}; + $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; # marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug) @@ -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);