Revision 165c6039
Von G. Richardson vor mehr als 12 Jahren hinzugefügt
SL/VK.pm | ||
---|---|---|
51 | 51 |
my @values; |
52 | 52 |
|
53 | 53 |
my $query = |
54 |
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 | . |
|
54 |
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 | .
|
|
55 | 55 |
qq|FROM invoice i | . |
56 | 56 |
qq|JOIN ar on (i.trans_id = ar.id) | . |
57 | 57 |
qq|JOIN parts p on (i.parts_id = p.id) | . |
bin/mozilla/vk.pl | ||
---|---|---|
329 | 329 |
# discount was already accounted for in db sellprice |
330 | 330 |
$ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor}; |
331 | 331 |
$ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor}; |
332 |
$ar->{sellprice_total} = $ar->{qty} * $ar->{sellprice};
|
|
332 |
$ar->{sellprice_total} = $ar->{qty} * ( $ar->{fxsellprice} * ( 1 - $ar->{discount} ) ) ;
|
|
333 | 333 |
$ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost}; |
334 | 334 |
# marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug) |
335 | 335 |
$ar->{marge_percent} = $ar->{sellprice_total} ? (($ar->{sellprice_total}-$ar->{lastcost_total}) / $ar->{sellprice_total} * 100) : 0; |
Auch abrufbar als: Unified diff
Verkaufsbericht: genauere Berechnung von sellprice_total (2. Mal)
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.