VRBL-INV-SG-1p4-49

Basic Info

Rule For purchase invoces, the value of the Invoice Line Tax ID must be contained in IRAS Purchase Invoice Tax Category ID [VRBL-CL-IRAS-PI-GST-SG-TaxCategoryID] (prefixed by 'VRBL:SG:'). Allowed values: VRBL:SG:BL, VRBL:SG:EP, VRBL:SG:IGDS, VRBL:SG:IM, VRBL:SG:IM-ESS, VRBL:SG:IM-N33, VRBL:SG:IM-RE, VRBL:SG:ME, VRBL:SG:NR, VRBL:SG:OP, VRBL:SG:TX, VRBL:SG:TX-ESS, VRBL:SG:TX-N33, VRBL:SG:TX-RE, VRBL:SG:TXCA, VRBL:SG:TXNA, VRBL:SG:TXRC-ESS, VRBL:SG:TXRC-N33, VRBL:SG:TXRC-RE, VRBL:SG:TXRC-TS, VRBL:SG:ZP.
Context /ubl:Invoice/cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID
Pattern vrbl-invoice-sg-1p4
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-SG-Prefix:$VRBL-CL-IRAS-PI-GST-SG-TaxCategoryID
showValues = true

Implementation

(
	(/ubl:Invoice/cec:UBLExtensions/cec:UBLExtension/cec:ExtensionContent/vrbl:InvoiceExtension/vrbl:PurchaseInvoiceIndicator = 'false') or (not(boolean(/ubl:Invoice/cec:UBLExtensions/cec:UBLExtension/cec:ExtensionContent/vrbl:InvoiceExtension/vrbl:PurchaseInvoiceIndicator)))
)
or
(
	not(boolean(.))
	or
	(
		(
			substring(normalize-space(.), 1, string-length($VRBL-SG-Prefix)) = $VRBL-SG-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(.), $VRBL-SG-Prefix),
					substring($VRBL-CL-IRAS-PI-GST-SG-TaxCategoryID, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-IRAS-PI-GST-SG-TaxCategoryID,
				concat(
					substring($VRBL-CL-IRAS-PI-GST-SG-TaxCategoryID, 1, 1),
					substring-after(normalize-space(.), $VRBL-SG-Prefix),
					substring($VRBL-CL-IRAS-PI-GST-SG-TaxCategoryID, 1, 1)
				)
			)
		)
	)
)