From 86534628876ce841bcf8816b9c6b8dad99df8805 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Mon, 20 Nov 2023 14:03:35 +0000 Subject: [PATCH] Working on refactoring PL rate handling --- regimes/pl/README.md | 48 +++++++++++++++++++----------------- regimes/pl/tax_categories.go | 41 +++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 26 deletions(-) diff --git a/regimes/pl/README.md b/regimes/pl/README.md index 88e77014..712666c8 100644 --- a/regimes/pl/README.md +++ b/regimes/pl/README.md @@ -6,28 +6,30 @@ Example PL GOBL files can be found in the [`examples`](./examples) (YAML uncalcu ## Table of contents -* [Public Documentation](#public-documentation) -* [Zones](#zones) -* [Local Codes](#local-codes) -* [Complements](#complements) +- [Public Documentation](#public-documentation) +- [Zones](#zones) +- [Local Codes](#local-codes) +- [Complements](#complements) ## Public Documentation -- [Wzór faktury)](http://crd.gov.pl/wzor/2021/11/29/11089/) +- [XML XSD Source - KSeF](https://www.podatki.gov.pl/e-deklaracje/dokumentacja-it/struktury-dokumentow-xml/#ksef) +- [Invoice Templates (Wzór faktury) FA(1)](http://crd.gov.pl/wzor/2021/11/29/11089/) +- [Invoice Templates (Wzór faktury) FA(2)](http://crd.gov.pl/wzor/2023/06/29/12648/) ### `TFormaPlatnosci` - Payment Means The FA_VAT `TFormaPlatnosci` field specifies an invoice's means of payment. The following table lists all the supported values and how GOBL will map them from the invoice's payment instructions key: -| Code | Name | GOBL Payment Instructions Key | -| ---- | ----------------------------------- | ----------------------------- | -| 1 | Gotówka | `cash` | -| 2 | Karta | `card` | -| 3 | Bon | `coupon` | -| 4 | Czek | `cheque` | -| 5 | Kredyt | `loan` | -| 6 | Przelew | `credit-transfer` | -| 7 | Mobilna | `mobile` | +| Code | Name | GOBL Payment Instructions Key | +| ---- | ------- | ----------------------------- | +| 1 | Gotówka | `cash` | +| 2 | Karta | `card` | +| 3 | Bon | `coupon` | +| 4 | Czek | `cheque` | +| 5 | Kredyt | `loan` | +| 6 | Przelew | `credit-transfer` | +| 7 | Mobilna | `mobile` | #### Example @@ -51,12 +53,12 @@ The following GOBL maps to the `1` (gotówka) value of the `TFormaPlatnosci` fie All Polish invoices must be identified with a specific type code defined by the FA_VAT format. The following table helps identify how GOBL will map the expected Polish code with a combination of the Invoice Type and tax tags. -| Code | Type | Tax Tags | Description | -| ------- | ------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| VAT | `standard` | | Regular invoice | -| UPR | `standard` | `simplified` | Simplified (no customer) | -| ZAL | `standard` | `partial` | Advance invioce | -| ROZ | `standard` | `settlement` | Settlement invoice | -| KOR | `corrective` | | Corrective (regular) | -| KOR_ZAL | `corrective` | `partial` | Corrective (advance) | -| KOR_ROZ | `corrective` | `settlement` | Corrective (settlement) | +| Code | Type | Tax Tags | Description | +| ------- | ------------ | ------------ | ------------------------ | +| VAT | `standard` | | Regular invoice | +| UPR | `standard` | `simplified` | Simplified (no customer) | +| ZAL | `standard` | `partial` | Advance invioce | +| ROZ | `standard` | `settlement` | Settlement invoice | +| KOR | `corrective` | | Corrective (regular) | +| KOR_ZAL | `corrective` | `partial` | Corrective (advance) | +| KOR_ROZ | `corrective` | `settlement` | Corrective (settlement) | diff --git a/regimes/pl/tax_categories.go b/regimes/pl/tax_categories.go index d7426fa4..31db5ced 100644 --- a/regimes/pl/tax_categories.go +++ b/regimes/pl/tax_categories.go @@ -1,6 +1,7 @@ package pl import ( + "github.com/invopop/gobl/cal" "github.com/invopop/gobl/cbc" "github.com/invopop/gobl/i18n" "github.com/invopop/gobl/num" @@ -28,7 +29,7 @@ var taxCategories = []*tax.Category{ }, Title: i18n.String{ i18n.EN: "Value Added Tax", - i18n.PL: "Podatek od wartości dodanej", + i18n.PL: "Podatek od Wartości Dodanej", }, Retained: false, Rates: []*tax.Rate{ @@ -41,9 +42,11 @@ var taxCategories = []*tax.Category{ Values: []*tax.RateValue{ { Percent: num.MakePercentage(230, 3), + Since: cal.NewDate(2011, 1, 1), }, { Percent: num.MakePercentage(220, 3), + Since: cal.NewDate(1993, 7, 8), }, }, }, @@ -56,9 +59,11 @@ var taxCategories = []*tax.Category{ Values: []*tax.RateValue{ { Percent: num.MakePercentage(80, 3), + Since: cal.NewDate(2011, 1, 1), }, { Percent: num.MakePercentage(70, 3), + Since: cal.NewDate(2000, 9, 4), }, }, }, @@ -71,9 +76,37 @@ var taxCategories = []*tax.Category{ Values: []*tax.RateValue{ { Percent: num.MakePercentage(50, 3), + Since: cal.NewDate(2011, 1, 1), }, + { + Percent: num.MakePercentage(30, 3), + Since: cal.NewDate(2000, 9, 4), + }, + }, + }, + { + Key: common.TaxRateZero, + Name: i18n.String{ + i18n.EN: "Zero Rate", + i18n.PL: "Stawka Zerowa", + }, + Values: []*tax.RateValue{ + { + Percent: num.MakePercentage(0, 3), + }, + }, + Extensions: []cbc.Key{}, + }, + { + Key: common.TaxRateExempt, + Name: i18n.String{ + i18n.EN: "Exempt", + i18n.PL: "Zwolnione", }, + Exempt: true, + Extensions: []cbc.Key{}, }, + { Key: common.TaxRateSpecial, Name: i18n.String{ @@ -89,6 +122,7 @@ var taxCategories = []*tax.Category{ }, }, }, + { Key: TaxRateZeroWDT, Name: i18n.String{ @@ -129,9 +163,10 @@ var taxCategories = []*tax.Category{ Key: TaxRateExempt, Name: i18n.String{ i18n.EN: "Exempt", - i18n.PL: "Zwolnione z opodatkowania", + i18n.PL: "Zwolnione", }, - Exempt: true, + Exempt: true, + Extensions: []cbc.Key{}, }, { Key: TaxRateNotPursuant,