An invoice total looks like three multiplications and an addition. Then you print the invoice and the lines do not add up to the total: one centime is missing, or one too many. The usual cause is a double , or a tax that was rounded once on the total while the printed lines were rounded one by one.
Algerian invoices add a second difficulty. A cash payment carries the droit de timbre de quittance, and its rules changed with the 2025 finance law: an exemption threshold, three brackets, a minimum, and no ceiling any more. An engine that still charges a flat 1 % gives a different amount from the current law on many cash invoices.
dz_invoice_tax is a pure Dart engine for exactly this. It computes TVA per rate, line and document discounts and the droit de timbre in integer centimes, under dated rules that cite the law they come from.
What it does
Exact money. Amounts are BigInt centimes. Quantities (6 decimal places) and rates (4 decimal places) are decimal strings.…