Change order of rounding taxes in line items
This commit is contained in:
parent
98450f434d
commit
971b989e57
|
|
@ -242,11 +242,11 @@ class InvoiceItemSum
|
||||||
private function setDiscount()
|
private function setDiscount()
|
||||||
{
|
{
|
||||||
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(round($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision),2));
|
||||||
} else {
|
} else {
|
||||||
$discount = ($this->item->line_total * ($this->item->discount / 100));
|
$discount = ($this->item->line_total * ($this->item->discount / 100));
|
||||||
|
|
||||||
$this->setLineTotal($this->formatValue(($this->getLineTotal() - $discount), $this->currency->precision));
|
$this->setLineTotal(round($this->formatValue(($this->getLineTotal() - $discount), $this->currency->precision),2));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
||||||
|
|
|
||||||
|
|
@ -177,9 +177,9 @@ class InvoiceItemSumInclusive
|
||||||
private function setDiscount()
|
private function setDiscount()
|
||||||
{
|
{
|
||||||
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(round($this->getLineTotal() - $this->formatValue($this->item->discount, $this->currency->precision),2));
|
||||||
} else {
|
} else {
|
||||||
$this->setLineTotal($this->getLineTotal() - $this->formatValue(($this->item->line_total * ($this->item->discount / 100)), $this->currency->precision));
|
$this->setLineTotal(round($this->getLineTotal() - $this->formatValue(($this->item->line_total * ($this->item->discount / 100)), $this->currency->precision),2));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
$this->item->is_amount_discount = $this->invoice->is_amount_discount;
|
||||||
|
|
|
||||||
|
|
@ -812,8 +812,7 @@ class InvoiceTest extends TestCase
|
||||||
|
|
||||||
$invoice = $invoice->calc()->getInvoice();
|
$invoice = $invoice->calc()->getInvoice();
|
||||||
|
|
||||||
nlog($invoice->amount);
|
$this->assertEquals(99.99, $invoice->amount);
|
||||||
$this->assertEquals(100, $invoice->amount);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue