Revision c126984e
Von G. Richardson vor etwa 12 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
222 | 222 |
my ($dec) = ($sellprice =~ /\.(\d+)/); |
223 | 223 |
my $decimalplaces = max 2, length($dec); |
224 | 224 |
|
225 |
my $parsed_discount = $form->parse_amount($myconfig, $form->{"discount_$i"}); |
|
226 |
my $linetotal_exact = $form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}; |
|
227 |
my $linetotal = $form->round_amount($linetotal_exact, 2); |
|
228 |
my $discount = $form->round_amount($form->{"qty_$i"} * $sellprice * $parsed_discount / 100 / $price_factor->{factor} - ($linetotal - $linetotal_exact), |
|
229 |
$decimalplaces); |
|
230 |
my $nodiscount_linetotal = $form->round_amount($form->{"qty_$i"} * $sellprice / $price_factor->{factor}, 2); |
|
225 |
my $parsed_discount = $form->parse_amount($myconfig, $form->{"discount_$i"}); |
|
226 |
|
|
227 |
my $linetotal_exact = $form->{"qty_$i"} * $sellprice * (100 - $parsed_discount) / 100 / $price_factor->{factor}; |
|
228 |
my $linetotal = $form->round_amount($linetotal_exact, 2); |
|
229 |
|
|
230 |
my $nodiscount_exact_linetotal = $form->{"qty_$i"} * $sellprice / $price_factor->{factor}; |
|
231 |
my $nodiscount_linetotal = $form->round_amount($nodiscount_exact_linetotal,2); |
|
232 |
|
|
233 |
my $discount = $nodiscount_linetotal - $linetotal; # is always rounded because $nodiscount_linetotal and $linetotal are rounded |
|
234 |
|
|
235 |
my $discount_round_error = $discount + ($linetotal_exact - $nodiscount_exact_linetotal); # not used |
|
236 |
|
|
231 | 237 |
$form->{"netprice_$i"} = $form->round_amount($form->{"qty_$i"} ? ($linetotal / $form->{"qty_$i"}) : 0, 2); |
232 | 238 |
|
233 | 239 |
push @{ $form->{TEMPLATE_ARRAYS}->{netprice} }, ($form->{"netprice_$i"} != 0) ? $form->format_amount($myconfig, $form->{"netprice_$i"}, $decimalplaces) : ''; |
Auch abrufbar als: Unified diff
Bug 1946 - Rundungsberechnung bei Rabattbeträgen verbessert