The convention
In Covex an amount is stored as an integer in the smallest unit — øre — together with a currency code. Never as a decimal.
A decimal can't always represent an amount exactly, and small rounding errors grow when lines are added up on an invoice, split across orders or converted to another currency. An integer in øre is exact, and the currency code travels with it, so an amount is never read in the wrong currency.
// Amount as an integer in the smallest unit + currency codetype Amount = { minor: number; currency: string };const price: Amount = { minor: 124950, currency: "DKK" }; // DKK 1,249.50Prices have versions
The same care applies to tariffs. Ingrid works out the price from zones, the lane matrix, weight bands and the customer segment, and prices are versioned: historical orders keep the version they were priced with. A new tariff version therefore doesn't change the price of an order that has already been priced.
Where it shows
- Quote sheets are calculated line by line against the tariff.
- Supplier invoices are split down to the individual orders.
- Surcharges and rates: fuel by index, environment, island, weekend and currency.
- Reports show revenue, cost and contribution margin (DB1) per month, customer, department, forwarder and lane.

