- my $discount = _round($item->sellprice * ($item->discount || 0), $num_dec);
- my $sellprice = _round($item->sellprice - $discount, $num_dec);
+
+ $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
+ my $sellprice = $item->sellprice;