# ibr-055-ae

Source: https://xmlvalid.com/rules/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'.

- Level: error
- Rule sets: PINT AE rules (United Arab Emirates) 1.0.4
- 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")`

Validate a document against these rules: https://xmlvalid.com/validate
