X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/36bdd4875c67f916e4a885191f7870d301ae2c11..dbcaeb6aece5d4c2490cb308bc793e2bdff17423:/SL/DB/Helper/PriceTaxCalculator.pm diff --git a/SL/DB/Helper/PriceTaxCalculator.pm b/SL/DB/Helper/PriceTaxCalculator.pm index 89173102a..e1db34039 100644 --- a/SL/DB/Helper/PriceTaxCalculator.pm +++ b/SL/DB/Helper/PriceTaxCalculator.pm @@ -83,7 +83,7 @@ sub _calculate_item { my ($self, $item, $idx, $data, %params) = @_; my $part = SL::DB::Part->load_cached($item->parts_id); - return unless $item->part; + return unless $part; my $part_unit = $data->{units_by_name}->{ $part->unit }; my $item_unit = $data->{units_by_name}->{ $item->unit }; @@ -96,6 +96,7 @@ sub _calculate_item { my $num_dec = max 2, _num_decimal_places($item->sellprice); + $item->discount(0) if !$item->discount; # don't include rounded discount into sellprice for calculation # any time the sellprice is multiplied with qty discount has to be considered as part of the multiplication