From: G. Richardson Date: Fri, 4 May 2012 16:22:34 +0000 (+0200) Subject: Verkaufsbericht: genauere Berechnung von sellprice_total X-Git-Tag: release-3.0.0beta1~342 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e3329d46a4c2ed19172f9c9ed8251af03cbc1905;p=kivitendo-erp.git Verkaufsbericht: genauere Berechnung von sellprice_total Gleiche Berechnung wie in Rechnung. Summe aus Verkaufsbericht sollte mit Summe aus Verkauf->Berichte->Rechnungen übereinstimmen. --- diff --git a/SL/VK.pm b/SL/VK.pm index c3a2562fd..ae3ff4dbe 100644 --- a/SL/VK.pm +++ b/SL/VK.pm @@ -51,7 +51,7 @@ sub invoice_transactions { my @values; my $query = - qq|SELECT cus.name,cus.customernumber,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit | . + qq|SELECT cus.name,cus.customernumber,ar.invnumber,ar.id,ar.transdate,p.partnumber,i.parts_id,i.qty,i.price_factor,i.discount,i.description,i.lastcost,i.sellprice,i.fxsellprice,i.marge_total,i.marge_percent,i.unit | . qq|FROM invoice i | . qq|join ar on (i.trans_id = ar.id) | . qq|join parts p on (i.parts_id = p.id) | . diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index e871053a3..b5c0931af 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -241,7 +241,7 @@ sub invoice_transactions { # discount was already accounted for in db sellprice $ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor}; $ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor}; - $ar->{sellprice_total} = $ar->{qty} * $ar->{sellprice}; + $ar->{sellprice_total} = $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) ; $ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost}; # 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}) : 0;