mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on tax all settings
This commit is contained in:
parent
90e1d8d228
commit
fec69f98e2
@ -104,7 +104,7 @@ class BaseRule implements RuleInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function taxByType(?int $product_tax_type): self
|
||||
public function taxByType($product_tax_type): self
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class Rule extends BaseRule implements RuleInterface
|
||||
|
||||
}
|
||||
|
||||
public function taxByType(?int $product_tax_type): self
|
||||
public function taxByType($product_tax_type): self
|
||||
{
|
||||
|
||||
if ($this->client->is_tax_exempt) {
|
||||
|
@ -20,7 +20,7 @@ interface RuleInterface
|
||||
|
||||
public function tax();
|
||||
|
||||
public function taxByType(?int $type);
|
||||
public function taxByType($type);
|
||||
|
||||
public function taxExempt();
|
||||
|
||||
|
@ -67,7 +67,7 @@ class Rule implements RuleInterface
|
||||
|
||||
}
|
||||
|
||||
public function taxByType(?int $product_tax_type): self
|
||||
public function taxByType($product_tax_type): self
|
||||
{
|
||||
if(!$product_tax_type)
|
||||
return $this;
|
||||
|
@ -44,11 +44,6 @@ class EuTaxTest extends TestCase
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
public function testInvoiceWithCustomTaxIdTax()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testInvoiceTaxCalcDetoBeNoVat()
|
||||
{
|
||||
$settings = CompanySettings::defaults();
|
||||
|
@ -146,6 +146,107 @@ class UsTaxTest extends TestCase
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
// public function testCompanyTaxAllOffTaxExemptProduct()
|
||||
// {
|
||||
|
||||
// $invoice = $this->invoiceStub('92582');
|
||||
// $client = $invoice->client;
|
||||
// $client->is_tax_exempt = false;
|
||||
// $client->save();
|
||||
|
||||
// $company = $invoice->company;
|
||||
// $tax_data = $company->tax_data;
|
||||
|
||||
// $tax_data->regions->US->has_sales_above_threshold = true;
|
||||
// $tax_data->regions->US->tax_all = false;
|
||||
|
||||
// $company->tax_data = $tax_data;
|
||||
// $company->save();
|
||||
|
||||
// $invoice = $invoice->calc()->getInvoice()->service()->markSent()->save();
|
||||
|
||||
// $this->assertEquals(0, $invoice->line_items[0]->tax_rate1);
|
||||
// $this->assertEquals(100, $invoice->amount);
|
||||
|
||||
// }
|
||||
|
||||
public function testCompanyTaxAllOffButTaxUSRegion()
|
||||
{
|
||||
|
||||
$invoice = $this->invoiceStub('92582');
|
||||
$client = $invoice->client;
|
||||
$client->is_tax_exempt = false;
|
||||
$client->save();
|
||||
|
||||
$company = $invoice->company;
|
||||
$company->tax_all_products = false;
|
||||
$tax_data = $company->tax_data;
|
||||
|
||||
$tax_data->regions->US->has_sales_above_threshold = true;
|
||||
$tax_data->regions->US->tax_all = true;
|
||||
|
||||
$company->tax_data = $tax_data;
|
||||
$company->save();
|
||||
|
||||
$invoice = $invoice->calc()->getInvoice()->service()->markSent()->save();
|
||||
|
||||
$this->assertEquals(8.75, $invoice->line_items[0]->tax_rate1);
|
||||
$this->assertEquals(108.75, $invoice->amount);
|
||||
|
||||
}
|
||||
|
||||
public function testCompanyTaxAllOff()
|
||||
{
|
||||
|
||||
$invoice = $this->invoiceStub('92582');
|
||||
$client = $invoice->client;
|
||||
$client->is_tax_exempt = false;
|
||||
$client->save();
|
||||
|
||||
$company = $invoice->company;
|
||||
$company->tax_all_products = false;
|
||||
$tax_data = $company->tax_data;
|
||||
|
||||
$tax_data->regions->US->has_sales_above_threshold = true;
|
||||
$tax_data->regions->US->tax_all = false;
|
||||
|
||||
$company->tax_data = $tax_data;
|
||||
$company->save();
|
||||
|
||||
$invoice = $invoice->calc()->getInvoice()->service()->markSent()->save();
|
||||
|
||||
$this->assertEquals(0, $invoice->line_items[0]->tax_rate1);
|
||||
$this->assertEquals(100, $invoice->amount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testThresholdLevelsAreMet()
|
||||
{
|
||||
|
||||
$invoice = $this->invoiceStub('92582');
|
||||
$client = $invoice->client;
|
||||
$client->is_tax_exempt = true;
|
||||
$client->save();
|
||||
|
||||
|
||||
$company = $invoice->company;
|
||||
$tax_data = $company->tax_data;
|
||||
|
||||
$tax_data->regions->US->has_sales_above_threshold = false;
|
||||
$tax_data->regions->US->tax_all = true;
|
||||
|
||||
$company->tax_data = $tax_data;
|
||||
$company->save();
|
||||
|
||||
$invoice = $invoice->calc()->getInvoice()->service()->markSent()->save();
|
||||
|
||||
$this->assertEquals(0, $invoice->line_items[0]->tax_rate1);
|
||||
$this->assertEquals(100, $invoice->amount);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testHasValidVatMakesNoDifferenceToTaxCalc()
|
||||
{
|
||||
|
||||
@ -158,10 +259,9 @@ class UsTaxTest extends TestCase
|
||||
|
||||
$this->assertEquals(8.75, $invoice->line_items[0]->tax_rate1);
|
||||
$this->assertEquals(108.75, $invoice->amount);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function testTaxExemption()
|
||||
{
|
||||
$invoice = $this->invoiceStub('92582');
|
||||
|
Loading…
x
Reference in New Issue
Block a user