KTPV5 Retail POS

Scales & Money

Fixed-point scaling, GST, rounding, surcharge, and point-rate conventions used across the retail POS.

All money, quantity, and percent values are stored as scaled integers — never floats. The same constants are defined on both sides (retail_pos_server/src/libs/constants.ts and retail_pos_app/src/renderer/src/libs/constants.ts).

Scaling constants

ConstantValueMeaning
MONEY_SCALE100Money is stored in cents. 1000 = $10.00
QTY_SCALE1000Quantity ×1000. 3500 = 3.5 units
PCT_SCALE1000Percent ×1000. 1000 = 1%
MONEY_DP2Money display decimal places
QTY_DP3Quantity display decimal places
PCT_DP3Percent display decimal places

GST (tax)

GST applies only to taxable items (Item.taxable, default false — most items are non-taxable). For a taxable row the price already includes GST, extracted as round(total / 11) (Australian 10%); non-taxable rows have zero tax. Tax is never added on top.

unit_price_effective = unit_price_adjusted ?? unit_price_discounted ?? unit_price_original
row.total      = round(unit_price_effective × qty / QTY_SCALE)
row.tax_amount = taxable ? round(row.total / 11) : 0
row.net        = row.total - row.tax_amount

Source: retail_pos_server/src/v1/sale/sale.create.service.ts.

Cash rounding (5¢)

When every payment on an invoice is cash, the subtotal is snapped to the nearest 5 cents; the difference is stored as rounding. Mixed/non-cash invoices have rounding = 0.

rounding = cashOnly ? (round(subtotal / 5) × 5) - subtotal : 0

Source: retail_pos_server/src/v1/sale/sale.refund.service.ts, sale.repay.service.ts.

Credit surcharge

A configurable surcharge applies to CREDIT tenders. GIFTCARD is treated as "CREDIT without surcharge".

  • StoreSetting.credit_surcharge_ratepermille (default 15 = 1.5%).
  • Surcharge GST follows the same 1/11 rule: surchargeTax ≈ round(creditSurchargeAmount / 11) (±1¢ drift tolerated).

Loyalty point rates

StoreSetting (defaults shown):

FieldDefaultMeaning
cash_point_rate10Percent of the cash-paid base earned as points (10 = 1%)
other_point_rate10Percent of the non-cash base earned as points (10 = 1%)
user_daily_voucher_default2000Default staff daily voucher amount (cents = $20.00)

Time limits

ConstantValueWhere
REPAY_TIME_LIMIT_MS10 * 60 * 1000 (10 min)retail_pos_server/src/v1/sale/sale.repay.service.ts

Invoice invariants

For a SaleInvoice (see schema.prisma):

Σ rows.total      == linesTotal
Σ rows.tax_amount == lineTax
Σ payments.amount == total
total             == linesTotal + rounding + creditSurchargeAmount

On this page