Introduce logic for tax exempt clients

This commit is contained in:
David Bomba 2024-10-04 10:24:11 +10:00
parent e059221ccd
commit a22ce2b8f6
4 changed files with 39 additions and 0 deletions

View File

@ -279,6 +279,15 @@ class InvoiceItemSum
$this->calcTaxesAutomatically();
}
if($this->client->is_tax_exempt){
$this->item->tax_rate1 = 0;
$this->item->tax_rate2 = 0;
$this->item->tax_rate3 = 0;
$this->item->tax_name1 = '';
$this->item->tax_name2 = '';
$this->item->tax_name3 = '';
}
$item_tax = 0;
$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / 100));

View File

@ -224,6 +224,15 @@ class InvoiceItemSumInclusive
$this->calcTaxesAutomatically();
}
if ($this->client->is_tax_exempt) {
$this->item->tax_rate1 = 0;
$this->item->tax_rate2 = 0;
$this->item->tax_rate3 = 0;
$this->item->tax_name1 = '';
$this->item->tax_name2 = '';
$this->item->tax_name3 = '';
}
$item_tax = 0;
$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / 100));

View File

@ -127,6 +127,18 @@ class InvoiceSum
private function calculateInvoiceTaxes(): self
{
if($this->client->is_tax_exempt) {
$this->invoice->tax_name1 = '';
$this->invoice->tax_name2 = '';
$this->invoice->tax_name3 = '';
$this->invoice->tax_rate1 = 0;
$this->invoice->tax_rate2 = 0;
$this->invoice->tax_rate3 = 0;
$this->total_taxes = 0;
$this->total_tax_map = [];
return $this;
}
if (is_string($this->invoice->tax_name1) && strlen($this->invoice->tax_name1) >= 2) {
$tax = $this->taxer($this->total, $this->invoice->tax_rate1);
$tax += $this->getSurchargeTaxTotalForKey($this->invoice->tax_name1, $this->invoice->tax_rate1);

View File

@ -129,6 +129,15 @@ class InvoiceSumInclusive
{
$amount = $this->total;
if ($this->client->is_tax_exempt) {
$this->invoice->tax_rate1 = 0;
$this->invoice->tax_rate2 = 0;
$this->invoice->tax_rate3 = 0;
$this->invoice->tax_name1 = '';
$this->invoice->tax_name2 = '';
$this->invoice->tax_name3 = '';
}
if ($this->invoice->discount > 0 && $this->invoice->is_amount_discount) {
$amount = $this->formatValue(($this->sub_total - $this->invoice->discount), 2);
}