
Chapter 4 of 7
A bucket of cold water for bad math.
Reading a number correctly isn't enough. MagicBucket checks that the numbers add up, and raises the alarm when the document itself is wrong.
Cross-checks between fields
- net + VAT = gross
- VAT = net × rate
- line items add up to the total
- dates come in the right order: issued, sold, due
- the balance sheet balances
- payroll: gross pay minus deductions gives net pay
- the amount in words matches the amount in figures
Amounts may differ by up to 0.02 for rounding. If a value a check needs is missing, the check is skipped, not failed.
When a check fails
Every field in that check becomes disputed, with a note: possible reading error or an error in the document. Nothing half-checked slips into your CSV as confirmed.
Check digits
IBANs, VAT and tax IDs, company registration and national ID numbers often carry their own checksums. A random misread almost never produces a valid check digit, so a failed checksum is a strong signal: the field is disputed even if all the models agree.
Cold water for the supplier, too Example
An invoice says: net 1,000.00 EUR, VAT 20% 202.00 EUR, gross 1,202.00 EUR. The models read all three numbers correctly, and the VAT check fails, because 20% of 1,000.00 is 200.00. The fields land as disputed with the note above, and you catch the supplier's mistake before it reaches your books.