mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for rounding when applying line item discounts
This commit is contained in:
parent
07d23c406b
commit
2ab2eef293
@ -81,6 +81,8 @@ class InvoiceItemSum
|
||||
|
||||
private function push()
|
||||
{
|
||||
nlog($this->sub_total . " + ". $this->getLineTotal());
|
||||
|
||||
$this->sub_total += $this->getLineTotal();
|
||||
|
||||
$this->line_items[] = $this->item;
|
||||
@ -103,7 +105,15 @@ class InvoiceItemSum
|
||||
if ($this->invoice->is_amount_discount) {
|
||||
$this->setLineTotal($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision));
|
||||
} else {
|
||||
$this->setLineTotal($this->getLineTotal() - $this->formatValue(round($this->item->line_total * ($this->item->discount / 100), 2), $this->currency->precision));
|
||||
|
||||
/*Test 16-08-2021*/
|
||||
$discount = ($this->item->line_total * ($this->item->discount / 100));
|
||||
$this->setLineTotal($this->formatValue(($this->getLineTotal() - $discount), $this->currency->precision));
|
||||
/*Test 16-08-2021*/
|
||||
|
||||
//replaces the following
|
||||
|
||||
// $this->setLineTotal($this->getLineTotal() - $this->formatValue(round($this->item->line_total * ($this->item->discount / 100), 2), $this->currency->precision));
|
||||
}
|
||||
|
||||
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
||||
|
Loading…
Reference in New Issue
Block a user