mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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) {
|
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 = $this->invoice->tax_data;
|
||||||
$tax_data->originDestination = "D";
|
$tax_data->originDestination = "D";
|
||||||
|
$tax_data->geoState = $this->client_subregion;
|
||||||
$this->invoice->tax_data = $tax_data;
|
$this->invoice->tax_data = $tax_data;
|
||||||
$this->invoice->saveQuietly();
|
$this->invoice->saveQuietly();
|
||||||
}
|
}
|
||||||
|
@ -144,9 +144,24 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
public function default(): self
|
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_rate1 = $this->tax_data->taxSales * 100;
|
||||||
$this->tax_name1 = "{$this->tax_data->geoState} Sales Tax";
|
$this->tax_name1 = "{$this->tax_data->geoState} Sales Tax";
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user