totals.reconciliation
Block totals reconcile against child documents
NumberOfEntries must count every document (cancelled included); TotalDebit and TotalCredit must equal the line amounts without VAT, cancelled documents excluded, within 0.01.
What this checks
Each block-level total inside SourceDocuments must reconcile with the documents underneath:
NumberOfEntries= number of documents in the section (Invoice/WorkDocument/Payment), cancelled documents included.TotalDebit= sum of the lines'DebitAmount, andTotalCredit= sum of the lines'CreditAmount. These are amounts without VAT, not the documents'GrossTotal. Cancelled documents are left out: statusAorFinSalesInvoices,AinWorkingDocumentsandPayments.MovementOfGoods.TotalQuantityIssued= sum of the lines'Quantity, cancelled movements left out.
Tolerance is 0.01. Source: Portaria n.º 302/2016, which defines these fields as control sums.
Why AT cares
The block totals are the integrity checksum AT validates on intake. An off-by-one count is usually a draft document that didn't flush; a sub-cent drift is a rounding mismatch between the ERP's line-level engine and the SAF-T aggregator.
Examples
| Field | Declared | Actual | Verdict |
|---|---|---|---|
| SalesInvoices.NumberOfEntries | 12 | 12 (including 1 cancelled) | ✓ |
| SalesInvoices.NumberOfEntries | 11 | 12 | ✗ one document missing from the count |
| SalesInvoices.TotalCredit | 1234.56 | 1234.56 (lines without VAT) | ✓ |
| SalesInvoices.TotalCredit | 1518.51 | 1234.56 | ✗ VAT included by mistake |
| SalesInvoices.TotalCredit | 1234.57 | 1234.56 | ✓ within the 0.01 tolerance |
How to fix
- Re-run the SAF-T extract from your ERP after closing any drafts.
- If your ERP allows manual override of the block aggregates, set them to the SAFTCheck-reported "actual" values.
- If the discrepancy is a known per-line rounding bug in your ERP, escalate it with the vendor — these aggregates are computed downstream of the lines.