mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
building out tax model
This commit is contained in:
parent
76d2780a60
commit
15676a3683
@ -155,6 +155,24 @@ class BaseRule implements RuleInterface
|
|||||||
return $this->client->company->tax_data->regions->{$this->client_region}->tax_all_subregions || $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->apply_tax;
|
return $this->client->company->tax_data->regions->{$this->client_region}->tax_all_subregions || $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->apply_tax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function taxForeignEntity(mixed $item): self
|
||||||
|
{
|
||||||
|
if($this->client_region == 'US') {
|
||||||
|
|
||||||
|
$this->tax_rate1 = $this->tax_data->taxSales * 100;
|
||||||
|
$this->tax_name1 = "{$this->tax_data->geoState} Sales Tax";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
$this->tax_rate1 = $this->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_rate;
|
||||||
|
$this->tax_name1 = "Tax";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setTaxData(Response $tax_data): self
|
public function setTaxData(Response $tax_data): self
|
||||||
{
|
{
|
||||||
$this->tax_data = $tax_data;
|
$this->tax_data = $tax_data;
|
||||||
|
@ -47,15 +47,19 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
|
|
||||||
return $this->taxExempt();
|
return $this->taxExempt();
|
||||||
|
|
||||||
} elseif ($this->client->company->tax_data->regions->EU->tax_all_subregions || $this->client->company->tax_data->regions->EU->subregions->{$this->client_subregion}->apply_tax) {
|
}
|
||||||
|
elseif ($this->client->company->tax_data->regions->EU->tax_all_subregions || $this->client->company->tax_data->regions->EU->subregions->{$this->client_subregion}->apply_tax) {
|
||||||
|
|
||||||
$this->taxByType($item->tax_id);
|
$this->taxByType($item->tax_id);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
elseif ($this->client_region != 'EU' && $this->isTaxableRegion()) { //foreign entity with tax obligations
|
||||||
|
|
||||||
|
$this->taxForeignEntity($item);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -184,5 +188,4 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
@ -62,6 +62,7 @@ class TaxModel
|
|||||||
$this->regions->AU->subregions->AU = new \stdClass();
|
$this->regions->AU->subregions->AU = new \stdClass();
|
||||||
$this->regions->AU->subregions->AU->apply_tax = false;
|
$this->regions->AU->subregions->AU->apply_tax = false;
|
||||||
$this->regions->AU->subregions->AU->tax_rate = 10;
|
$this->regions->AU->subregions->AU->tax_rate = 10;
|
||||||
|
$this->regions->AU->subregions->AU->tax_name = 'GST';
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user