diff --git a/app/DataMapper/Tax/BaseRule.php b/app/DataMapper/Tax/BaseRule.php index 779c40d82bc2..bf8481b1faaf 100644 --- a/app/DataMapper/Tax/BaseRule.php +++ b/app/DataMapper/Tax/BaseRule.php @@ -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(); } diff --git a/app/DataMapper/Tax/US/Rule.php b/app/DataMapper/Tax/US/Rule.php index 4b2789becba7..85b779020e93 100644 --- a/app/DataMapper/Tax/US/Rule.php +++ b/app/DataMapper/Tax/US/Rule.php @@ -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; }