# Fees Language: `en` Mirror page: [fees.md](fees.md) Status: `partial migration` See also the historical technical page: `../fees.md`.
Operational summaryA fee carries an amount, but its quantity must remain aligned with the lots it applies to. Per packing is the only exception: it follows packing units, not lot weight.
Marker Topic Short rule
Quantity fee.quantity Sum of linked lots in fee.lots.
State empty fee.qt_state Uses the contract weight basis.
State filled fee.qt_state Uses that state, capped by the weight basis.
Fallback state missing on lot Uses the closest previous state by sequence.
Net / gross fee.weight_type net reads quantity, brut reads gross_quantity.
Packing ppack Packing quantity, decoupled from weight.
Control Python + SQL Application guard and SQL diagnostic.
## Consultant Rules ### BR-PT-FEE-001 - Freight value from shipment fee Source: `BR-PT-003` #### Consultant Rule The freight value printed on invoice documents comes from the maritime freight fee on the shipment, not from a direct invoice field. #### Developer Notes ### BR-PT-FEE-002 - Effective lots for fees Source: `BR-PT-021` #### Consultant Rule A fee follows the virtual lot until a physical lot is linked. As soon as a physical lot is linked, physical lots become the calculation basis for the fee. #### Developer Notes ### BR-PT-FEE-003 - Fee quantity #### Consultant Rule The quantity of a fee follows the quantity life cycle of its linked lots. It must represent the sum of those lots in the authorized contractual quantity state. #### Short Rule
fee.quantity = sum(applicable quantity of effective fee.lots)
#### Quantity State Selection
Case Target state
empty fee.qt_state weight basis of the fee carrier contract
filled fee.qt_state fee.qt_state, unless later than the weight basis
fee.qt_state later than weight basis weight basis
target state missing on lot closest previous state by lot.qt.type.sequence
no target state available current lot weight, only when no weight basis applies
#### Weight Basis Source
Fee weight basis
Purchase fee fee.line.purchase.wb.qt_type
Sale fee fee.sale_line.sale.wb.qt_type
Shipment fee purchase weight basis of the lot when present
Shipment fee without purchase sale weight basis of the lot when present
#### Net / Gross #### Per Packing #### Lump Sum ### BR-PT-FEE-004 - `% rate` fees from financing delta Source: historical `BR-PT-016` and `2026-04-30` notes #### Consultant Rule Percentage financial fees are calculated with the financing delta from the `BL date` estimated line, not with the current date. #### Developer Notes ## Developer Section ### Key Fields ### Calculation Functions ### Python Guards ### Known Gap ### SQL Diagnostic