es

package
v0.53.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2023 License: Apache-2.0 Imports: 15 Imported by: 3

README

🇪🇸 GOBL Spain Tax Regime

Documentation

Overview

Package es provides tax regime support for Spain.

Index

Constants

View Source
const (
	TaxCategoryIRPF cbc.Code = "IRPF"
	TaxCategoryIGIC cbc.Code = "IGIC"
	TaxCategoryIPSI cbc.Code = "IPSI"
)

Local tax category definitions which are not considered standard.

View Source
const (
	// IRPF non-standard Rates (usually for self-employed)
	TaxRatePro                cbc.Key = "pro"                 // Professional Services
	TaxRateProStart           cbc.Key = "pro-start"           // Professionals, first 2 years
	TaxRateModules            cbc.Key = "modules"             // Module system
	TaxRateAgriculture        cbc.Key = "agriculture"         // Agricultural
	TaxRateAgricultureSpecial cbc.Key = "agriculture-special" // Agricultural special
	TaxRateCapital            cbc.Key = "capital"             // Rental or Interest

	// Special tax rate surcharge extension
	TaxRateEquivalence cbc.Key = "eqs"
)

Specific tax rate codes.

View Source
const (
	// TicketBAI (Basque Country) codes used for stamps.
	StampProviderTBAICode cbc.Key = "tbai-code"
	StampProviderTBAIQR   cbc.Key = "tbai-qr"
)

Official stamps or codes validated by government agencies

View Source
const (
	InboxKeyFACE cbc.Key = "face"

	// Main roles defined in FACE
	InboxRoleFiscal    cbc.Key = "fiscal"    // Fiscal / 01
	InboxRoleRecipient cbc.Key = "recipient" // Receptor / 02
	InboxRolePayer     cbc.Key = "payer"     // Pagador / 03
	InboxRoleCustomer  cbc.Key = "customer"  // Comprador / 04

)

Inbox key and role definitions

View Source
const (
	KeyAddressCode                 cbc.Key = "post"
	KeyFacturaE                    cbc.Key = "facturae"
	KeyFacturaETaxTypeCode         cbc.Key = "facturae-tax-type-code"
	KeyFacturaEInvoiceDocumentType cbc.Key = "facturae-invoice-document-type"
	KeyFacturaEInvoiceClass        cbc.Key = "facturae-invoice-class"
	KeyTicketBAICausaExencion      cbc.Key = "ticketbai-causa-exencion"
	KeyTicketBAIIDType             cbc.Key = "ticketbai-id-type"
)

Custom keys used typically in meta information.

View Source
const (
	ItemResale   cbc.Key = "resale"
	ItemServices cbc.Key = "services"
	ItemGoods    cbc.Key = "goods"
)

Item Keys which may be used by TicketBAI in the Basque Country.

View Source
const (
	CorrectionKeyCode            cbc.Key = "code"       // Invoice Code
	CorrectionKeySeries          cbc.Key = "series"     // Invoice series number
	CorrectionKeyIssueDate       cbc.Key = "issue-date" // Issue Date
	CorrectionKeySupplier        cbc.Key = "supplier"   // General supplier details
	CorrectionKeyCustomer        cbc.Key = "customer"   // General customer details
	CorrectionKeySupplierName    cbc.Key = "supplier-name"
	CorrectionKeyCustomerName    cbc.Key = "customer-name"
	CorrectionKeySupplierTaxID   cbc.Key = "supplier-tax-id"
	CorrectionKeyCustomerTaxID   cbc.Key = "customer-tax-id"
	CorrectionKeySupplierAddress cbc.Key = "supplier-addr"
	CorrectionKeyCustomerAddress cbc.Key = "customer-addr"
	CorrectionKeyLine            cbc.Key = "line"
	CorrectionKeyPeriod          cbc.Key = "period"
	CorrectionKeyType            cbc.Key = "type"
	CorrectionKeyLegalDetails    cbc.Key = "legal-details"
	CorrectionKeyTaxRate         cbc.Key = "tax-rate"
	CorrectionKeyTaxAmount       cbc.Key = "tax-amount"
	CorrectionKeyTaxBase         cbc.Key = "tax-base"
	CorrectionKeyTax             cbc.Key = "tax"          // General issue with tax calculations
	CorrectionKeyTaxRetained     cbc.Key = "tax-retained" // Error in retained tax calculations
	CorrectionKeyRefund          cbc.Key = "refund"       // Goods or materials have been returned to supplier
	CorrectionKeyDiscount        cbc.Key = "discount"     // New discounts or rebates added
	CorrectionKeyJudicial        cbc.Key = "judicial"     // Court ruling or administrative decision
	CorrectionKeyInsolvency      cbc.Key = "insolvency"   // the customer is insolvent and cannot pay
)

List of correction codes derived from the Spanish FacturaE format.

View Source
const (
	CorrectionMethodKeyComplete   cbc.Key = "complete"   // everything has changed
	CorrectionMethodKeyPartial    cbc.Key = "partial"    // only differences corrected
	CorrectionMethodKeyDiscount   cbc.Key = "discount"   // deducted from future invoices
	CorrectionMethodKeyAuthorized cbc.Key = "authorized" // Permitted by tax agency
)

List of correction methods derived from the Spanish FacturaE format.

View Source
const (
	TagCopy             cbc.Key = "copy"
	TagSummary          cbc.Key = "summary"
	TagSimplifiedScheme cbc.Key = "simplified-scheme"
	TagCustomerIssued   cbc.Key = "customer-issued"
	TagTravelAgency     cbc.Key = "travel-agency"
	TagSecondHandGoods  cbc.Key = "second-hand-goods"
	TagArt              cbc.Key = "art"
	TagAntiques         cbc.Key = "antiques"
	TagCashBasis        cbc.Key = "cash-basis"
)

Universal tax tags

View Source
const (
	TaxRateExempt    cbc.Key = "exempt"
	TaxRateArticle20 cbc.Key = "article-20"
	TaxRateArticle21 cbc.Key = "article-21"
	TaxRateArticle22 cbc.Key = "article-22"
	TaxRateArticle23 cbc.Key = "article-23"
	TaxRateArticle25 cbc.Key = "article-25"
	TaxRateOther     cbc.Key = "other"
)

Tax Rates which may be used by TicketBAI in the Basque Country.

View Source
const (
	TaxIdentityTypeFiscal   cbc.Key = "fiscal"
	TaxIdentityTypePassport cbc.Key = "passport"
	TaxIdentityTypeForeign  cbc.Key = "foreign"
	TaxIdentityTypeResident cbc.Key = "resident"
	TaxIdentityTypeOther    cbc.Key = "other"
)

The tax identity type is required for TicketBAI documents in the Basque Country.

View Source
const (
	ZoneVI l10n.Code = "VI" // (01) Álava
	ZoneAB l10n.Code = "AB" // (02) Albacete
	ZoneA  l10n.Code = "A"  // (03) Alicante
	ZoneAL l10n.Code = "AL" // (04) Almería
	ZoneAV l10n.Code = "AV" // (05) Ávila
	ZoneBA l10n.Code = "BA" // (06) Badajoz
	ZonePM l10n.Code = "PM" // (07) Baleares
	ZoneIB l10n.Code = "IB" // (07) Baleares
	ZoneB  l10n.Code = "B"  // (08) Barcelona
	ZoneBU l10n.Code = "BU" // (09) Burgos
	ZoneCC l10n.Code = "CC" // (10) Cáceres
	ZoneCA l10n.Code = "CA" // (11) Cádiz
	ZoneCS l10n.Code = "CS" // (12) Castellon
	ZoneCR l10n.Code = "CR" // (13) Ciudad Real
	ZoneCO l10n.Code = "CO" // (14) Cordoba
	ZoneC  l10n.Code = "C"  // (15) La Coruña
	ZoneCU l10n.Code = "CU" // (16) Cuenca
	ZoneGE l10n.Code = "GE" // (17) Gerona
	ZoneGI l10n.Code = "GI" // (17) Girona
	ZoneGR l10n.Code = "GR" // (18) Granada
	ZoneGU l10n.Code = "GU" // (19) Guadalajara
	ZoneSS l10n.Code = "SS" // (20) Guipúzcoa
	ZoneH  l10n.Code = "H"  // (21) Huelva
	ZoneHU l10n.Code = "HU" // (22) Huesca
	ZoneJ  l10n.Code = "J"  // (23) Jaén
	ZoneLE l10n.Code = "LE" // (24) León
	ZoneL  l10n.Code = "L"  // (25) Lérida / Lleida
	ZoneLO l10n.Code = "LO" // (26) La Rioja
	ZoneLU l10n.Code = "LU" // (27) Lugo
	ZoneM  l10n.Code = "M"  // (28) Madrid
	ZoneMA l10n.Code = "MA" // (29) Málaga
	ZoneMU l10n.Code = "MU" // (30) Murcia
	ZoneNA l10n.Code = "NA" // (31) Navarra
	ZoneOR l10n.Code = "OR" // (32) Orense
	ZoneOU l10n.Code = "OU" // (32) Orense
	ZoneO  l10n.Code = "O"  // (33) Asturias
	ZoneP  l10n.Code = "P"  // (34) Palencia
	ZoneGC l10n.Code = "GC" // (35) Las Palmas
	ZonePO l10n.Code = "PO" // (36) Pontevedra
	ZoneSA l10n.Code = "SA" // (37) Salamanca
	ZoneTF l10n.Code = "TF" // (38) Santa Cruz de Tenerife
	ZoneS  l10n.Code = "S"  // (39) Cantabria
	ZoneSG l10n.Code = "SG" // (40) Segovia
	ZoneSE l10n.Code = "SE" // (41) Sevilla
	ZoneSO l10n.Code = "SO" // (42) Soria
	ZoneT  l10n.Code = "T"  // (43) Tarragona
	ZoneTE l10n.Code = "TE" // (44) Teruel
	ZoneTO l10n.Code = "TO" // (45) Toledo
	ZoneV  l10n.Code = "V"  // (46) Valencia
	ZoneVA l10n.Code = "VA" // (47) Valladolid
	ZoneBI l10n.Code = "BI" // (48) Vizcaya
	ZoneZA l10n.Code = "ZA" // (49) Zamora
	ZoneZ  l10n.Code = "Z"  // (50) Zaragoza
	ZoneCE l10n.Code = "CE" // (51) Ceuta
	ZoneML l10n.Code = "ML" // (52) Melilla
)

Zone code definitions for Spain

Variables

View Source
var (
	ErrTaxCodeNoMatch      = errors.New("no match")
	ErrTaxCodeUnknownType  = errors.New("unknown type")
	ErrTaxCodeInvalidCheck = errors.New("check letter is invalid")
)

Standard simplified errors messages

View Source
var InvoiceLegalNoteExamples = map[string]*cbc.Note{

	"exempt": {
		Key:  cbc.NoteKeyLegal,
		Text: "Operación exenta por aplicación del artículo [indicar el articulo] de la Ley 37/1992, del 28 de diciembre, del Impuesto sobre el Valor Añadido.",
	},

	"transport": {
		Key:  cbc.NoteKeyLegal,
		Text: "Medio de transporte [describir el medio, por ejemplo automóvil turismo Seat Ibiza TDI 2.0] fecha 1ª puesta en servicio [indicar la fecha] distancias/horas recorridas [indicar la distancia o las horas, por ejemplo, 5.900 km o 48 horas].",
	},
}

InvoiceLegalNoteExamples defines a list of notes which may be required by Spanish law. These are expected to be used in user interfaces as examples that can be modified according to the details of the invoice. Most of this data has now been moved to scheme definitions, but some examples require a bit more effort from the user side.

Functions

func Calculate

func Calculate(doc interface{}) error

Calculate will perform any regime specific calculations.

func New

func New() *tax.Regime

New provides the Spanish tax regime definition

func Validate

func Validate(doc interface{}) error

Validate checks the document type and determines if it can be validated.

Types

type BillInvoiceLineMeta

type BillInvoiceLineMeta struct {
	// When true, this line should be considered as being sourced from a provider
	// under a "Equivalence Surcharge VAT" regime.
	Supplied bool `json:"supplied,omitempty" jsonschema:"title=Supplied"`

	// Message that explains why this line is exempt of taxes.
	Exempt string `json:"exempt,omitempty" jsonschema:"title=Exempt"`
}

BillInvoiceLineMeta defines additional fields that may be added and used in an invoice line.

type TaxCodeType

type TaxCodeType string

TaxCodeType represents the types of tax code which are issued in Spain. The same general format with variations is used for national individuals, foreigners, and legal organizations.

const (
	NationalTaxCode     TaxCodeType = "N"
	ForeignTaxCode      TaxCodeType = "X"
	OrganizationTaxCode TaxCodeType = "B"
	OtherTaxCode        TaxCodeType = "O"
	UnknownTaxCode      TaxCodeType = "NA"
)

Supported tax code types, from code itself.

func DetermineTaxCodeType

func DetermineTaxCodeType(code cbc.Code) (TaxCodeType, error)

DetermineTaxCodeType takes a valid code and determines the type. If the code is not valid, the `UnknownTaxCode` type will be returned.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL