VRBL-INV-MX-1p0-49

Basic Info

Rule For a Legal Entity, the value of the Seller Tax Scheme ID must be contained in Party Tax Scheme ID Subset for Legal Entity [VRBL-CL-MX-Party-TaxSchemeID-LegalEntity] (prefixed by 'VRBL:MX:'). Allowed values: VRBL:MX:601, VRBL:MX:603, VRBL:MX:610, VRBL:MX:620, VRBL:MX:622, VRBL:MX:623, VRBL:MX:624, VRBL:MX:626.
Context /ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme/cbc:ID
Pattern vrbl-invoice-mx-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-MX-Prefix:$VRBL-CL-MX-Party-TaxSchemeID-LegalEntity
showValues = true

Implementation

(
	not(string-length(../../cbc:CompanyID) = 12)
)
or
(
	not(boolean(.))
	or
	(
		(
			substring(normalize-space(.), 1, string-length($VRBL-MX-Prefix)) = $VRBL-MX-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(.), $VRBL-MX-Prefix),
					substring($VRBL-CL-MX-Party-TaxSchemeID-LegalEntity, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-MX-Party-TaxSchemeID-LegalEntity,
				concat(
					substring($VRBL-CL-MX-Party-TaxSchemeID-LegalEntity, 1, 1),
					substring-after(normalize-space(.), $VRBL-MX-Prefix),
					substring($VRBL-CL-MX-Party-TaxSchemeID-LegalEntity, 1, 1)
				)
			)
		)
	)
)