Cargolake
Help & Guides/Quotations

How pricing is calculated

The exact calculation — what each unit multiplies by, the three-phase order, conditions, minimum charge, VAT and currency conversion.

This is the precise behaviour of the pricing calculation. Read Pricing a quotation first for the concepts; this article is for when a number has to be explained exactly.

The three phases

Lines are not all calculated together. They are sorted into three groups and evaluated in order, because the later groups depend on the earlier ones.

PhaseLinesBasis
1Unit-based linesrate × units
2Depend on lines, in line-orderA percentage of one earlier line's net
3Total VAT Exclusive linesA percentage of the net of everything above

Two consequences follow directly:

  • A Total VAT Exclusive line includes the depend-on lines from phase 2 in its base, because those have already been added by the time phase 3 runs.
  • Two Total VAT Exclusive lines do not compound. Each is calculated against the running total as it stood, so ordering between them matters.

What each unit multiplies by

UnitUnits used
ShipmentAlways 1
InvoiceAlways 1
CBMTotal CBM
KilogramTotal weight
UnitNumber of pieces
DayDays
W/MThe W/M figure
CBMCieldTotal CBM, rounded up
WMCieldW/M, rounded up
CBMxDaysTotal CBM × days
CBMCieldxDaysCBM rounded up, × days
WMxDaysW/M × days
WMCieldxDaysW/M rounded up, × days

The ×Days units default days to 1 when days is absent. A storage line priced CBMxDays on a quotation with no day count does not fail and does not come out zero — it charges one day. That is the single most easily missed behaviour here: an under-charge that looks like a correct calculation. Always set days on a quotation carrying storage or demurrage lines.

The Cield units round the quantity up to a whole unit before multiplying, not the resulting money.

Conditions decide inclusion, not rate

Conditions answer "does this line apply?" — not "at what rate?". A line whose conditions are not satisfied is removed from the calculation altogether.

A line with no conditions always applies. Where a line has several, they are combined with OR: any one match includes it.

Only three condition types exist:

TypeTest
DayThe day count falls within a fromto range
Payment termsPayment terms equal the condition's value (prepaid / collect)
IMOThe hazardous flag matches

Day ranges

The range is inclusive at both ends — a range of 5 to 10 includes both 5 and 10. Adjacent ranges written as 0–5 and 5–10 therefore both match at 5, and both lines are charged. Write them as 0–5 and 6–10.

-1 means unbounded. A from of -1 has no lower limit; a to of -1 has no upper limit. That is how you express "11 days and over" — from 11, to -1.

Conditions that raise an error

A condition needs its input. If the quotation does not supply it, the calculation fails rather than guessing:

ErrorCause
DAYS_REQUIREDA day condition exists but the quotation has no day count.
FROM_REQUIRED / TO_REQUIREDA day condition is missing one end of its range. Use -1 for unbounded rather than leaving it empty.
PAYMENT_TERMS_REQUIREDA payment-terms condition exists but the quotation has none set.
IMO_REQUIREDAn IMO condition exists but the hazardous flag is not set.
CONDITION_UNIT_NOT_SUPPORTEDThe condition uses a type the calculator does not implement.

These come from the pricing engine, so they surface on Calculate rather than when the line is saved.

Depend-on lines

A Depend on line references another line by its order number, and its rate is treated as a percentage: the result is referenced line's net × rate ÷ 100.

If the referenced line is not there, the base is zero and the depend-on line prices at zero. It does not raise an error. The referenced line can be absent because it was deleted, because its order number changed, or — most easily missed — because its own conditions excluded it. A percentage-based charge silently pricing at zero is nearly always this.

Depend-on lines are evaluated in line-order, and each can only reference a line from phase 1. A depend-on line cannot reference another depend-on line.

Minimum charge

Minimum charge is applied as max(calculated amount, minimum charge)in the line's own currency, before conversion.

That ordering matters on a multi-currency quotation: a minimum charge of 50 USD is a floor of 50 USD, applied first and then translated, not a floor in the quotation's currency.

A line with no minimum charge is treated as having a minimum of zero.

VAT

VAT is calculated after conversion, on the converted net: net × VAT % ÷ 100. The line's total is net plus VAT.

VAT percentage must be between 0 and 100.

Currency conversion

Rates are quoted against the ledger's base currency, so converting between two other currencies is a cross rate:

converted = amount × rate(line currency) ÷ rate(target currency)

Three properties worth knowing:

  • One as-of instant per calculation. Every line in a single Calculate converts at the same moment, so a multi-line quotation cannot straddle a rate change part-way through.
  • Rates are fetched once per currency for the whole calculation.
  • A line already in the target currency is not converted at all, so it carries no rounding from conversion.

Rates come from Finance — see Tax groups, tariff codes, exchange rates and configuration.

Order of operations, end to end

For a single line:

  1. Determine units from the unit type.
  2. net = rate × units — or, for depend-on and total-VAT-exclusive lines, the percentage of their base.
  3. Apply minimum charge: max(net, minimum), in the line's currency.
  4. Convert to the quotation's currency.
  5. Apply VAT on the converted net.
  6. Total = net + VAT.

The quotation total is the sum of every included line's total.

Diagnosing a wrong figure

SymptomLook at
A line is missing from the resultIts conditions — it was excluded.
A percentage line came out zeroThe line it depends on was excluded or renumbered.
A storage charge is one dayDays not set; the ×Days units defaulted to 1.
The figure is a whole multiple when it should not beA Cield unit is rounding the quantity up.
A minimum charge looks wrong after conversionIt was applied before conversion, in the line's own currency.
Two overlapping tiers both chargedDay ranges are inclusive and overlap at the boundary.
Totals differ between two runsRates moved between calculations; each run uses its own as-of instant.

Last updated 9 September 2026