# BR-04

Source: https://xmlvalid.com/rules/BR-04

> An Invoice shall have an Invoice type code (BT-3).

- Level: error
- Rule sets: EN 16931 rules (UBL) 1.3.17, EN 16931 rules 1.3.16 (UBL), EXTENDED-CTC-FR rules (UBL) 1.4.0.04
- Context: `/ubl:Invoice | /cn:CreditNote`
- Test: `normalize-space(cbc:InvoiceTypeCode) != '' or normalize-space(cbc:CreditNoteTypeCode) !=''`

> An Invoice shall have an Invoice type code (BT-3).

- Level: error
- Rule sets: EN 16931 rules (CII) 1.3.17, EN 16931 rules 1.3.16 (CII), EXTENDED-CTC-FR rules (CII) 1.4.0.04
- Context: `/rsm:CrossIndustryInvoice`
- Test: `normalize-space(rsm:ExchangedDocument/ram:TypeCode) != ''`

> An Invoice shall have an Invoice type code (BT-3).

- Level: error
- Rule sets: Romanian RO e-Factura rules (UBL) 1.0.9
- Context: `/ubl:Invoice | /cn:CreditNote`
- Test: `(cbc:InvoiceTypeCode) !='' or (cbc:CreditNoteTypeCode) !=''`

> An Invoice shall have an Invoice type code (BT-3).

- Level: error
- Rule sets: Factur-X BASIC WL rules 1.09, Factur-X EN 16931 rules 1.09.2, Factur-X EXTENDED rules 1.09.2
- Context: `/rsm:CrossIndustryInvoice`
- Test: `(rsm:ExchangedDocument/ram:TypeCode!='')`

## Why it fails

- There is no `cbc:InvoiceTypeCode` (`cbc:CreditNoteTypeCode` in a credit note, `ram:TypeCode` in CII).

## How to fix it

- Add the type code (BT-3) from UNTDID 1001: `380` for a commercial invoice, `381` for a credit note, `384` for a corrected invoice.

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