mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Fixes for tax tests
This commit is contained in:
parent
231fdb00be
commit
4620120d38
@ -86,18 +86,16 @@ class Rule extends BaseRule implements RuleInterface
|
||||
|
||||
|
||||
if ($this->client->is_tax_exempt) {
|
||||
|
||||
return $this->taxExempt();
|
||||
} elseif ($this->client->company->tax_data->regions->EU->tax_all) {
|
||||
|
||||
$this->tax_rate1 = $this->vat_rate;
|
||||
$this->tax_name1 = "MwSt.";
|
||||
} elseif ($this->client->company->tax_data->regions->EU->tax_all_subregions || $this->client->company->tax_data->regions->EU->subregions->{$this->client_country_code}->apply_tax) {
|
||||
|
||||
$this->taxByType($type);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
if ($type)
|
||||
return $this->taxByType($type);
|
||||
|
||||
|
||||
return $this;
|
||||
@ -111,9 +109,6 @@ class Rule extends BaseRule implements RuleInterface
|
||||
return $this->taxExempt();
|
||||
}
|
||||
|
||||
if(!$product_tax_type)
|
||||
return $this;
|
||||
|
||||
match($product_tax_type){
|
||||
Product::PRODUCT_TYPE_EXEMPT => $this->taxExempt(),
|
||||
Product::PRODUCT_TYPE_DIGITAL => $this->taxDigital(),
|
||||
@ -146,29 +141,31 @@ class Rule extends BaseRule implements RuleInterface
|
||||
|
||||
public function taxDigital(): self
|
||||
{
|
||||
$this->tax();
|
||||
// $this->tax();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function taxService(): self
|
||||
{
|
||||
$this->tax();
|
||||
// $this->tax();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function taxShipping(): self
|
||||
{
|
||||
$this->tax();
|
||||
// $this->tax();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function taxPhysical(): self
|
||||
{
|
||||
$this->tax();
|
||||
// $this->tax();
|
||||
|
||||
$this->tax_rate1 = $this->vat_rate;
|
||||
$this->tax_name1 = 'MwSt.';
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = true;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -90,6 +90,7 @@ class EuTaxTest extends TestCase
|
||||
'tax_name3' => '',
|
||||
'tax_rate3' => 0,
|
||||
'type_id' => '1',
|
||||
'tax_id' => 1
|
||||
],
|
||||
],
|
||||
'tax_rate1' => 0,
|
||||
@ -116,7 +117,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = true;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -131,6 +132,7 @@ class EuTaxTest extends TestCase
|
||||
'country_id' => 56,
|
||||
'shipping_country_id' => 56,
|
||||
'has_valid_vat_number' => true,
|
||||
'is_tax_exempt' => false,
|
||||
]);
|
||||
|
||||
$invoice = Invoice::factory()->create([
|
||||
@ -180,7 +182,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = true;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -217,6 +219,7 @@ class EuTaxTest extends TestCase
|
||||
'tax_name3' => '',
|
||||
'tax_rate3' => 0,
|
||||
'type_id' => '1',
|
||||
'tax_id' => 1,
|
||||
],
|
||||
],
|
||||
'tax_rate1' => 0,
|
||||
@ -246,7 +249,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = true;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -291,7 +294,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = true;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -376,7 +379,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = false;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -418,7 +421,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = false;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -459,7 +462,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = false;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -499,7 +502,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = false;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -540,7 +543,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = false;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
@ -581,7 +584,7 @@ class EuTaxTest extends TestCase
|
||||
$tax_data->seller_region = 'DE';
|
||||
$tax_data->seller_subregion = 'DE';
|
||||
$tax_data->regions->EU->has_sales_above_threshold = false;
|
||||
$tax_data->regions->EU->tax_all = true;
|
||||
$tax_data->regions->EU->tax_all_subregions = true;
|
||||
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $this->account->id,
|
||||
|
@ -203,7 +203,6 @@ class UsTaxTest extends TestCase
|
||||
$client->is_tax_exempt = true;
|
||||
$client->save();
|
||||
|
||||
|
||||
$company = $invoice->company;
|
||||
$tax_data = $company->tax_data;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user