ibr-055-ae
Preceding invoice reference (IBG-03) is must when invoice type code (IBT-003) is 381 (Credit note) or 81 (Credit note related to goods or services) except when the [BTAE-03] Credit note reason code is 'VD'.
error: the document is invalid
What the rule checks
As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.
Context
/ubl:Invoice | /cn:CreditNote
Test
(((cbc:InvoiceTypeCode | cbc:CreditNoteTypeCode) = "381" or (cbc:InvoiceTypeCode | cbc:CreditNoteTypeCode) = "81") and (((cac:BillingReference) and (cac:DiscrepancyResponse/cbc:ResponseCode != "VD")) or (not(cac:BillingReference) and (cac:DiscrepancyResponse/cbc:ResponseCode = "VD")))) or not((cbc:InvoiceTypeCode | cbc:CreditNoteTypeCode) = "381" or (cbc:InvoiceTypeCode | cbc:CreditNoteTypeCode) = "81")
Checked with PINT UAE Invoice, PINT UAE Credit Note