]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Verkaufsbericht: genauere Berechnung von sellprice_total (2. Mal)
authorG. Richardson <information@lx-office-hosting.de>
Wed, 13 Jun 2012 14:51:06 +0000 (16:51 +0200)
committerG. Richardson <information@lx-office-hosting.de>
Wed, 13 Jun 2012 14:51:06 +0000 (16:51 +0200)
War schon in Commit e3329d46a4c2ed19172f9c9ed8251af03cbc1905 drin, ist aber bei
Überarbeitung verlogen gegangen.

Gleiche Berechnung wie in Rechnung unter Berücksichtigung von fxsellprice und
discount.

Summe aus Verkaufsbericht sollte mit Summe aus Verkauf->Berichte->Rechnungen
übereinstimmen.

SL/VK.pm
bin/mozilla/vk.pl

index 41357461122cbab6569309028b6bc1e4b3a45faf..9cf8bed8b1c46df11b9e1968306e9b1115ec1506 100644 (file)
--- a/SL/VK.pm
+++ b/SL/VK.pm
@@ -51,7 +51,7 @@ sub invoice_transactions {
   my @values;
 
   my $query =
-    qq|SELECT ct.id as customerid, ct.name as customername,ct.customernumber,ct.country,ar.invnumber,ar.id,ar.transdate,p.partnumber,pg.partsgroup,i.parts_id,i.qty,i.price_factor,i.discount,i.description as description,i.lastcost,i.sellprice,i.marge_total,i.marge_percent,i.unit,b.description as business,e.name as employee,e2.name as salesman, to_char(ar.transdate,'Month') as month, to_char(ar.transdate, 'YYYYMM') as nummonth | .
+    qq|SELECT ct.id as customerid, ct.name as customername,ct.customernumber,ct.country,ar.invnumber,ar.id,ar.transdate,p.partnumber,pg.partsgroup,i.parts_id,i.qty,i.price_factor,i.discount,i.description as description,i.lastcost,i.sellprice,i.fxsellprice,i.marge_total,i.marge_percent,i.unit,b.description as business,e.name as employee,e2.name as salesman, to_char(ar.transdate,'Month') as month, to_char(ar.transdate, 'YYYYMM') as nummonth | .
     qq|FROM invoice i | .  
     qq|JOIN ar on (i.trans_id = ar.id) | .
     qq|JOIN parts p on (i.parts_id = p.id) | .
index ef99388e2ab7907c301c8476210eb74d9f31a6a4..9e9116e4232e031e0131c6b05c437d595ed45e81 100644 (file)
@@ -329,7 +329,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} * 100) : 0;