An invariant enforced as you type and again on save, and applied on read so old rows cannot display a contradiction. Received plus missing must equal what was ordered. Missing is treated as the authority — someone deliberately said a quantity did not turn up — while received is often just the untouched 'everything arrived' default. Damaged is capped at what arrived and is not part of the sum.
Also called: received plus missing equals ordered · conflicting counts · damaged still arrived
- 1Typing a missing count sets arrived to ordered minus missing, and vice versa
- 2reconcileLine(qty, received, missing, damaged) re-derives the three numbers and reports whether the stored row was conflicted
- 3Rows are read through the same reconciliation, so a row stored before the invariant existed cannot show '2 of 2 received' next to '1 missing'
- 4Damaged clamps to what arrived — you cannot damage more than you received
Two comments say it. On the typing rule: 'MISSING subtracts from ARRIVED — you cannot have received 43 and be short 1 of 43… DAMAGED does NOT subtract. A cracked board still came off the truck; it is a different claim (replace/credit) from one that never shipped. Deducting it would double-count the loss and understate what the supplier delivered.' On the read rule: 'rows written before it did — or by any other path — can hold both "2 of 2 received" AND "1 missing", which is a contradiction that makes the whole count untrustworthy.'
- Hand-maintained arrived and missing counts drift apart
- Damaged material double-counted as a shortage
See it on your own jobs
Twenty minutes, your numbers, no slide deck. We’ll build one of your real buildings in front of you and send you the estimate link at the end — yours to keep either way.
or keep browsing features →