Fixes for tax calculations

This commit is contained in:
David Bomba 2023-04-29 10:07:23 +10:00
parent b52204c616
commit 3e46aad567
2 changed files with 13 additions and 6 deletions

View File

@ -217,9 +217,11 @@ class BaseRule implements RuleInterface
return $this;
}
$this->tax_rate1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_rate;
$this->tax_name1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_name;
if(isset($this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion})) {
$this->tax_rate1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_rate;
$this->tax_name1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_name;
}
return $this;
}

View File

@ -116,7 +116,6 @@ class InvoiceItemSum
{
if (!$this->invoice->line_items || !is_array($this->invoice->line_items)) {
$this->items = [];
return $this;
}
@ -146,7 +145,8 @@ class InvoiceItemSum
}
//should we be filtering by client country here? do we need to reflect at the company <=> client level?
if (in_array($this->client->country->iso_3166_2, $this->tax_jurisdictions)) { //only calculate for supported tax jurisdictions
// if (in_array($this->client->country->iso_3166_2, $this->tax_jurisdictions)) { //only calculate for supported tax jurisdictions
if (in_array($this->client->company->country()->iso_3166_2, $this->tax_jurisdictions)) { //only calculate for supported tax jurisdictions
$class = "App\DataMapper\Tax\\".$this->client->company->country()->iso_3166_2."\\Rule";
@ -216,7 +216,12 @@ class InvoiceItemSum
return $this;
}
/**
* calcTaxes
*
* @return self
*/
private function calcTaxes()
{
if ($this->calc_tax) {