Revision 7b9e6d68
Von G. Richardson vor mehr als 13 Jahren hinzugefügt
bin/mozilla/vk.pl | ||
---|---|---|
295 | 295 |
|
296 | 296 |
map { $totals{$_} += $ar->{$_} } @total_columns; |
297 | 297 |
|
298 |
$subtotals2{sellprice} = $subtotals2{sellprice_total} / $subtotals2{qty} if $subtotals2{qty} != 0; |
|
299 |
$subtotals1{sellprice} = $subtotals1{sellprice_total} / $subtotals1{qty} if $subtotals1{qty} != 0; |
|
300 |
$subtotals2{lastcost} = $subtotals2{lastcost_total} / $subtotals2{qty} if $subtotals2{qty} != 0; |
|
301 |
$subtotals1{lastcost} = $subtotals1{lastcost_total} / $subtotals1{qty} if $subtotals1{qty} != 0; |
|
298 |
if ( $subtotals1{qty} != 0 ) { |
|
299 |
# calculate averages for subtotals1 and subtotals2 |
|
300 |
# credited positions reduce both total and qty and thus don't influence average prices |
|
301 |
$subtotals1{sellprice} = $subtotals1{sellprice_total} / $subtotals1{qty}; |
|
302 |
$subtotals1{lastcost} = $subtotals1{lastcost_total} / $subtotals1{qty}; |
|
303 |
} else { |
|
304 |
# qty is zero, so we have a special case where each position in subtotal |
|
305 |
# group has a corresponding credit note so that the total qty is zero in |
|
306 |
# this case we also want the total amounts to be zero, so overwrite them, |
|
307 |
# rather than leaving the last value in sellprice/lastcost |
|
308 |
|
|
309 |
$subtotals1{sellprice} = 0; |
|
310 |
$subtotals1{lastcost} = 0; |
|
311 |
}; |
|
312 |
|
|
313 |
if ( $subtotals2{qty} != 0 ) { |
|
314 |
$subtotals2{sellprice} = $subtotals2{sellprice_total} / $subtotals2{qty}; |
|
315 |
$subtotals2{lastcost} = $subtotals2{lastcost_total} / $subtotals2{qty}; |
|
316 |
} else { |
|
317 |
$subtotals2{sellprice} = 0; |
|
318 |
$subtotals2{lastcost} = 0; |
|
319 |
}; |
|
302 | 320 |
|
303 | 321 |
# Ertrag prozentual in den Summen: (summe VK - summe Ertrag) / summe VK |
304 | 322 |
$subtotals1{marge_percent} = $subtotals1{sellprice_total} ? (($subtotals1{sellprice_total} - $subtotals1{lastcost_total}) / $subtotals1{sellprice_total}) : 0; |
Auch abrufbar als: Unified diff
Verkaufsbericht: Komplett gutgeschriebene Artikel berücksichtigen
Spezialfall wo qty innerhalb einer Subtotal 0 ist, wenn es zu allen Positionen
eine Gutschrift gibt. In diesem Fall wird der Gesamt-VK und Gesamt-EK auf 0
gesetzt, dies wurde bisher falsch berechnet.