How header totals are recomputed on every change
The totals shown on a Beleg (receipt/expense document) header are always derived from its line items, never typed in. This article explains what the header totals are, when they are recalculated, and why they always match the sum of the Positionen (line items).
The two header totals
A Beleg header carries two computed totals:
- Total net amount — the sum of every line item's net amount.
- Total gross amount — the sum of every line item's gross amount.
There is no separately stored header VAT total: the total VAT is simply total gross minus total net. The dashboard's tax summary reconstructs VAT by grouping the line VAT amounts per rate.
Recomputed on every change
The header totals are recalculated through a single centralized recompute step every time the line items change. That step runs whenever:
- A Beleg draft is created with line items.
- A Beleg in Draft or Needs Clarification is updated.
- An authorized reviewer applies a financial correction during review.
Because recompute is the only place header totals are set, they can never drift out of sync with the line items. If you add, edit, remove, or reorder rows, the totals are re-summed from the current line items on save.
Note: A header-only draft with no line items has totals of 0.00. As soon as you add priced line items and save, the totals reflect their sum.
How a save updates the totals
- Your line items are validated (required fields, the 20-item limit, active financial references).
- Each line item's net, VAT, and gross amounts are computed and rounded to 2 places.
- The line items are re-sequenced 1…n by sort order.
- The header total net and total gross are re-summed from those line items.
- The change is persisted in one transaction, rules are re-evaluated, and audit events are recorded.
The audit trail for totals
Every line-item update records two immutable audit events: BelegLineItemsUpdated (with the Beleg ID, status, and line-item count) and BelegTotalsRecomputed (with the new total net and total gross). This gives finance a traceable history of how the totals evolved across edits.
Tip: If a header total does not look right, check the individual line amounts rather than the header — the header is only ever a sum of the lines. A rounding or VAT-rate difference on one line is the usual cause.
Totals after approval
Once a Beleg is Approved, its line items and therefore its totals are frozen. Approved, Paid, and Rejected Belege are immutable, so no further recompute occurs. Only approved and paid Belege contribute to the financial figures on the expense dashboard, so the frozen totals are what downstream reporting relies on.
Related
- How net, VAT, and gross amounts are calculated
- Add line items to a Beleg
- Edit line items: create, update, and delete
- When you can edit a Beleg: editable states