New Three new products: fordway trading ERP, UEPS cloud rendering and WPECS delivery and operations View products →

Pricing rules, four checks and price snapshots: how fordway stops prices from contradicting each other

Engineering By SREYUN 0 views

Trading companies rarely lose margin on big deals. They lose it a little at a time across dozens of small orders a day: a salesperson quotes last time's price, an agreement price changed but nobody updated it, a customer is already over the credit limit and goods keep shipping. fordway manages pricing in three layers: how prices are fetched, when approval is needed, and how a price stays fixed after confirmation.

Pricing rules: the first hit wins

On order entry, AI recognition and order changes, prices are fetched in this order, stopping at the first hit:

PriorityPrice sourceNotes
1Agreement / promotion priceThe agreement price or a time-limited promotion in the customer's price list
2Standard priceThe standard price in the price list
3Last deal priceThe customer's most recent price for the item; the same unit first, otherwise converted between units
4Default priceThe default selling price in the item master

Two design choices are worth explaining. First, fordway has no quantity breaks: a price entry does not change with order quantity. In raw-material trading, volume deals usually become agreement prices, and tiered prices only make "why is this order at this price" harder to explain. Second, last deal prices are converted between units: if the last deal was 250 per bag and a bag holds 25 kg, an order entered in kilograms gets 10 per kg, which prevents "one tonne equals one kilogram" style unit errors.

No overlapping price periods, enforced by the database

If two price entries for the same customer and item overlap in time, both prices are "right". fordway does not leave this to if-statements in application code; a PostgreSQL exclusion constraint guarantees at the database level that entries for the same dimension never overlap. When a price changes, the old entry ends on the date the new one takes effect and the new one starts from that date; if the old entry only started today, the new price takes effect tomorrow at the earliest. The price history keeps selling and purchase prices in one table, and each role sees only its own side.

Precision: three decimals, no rounding drift with tax

Every unit price and unit cost has exactly three decimals, the same in entry, calculation, APIs, screens and print (for example 0.120), and amounts are calculated with fixed-point decimals, never floating point. When ordering at prices including tax, 16,000 times 0.10 is exactly 1,600.00, and receipts, returns and statements use the same basis, so there is no cent-level drift from calculating net amounts first and adding tax afterwards.

Four checks and approval

When an order is submitted or confirmed, these checks run automatically, and any hit sends the order to approval:

CheckRuleDefault
Floor priceThe unit price is below the floor price of the price list or itemFloor price on the price list or item
Price deviationA hint above the hint threshold, approval above the block thresholdHint at 2%, block at 5%
Margin red lineThe order's gross margin is below the red line5%
Credit limitOutstanding receivables plus unshipped orders exceed the credit limitThe customer's credit limit
Customer riskThe customer is rated high or medium risk and has not been cleared as a false positiveHigh risk needs approval, medium risk shows a hint

On the approval page, the owner does not see a bare "approval required" but typed reasons with exact amounts, such as "over credit: used 242,554.50 plus this order 27,575.00 exceeds the limit of 200,000.00", with an extra "overdue" tag when the customer has overdue receivables. Orders can be approved or rejected one by one or approved in bulk, and an approved order is confirmed automatically and its requester notified.

Frozen on confirmation: snapshots and versions

When an order is confirmed, prices are fetched again and frozen as a snapshot. Later price changes do not affect confirmed orders, and quotes, delivery notes and statements all print the snapshot price. Changing an order creates a new version and keeps every earlier one; an order that will not be fulfilled is terminated rather than deleted.

Partner risk identification

The customer risk check comes from partner risk identification. fordway can connect to enterprise risk APIs from Qichacha, Tianyancha or Alibaba Cloud Marketplace, or to an MCP service, and queries 21 risk items such as dishonest judgment debtors, enforcement records and lawsuits, preferably by unified social credit code. Data sources are tried in priority order; if one fails (timeout, authentication, quota), the next takes over, and if all fail the last successful result is kept with the reason recorded. Order entry and purchasing show the risk level and reasons in real time and hint, require approval or block according to policy; results can be cleared as false positives, and every query is traceable.

In short

Pricing rules answer "what should this order cost", the checks answer "can this price go through without approval", and snapshots answer "will it change after confirmation". With each layer doing one job, prices stop contradicting each other. See the fordway product page for more.

Related articles