1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Tax Name / Tax Rate added to Tax Model

This commit is contained in:
David Bomba 2023-04-12 10:21:02 +10:00
parent 0339e7a07b
commit 35e3ae8d50
4 changed files with 210 additions and 6 deletions

View File

@ -201,31 +201,37 @@ class TaxModel
$this->regions->EU->subregions->AT = new \stdClass(); $this->regions->EU->subregions->AT = new \stdClass();
$this->regions->EU->subregions->AT->tax_rate = 21; $this->regions->EU->subregions->AT->tax_rate = 21;
$this->regions->EU->subregions->AT->tax_name = 'USt';
$this->regions->EU->subregions->AT->reduced_tax_rate = 11; $this->regions->EU->subregions->AT->reduced_tax_rate = 11;
$this->regions->EU->subregions->AT->apply_tax = false; $this->regions->EU->subregions->AT->apply_tax = false;
$this->regions->EU->subregions->BE = new \stdClass(); $this->regions->EU->subregions->BE = new \stdClass();
$this->regions->EU->subregions->BE->tax_rate = 21; $this->regions->EU->subregions->BE->tax_rate = 21;
$this->regions->EU->subregions->BE->tax_name = 'BTW';
$this->regions->EU->subregions->BE->reduced_tax_rate = 6; $this->regions->EU->subregions->BE->reduced_tax_rate = 6;
$this->regions->EU->subregions->BE->apply_tax = false; $this->regions->EU->subregions->BE->apply_tax = false;
$this->regions->EU->subregions->BG = new \stdClass(); $this->regions->EU->subregions->BG = new \stdClass();
$this->regions->EU->subregions->BG->tax_rate = 20; $this->regions->EU->subregions->BG->tax_rate = 20;
$this->regions->EU->subregions->BG->tax_name = 'НДС';
$this->regions->EU->subregions->BG->reduced_tax_rate = 9; $this->regions->EU->subregions->BG->reduced_tax_rate = 9;
$this->regions->EU->subregions->BG->apply_tax = false; $this->regions->EU->subregions->BG->apply_tax = false;
$this->regions->EU->subregions->CY = new \stdClass(); $this->regions->EU->subregions->CY = new \stdClass();
$this->regions->EU->subregions->CY->tax_rate = 19; $this->regions->EU->subregions->CY->tax_rate = 19;
$this->regions->EU->subregions->CY->tax_name = 'ΦΠΑ';
$this->regions->EU->subregions->CY->reduced_tax_rate = 9; $this->regions->EU->subregions->CY->reduced_tax_rate = 9;
$this->regions->EU->subregions->CY->apply_tax = false; $this->regions->EU->subregions->CY->apply_tax = false;
$this->regions->EU->subregions->CZ = new \stdClass(); $this->regions->EU->subregions->CZ = new \stdClass();
$this->regions->EU->subregions->CZ->tax_rate = 21; $this->regions->EU->subregions->CZ->tax_rate = 21;
$this->regions->EU->subregions->CZ->tax_name = 'DPH';
$this->regions->EU->subregions->CZ->reduced_tax_rate = 15; $this->regions->EU->subregions->CZ->reduced_tax_rate = 15;
$this->regions->EU->subregions->CZ->apply_tax = false; $this->regions->EU->subregions->CZ->apply_tax = false;
$this->regions->EU->subregions->DE = new \stdClass(); $this->regions->EU->subregions->DE = new \stdClass();
$this->regions->EU->subregions->DE->tax_rate = 19; $this->regions->EU->subregions->DE->tax_rate = 19;
$this->regions->EU->subregions->DE->tax_name = 'MwSt';
$this->regions->EU->subregions->DE->reduced_tax_rate = 7; $this->regions->EU->subregions->DE->reduced_tax_rate = 7;
$this->regions->EU->subregions->DE->apply_tax = false; $this->regions->EU->subregions->DE->apply_tax = false;
@ -236,21 +242,25 @@ class TaxModel
$this->regions->EU->subregions->EE = new \stdClass(); $this->regions->EU->subregions->EE = new \stdClass();
$this->regions->EU->subregions->EE->tax_rate = 20; $this->regions->EU->subregions->EE->tax_rate = 20;
$this->regions->EU->subregions->EE->tax_name = 'KM';
$this->regions->EU->subregions->EE->reduced_tax_rate = 9; $this->regions->EU->subregions->EE->reduced_tax_rate = 9;
$this->regions->EU->subregions->EE->apply_tax = false; $this->regions->EU->subregions->EE->apply_tax = false;
$this->regions->EU->subregions->ES = new \stdClass(); $this->regions->EU->subregions->ES = new \stdClass();
$this->regions->EU->subregions->ES->tax_rate = 21; $this->regions->EU->subregions->ES->tax_rate = 21;
$this->regions->EU->subregions->ES->tax_name = 'IVA';
$this->regions->EU->subregions->ES->reduced_tax_rate = 10; $this->regions->EU->subregions->ES->reduced_tax_rate = 10;
$this->regions->EU->subregions->ES->apply_tax = false; $this->regions->EU->subregions->ES->apply_tax = false;
$this->regions->EU->subregions->FI = new \stdClass(); $this->regions->EU->subregions->FI = new \stdClass();
$this->regions->EU->subregions->FI->tax_rate = 24; $this->regions->EU->subregions->FI->tax_rate = 24;
$this->regions->EU->subregions->FI->tax_name = 'ALV';
$this->regions->EU->subregions->FI->reduced_tax_rate = 14; $this->regions->EU->subregions->FI->reduced_tax_rate = 14;
$this->regions->EU->subregions->FI->apply_tax = false; $this->regions->EU->subregions->FI->apply_tax = false;
$this->regions->EU->subregions->FR = new \stdClass(); $this->regions->EU->subregions->FR = new \stdClass();
$this->regions->EU->subregions->FR->tax_rate = 20; $this->regions->EU->subregions->FR->tax_rate = 20;
$this->regions->EU->subregions->FR->tax_name = 'TVA';
$this->regions->EU->subregions->FR->reduced_tax_rate = 5.5; $this->regions->EU->subregions->FR->reduced_tax_rate = 5.5;
$this->regions->EU->subregions->FR->apply_tax = false; $this->regions->EU->subregions->FR->apply_tax = false;
@ -261,76 +271,91 @@ class TaxModel
$this->regions->EU->subregions->GR = new \stdClass(); $this->regions->EU->subregions->GR = new \stdClass();
$this->regions->EU->subregions->GR->tax_rate = 24; $this->regions->EU->subregions->GR->tax_rate = 24;
$this->regions->EU->subregions->GR->tax_name = 'ΦΠΑ';
$this->regions->EU->subregions->GR->reduced_tax_rate = 13; $this->regions->EU->subregions->GR->reduced_tax_rate = 13;
$this->regions->EU->subregions->GR->apply_tax = false; $this->regions->EU->subregions->GR->apply_tax = false;
$this->regions->EU->subregions->HR = new \stdClass(); $this->regions->EU->subregions->HR = new \stdClass();
$this->regions->EU->subregions->HR->tax_rate = 25; $this->regions->EU->subregions->HR->tax_rate = 25;
$this->regions->EU->subregions->HR->tax_name = 'PDV';
$this->regions->EU->subregions->HR->reduced_tax_rate = 5; $this->regions->EU->subregions->HR->reduced_tax_rate = 5;
$this->regions->EU->subregions->HR->apply_tax = false; $this->regions->EU->subregions->HR->apply_tax = false;
$this->regions->EU->subregions->HU = new \stdClass(); $this->regions->EU->subregions->HU = new \stdClass();
$this->regions->EU->subregions->HU->tax_rate = 27; $this->regions->EU->subregions->HU->tax_rate = 27;
$this->regions->EU->subregions->HU->tax_name = 'ÁFA';
$this->regions->EU->subregions->HU->reduced_tax_rate = 5; $this->regions->EU->subregions->HU->reduced_tax_rate = 5;
$this->regions->EU->subregions->HU->apply_tax = false; $this->regions->EU->subregions->HU->apply_tax = false;
$this->regions->EU->subregions->IE = new \stdClass(); $this->regions->EU->subregions->IE = new \stdClass();
$this->regions->EU->subregions->IE->tax_rate = 23; $this->regions->EU->subregions->IE->tax_rate = 23;
$this->regions->EU->subregions->IE->tax_name = 'VAT';
$this->regions->EU->subregions->IE->reduced_tax_rate = 0; $this->regions->EU->subregions->IE->reduced_tax_rate = 0;
$this->regions->EU->subregions->IE->apply_tax = false; $this->regions->EU->subregions->IE->apply_tax = false;
$this->regions->EU->subregions->IT = new \stdClass(); $this->regions->EU->subregions->IT = new \stdClass();
$this->regions->EU->subregions->IT->tax_rate = 22; $this->regions->EU->subregions->IT->tax_rate = 22;
$this->regions->EU->subregions->IT->tax_name = 'IVA';
$this->regions->EU->subregions->IT->reduced_tax_rate = 10; $this->regions->EU->subregions->IT->reduced_tax_rate = 10;
$this->regions->EU->subregions->IT->apply_tax = false; $this->regions->EU->subregions->IT->apply_tax = false;
$this->regions->EU->subregions->LT = new \stdClass(); $this->regions->EU->subregions->LT = new \stdClass();
$this->regions->EU->subregions->LT->tax_rate = 21; $this->regions->EU->subregions->LT->tax_rate = 21;
$this->regions->EU->subregions->LT->tax_name = 'PVM';
$this->regions->EU->subregions->LT->reduced_tax_rate = 9; $this->regions->EU->subregions->LT->reduced_tax_rate = 9;
$this->regions->EU->subregions->LT->apply_tax = false; $this->regions->EU->subregions->LT->apply_tax = false;
$this->regions->EU->subregions->LU = new \stdClass(); $this->regions->EU->subregions->LU = new \stdClass();
$this->regions->EU->subregions->LU->tax_rate = 17; $this->regions->EU->subregions->LU->tax_rate = 17;
$this->regions->EU->subregions->LU->tax_name = 'TVA';
$this->regions->EU->subregions->LU->reduced_tax_rate = 3; $this->regions->EU->subregions->LU->reduced_tax_rate = 3;
$this->regions->EU->subregions->LU->apply_tax = false; $this->regions->EU->subregions->LU->apply_tax = false;
$this->regions->EU->subregions->LV = new \stdClass(); $this->regions->EU->subregions->LV = new \stdClass();
$this->regions->EU->subregions->LV->tax_rate = 21; $this->regions->EU->subregions->LV->tax_rate = 21;
$this->regions->EU->subregions->LV->tax_name = 'PVN';
$this->regions->EU->subregions->LV->reduced_tax_rate = 12; $this->regions->EU->subregions->LV->reduced_tax_rate = 12;
$this->regions->EU->subregions->LV->apply_tax = false; $this->regions->EU->subregions->LV->apply_tax = false;
$this->regions->EU->subregions->MT = new \stdClass(); $this->regions->EU->subregions->MT = new \stdClass();
$this->regions->EU->subregions->MT->tax_rate = 18; $this->regions->EU->subregions->MT->tax_rate = 18;
$this->regions->EU->subregions->MT->tax_name = 'VAT';
$this->regions->EU->subregions->MT->reduced_tax_rate = 5; $this->regions->EU->subregions->MT->reduced_tax_rate = 5;
$this->regions->EU->subregions->MT->apply_tax = false; $this->regions->EU->subregions->MT->apply_tax = false;
$this->regions->EU->subregions->NL = new \stdClass(); $this->regions->EU->subregions->NL = new \stdClass();
$this->regions->EU->subregions->NL->tax_rate = 21; $this->regions->EU->subregions->NL->tax_rate = 21;
$this->regions->EU->subregions->NL->tax_name = 'BTW';
$this->regions->EU->subregions->NL->reduced_tax_rate = 9; $this->regions->EU->subregions->NL->reduced_tax_rate = 9;
$this->regions->EU->subregions->NL->apply_tax = false; $this->regions->EU->subregions->NL->apply_tax = false;
$this->regions->EU->subregions->PT = new \stdClass(); $this->regions->EU->subregions->PT = new \stdClass();
$this->regions->EU->subregions->PT->tax_rate = 23; $this->regions->EU->subregions->PT->tax_rate = 23;
$this->regions->EU->subregions->PT->tax_name = 'IVA';
$this->regions->EU->subregions->PT->reduced_tax_rate = 6; $this->regions->EU->subregions->PT->reduced_tax_rate = 6;
$this->regions->EU->subregions->PT->apply_tax = false; $this->regions->EU->subregions->PT->apply_tax = false;
$this->regions->EU->subregions->RO = new \stdClass(); $this->regions->EU->subregions->RO = new \stdClass();
$this->regions->EU->subregions->RO->tax_rate = 19; $this->regions->EU->subregions->RO->tax_rate = 19;
$this->regions->EU->subregions->RO->tax_name = 'TVA';
$this->regions->EU->subregions->RO->reduced_tax_rate = 5; $this->regions->EU->subregions->RO->reduced_tax_rate = 5;
$this->regions->EU->subregions->RO->apply_tax = false; $this->regions->EU->subregions->RO->apply_tax = false;
$this->regions->EU->subregions->SE = new \stdClass(); $this->regions->EU->subregions->SE = new \stdClass();
$this->regions->EU->subregions->SE->tax_rate = 25; $this->regions->EU->subregions->SE->tax_rate = 25;
$this->regions->EU->subregions->SE->tax_name = 'Moms';
$this->regions->EU->subregions->SE->reduced_tax_rate = 12; $this->regions->EU->subregions->SE->reduced_tax_rate = 12;
$this->regions->EU->subregions->SE->apply_tax = false; $this->regions->EU->subregions->SE->apply_tax = false;
$this->regions->EU->subregions->SI = new \stdClass(); $this->regions->EU->subregions->SI = new \stdClass();
$this->regions->EU->subregions->SI->tax_rate = 22; $this->regions->EU->subregions->SI->tax_rate = 22;
$this->regions->EU->subregions->SI->tax_name = 'DDV';
$this->regions->EU->subregions->SI->reduced_tax_rate = 9.5; $this->regions->EU->subregions->SI->reduced_tax_rate = 9.5;
$this->regions->EU->subregions->SI->apply_tax = false; $this->regions->EU->subregions->SI->apply_tax = false;
$this->regions->EU->subregions->SK = new \stdClass(); $this->regions->EU->subregions->SK = new \stdClass();
$this->regions->EU->subregions->SK->tax_rate = 20; $this->regions->EU->subregions->SK->tax_rate = 20;
$this->regions->EU->subregions->SK->tax_name = 'DPH';
$this->regions->EU->subregions->SK->reduced_tax_rate = 10; $this->regions->EU->subregions->SK->reduced_tax_rate = 10;
$this->regions->EU->subregions->SK->apply_tax = false; $this->regions->EU->subregions->SK->apply_tax = false;

View File

@ -250,6 +250,7 @@ class User extends Authenticatable implements MustVerifyEmail
'custom_value3', 'custom_value3',
'custom_value4', 'custom_value4',
'is_deleted', 'is_deleted',
'oauth_user_token',
]; ];
/** /**

View File

@ -1,9 +1,12 @@
<?php <?php
use App\Models\BankTransaction; use App\Utils\Ninja;
use App\Models\Client; use App\Models\Client;
use App\Models\Company; use App\Models\Company;
use App\Models\Product; use App\Models\Product;
use App\Models\GatewayType;
use App\Models\PaymentType;
use App\Models\BankTransaction;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
@ -67,6 +70,172 @@ return new class extends Migration
$product->save(); $product->save();
}); });
//payment types from 34
if(Ninja::isSelfHost()) {
$pt = PaymentType::find(34);
if(!$pt) {
$type = new PaymentType();
$type->id = 34;
$type->name = 'Mollie Bank Transfer';
$type->gateway_type_id = GatewayType::BANK_TRANSFER;
$type->save();
}
$pt = PaymentType::find(35);
if(!$pt) {
$type = new PaymentType();
$type->id = 35;
$type->name = 'KBC/CBC';
$type->gateway_type_id = GatewayType::KBC;
$type->save();
}
$pt = PaymentType::find(36);
if(!$pt) {
$type = new PaymentType();
$type->id = 36;
$type->name = 'Bancontact';
$type->gateway_type_id = GatewayType::BANCONTACT;
$type->save();
}
$pt = PaymentType::find(37);
if(!$pt) {
$type = new PaymentType();
$type->id = 37;
$type->name = 'iDEAL';
$type->gateway_type_id = GatewayType::IDEAL;
$type->save();
}
$pt = PaymentType::find(38);
if(!$pt) {
$type = new PaymentType();
$type->id = 38;
$type->name = 'Hosted Page';
$type->gateway_type_id = GatewayType::HOSTED_PAGE;
$type->save();
}
$pt = PaymentType::find(39);
if(!$pt) {
$type = new PaymentType();
$type->id = 39;
$type->name = 'GiroPay';
$type->gateway_type_id = GatewayType::GIROPAY;
$type->save();
}
$pt = PaymentType::find(40);
if(!$pt) {
$type = new PaymentType();
$type->id = 40;
$type->name = 'Przelewy24';
$type->gateway_type_id = GatewayType::PRZELEWY24;
$type->save();
}
$pt = PaymentType::find(41);
if(!$pt) {
$type = new PaymentType();
$type->id = 41;
$type->name = 'EPS';
$type->gateway_type_id = GatewayType::EPS;
$type->save();
}
$pt = PaymentType::find(42);
if(!$pt) {
$type = new PaymentType();
$type->id = 42;
$type->name = 'Direct Debit';
$type->gateway_type_id = GatewayType::DIRECT_DEBIT;
$type->save();
}
$pt = PaymentType::find(43);
if(!$pt) {
$type = new PaymentType();
$type->id = 43;
$type->name = 'BECS';
$type->gateway_type_id = GatewayType::BECS;
$type->save();
}
$pt = PaymentType::find(44);
if(!$pt) {
$type = new PaymentType();
$type->id = 44;
$type->name = 'ACSS';
$type->gateway_type_id = GatewayType::ACSS;
$type->save();
}
$pt = PaymentType::find(45);
if(!$pt) {
$type = new PaymentType();
$type->id = PaymentType::INSTANT_BANK_PAY;
$type->name = 'Instant Bank Pay';
$type->gateway_type_id = GatewayType::INSTANT_BANK_PAY;
$type->save();
}
$pt = PaymentType::find(47);
if (!$pt) {
$type = new PaymentType();
$type->id = 47;
$type->name = 'Klarna';
$type->gateway_type_id = GatewayType::KLARNA;
$type->save();
}
$pt = PaymentType::find(48);
if (!$pt) {
$type = new PaymentType();
$type->id = 48;
$type->name = 'Interac E-Transfer';
$type->save();
}
$gt = GatewayType::find(23);
if (!$gt) {
$type = new GatewayType();
$type->id = 23;
$type->alias = 'klarna';
$type->name = 'Klarna';
$type->save();
}
}
} }
/** /**

View File

@ -104,15 +104,24 @@ class TaskApiTest extends TestCase
$logs = [ $logs = [
[1680035007,1680036807,"",true], [1680035007,1680036807,"",true],
[1681156840,1681158000,"",true],
[1680302433,1680387960,"",true],
[1680715620,1680722820,"",true],
[1,1680737460,"",true]
]; ];
$key_values = array_column($logs, 0); $key_values = array_column($logs, 0);
array_multisort($key_values, SORT_ASC, $logs);
$start = $logs[0];
$this->assertEquals(1680035007, $start[0]);
$logs = [
];
$key_values = array_column($logs, 0);
array_multisort($key_values, SORT_ASC, $logs);
$this->assertIsArray($logs);
nlog($logs);
} }