PintLint

Rules / IBR-055-AE

Preceding invoice reference is must when invoice type code is 381 (Credit note) or 81 (Credit note related to goods or services) except when the Credit note reason code is 'VD'

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'.

Fails

<cbc:CreditNoteTypeCode>381</cbc:CreditNoteTypeCode>
<!-- no cac:BillingReference, and cbc:ResponseCode isn't VD -->

Fix

On a credit note (381 or 81), add cac:BillingReference pointing to the original invoice, with a credit note reason code in cac:DiscrepancyResponse/cbc:ResponseCode. Only when that reason code is VD, leave cac:BillingReference out.

Schematron
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")

Official text: 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'.

Official · PINT AE (UAE) rules. Severity: error. Runs on UBL XML.

Check your invoice for this rule