VRBL-INV-RS-1p0-12

Basic Info

Rule The Buyer Tax Company ID must be sent. If the Buyer Tax Scheme ID is VAT, it can contain: the Serbian TIN preceeded by the prefix RS, or the JMBG.
Context /ubl:Invoice/cac:AccountingCustomerParty
Pattern vrbl-invoice-rs-1p0
Severity fatal

Implementation

not($RSSupplierCountry = 'RS')
or
boolean(cac:Party/cac:PartyTaxScheme/cbc:CompanyID)
and
(
	substring(cac:Party/cac:PartyTaxScheme[translate(normalize-space(cac:TaxScheme/cbc:ID), 'vat', 'VAT') = 'VAT']/cbc:CompanyID, 1, 2) = 'RS'
	and
	string-length(cac:Party/cac:PartyTaxScheme/cbc:CompanyID) = 11
	and
	string-length(translate(substring(cac:Party/cac:PartyTaxScheme[translate(normalize-space(cac:TaxScheme/cbc:ID), 'vat', 'VAT') = 'VAT']/cbc:CompanyID, 3, 11), $Numerics, '')) = 0
)