Skip to content

Commit

Permalink
Working on refactoring PL rate handling
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Nov 20, 2023
1 parent bed362a commit 8653462
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 26 deletions.
48 changes: 25 additions & 23 deletions regimes/pl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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) |
41 changes: 38 additions & 3 deletions regimes/pl/tax_categories.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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{
Expand All @@ -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),
},
},
},
Expand All @@ -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),
},
},
},
Expand All @@ -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{
Expand All @@ -89,6 +122,7 @@ var taxCategories = []*tax.Category{
},
},
},

{
Key: TaxRateZeroWDT,
Name: i18n.String{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8653462

Please sign in to comment.