Fixes for zero percent line item taxes

This commit is contained in:
David Bomba 2022-02-04 12:44:39 +11:00
parent e0f5ac0751
commit 77034b6083
2 changed files with 9 additions and 7 deletions

View File

@ -134,21 +134,22 @@ class InvoiceItemSum
$item_tax += $item_tax_rate1_total; $item_tax += $item_tax_rate1_total;
if($item_tax_rate1_total != 0) // if($item_tax_rate1_total != 0)
if (strlen($this->item->tax_name1) > 1)
$this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total); $this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total);
$item_tax_rate2_total = $this->calcAmountLineTax($this->item->tax_rate2, $amount); $item_tax_rate2_total = $this->calcAmountLineTax($this->item->tax_rate2, $amount);
$item_tax += $item_tax_rate2_total; $item_tax += $item_tax_rate2_total;
if($item_tax_rate2_total != 0) if (strlen($this->item->tax_name2) > 1)
$this->groupTax($this->item->tax_name2, $this->item->tax_rate2, $item_tax_rate2_total); $this->groupTax($this->item->tax_name2, $this->item->tax_rate2, $item_tax_rate2_total);
$item_tax_rate3_total = $this->calcAmountLineTax($this->item->tax_rate3, $amount); $item_tax_rate3_total = $this->calcAmountLineTax($this->item->tax_rate3, $amount);
$item_tax += $item_tax_rate3_total; $item_tax += $item_tax_rate3_total;
if($item_tax_rate3_total != 0) if (strlen($this->item->tax_name3) > 1)
$this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total); $this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total);
$this->setTotalTaxes($this->formatValue($item_tax, $this->currency->precision)); $this->setTotalTaxes($this->formatValue($item_tax, $this->currency->precision));

View File

@ -119,21 +119,22 @@ class InvoiceItemSumInclusive
$item_tax += $this->formatValue($item_tax_rate1_total, $this->currency->precision); $item_tax += $this->formatValue($item_tax_rate1_total, $this->currency->precision);
if($item_tax_rate1_total != 0) // if($item_tax_rate1_total != 0)
if (strlen($this->item->tax_name1) > 1)
$this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total); $this->groupTax($this->item->tax_name1, $this->item->tax_rate1, $item_tax_rate1_total);
$item_tax_rate2_total = $this->calcInclusiveLineTax($this->item->tax_rate2, $amount); $item_tax_rate2_total = $this->calcInclusiveLineTax($this->item->tax_rate2, $amount);
$item_tax += $this->formatValue($item_tax_rate2_total, $this->currency->precision); $item_tax += $this->formatValue($item_tax_rate2_total, $this->currency->precision);
if($item_tax_rate2_total != 0) if (strlen($this->item->tax_name2) > 1)
$this->groupTax($this->item->tax_name2, $this->item->tax_rate2, $item_tax_rate2_total); $this->groupTax($this->item->tax_name2, $this->item->tax_rate2, $item_tax_rate2_total);
$item_tax_rate3_total = $this->calcInclusiveLineTax($this->item->tax_rate3, $amount); $item_tax_rate3_total = $this->calcInclusiveLineTax($this->item->tax_rate3, $amount);
$item_tax += $this->formatValue($item_tax_rate3_total, $this->currency->precision); $item_tax += $this->formatValue($item_tax_rate3_total, $this->currency->precision);
if($item_tax_rate3_total != 0) if (strlen($this->item->tax_name3) > 1)
$this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total); $this->groupTax($this->item->tax_name3, $this->item->tax_rate3, $item_tax_rate3_total);