Where the cost on your line came from — transcript
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 at GadgetSphere has to defend a gross margin figure. In about fourteen minutes you will know which cost columns on a finalised line are filled and by which step, what the stored amount actually measures, why the margin report multiplies the price instead of reading the amount, and which three cost bases quietly return nothing.
Step 1 — Know that none of it exists when Finalise returns
After this step you will have the timing right. A finalised line’s cost columns are empty at the moment the screen comes back. The inventory job runs first and writes the stock ledger line. That job queues a second one, which recomputes the item’s company balance and its moving average and writes the result back onto your document line. That one queues a third, which walks the FIFO baskets and writes four more columns. Three levels, three separate queue rows, and the document is already FINAL and already visible throughout.
Reference: How Work Actually Runs — Trace it once: what one Finalise actually starts
Step 2 — Know exactly which columns get written
After this step you will stop trusting the empty ones. The document line has cost columns for six methods — moving average, weighted average, FIFO, LIFO, manual and replacement — each in a location flavour and a company flavour, plus landed-cost and last-purchase variants. Of all of them, the stock-balance step writes six: the company moving-average amount and price, the company weighted-average amount and price, and the landed-cost moving-average pair. The FIFO step then writes four more. The location-level write-back exists in the code as a method that deliberately does nothing, with a comment saying costing is not required at that level.
Reference: Costing Internals
Step 3 — Know what the stored amount actually measures
After this step you will stop misreading the biggest number on the line. The moving-average amount written onto your document line is not the cost of that line. It is the total value of that item’s company stock balance after the movement, and the price beside it is the new average unit cost. The FIFO pair works the same way, except that FIFO also stores a genuine per-transaction pair alongside it. So on a line selling two laptops out of a hundred in stock, the cost amount you are looking at is close to the value of the other ninety-eight.
Reference: Costing Internals
Step 4 — Understand why the margin report multiplies instead of reading
After this step you will know why two figures that should agree do. Because the stored amount is a balance and not a line cost, the Profit Loss Report never reads it. It takes the stored unit cost price, multiplies by the line’s own quantity and signum, and calls that the cost of the line. That is the right arithmetic given what is stored, and it is also the reason the report’s cost of sales can differ from the month-end cost-of-goods-sold journal: one is built from document lines at a cost basis you pick on screen, the other from opening stock plus purchases minus closing stock.
Reference: Financial Report — What this report asks the server, and the four ways its total surprises you
Step 5 — Avoid the three cost bases that return nothing
After this step you will never send anyone a hundred-percent margin. The report offers six cost bases and three of them read a column the chain never writes. LIFO is the clearest: the processor whose name and description promise FIFO and LIFO has the LIFO half commented out, and across every tenant database that column is null on every sales line. Manual has no writer at all. Replacement is filled — but by the pricing subsystem, from a pricing scheme link, and only on the minority of lines that name one. Choose moving average, weighted average or FIFO.
Reference: Financial Report — What this report asks the server, and the four ways its total surprises you
Step 6 — Remember the two documents that get no cost at all
After this step you will know where to look when a whole class of line is blank. A document raised in a currency other than the company’s base currency produces no inventory ledger line whatsoever, so no cost is computed, nothing is written back, and nothing tells you. And no sales document ever posts a cost-of-sales journal: the sales posting is receivable, sales, discount, tax and forex, and cost of goods sold arrives once a month from a completely different calculation. A cost on the line and a cost in the ledger are two different things.
Reference: Costing Internals
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.
Answer key
- By background jobs afterwards — the stock-balance step, then the FIFO step — How Work Actually Runs — Trace it once: what one Finalise actually starts
- The value of the item's whole company stock balance after the movement — Costing Internals
- Nothing writes the LIFO cost column, so the report multiplies by null and totals zero — Financial Report — What this report asks the server, and the four ways its total surprises you
- None — a foreign-currency document produces no inventory ledger line at all — Costing Internals
Next: When the chain does not run, and how you find out · Back to the series · Play this as a presentation