mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Fixes for cross region rules
This commit is contained in:
parent
85b261ab21
commit
9584fe0ee5
@ -162,6 +162,7 @@ class BaseRule implements RuleInterface
|
||||
if(strlen($this->invoice->tax_data?->originDestination) == 0 && $this->client->company->tax_data->seller_subregion != $this->client_subregion) {
|
||||
$tax_data = $this->invoice->tax_data;
|
||||
$tax_data->originDestination = "D";
|
||||
$tax_data->geoState = $this->client_subregion;
|
||||
$this->invoice->tax_data = $tax_data;
|
||||
$this->invoice->saveQuietly();
|
||||
}
|
||||
|
@ -143,10 +143,25 @@ class Rule extends BaseRule implements RuleInterface
|
||||
*/
|
||||
public function default(): self
|
||||
{
|
||||
|
||||
|
||||
if($this->tax_data?->stateSalesTax == 0) {
|
||||
|
||||
if($this->tax_data->originDestination == "O"){
|
||||
$tax_region = $this->client->company->tax_data->seller_subregion;
|
||||
$this->tax_rate1 = $this->invoice->client->company->tax_data->regions->US->subregions->{$tax_region}->tax_rate;
|
||||
$this->tax_name1 = "{$this->tax_data->geoState} Sales Tax";
|
||||
} else {
|
||||
$this->tax_rate1 = $this->invoice->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_rate;
|
||||
$this->tax_name1 = $this->invoice->client->company->tax_data->regions->{$this->client_region}->subregions->{$this->client_subregion}->tax_name;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->tax_rate1 = $this->tax_data->taxSales * 100;
|
||||
$this->tax_name1 = "{$this->tax_data->geoState} Sales Tax";
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user