mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 20:24:30 -04:00
Add 3 autonomous regions of spain
This commit is contained in:
parent
02d93356aa
commit
506f7b5d7a
@ -48,6 +48,9 @@ class BaseRule implements RuleInterface
|
||||
'DK', // Denmark
|
||||
'EE', // Estonia
|
||||
'ES', // Spain
|
||||
'ES-CN', // Canary Islands
|
||||
'ES-CE', // Ceuta
|
||||
'ES-ML', // Melilla
|
||||
'FI', // Finland
|
||||
'FR', // France
|
||||
'GR', // Greece
|
||||
@ -78,6 +81,9 @@ class BaseRule implements RuleInterface
|
||||
'DK' => 'EU', // Denmark
|
||||
'EE' => 'EU', // Estonia
|
||||
'ES' => 'EU', // Spain
|
||||
'ES-CN' => 'EU', // Canary Islands
|
||||
'ES-CE' => 'EU', // Ceuta
|
||||
'ES-ML' => 'EU', // Melilla
|
||||
'FI' => 'EU', // Finland
|
||||
'FR' => 'EU', // France
|
||||
'GR' => 'EU', // Greece
|
||||
|
@ -17,7 +17,7 @@ class TaxModel
|
||||
public string $seller_subregion = 'CA';
|
||||
|
||||
/** @var string $version */
|
||||
public string $version = 'beta';
|
||||
public string $version = 'gamma';
|
||||
|
||||
/** @var object $regions */
|
||||
public object $regions;
|
||||
@ -58,6 +58,32 @@ class TaxModel
|
||||
$this->version = 'beta';
|
||||
}
|
||||
|
||||
if($this->version == 'beta') {
|
||||
|
||||
//CEUTA
|
||||
$this->regions->EU->subregions->{'ES-CE'} = new \stdClass();
|
||||
$this->regions->EU->subregions->{'ES-CE'}->tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-CE'}->tax_name = 'IGIC';
|
||||
$this->regions->EU->subregions->{'ES-CE'}->reduced_tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-CE'}->apply_tax = false;
|
||||
|
||||
//MELILLA ML 4
|
||||
$this->regions->EU->subregions->{'ES-ML'} = new \stdClass();
|
||||
$this->regions->EU->subregions->{'ES-ML'}->tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-ML'}->tax_name = 'IGIC';
|
||||
$this->regions->EU->subregions->{'ES-ML'}->reduced_tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-ML'}->apply_tax = false;
|
||||
|
||||
//CANARIAS CN 7/3
|
||||
$this->regions->EU->subregions->{'ES-CN'} = new \stdClass();
|
||||
$this->regions->EU->subregions->{'ES-CN'}->tax_rate = 7;
|
||||
$this->regions->EU->subregions->{'ES-CN'}->tax_name = 'IGIC';
|
||||
$this->regions->EU->subregions->{'ES-CN'}->reduced_tax_rate = 3;
|
||||
$this->regions->EU->subregions->{'ES-CN'}->apply_tax = false;
|
||||
|
||||
$this->version = 'gamma';
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -419,6 +445,25 @@ class TaxModel
|
||||
$this->regions->EU->subregions->ES->reduced_tax_rate = 10;
|
||||
$this->regions->EU->subregions->ES->apply_tax = false;
|
||||
|
||||
$this->regions->EU->subregions->{'ES-CE'} = new \stdClass();
|
||||
$this->regions->EU->subregions->{'ES-CE'}->tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-CE'}->tax_name = 'IGIC';
|
||||
$this->regions->EU->subregions->{'ES-CE'}->reduced_tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-CE'}->apply_tax = false;
|
||||
|
||||
$this->regions->EU->subregions->{'ES-ML'} = new \stdClass();
|
||||
$this->regions->EU->subregions->{'ES-ML'}->tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-ML'}->tax_name = 'IGIC';
|
||||
$this->regions->EU->subregions->{'ES-ML'}->reduced_tax_rate = 4;
|
||||
$this->regions->EU->subregions->{'ES-ML'}->apply_tax = false;
|
||||
|
||||
$this->regions->EU->subregions->{'ES-CN'} = new \stdClass();
|
||||
$this->regions->EU->subregions->{'ES-CN'}->tax_rate = 7;
|
||||
$this->regions->EU->subregions->{'ES-CN'}->tax_name = 'IGIC';
|
||||
$this->regions->EU->subregions->{'ES-CN'}->reduced_tax_rate = 3;
|
||||
$this->regions->EU->subregions->{'ES-CN'}->apply_tax = false;
|
||||
|
||||
|
||||
$this->regions->EU->subregions->FI = new \stdClass();
|
||||
$this->regions->EU->subregions->FI->tax_rate = 24;
|
||||
$this->regions->EU->subregions->FI->tax_name = 'ALV';
|
||||
|
@ -42,6 +42,9 @@ class InvoiceItemSum
|
||||
'DK', // Denmark
|
||||
'EE', // Estonia
|
||||
'ES', // Spain
|
||||
'ES-CE',
|
||||
'ES-CN',
|
||||
'ES-ML',
|
||||
'FI', // Finland
|
||||
'FR', // France
|
||||
'GR', // Greece
|
||||
@ -72,6 +75,9 @@ class InvoiceItemSum
|
||||
'DK', // Denmark
|
||||
'EE', // Estonia
|
||||
'ES', // Spain
|
||||
'ES-CE',
|
||||
'ES-CN',
|
||||
'ES-ML',
|
||||
'FI', // Finland
|
||||
'FR', // France
|
||||
'GR', // Greece
|
||||
@ -182,7 +188,7 @@ class InvoiceItemSum
|
||||
|
||||
|
||||
/** @var \App\DataMapper\Tax\BaseRule $class */
|
||||
$class = "App\DataMapper\Tax\\".$this->client->company->country()->iso_3166_2."\\Rule";
|
||||
$class = "App\DataMapper\Tax\\".str_replace("-","_",$this->client->company->country()->iso_3166_2)."\\Rule";
|
||||
|
||||
$this->rule = new $class();
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -22,7 +23,11 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
|
||||
Schema::table('countries', function (Blueprint $table) {
|
||||
$table->string('iso_3166_2',5)->change();
|
||||
});
|
||||
|
||||
$regions = [
|
||||
[
|
||||
'id' => 1000, // INE code for Canary Islands
|
||||
@ -95,6 +100,10 @@ return new class extends Migration
|
||||
Model::reguard();
|
||||
|
||||
|
||||
Company::query()->cursor()->each(function ($company) {
|
||||
$company->tax_data = new \App\DataMapper\Tax\TaxModel($company->tax_data);
|
||||
$company->save();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user