Rules
VRBL-INV-SA-1p2-12
Basic Info
| Rule | If the Buyer Tax ID used for VAT ID exists, it must contain 15 digits. The first and last digits of the ID must both be "3". |
| Context |
/ubl:Invoice
|
| Pattern | vrbl-invoice-sa-1p2 |
| Severity | fatal |
Implementation
count(cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID) = 0 or (string-length(cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID) = 15 and string-length(translate(cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID,'0123456789','')) = 0 and starts-with(cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID,'3') and substring(cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID, string-length(cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID)) = '3')