Skip to content
What the line remembers, and when it was remembered — transcript

What the line remembers, and when it was remembered — transcript

Presentation 3 of 5 in Finalise: what the button starts, and what it writes · about 13 minutes · for the whole-system operator — you run the books.

Play this as a presentation — one slide per step, with the same narration. Every word of every step is on this page.

This lesson is for whoever has to answer “who put that number there” about a line on a finalised invoice at GadgetSphere. In about thirteen minutes you will be able to sort every figure on that line into three piles — what the screen sent, what the server worked out, and what was copied from a master record — and say which save wrote it.

Step 1 — Start from what the screen sent

After this step you will know the default answer. The price, the discount and the resulting net amount on a line are computed in the applet, by its own pricing engine, before the document ever reaches the server. The server stores them. It does not recompute them, it does not check them against the price book, and it will not notice if they disagree. That is why the previous two series in this programme spent their time inside the applet: for the numbers a customer actually pays, the browser is where the arithmetic happened and the server is only the filing cabinet.

Reference: Pricebook — Where the number came from, and what the line remembers

Step 2 — Learn the one price the server does work out

After this step you will stop chasing a two-cent difference. If the applet sends a line total and no unit price, the server fills the unit price in by dividing the total by the base quantity, to two decimal places, rounding up. On a quantity of one that is invisible. On a quantity of three it is not: a line of ten ringgit for three units gets a unit price of three ringgit thirty-four, and three times that is ten ringgit and two cents. The total is the figure that posts and the figure that is right. The unit price is a derived, rounded-up display number.

Screen: Sales Invoice, an item line where Unit Price multiplied by quantity does not equal the line amount

Reference: Sales Invoice (Internal) — Lifecycle and effects

Step 3 — Learn which master record gets copied onto the line

After this step you will know why a price column changed with nobody editing it. If the line names a pricing scheme link, then on every save — the finalise included — the server copies that link’s entire price set onto the line: the replacement price, three reference prices, three delta prices, three delta percentages, three rebate prices, the promotion price, and the four sales and purchase minimum and maximum prices. Those are a snapshot, taken at the last save, of a master record that may since have changed. Edit one on the document and the next save puts it back.

Reference: Sales Invoice (Internal) — Lifecycle and effects

Step 4 — Notice the cost column that is really a price

After this step you will have the single most surprising fact in this series. The same copy also fills the line’s replacement cost columns, straight from the pricing scheme link’s replacement price. So one member of the cost family on your document line is not a costing figure at all: it is a price, written by the pricing subsystem, on a save, before the costing chain has run or even been queued. Every other cost column on that line is written minutes later by a background job. It is worth knowing before you choose Replacement as a cost basis on a margin report.

Reference: Financial Report — What this report asks the server, and the four ways its total surprises you

Step 5 — Know the two smaller rewrites on the same pass

After this step you will have the rest of the list. The same pricing-scheme branch fills the line’s point rate and point amount from the link’s reward ratio, but only when the line carries no point type and no point amount already — so a till that has computed points keeps its own, and a line that has none gets them filled in. Separately, a line carrying a tax code but no tax type has the tax rate re-read from the tax master and overwritten with today’s rate. The code comment says it only does that when the rate differs; it does not.

Reference: Sales Invoice (Internal) — Lifecycle and effects

Step 6 — Use the three piles to answer the question

After this step you will have a routine. Given a figure on a finalised line, ask which pile it is in. If it is a price, a discount or a net amount, the applet sent it and the answer is in the price book series. If it is a unit price that does not multiply back, the server derived it. If it is a reference, delta, rebate, promotion, minimum, maximum or replacement figure, it was copied from the pricing scheme link at the last save, and the link is where you change it. Everything else — the costs — is the next lesson.

Reference: Sales Invoice (Internal) — Lifecycle and effects

Check yourself

Three to five questions on what you just heard. Every correct answer links to the page that makes it correct, so you can check the source, not just the mark.

1. Who computed the discount on a sales invoice line?


2. A line's unit price multiplied by its quantity comes to two cents more than the line amount. What happened?


3. Somebody edits the replacement price on a finalised line and saves. What does the next save do?


4. Which subsystem writes the replacement cost columns on a document line?


Answer key
  1. The pricing engine inside the applet, before the document was sentPricebook — Where the number came from, and what the line remembers
  2. No unit price was sent, so the server derived it from the total and rounded up to two decimalsSales Invoice (Internal) — Lifecycle and effects
  3. Overwrites it again from the pricing scheme link the line namesSales Invoice (Internal) — Lifecycle and effects
  4. The pricing subsystem, on the save, from the pricing scheme linkSales Invoice (Internal) — Lifecycle and effects
This is a self-check. Your answers are marked in your browser and stay there — nothing is sent anywhere, nothing is recorded, and the marking is readable in the page source, so it is not a credential. Open the answer key at any time.

Next: Where the cost on your line came from · Back to the series · Play this as a presentation

Last updated on