Number7 research · Enterprise AP / procurement / systems team
Stateful three-way matching
DIRECT ANSWER Stateful matching maintains the evolving relationship between purchase orders, goods receipts and invoices across partials, cumulative billing, tolerances and corrections.
CANONICAL DEFINITIONReviewed 7 September 2026Number7 AI Research
Re-evaluate the balance after each event
A receipt correction changes the safe next action.
Receipt-matching example · not a measured customer result
500 ordered450 cumulatively billed430 supported20 units held
Zero quantity tolerance · unit price $8.00. Resolve the 20-unit shortage; approval remains a separate requirement. Quantity support does not replace price, tax or authority checks.
A receipt correction changes the safe next action.
Receipt-matching example · not a measured customer result
500 ordered450 cumulatively billed430 supported20 units held
Source event
Net received
Billed to date
Supported
Held
Unbilled commitment
PO-4101 · order
0 units
0 units
0 units
0 units
500 units
GRN-4102 · +300 received
300 units
0 units
0 units
0 units
500 units
Earlier bills · 250 units
300 units
250 units
250 units
0 units
250 units
GRN-4129 · +150 received
450 units
250 units
250 units
0 units
250 units
LAB-110 · +200 invoiced
450 units
450 units
450 units
0 units
50 units
Receipt correction · −20
430 units
450 units
430 units
20 units
50 units
Zero quantity tolerance · unit price $8.00. Resolve the 20-unit shortage; approval remains a separate requirement. Quantity support does not replace price, tax or authority checks.
Retain the ordered quantity, agreed unit price and remaining commitment at PO-line level. A revised order changes the applicable balance; it does not erase earlier receipts or bills.
02
Receipt state
Sum linked receipt events, returns and corrections. Keep each receipt reference so the quantity supporting a bill can be reconstructed after a correction.
03
Invoice state
Retain earlier and current invoice quantities against the same PO line. Compare cumulative billing with cumulative supported receipts rather than restarting the comparison for every PDF.
04
Tolerance
Record the applicable quantity and price tolerances separately. A permitted tolerance is a configured control; a missing receipt is not automatically evidence of delivery.
05
Cumulative balance
Track ordered, received and invoiced quantities together. With zero tolerance, billed quantity above net received quantity creates a named hold.
06
Corrections
Append the correction and re-evaluate affected quantities and controls. Retain the original event and record why the current interpretation supersedes it.
How to evaluate it
Use the lab’s zero-tolerance example: after a −20-unit receipt correction, 450 cumulative invoiced units have only 430 units of receipt support. The 20-unit hold returns; approval stays separate.
Freeze the population and workflow boundary.
Define required evidence and successful exit state.
Measure exceptions, human touches and silent errors.
Separate modeled outcomes from production measurements.
Go deeper where you need to
Technical appendix: Match quantity and value across the full history.
Receipt and invoice edge cases
01
Multiple GRNs
Link every relevant goods-receipt reference to its PO line. Net received quantity is the cumulative received quantity after returns and corrections.
02
Partial invoices
Link each partial bill to the same PO line. Earlier billing consumes the available received balance before the current invoice is evaluated.
03
Cumulative quantity
Compare net receipts with earlier plus current billing. In the source lab, 250 earlier units plus 200 current units are evaluated against 430 net received units.
04
Tolerance use
The source lab uses zero tolerance. A different rule must be recorded explicitly and tested without treating approval as proof that a delivery occurred.
05
Returns
Retain negative receipt events and their source. A return can reduce the support for previously matched billing and require the transaction to be reconsidered.
Validation questions for this model
Freeze the population and workflow boundary.
Define required evidence and successful exit state.
Measure exceptions, human touches and silent errors.
Separate modeled outcomes from production measurements.
Next step
Change the receipt. Watch the decision change.
Test cumulative billing, correction, tolerance and separate approval on the same PO line.