# BR-CO-12 Sum of document charges must match total

Sum of charges on document level (BT-108) shall equal the sum of all document level charge amounts (BT-99): BT-108 = Σ BT-99.

## Problem Description

> **ERROR**: EN 16931 calculation and consistency rule (BR-CO)

## Context and Significance

This EN 16931 calculation rule feeds the totals chain: BT-108 is part of the invoice total without VAT (BR-CO-13). The validator compares BT-108 exactly with the sum of the document level charges. The error typically occurs when shipping costs are added to the document without updating BT-108, when BT-108 is filled although there is no document level charge, or when invoice line charges (BG-28) are counted in BT-108 although they are already included in the line net amounts.

## Solution

Recompute BT-108 as the exact sum of all document level charge amounts (BT-99) and write it into cbc:ChargeTotalAmount (UBL) or ram:ChargeTotalAmount (CII). If there is no document level charge, omit BT-108 or set it to 0.00.

- [Validate XML](/en/xrechnung-validator?source=resource&rule=BR-CO-12)
- [Convert invoice](/en/pdf-to-xrechnung?source=resource&rule=BR-CO-12)

## Valid Examples

- BT-99 = 20.00 and BT-99 = 10.00, BT-108 = 30.00
- No document level charge and BT-108 absent

## Invalid Examples

- BT-99 = 20.00 and BT-99 = 10.00, but BT-108 = 25.00
- BT-108 = 3.00 although the only charge of 3.00 is an invoice line charge (BG-28)

## Code Examples

### Valid XML
```
<cac:AllowanceCharge>
  <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
  <cbc:AllowanceChargeReasonCode>FC</cbc:AllowanceChargeReasonCode>
  <cbc:AllowanceChargeReason>Freight charge</cbc:AllowanceChargeReason>
  <cbc:Amount currencyID="EUR">20.00</cbc:Amount>
  <cac:TaxCategory>
    <cbc:ID>S</cbc:ID>
    <cbc:Percent>19</cbc:Percent>
    <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
  </cac:TaxCategory>
</cac:AllowanceCharge>
<cac:AllowanceCharge>
  <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
  <cbc:AllowanceChargeReasonCode>ABL</cbc:AllowanceChargeReasonCode>
  <cbc:AllowanceChargeReason>Additional packaging</cbc:AllowanceChargeReason>
  <cbc:Amount currencyID="EUR">10.00</cbc:Amount>
  <cac:TaxCategory>
    <cbc:ID>S</cbc:ID>
    <cbc:Percent>19</cbc:Percent>
    <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
  </cac:TaxCategory>
</cac:AllowanceCharge>
<cac:LegalMonetaryTotal>
  <cbc:ChargeTotalAmount currencyID="EUR">30.00</cbc:ChargeTotalAmount>
</cac:LegalMonetaryTotal>
```

### Invalid XML
```
<cac:AllowanceCharge>
  <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
  <cbc:AllowanceChargeReasonCode>FC</cbc:AllowanceChargeReasonCode>
  <cbc:AllowanceChargeReason>Freight charge</cbc:AllowanceChargeReason>
  <cbc:Amount currencyID="EUR">20.00</cbc:Amount>
  <cac:TaxCategory>
    <cbc:ID>S</cbc:ID>
    <cbc:Percent>19</cbc:Percent>
    <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
  </cac:TaxCategory>
</cac:AllowanceCharge>
<cac:AllowanceCharge>
  <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
  <cbc:AllowanceChargeReasonCode>ABL</cbc:AllowanceChargeReasonCode>
  <cbc:AllowanceChargeReason>Additional packaging</cbc:AllowanceChargeReason>
  <cbc:Amount currencyID="EUR">10.00</cbc:Amount>
  <cac:TaxCategory>
    <cbc:ID>S</cbc:ID>
    <cbc:Percent>19</cbc:Percent>
    <cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
  </cac:TaxCategory>
</cac:AllowanceCharge>
<cac:LegalMonetaryTotal>
  <cbc:ChargeTotalAmount currencyID="EUR">25.00</cbc:ChargeTotalAmount>
</cac:LegalMonetaryTotal>
```

## Affected Fields

- [BT-99 Document level charge amount](/resources/xrechnung/bt-99-document-level-charge-amount)
- [BT-108 Sum of charges on document level](/resources/xrechnung/bt-108-sum-of-charges-on-document-level)

## Related Rules

- [BR-CO-11](/resources/kosit-validator-errors/br-co-11-sum-of-document-allowances-must-match)
- [BR-CO-13](/resources/kosit-validator-errors/br-co-13-invoice-total-without-vat-must-match-totals-chain)

## Validation Tools

- [Official KoSIT Validator](https://github.com/itplr-kosit/validator): Run the official KoSIT validator with the XRechnung configuration to check EN 16931 and XRechnung rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Find validation errors during conversion and review each correction.

## Related Resources

- [Official Specification](https://docs.peppol.eu/poacc/billing/3.0/rules/ubl-tc434/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [All validation errors](/resources/kosit-validator-errors): Overview of the EN 16931, XRechnung and Peppol validation rules explained here.
