mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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()
|
private function push()
|
||||||
{
|
{
|
||||||
|
nlog($this->sub_total . " + ". $this->getLineTotal());
|
||||||
|
|
||||||
$this->sub_total += $this->getLineTotal();
|
$this->sub_total += $this->getLineTotal();
|
||||||
|
|
||||||
$this->line_items[] = $this->item;
|
$this->line_items[] = $this->item;
|
||||||
@ -103,7 +105,15 @@ class InvoiceItemSum
|
|||||||
if ($this->invoice->is_amount_discount) {
|
if ($this->invoice->is_amount_discount) {
|
||||||
$this->setLineTotal($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision));
|
$this->setLineTotal($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision));
|
||||||
} else {
|
} 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;
|
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user