From 96a7ab6d1eeeeb6e8175793ee71e9b7f69b41e33 Mon Sep 17 00:00:00 2001 From: Rafal Lyzwa Date: Wed, 29 Nov 2023 15:02:42 +0100 Subject: [PATCH] add invoice types --- regimes/pl/pay.go | 14 ++--- regimes/pl/pl.go | 7 +-- regimes/pl/scenarios.go | 110 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 regimes/pl/scenarios.go diff --git a/regimes/pl/pay.go b/regimes/pl/pay.go index f91efcc6..71fb0039 100644 --- a/regimes/pl/pay.go +++ b/regimes/pl/pay.go @@ -24,7 +24,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Gotówka", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "1", + KeyFA_VATPaymentType: "1", }, }, { @@ -34,7 +34,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Karta", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "2", + KeyFA_VATPaymentType: "2", }, }, { @@ -44,7 +44,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Bon", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "3", + KeyFA_VATPaymentType: "3", }, }, { @@ -54,7 +54,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Czek", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "4", + KeyFA_VATPaymentType: "4", }, }, { @@ -64,7 +64,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Kredyt", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "5", + KeyFA_VATPaymentType: "5", }, }, { @@ -74,7 +74,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Przelew", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "6", + KeyFA_VATPaymentType: "6", }, }, { @@ -84,7 +84,7 @@ var paymentMeansKeyDefinitions = []*tax.KeyDefinition{ i18n.PL: "Mobilna", }, Map: cbc.CodeMap{ - KeyFA_VATFormaPlatnosci: "7", + KeyFA_VATPaymentType: "7", }, }, } diff --git a/regimes/pl/pl.go b/regimes/pl/pl.go index 5d9bc13d..995ec857 100644 --- a/regimes/pl/pl.go +++ b/regimes/pl/pl.go @@ -16,7 +16,8 @@ func init() { // Custom keys used typically in meta or codes information. const ( - KeyFA_VATFormaPlatnosci cbc.Key = "favat-forma-platnosci" // for mapping to TFormaPlatnosci's codes + KeyFA_VATPaymentType cbc.Key = "favat-forma-platnosci" // for mapping to TFormaPlatnosci's codes + KeyFA_VATInvoiceType cbc.Key = "favat-rodzaj-faktury" // for mapping to TRodzajFaktury's codes ) // New instantiates a new Polish regime. @@ -32,8 +33,8 @@ func New() *tax.Regime { // ChargeKeys: chargeKeyDefinitions, // charges.go PaymentMeansKeys: paymentMeansKeyDefinitions, // pay.go // Extensions: extensionKeys, // extensions.go - // Tags: invoiceTags, - // Scenarios: scenarios, // scenarios.go + Tags: invoiceTags, + Scenarios: scenarios, // scenarios.go Validator: Validate, // Calculator: Calculate, Categories: taxCategories, // tax_categories.go diff --git a/regimes/pl/scenarios.go b/regimes/pl/scenarios.go new file mode 100644 index 00000000..c914d7be --- /dev/null +++ b/regimes/pl/scenarios.go @@ -0,0 +1,110 @@ +package pl + +import ( + "github.com/invopop/gobl/bill" + "github.com/invopop/gobl/cbc" + "github.com/invopop/gobl/i18n" + "github.com/invopop/gobl/regimes/common" + "github.com/invopop/gobl/tax" +) + +// Document tag keys +const ( + TagSettlement cbc.Key = "partial" +) + +var invoiceTags = []*tax.KeyDefinition{ + { + Key: TagSettlement, + Name: i18n.String{ + i18n.EN: "Settlement Invoice", + i18n.PL: "Faktura Rozliczeniowa", + }, + }, +} + +var scenarios = []*tax.ScenarioSet{ + invoiceScenarios, +} + +var invoiceScenarios = &tax.ScenarioSet{ + Schema: bill.ShortSchemaInvoice, + List: []*tax.Scenario{ + // **** Invoice Type **** + { + Types: []cbc.Key{bill.InvoiceTypeStandard}, + Name: i18n.String{ + i18n.EN: "Regular Invoice", + i18n.PL: "Faktura Podstawowa", + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "VAT", + }, + }, + { + Types: []cbc.Key{bill.InvoiceTypeStandard}, + Tags: []cbc.Key{common.TagPartial}, + Name: i18n.String{ + i18n.EN: "Prepayment Invoice", + i18n.PL: `Faktura Zaliczkowa`, + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "ZAL", + }, + }, + { + Types: []cbc.Key{bill.InvoiceTypeStandard}, + Tags: []cbc.Key{TagSettlement}, + Name: i18n.String{ + i18n.EN: "Settlement Invoice", + i18n.PL: "Faktura Rozliczeniowa", + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "ROZ", + }, + }, + { + Types: []cbc.Key{bill.InvoiceTypeStandard}, + Tags: []cbc.Key{common.TagSimplified}, + Name: i18n.String{ + i18n.EN: "Simplified Invoice", + i18n.PL: "Faktura Uproszczona", + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "UPR", + }, + }, + { + Types: []cbc.Key{bill.InvoiceTypeCorrective}, + Name: i18n.String{ + i18n.EN: "Corrective Invoice", + i18n.PL: "Faktura Korygująca", + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "KOR", + }, + }, + { + Types: []cbc.Key{bill.InvoiceTypeCorrective}, + Tags: []cbc.Key{common.TagPartial}, + Name: i18n.String{ + i18n.EN: "Corrective Prepayment Invoice", + i18n.PL: `Faktura korygująca fakturę zaliczkową`, + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "KOR_ZAL", + }, + }, + { + Types: []cbc.Key{bill.InvoiceTypeCorrective}, + Tags: []cbc.Key{TagSettlement}, + Name: i18n.String{ + i18n.EN: "Corrective Settlement Invoice", + i18n.PL: "Faktura korygująca fakturę rozliczeniową", + }, + Codes: cbc.CodeMap{ + KeyFA_VATInvoiceType: "KOR_ROZ", + }, + }, + }, +}