Skip to content

Commit

Permalink
Simplifying PT extension examples
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Feb 19, 2025
1 parent d12422e commit 08ac29c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 78 deletions.
109 changes: 36 additions & 73 deletions addons/pt/saft/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,8 @@ var extensions = []*cbc.Definition{
SAF-T's ~InvoiceType~ (Tipo de documento) specifies the type of a sales invoice. In GOBL,
this type can be set using the ~pt-saft-invoice-type~ extension in the tax section. GOBL
will set the extension for you based on the type and the tax tags you set in your invoice.
The table below shows how this mapping is done:
| Code | Name | GOBL Type | GOBL Tax Tag |
| ---- | ----------------------------------------------------------------------- | ------------- | ----------------- |
| FT | Fatura, emitida nos termos do artigo 36.o do Código do IVA | ~standard~ | |
| FS | Fatura simplificada, emitida nos termos do artigo 40.o do Código do IVA | ~standard~ | ~simplified~ |
| FR | Fatura-recibo | ~standard~ | ~invoice-receipt~ |
| ND | Nota de débito | ~credit-note~ | |
| NC | Nota de crédito | ~debit-note~ | |
For example:
Example:
~~~js
{
Expand All @@ -98,20 +89,32 @@ var extensions = []*cbc.Definition{
i18n.EN: "Standard Invoice",
i18n.PT: "Fatura",
},
Desc: i18n.String{
i18n.EN: "Invoice issued under article 36 of the VAT code.",
i18n.PT: "Fatura, emitida nos termos do artigo 36.o do Código do IVA",
},
},
{
Code: InvoiceTypeSimplified,
Name: i18n.String{
i18n.EN: "Simplified Invoice",
i18n.PT: "Fatura Simplificada",
},
Desc: i18n.String{
i18n.EN: "Simplified invoice issued under article 40 of the VAT code.",
i18n.PT: "Fatura simplificada, emitida nos termos do artigo 40.o do Código do IVA",
},
},
{
Code: InvoiceTypeInvoiceReceipt,
Name: i18n.String{
i18n.EN: "Invoice-Receipt",
i18n.PT: "Fatura-Recibo",
},
Desc: i18n.String{
i18n.EN: "Invoice issued after payment.",
i18n.PT: "Fatura-recibo",
},
},
{
Code: InvoiceTypeDebitNote,
Expand Down Expand Up @@ -195,10 +198,10 @@ var extensions = []*cbc.Definition{
| Code | Name | GOBL Tax Rate |
| ------ | --------------- | -------------- |
| ~NOR | Tipo Geral | ~standard~ |
| ~INT | Taxa Intermédia | ~intermediate~ |
| ~RED | Taxa Reduzida | ~reduced~ |
| ~ISE | Isenta | ~exempt~ |
| ~NOR~ | Tipo Geral | ~standard~ |
| ~INT~ | Taxa Intermédia | ~intermediate~ |
| ~RED~ | Taxa Reduzida | ~reduced~ |
| ~ISE~ | Isenta | ~exempt~ |
`),
},
Values: []*cbc.Definition{
Expand Down Expand Up @@ -249,38 +252,7 @@ var extensions = []*cbc.Definition{
i18n.EN: here.Doc(`
AT's ~TaxExemptionCode~ (Código do motivo de isenção de imposto) is a code that
specifies the reason the VAT tax is exempt in a Portuguese invoice. When the ~exempt~ tag
is used, one of the following must be defined in the ~ext~ map's ~pt-exemption-code~
property:
| Code | Description |
| ----- | -------------------------------------------------------------------------------------------------------- |
| ~M01~ | Artigo 16.°, n.° 6 do CIVA |
| ~M02~ | Artigo 6.° do Decreto-Lei n.° 198/90, de 19 de junho |
| ~M04~ | Isento artigo 13.° do CIVA |
| ~M05~ | Isento artigo 14.° do CIVA |
| ~M06~ | Isento artigo 15.° do CIVA |
| ~M07~ | Isento artigo 9.° do CIVA |
| ~M09~ | IVA - não confere direito a dedução / Artigo 62.° alínea b) do CIVA |
| ~M10~ | IVA - regime de isenção / Artigo 57.° do CIVA |
| ~M11~ | Regime particular do tabaco / Decreto-Lei n.° 346/85, de 23 de agosto |
| ~M12~ | Regime da margem de lucro - Agências de viagens / Decreto-Lei n.° 221/85, de 3 de julho |
| ~M13~ | Regime da margem de lucro - Bens em segunda mão / Decreto-Lei n.° 199/96, de 18 de outubro |
| ~M14~ | Regime da margem de lucro - Objetos de arte / Decreto-Lei n.° 199/96, de 18 de outubro |
| ~M15~ | Regime da margem de lucro - Objetos de coleção e antiguidades / Decreto-Lei n.° 199/96, de 18 de outubro |
| ~M16~ | Isento artigo 14.° do RITI |
| ~M19~ | Outras isenções - Isenções temporárias determinadas em diploma próprio |
| ~M20~ | IVA - regime forfetário / Artigo 59.°-D n.°2 do CIVA |
| ~M21~ | IVA - não confere direito à dedução (ou expressão similar) - Artigo 72.° n.° 4 do CIVA |
| ~M25~ | Mercadorias à consignação - Artigo 38.° n.° 1 alínea a) do CIVA |
| ~M30~ | IVA - autoliquidação / Artigo 2.° n.° 1 alínea i) do CIVA |
| ~M31~ | IVA - autoliquidação / Artigo 2.° n.° 1 alínea j) do CIVA |
| ~M32~ | IVA - autoliquidação / Artigo 2.° n.° 1 alínea I) do CIVA |
| ~M33~ | IVA - autoliquidação / Artigo 2.° n.° 1 alínea m) do CIVA |
| ~M40~ | IVA - autoliquidação / Artigo 6.° n.° 6 alínea a) do CIVA, a contrário |
| ~M41~ | IVA - autoliquidação / Artigo 8.° n.° 3 do RITI |
| ~M42~ | IVA - autoliquidação / Decreto-Lei n.° 21/2007, de 29 de janeiro |
| ~M43~ | IVA - autoliquidação / Decreto-Lei n.° 362/99, de 16 de setembro |
| ~M99~ | Não sujeito ou não tributado |
is used in a tax combo, the ~ext~ map's ~pt-exemption-code~ property is required.
For example, you could define an invoice line exempt of tax as follows:
Expand All @@ -300,9 +272,8 @@ var extensions = []*cbc.Definition{
"cat": "VAT",
"rate": "exempt",
"ext": {
// ...
"pt-saft-tax-rate": "ISE",
"pt-exemption-code": "M19"
"pt-saft-exemption": "M19"
}
}
]
Expand Down Expand Up @@ -514,17 +485,9 @@ var extensions = []*cbc.Definition{
i18n.EN: here.Doc(`
SAF-T's ~ProductType~ (Indicador de produto ou serviço) indicates the type of each line
item in an invoice. The ~pt-saft-product-type~ extension used at line item level allows to
set the product type to one of the allowed values:
set the product type to one of the allowed values.
| Code | Description |
| ---- | ---------------------------------- |
| P | Products (default) |
| S | Services |
| O | Other |
| E | Excise Duties |
| I | Taxes, fees and parafiscal charges |
For example:
Example:
~~~js
{
Expand Down Expand Up @@ -610,22 +573,22 @@ var extensions = []*cbc.Definition{
value in your ~bill.Invoice~ advances or in you ~bill.Receipt~ method. GOBL maps certain
payment mean keys automatically to this extension:
| Code | Name | GOBL Payment Mean |
| Code | Name | GOBL Payment Means |
| ---- | -------------------------------------------------- | ----------------------------------------------------- |
| CC | Cartão crédito | ~card~ |
| CD | Cartão débito | (*) |
| CH | Cheque bancário | ~cheque~ |
| CI | Letter of credit | (*) |
| CO | Cheque ou cartão oferta | (*) |
| CS | Compensação de saldos em conta corrente | ~netting~ |
| DE | Dinheiro eletrónico | ~online~ |
| LC | Letra comercial | ~promissory-note~ |
| MB | Referências de pagamento para Multibanco | (*) |
| NU | Numerário | ~cash~ |
| OU | Outro | ~other~ |
| PR | Permuta de bens | (*) |
| TB | Transferência bancária ou débito direto autorizado | ~credit-transfer~, ~debit-transfer~ or ~direct-debit~ |
| TR | Títulos de compensação extrassalarial | (*) |
| ~CC~ | Cartão crédito | ~card~ |
| ~CD~ | Cartão débito | (*) |
| ~CH~ | Cheque bancário | ~cheque~ |
| ~CI~ | Letter of credit | (*) |
| ~CO~ | Cheque ou cartão oferta | (*) |
| ~CS~ | Compensação de saldos em conta corrente | ~netting~ |
| ~DE~ | Dinheiro eletrónico | ~online~ |
| ~LC~ | Letra comercial | ~promissory-note~ |
| ~MB~ | Referências de pagamento para Multibanco | (*) |
| ~NU~ | Numerário | ~cash~ |
| ~OU~ | Outro | ~other~ |
| ~PR~ | Permuta de bens | (*) |
| ~TB~ | Transferência bancária ou débito direto autorizado | ~credit-transfer~, ~debit-transfer~ or ~direct-debit~ |
| ~TR~ | Títulos de compensação extrassalarial | (*) |
(*) For codes not mapped from a GOBL Payment Mean, use ~other~ and explicitly set the
extension.
Expand Down
Loading

0 comments on commit 08ac29c

Please sign in to comment.