ekwo-os 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +873 -0
- package/dist/args.d.ts +57 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +134 -0
- package/dist/args.js.map +1 -0
- package/dist/assets/expected-objects.json +9432 -0
- package/dist/assets/migrations/20260911120000_core_companies.sql +260 -0
- package/dist/assets/migrations/20260911120100_accounts_journals.sql +211 -0
- package/dist/assets/migrations/20260911120200_contacts.sql +90 -0
- package/dist/assets/migrations/20260911120300_taxes.sql +146 -0
- package/dist/assets/migrations/20260911120400_entries.sql +338 -0
- package/dist/assets/migrations/20260911120500_documents.sql +279 -0
- package/dist/assets/migrations/20260911120600_payments_reconciliation.sql +251 -0
- package/dist/assets/migrations/20260911120700_bank.sql +178 -0
- package/dist/assets/migrations/20260911120800_analytics_attachments.sql +128 -0
- package/dist/assets/migrations/20260911120900_post_document.sql +279 -0
- package/dist/assets/migrations/20260911121000_reporting.sql +235 -0
- package/dist/assets/migrations/20260911121100_country_templates.sql +226 -0
- package/dist/assets/migrations/20260911121200_fec.sql +71 -0
- package/dist/assets/migrations/20260911130000_instance.sql +77 -0
- package/dist/assets/migrations/20260911130100_instance_members.sql +224 -0
- package/dist/assets/migrations/20260911140000_instance_admins.sql +112 -0
- package/dist/assets/migrations/20260911160000_tax_posting_templates_unique.sql +17 -0
- package/dist/assets/migrations/20260911170000_document_amount_paid.sql +82 -0
- package/dist/assets/migrations/20260911173000_post_payment.sql +122 -0
- package/dist/assets/migrations/20260911173100_sequence_counters_under_rls.sql +84 -0
- package/dist/assets/migrations/20260911183000_country_journal_defaults.sql +143 -0
- package/dist/assets/migrations/20260911193853_line_account_defaults.sql +274 -0
- package/dist/assets/migrations/20260911195054_products.sql +221 -0
- package/dist/assets/migrations/20260911210131_anon_surface.sql +85 -0
- package/dist/assets/migrations/20260912074712_country_packs.sql +318 -0
- package/dist/assets/migrations/20260912080311_report_code_and_region.sql +198 -0
- package/dist/assets/migrations/20260912081014_pack_certification_maintained.sql +31 -0
- package/dist/assets/migrations/20260912081015_pack_certification_backfill.sql +16 -0
- package/dist/assets/migrations/20260912090407_tax_report_boxes.sql +329 -0
- package/dist/assets/migrations/20260912091917_tax_on_base_value.sql +25 -0
- package/dist/assets/migrations/20260912091918_tax_engine_columns.sql +776 -0
- package/dist/assets/migrations/20260912094412_opening_and_closing.sql +759 -0
- package/dist/assets/migrations/20260912095825_charts_of_accounts.sql +326 -0
- package/dist/assets/migrations/20260912100412_financial_statements.sql +632 -0
- package/dist/assets/migrations/20260912104719_one_formula_evaluator.sql +209 -0
- package/dist/assets/migrations/20260912105720_entry_kind_appropriation.sql +26 -0
- package/dist/assets/migrations/20260912105721_appropriation_entry_kind.sql +444 -0
- package/dist/assets/migrations/20260912111751_document_rules.sql +274 -0
- package/dist/assets/migrations/20260912112132_cash_basis_vat_and_fx.sql +1189 -0
- package/dist/assets/migrations/20260913074512_modules.sql +493 -0
- package/dist/assets/migrations/20260913075903_asset_disposal_roles.sql +47 -0
- package/dist/assets/migrations/20260913083216_capabilities.sql +637 -0
- package/dist/assets/migrations/20260913083901_company_invitations.sql +262 -0
- package/dist/assets/migrations/20260913084402_user_preferences.sql +376 -0
- package/dist/assets/migrations/20260913084847_company_profile.sql +261 -0
- package/dist/assets/migrations/20260913085436_numbering_reads_the_pack.sql +235 -0
- package/dist/assets/migrations/20260913085932_api_keys.sql +303 -0
- package/dist/assets/migrations/20260913090216_fiscal_year_bounds.sql +159 -0
- package/dist/assets/migrations/20260913092527_entries_import.sql +219 -0
- package/dist/assets/migrations/20260913101536_null_safe_guards.sql +188 -0
- package/dist/assets/migrations/20260913102115_installer_is_named.sql +462 -0
- package/dist/assets/migrations/20260913102758_no_currency_default.sql +138 -0
- package/dist/assets/migrations/20260913103355_cash_basis_needs_a_box.sql +453 -0
- package/dist/assets/migrations/20260913104014_aged_balance_named_group.sql +79 -0
- package/dist/assets/migrations/20260913104232_foreign_key_indexes.sql +144 -0
- package/dist/assets/migrations/20260913105120_declared_no_reader.sql +41 -0
- package/dist/assets/migrations/20260913111407_pack_languages.sql +223 -0
- package/dist/assets/migrations/20260913112233_schema_comments_for_a_reader.sql +27 -0
- package/dist/assets/migrations/20260913114535_fec_opening_balances.sql +307 -0
- package/dist/assets/migrations/20260914103412_audit_log.sql +509 -0
- package/dist/assets/migrations/20260914111907_pack_upgrade.sql +428 -0
- package/dist/assets/migrations/20260914120500_rounding_reads_the_currency.sql +206 -0
- package/dist/assets/migrations/20260914121200_amounts_round_at_the_currency.sql +2403 -0
- package/dist/assets/migrations/20260914134325_schema_version_0_2_0.sql +36 -0
- package/dist/assets/migrations/20260914143915_accounts_in_use.sql +428 -0
- package/dist/assets/migrations/20260914144731_account_code_frozen.sql +99 -0
- package/dist/assets/migrations/20260914151207_schema_grants_its_own_rights.sql +284 -0
- package/dist/assets/migrations/20260914152840_pack_upgrade_records_its_own_line.sql +237 -0
- package/dist/assets/migrations/20260914163943_declaration_periodicity.sql +349 -0
- package/dist/assets/migrations/20260915094000_foreign_services_received.sql +37 -0
- package/dist/assets/migrations/20260915094500_mentions_read_a_foreign_service.sql +72 -0
- package/dist/assets/migrations/20260915153000_document_shares.sql +568 -0
- package/dist/assets/migrations/20260915160000_ec_sales_list.sql +181 -0
- package/dist/assets/migrations/20260915161842_pack_sources.sql +56 -0
- package/dist/assets/migrations/20260915170500_schema_version_0_3_0.sql +45 -0
- package/dist/assets/migrations/20260915174500_a_vat_category_is_a_code.sql +177 -0
- package/dist/assets/migrations/20260915180000_document_rule_references.sql +85 -0
- package/dist/assets/migrations/20260915181000_territories.sql +342 -0
- package/dist/assets/migrations/20260915181500_ec_sales_list_reads_the_territories.sql +222 -0
- package/dist/assets/migrations/20260915182000_intracom_triangular.sql +53 -0
- package/dist/assets/migrations/20260915182500_a_triangular_supply_says_reverse_charge.sql +99 -0
- package/dist/assets/migrations/20260915191200_a_document_knows_its_language.sql +633 -0
- package/dist/assets/migrations/20260915195000_a_price_that_holds_its_tax.sql +649 -0
- package/dist/assets/migrations/20260915200000_a_posting_names_its_boxes.sql +1004 -0
- package/dist/assets/migrations/20260916094500_a_company_files_more_than_one_declaration.sql +795 -0
- package/dist/assets/migrations/20260916103000_a_ledger_line_names_its_posting.sql +902 -0
- package/dist/assets/migrations/20260916123000_a_vocabulary_for_a_tax_that_is_not_a_vat.sql +144 -0
- package/dist/assets/migrations/20260916124000_a_box_can_be_a_rate_of_a_box.sql +525 -0
- package/dist/assets/migrations/20260916125000_a_tax_follows_the_territory.sql +1318 -0
- package/dist/assets/migrations/20260916126000_a_tax_point_and_its_exception.sql +1211 -0
- package/dist/assets/migrations/20260917090000_a_counterparty_that_learns.sql +561 -0
- package/dist/assets/migrations/20260917120000_what_the_money_pays.sql +545 -0
- package/dist/assets/migrations/20260917150000_a_filing_is_a_row.sql +488 -0
- package/dist/assets/migrations/20260917170000_when_it_is_due.sql +194 -0
- package/dist/assets/migrations/20260917180000_a_box_is_a_number_and_a_kind.sql +213 -0
- package/dist/assets/migrations/20260917190000_what_a_declaration_owes.sql +486 -0
- package/dist/assets/migrations/20260917200000_what_moved_after_it_went.sql +227 -0
- package/dist/assets/migrations/20260918090000_a_form_names_its_file.sql +27 -0
- package/dist/assets/migrations/20260918110000_a_deposit_and_what_came_back.sql +286 -0
- package/dist/assets/migrations/20260918113741_a_fourth_preset_is_named.sql +9 -0
- package/dist/assets/migrations/20260918113807_a_client_reads_and_hands_over.sql +96 -0
- package/dist/assets/migrations/20260918114322_two_definer_functions_check_their_caller.sql +75 -0
- package/dist/assets/migrations/20260918130000_every_company_somebody_keeps.sql +177 -0
- package/dist/assets/migrations/20260918140000_a_session_nobody_prepared.sql +40 -0
- package/dist/assets/migrations/20260918141107_a_line_keeps_the_tax_it_was_posted_with.sql +256 -0
- package/dist/assets/migrations/20260918141342_a_company_has_an_electronic_address.sql +66 -0
- package/dist/assets/migrations/20260918141605_an_invoice_reads_whole_from_the_views.sql +313 -0
- package/dist/assets/migrations/20260918141627_a_policy_asks_once.sql +132 -0
- package/dist/assets/migrations/20260918143352_a_suggestion_reads_the_words_once.sql +204 -0
- package/dist/assets/migrations/20260918143417_a_reference_of_the_caller_and_a_rehearsal.sql +115 -0
- package/dist/assets/migrations/20260918150712_a_company_leaves_with_its_books.sql +1119 -0
- package/dist/assets/migrations/20260918150931_a_statement_is_imported_once.sql +654 -0
- package/dist/assets/migrations/20260918161204_a_posted_document_does_not_move.sql +437 -0
- package/dist/assets/migrations/20260918161538_a_posted_entry_does_not_move.sql +252 -0
- package/dist/assets/migrations/20260918171946_an_entry_is_posted_by_post_entry.sql +289 -0
- package/dist/assets/migrations/20260918174312_schema_version_0_4_0.sql +53 -0
- package/dist/assets/modules/assets/module.json +13 -0
- package/dist/assets/modules/assets/supabase/migrations/20260913081447_assets.sql +1190 -0
- package/dist/assets/modules/assets/supabase/migrations/20260913104234_foreign_key_indexes.sql +47 -0
- package/dist/assets/modules/assets/supabase/migrations/20260913104500_assets_capabilities.sql +145 -0
- package/dist/assets/modules/assets/supabase/migrations/20260914122100_assets_round_at_the_currency.sql +564 -0
- package/dist/assets/modules/assets/supabase/migrations/20260914145012_assets_accounts_in_use.sql +37 -0
- package/dist/assets/modules/assets/supabase/migrations/20260914151530_assets_grants_its_own_rights.sql +63 -0
- package/dist/assets/modules/assets/supabase/migrations/20260918113912_assets_client_reads.sql +20 -0
- package/dist/assets/modules/assets/supabase/migrations/20260918150801_assets_leave_with_the_company.sql +41 -0
- package/dist/assets/modules/budgets/module.json +12 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260913083012_budgets.sql +210 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260913104233_foreign_key_indexes.sql +37 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260913104501_budgets_capabilities.sql +72 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260914122400_budgets_round_at_the_currency.sql +68 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260914145048_budgets_accounts_in_use.sql +30 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260914151812_budgets_grants_its_own_rights.sql +31 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260918113954_budgets_client_reads.sql +20 -0
- package/dist/assets/modules/budgets/supabase/migrations/20260918150823_budgets_leave_with_the_company.sql +37 -0
- package/dist/assets/modules/schema/module.1.json +69 -0
- package/dist/assets/seed/00_currencies.sql +15 -0
- package/dist/assets/seed/00_territories.sql +280 -0
- package/dist/assets/seed/05_framework_generic.sql +110 -0
- package/dist/assets/seed/10_pack_be.sql +1284 -0
- package/dist/assets/seed/11_pack_fr.sql +1112 -0
- package/dist/assets/seed/12_pack_lu.sql +2484 -0
- package/dist/assets/seed/13_pack_ee.sql +733 -0
- package/dist/assets/seed/14_pack_gb.sql +796 -0
- package/dist/assets/seed/15_pack_us.sql +751 -0
- package/dist/assets/seed/90_demo_company.sql +368 -0
- package/dist/assets/seed/modules/assets/10_pack_be.sql +58 -0
- package/dist/assets/seed/modules/assets/11_pack_fr.sql +57 -0
- package/dist/assets/seed/modules/assets/14_pack_gb.sql +58 -0
- package/dist/assets/seed/modules/assets/15_pack_us.sql +60 -0
- package/dist/auth.d.ts +59 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +134 -0
- package/dist/auth.js.map +1 -0
- package/dist/bin.d.ts +6 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +8 -0
- package/dist/bin.js.map +1 -0
- package/dist/books.d.ts +60 -0
- package/dist/books.d.ts.map +1 -0
- package/dist/books.js +168 -0
- package/dist/books.js.map +1 -0
- package/dist/bootstrap.d.ts +236 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +459 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/bundle.d.ts +27 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +47 -0
- package/dist/bundle.js.map +1 -0
- package/dist/checklist.d.ts +35 -0
- package/dist/checklist.d.ts.map +1 -0
- package/dist/checklist.js +64 -0
- package/dist/checklist.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +318 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/company.d.ts +59 -0
- package/dist/commands/company.d.ts.map +1 -0
- package/dist/commands/company.js +287 -0
- package/dist/commands/company.js.map +1 -0
- package/dist/commands/contact.d.ts +9 -0
- package/dist/commands/contact.d.ts.map +1 -0
- package/dist/commands/contact.js +82 -0
- package/dist/commands/contact.js.map +1 -0
- package/dist/commands/demo.d.ts +19 -0
- package/dist/commands/demo.d.ts.map +1 -0
- package/dist/commands/demo.js +72 -0
- package/dist/commands/demo.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/document.d.ts +17 -0
- package/dist/commands/document.d.ts.map +1 -0
- package/dist/commands/document.js +217 -0
- package/dist/commands/document.js.map +1 -0
- package/dist/commands/init.d.ts +31 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +535 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +24 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +128 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/migrate.d.ts +30 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +115 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/module.d.ts +32 -0
- package/dist/commands/module.d.ts.map +1 -0
- package/dist/commands/module.js +285 -0
- package/dist/commands/module.js.map +1 -0
- package/dist/commands/pack.d.ts +22 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +481 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/payment.d.ts +15 -0
- package/dist/commands/payment.d.ts.map +1 -0
- package/dist/commands/payment.js +97 -0
- package/dist/commands/payment.js.map +1 -0
- package/dist/commands/register.d.ts +20 -0
- package/dist/commands/register.d.ts.map +1 -0
- package/dist/commands/register.js +134 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +134 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/whoami.d.ts +21 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +133 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/company.d.ts +16 -0
- package/dist/company.d.ts.map +1 -0
- package/dist/company.js +26 -0
- package/dist/company.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +50 -0
- package/dist/config.js.map +1 -0
- package/dist/connection.d.ts +79 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +116 -0
- package/dist/connection.js.map +1 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +93 -0
- package/dist/context.js.map +1 -0
- package/dist/doctor.d.ts +45 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +448 -0
- package/dist/doctor.js.map +1 -0
- package/dist/grants.d.ts +88 -0
- package/dist/grants.d.ts.map +1 -0
- package/dist/grants.js +174 -0
- package/dist/grants.js.map +1 -0
- package/dist/identity.d.ts +54 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +132 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory.d.ts +155 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +303 -0
- package/dist/inventory.js.map +1 -0
- package/dist/migrations.d.ts +76 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +226 -0
- package/dist/migrations.js.map +1 -0
- package/dist/module/read.d.ts +91 -0
- package/dist/module/read.d.ts.map +1 -0
- package/dist/module/read.js +172 -0
- package/dist/module/read.js.map +1 -0
- package/dist/output.d.ts +110 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +173 -0
- package/dist/output.js.map +1 -0
- package/dist/pack/certification.d.ts +27 -0
- package/dist/pack/certification.d.ts.map +1 -0
- package/dist/pack/certification.js +38 -0
- package/dist/pack/certification.js.map +1 -0
- package/dist/pack/compile.d.ts +75 -0
- package/dist/pack/compile.d.ts.map +1 -0
- package/dist/pack/compile.js +801 -0
- package/dist/pack/compile.js.map +1 -0
- package/dist/pack/filing.d.ts +48 -0
- package/dist/pack/filing.d.ts.map +1 -0
- package/dist/pack/filing.js +56 -0
- package/dist/pack/filing.js.map +1 -0
- package/dist/pack/read.d.ts +766 -0
- package/dist/pack/read.d.ts.map +1 -0
- package/dist/pack/read.js +2336 -0
- package/dist/pack/read.js.map +1 -0
- package/dist/pack/schema.d.ts +26 -0
- package/dist/pack/schema.d.ts.map +1 -0
- package/dist/pack/schema.js +181 -0
- package/dist/pack/schema.js.map +1 -0
- package/dist/pack/territories.d.ts +98 -0
- package/dist/pack/territories.d.ts.map +1 -0
- package/dist/pack/territories.js +0 -0
- package/dist/pack/territories.js.map +1 -0
- package/dist/pack/upgrade.d.ts +86 -0
- package/dist/pack/upgrade.d.ts.map +1 -0
- package/dist/pack/upgrade.js +76 -0
- package/dist/pack/upgrade.js.map +1 -0
- package/dist/pack/vat-codes.d.ts +273 -0
- package/dist/pack/vat-codes.d.ts.map +1 -0
- package/dist/pack/vat-codes.js +513 -0
- package/dist/pack/vat-codes.js.map +1 -0
- package/dist/profiles.d.ts +67 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +187 -0
- package/dist/profiles.js.map +1 -0
- package/dist/prompt.d.ts +40 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +120 -0
- package/dist/prompt.js.map +1 -0
- package/dist/registry.d.ts +84 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +104 -0
- package/dist/registry.js.map +1 -0
- package/dist/rest.d.ts +81 -0
- package/dist/rest.d.ts.map +1 -0
- package/dist/rest.js +245 -0
- package/dist/rest.js.map +1 -0
- package/dist/schema.d.ts +15 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +15 -0
- package/dist/schema.js.map +1 -0
- package/dist/seeds.d.ts +27 -0
- package/dist/seeds.d.ts.map +1 -0
- package/dist/seeds.js +47 -0
- package/dist/seeds.js.map +1 -0
- package/dist/session.d.ts +39 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +92 -0
- package/dist/session.js.map +1 -0
- package/dist/sql.d.ts +48 -0
- package/dist/sql.d.ts.map +1 -0
- package/dist/sql.js +112 -0
- package/dist/sql.js.map +1 -0
- package/dist/status.d.ts +94 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +120 -0
- package/dist/status.js.map +1 -0
- package/dist/ui.d.ts +55 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +114 -0
- package/dist/ui.js.map +1 -0
- package/package.json +29 -0
- package/schema/output.1.json +613 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
-- Ekwo OS — territories. The common system of VAT, and where it applies.
|
|
2
|
+
--
|
|
3
|
+
-- Reference data of the framework, like the currencies beside it, and read by
|
|
4
|
+
-- `ec_sales_list()` through `territory_of()`, `is_eu_member()`,
|
|
5
|
+
-- `eu_vat_scope_of()` and `vat_prefix_of()`. The table, the four functions and
|
|
6
|
+
-- the whole argument for why this is data and not code are in the migration
|
|
7
|
+
-- `20260915181000_territories.sql`; this file is the rows.
|
|
8
|
+
--
|
|
9
|
+
-- **It upserts, where the currencies do nothing.** A currency nobody corrects
|
|
10
|
+
-- can be inserted once and left alone. This list changes — a State accedes, a
|
|
11
|
+
-- State leaves, a territory moves from one paragraph of article 6 to another —
|
|
12
|
+
-- and re-applying this file has to be how that correction reaches an
|
|
13
|
+
-- installation that already exists, which is the rule the seed README states
|
|
14
|
+
-- for every country pack. So every column is written again on conflict.
|
|
15
|
+
--
|
|
16
|
+
-- Sources, in full, in the migration. In short: Council Directive 2006/112/EC,
|
|
17
|
+
-- articles 5, 6 and 7; the Withdrawal Agreement and the Protocol on
|
|
18
|
+
-- Ireland/Northern Ireland; the VIES register for the prefixes; the accession
|
|
19
|
+
-- treaties for the dates, cited on each row.
|
|
20
|
+
|
|
21
|
+
-- ---------------------------------------------------------------------------
|
|
22
|
+
-- The rows — the Member States
|
|
23
|
+
--
|
|
24
|
+
-- One row per State, with the day it became bound by the common system, which
|
|
25
|
+
-- is the day of its accession. The six founding States are dated 1 January
|
|
26
|
+
-- 1958, the day the Treaty of Rome entered into force: the common system
|
|
27
|
+
-- itself is younger — the first directives are of 1967 and the sixth of 1977 —
|
|
28
|
+
-- and dating them from 1958 says the same thing every reader of this column
|
|
29
|
+
-- needs, which is that nothing in a ledger this software will ever read falls
|
|
30
|
+
-- before the date.
|
|
31
|
+
-- ---------------------------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
insert into territories (code, code_source, name, parent_code, eu_vat_scope, eu_vat_from, eu_vat_to, vat_prefix, legal_reference) values
|
|
34
|
+
('BE', 'iso_3166_1', 'Belgium', null, 'full', date '1958-01-01', null, null, 'Treaty establishing the European Economic Community, Rome, 25 March 1957, in force 1 January 1958'),
|
|
35
|
+
('DE', 'iso_3166_1', 'Germany', null, 'full', date '1958-01-01', null, null, 'Treaty establishing the European Economic Community, Rome, 25 March 1957, in force 1 January 1958'),
|
|
36
|
+
('FR', 'iso_3166_1', 'France', null, 'full', date '1958-01-01', null, null, 'Treaty establishing the European Economic Community, Rome, 25 March 1957, in force 1 January 1958'),
|
|
37
|
+
('IT', 'iso_3166_1', 'Italy', null, 'full', date '1958-01-01', null, null, 'Treaty establishing the European Economic Community, Rome, 25 March 1957, in force 1 January 1958'),
|
|
38
|
+
('LU', 'iso_3166_1', 'Luxembourg', null, 'full', date '1958-01-01', null, null, 'Treaty establishing the European Economic Community, Rome, 25 March 1957, in force 1 January 1958'),
|
|
39
|
+
('NL', 'iso_3166_1', 'Netherlands', null, 'full', date '1958-01-01', null, null, 'Treaty establishing the European Economic Community, Rome, 25 March 1957, in force 1 January 1958'),
|
|
40
|
+
('DK', 'iso_3166_1', 'Denmark', null, 'full', date '1973-01-01', null, null, 'Treaty of Accession 1972, in force 1 January 1973'),
|
|
41
|
+
('IE', 'iso_3166_1', 'Ireland', null, 'full', date '1973-01-01', null, null, 'Treaty of Accession 1972, in force 1 January 1973'),
|
|
42
|
+
('GR', 'iso_3166_1', 'Greece', null, 'full', date '1981-01-01', null, 'EL', 'Treaty of Accession 1979, in force 1 January 1981; the prefix EL is the one the VIES register publishes for Greek VAT identification numbers'),
|
|
43
|
+
('ES', 'iso_3166_1', 'Spain', null, 'full', date '1986-01-01', null, null, 'Treaty of Accession 1985, in force 1 January 1986'),
|
|
44
|
+
('PT', 'iso_3166_1', 'Portugal', null, 'full', date '1986-01-01', null, null, 'Treaty of Accession 1985, in force 1 January 1986'),
|
|
45
|
+
('AT', 'iso_3166_1', 'Austria', null, 'full', date '1995-01-01', null, null, 'Treaty of Accession 1994, in force 1 January 1995'),
|
|
46
|
+
('FI', 'iso_3166_1', 'Finland', null, 'full', date '1995-01-01', null, null, 'Treaty of Accession 1994, in force 1 January 1995'),
|
|
47
|
+
('SE', 'iso_3166_1', 'Sweden', null, 'full', date '1995-01-01', null, null, 'Treaty of Accession 1994, in force 1 January 1995'),
|
|
48
|
+
('CY', 'iso_3166_1', 'Cyprus', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
49
|
+
('CZ', 'iso_3166_1', 'Czechia', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
50
|
+
('EE', 'iso_3166_1', 'Estonia', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
51
|
+
('HU', 'iso_3166_1', 'Hungary', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
52
|
+
('LT', 'iso_3166_1', 'Lithuania', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
53
|
+
('LV', 'iso_3166_1', 'Latvia', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
54
|
+
('MT', 'iso_3166_1', 'Malta', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
55
|
+
('PL', 'iso_3166_1', 'Poland', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
56
|
+
('SI', 'iso_3166_1', 'Slovenia', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
57
|
+
('SK', 'iso_3166_1', 'Slovakia', null, 'full', date '2004-05-01', null, null, 'Treaty of Accession 2003, in force 1 May 2004'),
|
|
58
|
+
('BG', 'iso_3166_1', 'Bulgaria', null, 'full', date '2007-01-01', null, null, 'Treaty of Accession 2005, in force 1 January 2007'),
|
|
59
|
+
('RO', 'iso_3166_1', 'Romania', null, 'full', date '2007-01-01', null, null, 'Treaty of Accession 2005, in force 1 January 2007'),
|
|
60
|
+
('HR', 'iso_3166_1', 'Croatia', null, 'full', date '2013-07-01', null, null, 'Treaty of Accession 2011, in force 1 July 2013')
|
|
61
|
+
on conflict (code) do update set
|
|
62
|
+
code_source = excluded.code_source,
|
|
63
|
+
name = excluded.name,
|
|
64
|
+
parent_code = excluded.parent_code,
|
|
65
|
+
eu_vat_scope = excluded.eu_vat_scope,
|
|
66
|
+
eu_vat_from = excluded.eu_vat_from,
|
|
67
|
+
eu_vat_to = excluded.eu_vat_to,
|
|
68
|
+
vat_prefix = excluded.vat_prefix,
|
|
69
|
+
legal_reference = excluded.legal_reference;
|
|
70
|
+
|
|
71
|
+
-- ---------------------------------------------------------------------------
|
|
72
|
+
-- The United Kingdom, and Northern Ireland
|
|
73
|
+
--
|
|
74
|
+
-- Two rows, not one, and the second is not a column on the first.
|
|
75
|
+
--
|
|
76
|
+
-- Northern Ireland is a territory of the United Kingdom, which is not a Member
|
|
77
|
+
-- State, and it is inside the common system of VAT for supplies of goods and
|
|
78
|
+
-- outside it for supplies of services. Its numbers carry `XI`, a prefix the
|
|
79
|
+
-- United Kingdom's own `GB` numbers do not share, and VIES validates them
|
|
80
|
+
-- separately. Everything a reader asks of a territory it asks of that one:
|
|
81
|
+
-- what its prefix is, whether a supply to it is intra-Community, which State
|
|
82
|
+
-- it belongs to. A boolean on the `GB` row — `vat_territory_of_eu_for_goods` —
|
|
83
|
+
-- would answer none of them: it would make the United Kingdom itself partly
|
|
84
|
+
-- inside the system, which is exactly wrong, and it would leave `XI` with
|
|
85
|
+
-- nothing to resolve to when it arrives in a VAT number.
|
|
86
|
+
--
|
|
87
|
+
-- So: a row, with `parent_code` saying whose territory it is, and the middle
|
|
88
|
+
-- value of `eu_vat_scope` saying how much of the system reaches it. The date
|
|
89
|
+
-- is 1 January 2021, the day after the transition ended, which is the first
|
|
90
|
+
-- day `XI` meant anything: before it, Northern Ireland was inside the system
|
|
91
|
+
-- because the whole United Kingdom was.
|
|
92
|
+
-- ---------------------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
insert into territories (code, code_source, name, parent_code, eu_vat_scope, eu_vat_from, eu_vat_to, vat_prefix, legal_reference) values
|
|
95
|
+
('GB', 'iso_3166_1', 'United Kingdom', null, 'full', date '1973-01-01', date '2020-12-31', null,
|
|
96
|
+
'Treaty of Accession 1972, in force 1 January 1973. The United Kingdom ceased to be a Member State on 31 January 2020 and remained inside the common system of VAT until 31 December 2020, because articles 126 and 127 of the Withdrawal Agreement kept Union law applying through the transition period. This column records the VAT date.'),
|
|
97
|
+
('XI', 'eu', 'Northern Ireland', 'GB', 'goods', date '2021-01-01', null, null,
|
|
98
|
+
'Protocol on Ireland/Northern Ireland to the Withdrawal Agreement, article 8 and annex 3, as amended by the Windsor Framework: the Union''s VAT rules on goods apply in Northern Ireland and its rules on services do not. The prefix XI is the one the VIES register publishes for it.')
|
|
99
|
+
on conflict (code) do update set
|
|
100
|
+
code_source = excluded.code_source,
|
|
101
|
+
name = excluded.name,
|
|
102
|
+
parent_code = excluded.parent_code,
|
|
103
|
+
eu_vat_scope = excluded.eu_vat_scope,
|
|
104
|
+
eu_vat_from = excluded.eu_vat_from,
|
|
105
|
+
eu_vat_to = excluded.eu_vat_to,
|
|
106
|
+
vat_prefix = excluded.vat_prefix,
|
|
107
|
+
legal_reference = excluded.legal_reference;
|
|
108
|
+
|
|
109
|
+
-- ---------------------------------------------------------------------------
|
|
110
|
+
-- Territories article 7 puts inside the system
|
|
111
|
+
--
|
|
112
|
+
-- Two places that are not in the Union and where the Directive applies all the
|
|
113
|
+
-- same, because the article says a transaction with them is a transaction with
|
|
114
|
+
-- the State beside them. Both are worth a row for one reason: their VAT
|
|
115
|
+
-- numbers carry that State's prefix, so a customer recorded in Monaco is a
|
|
116
|
+
-- French customer to every form this software writes, and a reader that took
|
|
117
|
+
-- `MC` at face value would report an export.
|
|
118
|
+
-- ---------------------------------------------------------------------------
|
|
119
|
+
|
|
120
|
+
insert into territories (code, code_source, name, parent_code, eu_vat_scope, eu_vat_from, eu_vat_to, vat_prefix, legal_reference) values
|
|
121
|
+
('MC', 'iso_3166_1', 'Monaco', 'FR', 'full', date '1958-01-01', null, 'FR',
|
|
122
|
+
'Directive 2006/112/EC, article 7(1): transactions originating in or intended for the Principality of Monaco are treated as transactions originating in or intended for France'),
|
|
123
|
+
('IM', 'iso_3166_1', 'Isle of Man', 'GB', 'full', date '1973-01-01', date '2020-12-31', 'GB',
|
|
124
|
+
'Directive 2006/112/EC, article 7(1): transactions originating in or intended for the Isle of Man were treated as transactions originating in or intended for the United Kingdom, which left the common system on 31 December 2020')
|
|
125
|
+
on conflict (code) do update set
|
|
126
|
+
code_source = excluded.code_source,
|
|
127
|
+
name = excluded.name,
|
|
128
|
+
parent_code = excluded.parent_code,
|
|
129
|
+
eu_vat_scope = excluded.eu_vat_scope,
|
|
130
|
+
eu_vat_from = excluded.eu_vat_from,
|
|
131
|
+
eu_vat_to = excluded.eu_vat_to,
|
|
132
|
+
vat_prefix = excluded.vat_prefix,
|
|
133
|
+
legal_reference = excluded.legal_reference;
|
|
134
|
+
|
|
135
|
+
-- ---------------------------------------------------------------------------
|
|
136
|
+
-- Territories article 6 takes out of the system
|
|
137
|
+
--
|
|
138
|
+
-- The Directive does not apply to them, whether or not they are inside the
|
|
139
|
+
-- customs territory of the Union, and the distinction between its two
|
|
140
|
+
-- paragraphs is a customs one that changes nothing here — which is why the
|
|
141
|
+
-- column records the outcome and the `legal_reference` records the paragraph.
|
|
142
|
+
-- Campione d'Italia and the Italian waters of Lake Lugano moved from the
|
|
143
|
+
-- second paragraph to the first on 1 January 2020 and were outside the VAT
|
|
144
|
+
-- territory before and after, so the row carries both citations and no date.
|
|
145
|
+
--
|
|
146
|
+
-- None of them issues a VAT identification number, so `vat_prefix` is null on
|
|
147
|
+
-- every one: a business established in the Canary Islands that has to identify
|
|
148
|
+
-- for Union VAT does so in Spain, with a Spanish number.
|
|
149
|
+
-- ---------------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
insert into territories (code, code_source, name, parent_code, eu_vat_scope, eu_vat_from, eu_vat_to, vat_prefix, legal_reference) values
|
|
152
|
+
('GR-69', 'iso_3166_2', 'Mount Athos', 'GR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(a)'),
|
|
153
|
+
('ES-CN', 'iso_3166_2', 'Canary Islands', 'ES', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(b)'),
|
|
154
|
+
('GP', 'iso_3166_1', 'Guadeloupe', 'FR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(c), which names the French territories referred to in articles 349 and 355(1) of the Treaty on the Functioning of the European Union'),
|
|
155
|
+
('GF', 'iso_3166_1', 'French Guiana', 'FR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(c)'),
|
|
156
|
+
('MQ', 'iso_3166_1', 'Martinique', 'FR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(c)'),
|
|
157
|
+
('RE', 'iso_3166_1', 'Réunion', 'FR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(c)'),
|
|
158
|
+
('YT', 'iso_3166_1', 'Mayotte', 'FR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(c)'),
|
|
159
|
+
('MF', 'iso_3166_1', 'Saint-Martin (French part)', 'FR', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(c)'),
|
|
160
|
+
('AX', 'iso_3166_1', 'Åland Islands', 'FI', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(d); Act of Accession 1994, protocol no 2 on the Åland Islands'),
|
|
161
|
+
('GG', 'iso_3166_1', 'Guernsey', 'GB', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(e), which names the Channel Islands'),
|
|
162
|
+
('JE', 'iso_3166_1', 'Jersey', 'GB', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(e), which names the Channel Islands'),
|
|
163
|
+
('IT-CAMPIONE', 'named', 'Campione d''Italia', 'IT', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(f) since 1 January 2020 and article 6(2)(f) before it, the municipality having entered the customs territory of the Union under Directive (EU) 2019/475 without entering its VAT territory'),
|
|
164
|
+
('IT-LUGANO', 'named', 'Italian waters of Lake Lugano', 'IT', 'none', null, null, null, 'Directive 2006/112/EC, article 6(1)(g) since 1 January 2020 and article 6(2)(g) before it, under Directive (EU) 2019/475'),
|
|
165
|
+
('DE-HELIGOLAND', 'named', 'Island of Heligoland', 'DE', 'none', null, null, null, 'Directive 2006/112/EC, article 6(2)(a)'),
|
|
166
|
+
('DE-BUSINGEN', 'named', 'Territory of Büsingen', 'DE', 'none', null, null, null, 'Directive 2006/112/EC, article 6(2)(b)'),
|
|
167
|
+
('ES-CE', 'iso_3166_2', 'Ceuta', 'ES', 'none', null, null, null, 'Directive 2006/112/EC, article 6(2)(c)'),
|
|
168
|
+
('ES-ML', 'iso_3166_2', 'Melilla', 'ES', 'none', null, null, null, 'Directive 2006/112/EC, article 6(2)(d)'),
|
|
169
|
+
('IT-LIVIGNO', 'named', 'Livigno', 'IT', 'none', null, null, null, 'Directive 2006/112/EC, article 6(2)(e)')
|
|
170
|
+
on conflict (code) do update set
|
|
171
|
+
code_source = excluded.code_source,
|
|
172
|
+
name = excluded.name,
|
|
173
|
+
parent_code = excluded.parent_code,
|
|
174
|
+
eu_vat_scope = excluded.eu_vat_scope,
|
|
175
|
+
eu_vat_from = excluded.eu_vat_from,
|
|
176
|
+
eu_vat_to = excluded.eu_vat_to,
|
|
177
|
+
vat_prefix = excluded.vat_prefix,
|
|
178
|
+
legal_reference = excluded.legal_reference;
|
|
179
|
+
|
|
180
|
+
-- ---------------------------------------------------------------------------
|
|
181
|
+
-- Third countries a pack of this repository keeps books in
|
|
182
|
+
--
|
|
183
|
+
-- A country outside the common system of VAT has to be *in* this table, and
|
|
184
|
+
-- saying nothing about it is not the same as saying no. `eu_vat_scope_of()`
|
|
185
|
+
-- answers `none` for a code it does not carry, which is the right answer to
|
|
186
|
+
-- the question the recapitulative statement asks — a supply to a place the
|
|
187
|
+
-- Union has never heard of is not an intra-Community one. It is the wrong
|
|
188
|
+
-- answer to the question `ekwo pack check` asks, which is whether the VATEX
|
|
189
|
+
-- code list of EN 16931 reaches a pack at all: there, a missing row is read as
|
|
190
|
+
-- "unknown" and the pack is held to the Union's table, so a pack for a country
|
|
191
|
+
-- with no row would be refused for leaving `exemption_code` empty on an exempt
|
|
192
|
+
-- line, and told to write a code that names an article of a Directive its
|
|
193
|
+
-- seller is not bound by. `tests/territories.test.ts` already refuses a pack
|
|
194
|
+
-- whose country this table does not carry, for the same reason from the other
|
|
195
|
+
-- side.
|
|
196
|
+
--
|
|
197
|
+
-- So a country a pack books in gets a row here, whether or not the Union's law
|
|
198
|
+
-- has anything to say about it. The scope is `none` and the window is empty,
|
|
199
|
+
-- which the `territories_scope_matches_window` constraint requires of each
|
|
200
|
+
-- other: the common system has never reached it and there is no date on which
|
|
201
|
+
-- it started or stopped. `vat_prefix` is null because there is no VAT
|
|
202
|
+
-- identification number to prefix — the United States levies no value added
|
|
203
|
+
-- tax at any level of government.
|
|
204
|
+
-- ---------------------------------------------------------------------------
|
|
205
|
+
|
|
206
|
+
insert into territories (code, code_source, name, parent_code, eu_vat_scope, eu_vat_from, eu_vat_to, vat_prefix, legal_reference) values
|
|
207
|
+
('US', 'iso_3166_1', 'United States of America', null, 'none', null, null, null,
|
|
208
|
+
'Directive 2006/112/EC, article 5(2): the common system of VAT applies in the territory of the Community as defined by the Treaties, and a State outside it is a third country for every rule the Directive carries. The United States has never been inside the system and levies no value added tax of its own at any level of government: what its states levy is a retail sales tax and a compensating use tax, which no Union instrument reaches.')
|
|
209
|
+
on conflict (code) do update set
|
|
210
|
+
code_source = excluded.code_source,
|
|
211
|
+
name = excluded.name,
|
|
212
|
+
parent_code = excluded.parent_code,
|
|
213
|
+
eu_vat_scope = excluded.eu_vat_scope,
|
|
214
|
+
eu_vat_from = excluded.eu_vat_from,
|
|
215
|
+
eu_vat_to = excluded.eu_vat_to,
|
|
216
|
+
vat_prefix = excluded.vat_prefix,
|
|
217
|
+
legal_reference = excluded.legal_reference;
|
|
218
|
+
|
|
219
|
+
-- ---------------------------------------------------------------------------
|
|
220
|
+
-- The territories a pack conditions a tax on
|
|
221
|
+
--
|
|
222
|
+
-- The rule above is the common system of VAT: the Member States, the United
|
|
223
|
+
-- Kingdom, Northern Ireland, the territories articles 6 and 7 take out or put
|
|
224
|
+
-- in, and a third country a pack books in. A tax that names a territory is a
|
|
225
|
+
-- second reason for a row, and so is a territory a document says a supply took
|
|
226
|
+
-- place in. Both are a different reason from the first — `US-CA` has nothing to
|
|
227
|
+
-- do with Directive 2006/112/EC and never will.
|
|
228
|
+
--
|
|
229
|
+
-- It is the same table all the same, and it is the same table for the reason
|
|
230
|
+
-- the first rule gives: a territory code is only useful if a reader can look
|
|
231
|
+
-- it up, and `taxes.applies_*_territory` is a foreign key precisely so that no
|
|
232
|
+
-- pack can invent a place. `jurisdiction` has been a free string since the day
|
|
233
|
+
-- it was added and nothing has ever read it; that is what this fixes.
|
|
234
|
+
--
|
|
235
|
+
-- So the rule the table holds is now two rules, and every row says which of
|
|
236
|
+
-- them put it there:
|
|
237
|
+
--
|
|
238
|
+
-- 1. **The common system of VAT** — where it applies and where it does not.
|
|
239
|
+
-- The rows above, and the third countries a pack books in.
|
|
240
|
+
-- 2. **A territory a pack conditions a tax on, or delivers to.** The rows
|
|
241
|
+
-- below — `documents.supply_territory_code` is a foreign key too, so a
|
|
242
|
+
-- destination a scenario names is a row like any other. They carry
|
|
243
|
+
-- `eu_vat_scope = 'none'` and no window, which is what the constraint
|
|
244
|
+
-- requires of a place the Union's law has never reached, and their
|
|
245
|
+
-- `parent_code` is the State they belong to, which is what lets a
|
|
246
|
+
-- condition naming that State reach them.
|
|
247
|
+
--
|
|
248
|
+
-- The list therefore grows with the packs, and it grows by a handful of rows
|
|
249
|
+
-- and not by fifty: `packs/us/` declares three states because three states is
|
|
250
|
+
-- what its codes cover. `docs/international.md` already records that a pack of
|
|
251
|
+
-- a third country adds a row here before anything else; this is the same
|
|
252
|
+
-- sentence with a second clause.
|
|
253
|
+
--
|
|
254
|
+
-- The dividing line is worth stating, because it is the one somebody will be
|
|
255
|
+
-- tempted to cross. This table says **where a body of tax law applies**. It
|
|
256
|
+
-- says nothing about what that law charges, which is a pack's business: no
|
|
257
|
+
-- rate, no threshold, no registration, and no district. The City of Oakland
|
|
258
|
+
-- levies a combined 10.75 per cent and has no row here — `US-CA-S-1075` is a
|
|
259
|
+
-- Californian tax at a Californian place of supply, and which city inside
|
|
260
|
+
-- California is a question this table has never answered for any country.
|
|
261
|
+
-- ---------------------------------------------------------------------------
|
|
262
|
+
|
|
263
|
+
insert into territories (code, code_source, name, parent_code, eu_vat_scope, eu_vat_from, eu_vat_to, vat_prefix, legal_reference) values
|
|
264
|
+
('US-CA', 'iso_3166_2', 'California', 'US', 'none', null, null, null,
|
|
265
|
+
'ISO 3166-2:US for the code. California Revenue and Taxation Code, sections 6051 and 6201, which impose the sales tax on a retailer''s gross receipts and the use tax on the storage, use or other consumption of tangible personal property in this State — the two statutes that make California a taxing territory of its own inside a country that levies no tax at all at federal level. Outside the common system of VAT with its parent, under Directive 2006/112/EC, article 5(2).'),
|
|
266
|
+
('US-NY', 'iso_3166_2', 'New York', 'US', 'none', null, null, null,
|
|
267
|
+
'ISO 3166-2:US for the code. New York Tax Law, article 28, section 1105, which imposes the sales tax on receipts from every retail sale of tangible personal property, and section 1210, under which a city or county may impose a tax of its own on the same receipts. Outside the common system of VAT with its parent, under Directive 2006/112/EC, article 5(2).'),
|
|
268
|
+
('US-AZ', 'iso_3166_2', 'Arizona', 'US', 'none', null, null, null,
|
|
269
|
+
'ISO 3166-2:US for the code. Arizona Revised Statutes, title 42, chapter 5, article 1, which levies the transaction privilege tax on the gross proceeds of a retail business, and section 42-5155, which levies the use tax on tangible personal property purchased from a retailer for storage, use or consumption in this State. No tax of this repository is levied here: the row exists because a Californian sale shipped to Phoenix has to be able to say where the goods went. Outside the common system of VAT with its parent, under Directive 2006/112/EC, article 5(2).'),
|
|
270
|
+
('US-OR', 'iso_3166_2', 'Oregon', 'US', 'none', null, null, null,
|
|
271
|
+
'ISO 3166-2:US for the code. Oregon imposes no general sales or use tax: no chapter of the Oregon Revised Statutes levies one, and article IX, section 1a of the Oregon Constitution, with the six rejections of a sales tax put to the electorate since 1933, is why. A territory with no tax is a territory all the same — it is what says that a delivery there carries none. Outside the common system of VAT with its parent, under Directive 2006/112/EC, article 5(2).')
|
|
272
|
+
on conflict (code) do update set
|
|
273
|
+
code_source = excluded.code_source,
|
|
274
|
+
name = excluded.name,
|
|
275
|
+
parent_code = excluded.parent_code,
|
|
276
|
+
eu_vat_scope = excluded.eu_vat_scope,
|
|
277
|
+
eu_vat_from = excluded.eu_vat_from,
|
|
278
|
+
eu_vat_to = excluded.eu_vat_to,
|
|
279
|
+
vat_prefix = excluded.vat_prefix,
|
|
280
|
+
legal_reference = excluded.legal_reference;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
-- Ekwo OS — Generic framework: financial statements by account type, for any chart of any country.
|
|
2
|
+
--
|
|
3
|
+
-- Generated from packs/generic at version 1.1.1, do not edit.
|
|
4
|
+
-- Change the pack and run `ekwo pack build generic`; `ekwo pack check --all`
|
|
5
|
+
-- refuses a seed that is not the exact output of its pack, and the CI runs it.
|
|
6
|
+
--
|
|
7
|
+
-- Maintained by Ekwo — not yet reviewed by an accountant.
|
|
8
|
+
-- Written from:
|
|
9
|
+
-- IFRS for SMEs Accounting Standard (2015), section 4 — Statement of Financial Position
|
|
10
|
+
-- IFRS for SMEs Accounting Standard (2015), section 5 — Statement of Comprehensive Income
|
|
11
|
+
--
|
|
12
|
+
-- Reference data with no country and no chart: `financial_statement()` reads it
|
|
13
|
+
-- directly, and nothing here is copied into a company.
|
|
14
|
+
|
|
15
|
+
insert into statement_templates
|
|
16
|
+
(code, country, chart_code, name, kind, framework, valid_from, valid_to, legal_reference,
|
|
17
|
+
source_key)
|
|
18
|
+
values
|
|
19
|
+
('IFRS-SME-BS', null, null, 'Statement of financial position', 'balance_sheet', 'IFRS-SME', date '1970-01-01', null, 'IFRS for SMEs, section 4', null),
|
|
20
|
+
('IFRS-SME-IS', null, null, 'Income statement', 'income_statement', 'IFRS-SME', date '1970-01-01', null, 'IFRS for SMEs, section 5', null)
|
|
21
|
+
on conflict (code) do update set
|
|
22
|
+
country = excluded.country,
|
|
23
|
+
chart_code = excluded.chart_code,
|
|
24
|
+
name = excluded.name,
|
|
25
|
+
kind = excluded.kind,
|
|
26
|
+
framework = excluded.framework,
|
|
27
|
+
valid_from = excluded.valid_from,
|
|
28
|
+
valid_to = excluded.valid_to,
|
|
29
|
+
legal_reference = excluded.legal_reference,
|
|
30
|
+
source_key = excluded.source_key;
|
|
31
|
+
|
|
32
|
+
insert into statement_line_templates
|
|
33
|
+
(statement_code, code, parent_code, name, name_i18n, sequence, sign, is_total,
|
|
34
|
+
plus_lines, minus_lines, xbrl_element, legal_reference, source_key)
|
|
35
|
+
values
|
|
36
|
+
('IFRS-SME-BS', 'A-NC-FIX', 'A-NC', 'Property, plant, equipment and intangible assets', '{}'::jsonb, 10, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
37
|
+
('IFRS-SME-BS', 'A-NC-OTH', 'A-NC', 'Other non-current assets', '{}'::jsonb, 20, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
38
|
+
('IFRS-SME-BS', 'A-NC', null, 'Non-current assets', '{}'::jsonb, 30, 1, true, array['A-NC-FIX', 'A-NC-OTH']::text[], '{}'::text[], null, null, null),
|
|
39
|
+
('IFRS-SME-BS', 'A-C-REC', 'A-C', 'Trade and other receivables', '{}'::jsonb, 40, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
40
|
+
('IFRS-SME-BS', 'A-C-OTH', 'A-C', 'Inventories, prepayments and other current assets', '{}'::jsonb, 50, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
41
|
+
('IFRS-SME-BS', 'A-C-CASH', 'A-C', 'Cash and cash equivalents', '{}'::jsonb, 60, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
42
|
+
('IFRS-SME-BS', 'A-C', null, 'Current assets', '{}'::jsonb, 70, 1, true, array['A-C-REC', 'A-C-OTH', 'A-C-CASH']::text[], '{}'::text[], null, null, null),
|
|
43
|
+
('IFRS-SME-BS', 'A-TOT', null, 'Total assets', '{}'::jsonb, 80, 1, true, array['A-NC', 'A-C']::text[], '{}'::text[], null, null, null),
|
|
44
|
+
('IFRS-SME-BS', 'E-CAP', 'E-TOT', 'Capital and reserves', '{}'::jsonb, 90, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
45
|
+
('IFRS-SME-BS', 'E-RET', 'E-TOT', 'Retained earnings', '{}'::jsonb, 100, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
46
|
+
('IFRS-SME-BS', 'E-RESULT', 'E-TOT', 'Result for the period, not yet allocated', '{}'::jsonb, 105, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
47
|
+
('IFRS-SME-BS', 'E-TOT', null, 'Total equity', '{}'::jsonb, 110, 1, true, array['E-CAP', 'E-RET', 'E-RESULT']::text[], '{}'::text[], null, null, null),
|
|
48
|
+
('IFRS-SME-BS', 'L-NC', 'L-TOT', 'Non-current liabilities', '{}'::jsonb, 120, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
49
|
+
('IFRS-SME-BS', 'L-C-PAY', 'L-C', 'Trade and other payables', '{}'::jsonb, 130, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
50
|
+
('IFRS-SME-BS', 'L-C-OTH', 'L-C', 'Other current liabilities', '{}'::jsonb, 140, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
51
|
+
('IFRS-SME-BS', 'L-C', null, 'Current liabilities', '{}'::jsonb, 150, 1, true, array['L-C-PAY', 'L-C-OTH']::text[], '{}'::text[], null, null, null),
|
|
52
|
+
('IFRS-SME-BS', 'L-TOT', null, 'Total liabilities', '{}'::jsonb, 160, 1, true, array['L-NC', 'L-C']::text[], '{}'::text[], null, null, null),
|
|
53
|
+
('IFRS-SME-BS', 'EL-TOT', null, 'Total equity and liabilities', '{}'::jsonb, 170, 1, true, array['E-TOT', 'L-TOT']::text[], '{}'::text[], null, null, null),
|
|
54
|
+
('IFRS-SME-IS', 'REV', null, 'Revenue', '{}'::jsonb, 10, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
55
|
+
('IFRS-SME-IS', 'COST', null, 'Cost of sales', '{}'::jsonb, 20, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
56
|
+
('IFRS-SME-IS', 'GROSS', null, 'Gross profit', '{}'::jsonb, 30, 1, true, array['REV']::text[], array['COST']::text[], null, null, null),
|
|
57
|
+
('IFRS-SME-IS', 'OTH-INC', null, 'Other income', '{}'::jsonb, 40, -1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
58
|
+
('IFRS-SME-IS', 'OPEX', null, 'Operating expenses', '{}'::jsonb, 50, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
59
|
+
('IFRS-SME-IS', 'DEPR', null, 'Depreciation and amortisation', '{}'::jsonb, 60, 1, false, '{}'::text[], '{}'::text[], null, null, null),
|
|
60
|
+
('IFRS-SME-IS', 'PROFIT', null, 'Profit (loss) for the period', '{}'::jsonb, 70, 1, true, array['GROSS', 'OTH-INC']::text[], array['OPEX', 'DEPR']::text[], null, null, null)
|
|
61
|
+
on conflict (statement_code, code) do update set
|
|
62
|
+
parent_code = excluded.parent_code,
|
|
63
|
+
name = excluded.name,
|
|
64
|
+
name_i18n = excluded.name_i18n,
|
|
65
|
+
sequence = excluded.sequence,
|
|
66
|
+
sign = excluded.sign,
|
|
67
|
+
is_total = excluded.is_total,
|
|
68
|
+
plus_lines = excluded.plus_lines,
|
|
69
|
+
minus_lines = excluded.minus_lines,
|
|
70
|
+
xbrl_element = excluded.xbrl_element,
|
|
71
|
+
legal_reference = excluded.legal_reference,
|
|
72
|
+
source_key = excluded.source_key;
|
|
73
|
+
|
|
74
|
+
insert into statement_line_rules
|
|
75
|
+
(statement_code, line_code, sequence, rule_kind, code_from, code_to,
|
|
76
|
+
account_type, balance_side)
|
|
77
|
+
select v.statement_code, v.line_code, v.sequence, v.rule_kind, v.code_from,
|
|
78
|
+
v.code_to, v.account_type::account_type, v.balance_side
|
|
79
|
+
from (values
|
|
80
|
+
('IFRS-SME-BS', 'A-NC-FIX', 10, 'account_type', null, null, 'asset_fixed', 'any'),
|
|
81
|
+
('IFRS-SME-BS', 'A-NC-OTH', 10, 'account_type', null, null, 'asset_non_current', 'any'),
|
|
82
|
+
('IFRS-SME-BS', 'A-C-REC', 10, 'account_type', null, null, 'asset_receivable', 'any'),
|
|
83
|
+
('IFRS-SME-BS', 'A-C-OTH', 10, 'account_type', null, null, 'asset_current', 'any'),
|
|
84
|
+
('IFRS-SME-BS', 'A-C-OTH', 20, 'account_type', null, null, 'asset_prepayments', 'any'),
|
|
85
|
+
('IFRS-SME-BS', 'A-C-CASH', 10, 'account_type', null, null, 'asset_cash', 'any'),
|
|
86
|
+
('IFRS-SME-BS', 'E-CAP', 10, 'account_type', null, null, 'equity', 'any'),
|
|
87
|
+
('IFRS-SME-BS', 'E-RET', 10, 'account_type', null, null, 'equity_retained', 'any'),
|
|
88
|
+
('IFRS-SME-BS', 'E-RESULT', 10, 'account_type', null, null, 'income', 'any'),
|
|
89
|
+
('IFRS-SME-BS', 'E-RESULT', 20, 'account_type', null, null, 'income_other', 'any'),
|
|
90
|
+
('IFRS-SME-BS', 'E-RESULT', 30, 'account_type', null, null, 'expense', 'any'),
|
|
91
|
+
('IFRS-SME-BS', 'E-RESULT', 40, 'account_type', null, null, 'expense_direct_cost', 'any'),
|
|
92
|
+
('IFRS-SME-BS', 'E-RESULT', 50, 'account_type', null, null, 'expense_depreciation', 'any'),
|
|
93
|
+
('IFRS-SME-BS', 'L-NC', 10, 'account_type', null, null, 'liability_non_current', 'any'),
|
|
94
|
+
('IFRS-SME-BS', 'L-C-PAY', 10, 'account_type', null, null, 'liability_payable', 'any'),
|
|
95
|
+
('IFRS-SME-BS', 'L-C-OTH', 10, 'account_type', null, null, 'liability_current', 'any'),
|
|
96
|
+
('IFRS-SME-BS', 'L-C-OTH', 20, 'account_type', null, null, 'liability_credit_card', 'any'),
|
|
97
|
+
('IFRS-SME-IS', 'REV', 10, 'account_type', null, null, 'income', 'any'),
|
|
98
|
+
('IFRS-SME-IS', 'COST', 10, 'account_type', null, null, 'expense_direct_cost', 'any'),
|
|
99
|
+
('IFRS-SME-IS', 'OTH-INC', 10, 'account_type', null, null, 'income_other', 'any'),
|
|
100
|
+
('IFRS-SME-IS', 'OPEX', 10, 'account_type', null, null, 'expense', 'any'),
|
|
101
|
+
('IFRS-SME-IS', 'DEPR', 10, 'account_type', null, null, 'expense_depreciation', 'any')
|
|
102
|
+
) as v (statement_code, line_code, sequence, rule_kind, code_from, code_to,
|
|
103
|
+
account_type, balance_side)
|
|
104
|
+
on conflict (statement_code, line_code, sequence) do update set
|
|
105
|
+
rule_kind = excluded.rule_kind,
|
|
106
|
+
code_from = excluded.code_from,
|
|
107
|
+
code_to = excluded.code_to,
|
|
108
|
+
account_type = excluded.account_type,
|
|
109
|
+
balance_side = excluded.balance_side;
|
|
110
|
+
|