VRBL-INV-PT-2p1-17

Basic Info

Rule A Credit Note must contain the Billing Reference Group.
Context /ubl:Invoice
Pattern vrbl-invoice-pt-2p1
Severity fatal

Implementation

not(
	contains(
		$VRBL-CL-PT-CreditNoteTypeCode,
		concat(
			substring($VRBL-CL-PT-CreditNoteTypeCode, 1, 1),
			normalize-space(cbc:InvoiceTypeCode),
			substring($VRBL-CL-PT-CreditNoteTypeCode, 1, 1)
		)
	) 
	or
	(
		substring(normalize-space(cbc:InvoiceTypeCode), 1, string-length($VRBL-PT-Prefix)) = $VRBL-PT-Prefix
		and
		contains(
			$VRBL-CL-PT-CreditNoteTypeCode-Alt,
			concat(
				substring($VRBL-CL-PT-CreditNoteTypeCode-Alt, 1, 1),
				substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-PT-Prefix),
				substring($VRBL-CL-PT-CreditNoteTypeCode-Alt, 1, 1)
			)
		)
	)
)
or
boolean(cac:BillingReference)