VRBL-INV-PH-1p0-29

Basic Info

Rule When the Invoice Subtype Code is POS, the value of the Invoice Type Code must be contained in Invoice Type Code for Philippines POS [VRBL-CL-PH-InvoiceTypeCode-POS] (prefixed by 'VRBL:PH:').
Context /ubl:Invoice
Pattern vrbl-invoice-ph-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = cbc:InvoiceTypeCode
codeList = $VRBL-PH-Prefix:$VRBL-CL-PH-InvoiceTypeCode-POS

Implementation

(
	not(normalize-space(/ubl:Invoice/cec:UBLExtensions/cec:UBLExtension/cec:ExtensionContent/vrbl:InvoiceExtension/vrbl:InvoiceSubtypeCode) = 'VRBL:PH:POS')
)
or
(
	not(boolean(cbc:InvoiceTypeCode))
	or
	(
		(
			substring(normalize-space(cbc:InvoiceTypeCode), 1, string-length($VRBL-PH-Prefix)) = $VRBL-PH-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-PH-Prefix),
					substring($VRBL-CL-PH-InvoiceTypeCode-POS, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-PH-InvoiceTypeCode-POS,
				concat(
					substring($VRBL-CL-PH-InvoiceTypeCode-POS, 1, 1),
					substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-PH-Prefix),
					substring($VRBL-CL-PH-InvoiceTypeCode-POS, 1, 1)
				)
			)
		)
	)
)