PintLint

Rules / IBR-055-AE

IBR-055-AE error

Preceding invoice reference 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:InvoiceTypeCode>381</cbc:InvoiceTypeCode>
<!-- the data this document type requires is missing or wrong -->

Fix

Type code 381 triggers this rule. Add what it asks for, or check the type code is right.

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 an invoice