Rounding in Unleashed
Lesson 18 of 24 9 min read
How Unleashed rounds sales order lines and totals, when a one-penny difference appears, and how the rounding settings reconcile it.
A retailer orders 142 cases at £16.25. That should be £2,307.50. Unleashed says £2,307.47. Nobody typed anything wrong: it is rounding. If you send orders from EDI or B2B channels, especially with case prices that do not divide neatly into units, you will meet this. This lesson explains how Unleashed rounds, and how Supply Lens's rounding settings close the gap.
How Unleashed rounds
Unleashed holds every line to 2 decimal places, and the order total is always the sum of the lines.
| Field | Held to | How it is set |
|---|---|---|
| Quantity | 4 dp | Rounded to 4 dp |
| Unit price (goods) | 4 dp | Rounded to 4 dp |
| Unit price (charge line) | 2 dp | Rounded to 2 dp |
| Line total | 2 dp | Unleashed's own calculation |
| Line tax | 2 dp | Recalculated as line total × tax rate |
| Subtotal, tax total, total | 2 dp | Sums of the stored lines |
All rounding takes a half away from zero. The line total uses Unleashed's own formula: the discounted unit price (unit price × (1 − discount rate)) rounded to 4 dp, then quantity × that price rounded to 2 dp.
Where the penny goes
Because each line is rounded before the lines are added up, the total can differ from the order's own total rounded once:
| Line 1 | Line 2 | Total | |
|---|---|---|---|
| The order (96 and 48 units at £1.691) | 162.336 | 81.168 | 243.504, which is 243.50 |
| What Unleashed stores | 162.34 | 81.17 | 243.51 |
Nothing in Unleashed can hold 243.50 for these lines except a separate charge line of −0.01.
The second kind of gap is the unit price. Unleashed holds unit prices to 4 dp and works in units. A case of 6 at £16.25 is £2.708333… a unit, held as £2.7083. 852 units × £2.7083 = £2,307.47, three pence short of the retailer's £2,307.50.
What Unleashed refuses
Unleashed checks the figures it is sent. Each line total must round to its own calculation, the subtotal and tax total must agree with the lines, and the total must be exactly subtotal plus tax total. If any check fails, the whole order is refused with a message such as Provided LineTotal of '162.0' does not match the calculated line total of '162.34'.
The rounding settings
| tryCalculateRoundingAdjustments | When on, Supply Lens works out each line the way Unleashed will hold it, compares the result with the source order, and adds an adjustment line to close any gap. When off, the order's own figures are sent and Unleashed does the rounding. |
|---|---|
| roundingTolerance | The largest gap, in order currency, accepted as rounding. A larger gap is refused rather than adjusted. 0.01 if unset. |
| taxRateForTaxRoundingAmounts | The tax rate for a tax rounding adjustment. If unset, the order's highest rate is used. |
| lineTotalRoundingDecimals | The number of decimal places for rounding individual line totals, to prevent errors building up across many lines. |
With tryCalculateRoundingAdjustments on, Supply Lens:
- Values each line as Unleashed will hold it, and works out its tax as Unleashed will.
- Compares total tax with the source order's tax. A gap adds a Tax Rounding Adjustment charge.
- Compares the total with the source order's payable amount. A gap adds a zero-rated Rounding Adjustment charge.
- Refuses any gap larger than
roundingToleranceinstead of adjusting it. - Sends a header that is the lines' own sums, so Unleashed's checks always pass.
In the £2,307.50 example, Supply Lens adds a Rounding Adjustment of £0.03, so the Unleashed order matches what the retailer expects to be invoiced.
The catch: adjustments on EDI invoices
A Rounding Adjustment is a charge line, and it carries through to the invoice raised from the order. Some retailers' invoice formats refuse any adjustment with a non-zero value. A one-line order rarely produces one big enough to survive rounding to 2 dp; two lines can add up to −0.01, which such a retailer would reject.
There is a second subtlety: a charge keeps its value if someone edits the order in Unleashed. If a goods line is repriced after creation, the adjustment that was worked out for the old price no longer fits.
Check with your trading partners
If you invoice retailers by EDI, talk to your Supply Lens contact before turning on rounding adjustments. They can confirm how adjustments will appear on each partner's invoice.
A wholesale order that is three pence out
Fernside Foods, a Hilltop-style business selling to supermarkets, receives a Morrisons order for 142 cases at £16.25. Unleashed holds units, so without adjustments the order lands at £2,307.47 and the invoice disagrees with the retailer's PO. Fernside turns on tryCalculateRoundingAdjustments with the default tolerance. The next order arrives with a £0.03 Rounding Adjustment and a total of £2,307.50.
Recap
- Unleashed stores each line to 2 dp, unit prices to 4 dp, and totals as the sum of stored lines.
- Rounding each line, and unit prices that cannot hold a case price exactly, cause penny differences.
tryCalculateRoundingAdjustmentsadds Tax Rounding and Rounding Adjustment lines to match the source total.- Gaps larger than
roundingTolerance(0.01 by default) are refused, not adjusted. - Adjustment lines reach invoices; check EDI partners before turning this on.
Quick guides for this topic
Your progress is saved in this browser. Create a free account to keep it everywhere, take quizzes and earn certificates.