MEGAINFRA-WEBAPP/docs/audits/2026-09-27-delivery-note-remediation.md
DEls 3ba004ffd3 fix(dn): harden delivery-note matching, posting and PO reconciliation
Fresh duplicate check before posting, dismiss route sets stage, free accessory
lines no longer crash promotion, readiness treats only posted notes as terminal,
document-reference/usable-PO helpers, PO delivery reconciliation API + docs and
audit register.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-28 21:16:24 +02:00

21 KiB
Raw Blame History

Delivery-note queue remediation — 27 September 2026

Source-scan verification update

I checked the cached OCR fields for every repeated Vula invoice in the 73-page batch against the printed date, invoice and delivery-note references, item codes, quantities, unit rates and totals. I independently OCR'd the reference area of pages 17–72 with Tesseract and opened the source images for material disagreements. This establishes repeated paperwork for the same delivery; it does not mean a tax invoice and its signed delivery note are the same physical document.

Printed invoice Pages in this batch Evidence / disposition
VCINV073787 17, 27, 40, 60 Same VDN074323, 55 × 450 mm pipe, R46,703.25 ex VAT; already posted, so no second receipt.
VCINV073799 18, 31, 70 Same VDN074329, 34 × 600 mm pipe, R43,715.50. Page 70 is marked “Tax Invoice copy”; its item code differs in print/OCR, but reference, description, quantity and total agree. Hold for reviewer.
VCINV073800 29, 32, 38, 58 Page 29 OCR said VCINV073900. The source scan visibly prints VCINV073800; all copies also print VDN074334, 14 × 600 mm plus 20 × 675 mm, R55,312.50. Audited identity correction saved; page 29 moved from Ready to Needs matching.
VCINV073801 28, 33, 39, 59 Same VDN074337, 34 × 450 mm plus 13 × 600 mm, R45,585.85.
VCINV073802 30, 34, 37, 57 Same VDN074348, 30 × 675 mm, R55,968.00. Page 30's item code was read as P67S-100, but the scan shows P675-100.
VCINV073832 26, 35, 41, 61 Same VDN074366, 34 × 600 mm, R43,715.50.
VCINV074055 22, 48, 66 Same 11 × 1050 mm pipe and 11 rings, R43,560.55. Page 22 OCR read VDN074555, but its scan prints VDN074559, matching pages 48 and 66. Audited secondary-reference correction saved.
VCINV074056 21, 49, 52, 67 Same VDN074562, 11 × 1050 mm pipe and 8 rings, R43,560.55; already posted.
VCINV074057 20, 50, 53, 68 Same VDN074588, 11 × 1050 mm pipe, R43,560.55.
VCINV074058 19, 51, 54, 69 Same VDN074589, 11 × 1050 mm pipe, R43,560.55; already posted.
VCINV074077 46, 65 Page 46 OCR said VCINV0746T7. Both scans visibly print VCINV074077 and VDN074606, 11 × 1050 mm pipe plus 11 rings, R43,560.55. Audited identity correction saved.
VCINV074078 24, 44, 63 Same VDN074607, 11 × 1050 mm pipe plus 11 rings, R43,560.55; already posted.
VCINV074079 23, 45, 64, 71 Same VDN074616, 11 × 1050 mm pipe plus 36 rings, R43,560.55.
VCINV074143 25, 42, 62 Same VDN074673, 13 × 1050 mm pipe plus 13 rings, R51,480.65; already posted.

The signed delivery notes on pages 55 (VDN074597), 56 (VDN074673), and 72 (VDN074699) are distinct physical documents, linked respectively to invoices VCINV074063, VCINV074143, and VCINV074156. Their quantities are supporting evidence for one delivery apiece, not additional receipts. The invoice scans themselves are not automatically dismissed: some are copies with different handwritten markings, and an operator must retain the best source and confirm posting status.

After the reference corrections and cached batch rerun, the whole inbox has 61 Needs matching and 1 Ready to post active scans with document numbers. The earlier table below is a historical per-scan snapshot; it predates these three OCR corrections and the symmetrical alternate-reference gate. In particular, pages 29 and 43 are now in Needs matching, and page 36 is the sole Ready to post Vula scan. No additional goods were booked by this verification.

Snapshot after the Vula rematch and four one-page batch refreshes. The user initially saw 56 Needs matching scans. The current queue shows 59 Needs matching scans and 3 Ready to post. The count rose because first copies of repeated invoices are now held for comparison too; no extra goods were booked.

Root causes and changes

  • The Vula tax invoice imported as PO #MEGCP09109 was quarantined. The genuine order is MEGCPO9109. Four posted receipts were moved in one audited transaction; 46 pipe lengths are now 115 m at R1,584.02/m = R182,162.30 ex VAT. Thirty-two free rubber rings remain as raw unmatched lines with zero booked PO quantity.
  • Nine unposted Vula candidates received a corrected PO reference override and were rematched. The supplier export registration 21615145 is excluded from Vula document identity; zero candidates now block on it.
  • Leading/trailing hashes and the known MEGCP0 OCR prefix error resolve by a unique PO key. Fuzzy-nearest PO guesses no longer return items to the automated workflow.
  • All scans sharing one primary document reference are held for comparison, including the first scan. Unpriced unmatched lines and failed posted-ledger reads cannot silently pass as free/empty.
  • The read-only /api/purchase-orders/{id}/delivery-reconciliation endpoint reports grouped candidates and posted line quantities/values without adding candidates to totals.

Current queue by decision

  • Repeated scan — compare copies: 34
  • Already posted — compare source: 14
  • PO line decision: 5
  • PO missing or unresolved: 3
  • Ready for human posting: 3
  • Other checks / manual review: 3

Every active document scan

Page Document PO State Next issue
4 IN018888 #MEGCPO9256 PO line decision 1 need a product decision, 1 match no PO line
7 INA00005204 MEGCP09150 PO line decision 8 match no PO line
8 INV70963 — PO missing or unresolved no order number found on the slip
9 INV71060 — PO missing or unresolved no order number found on the slip
11 090005815 #MEGCPO9185 PO missing or unresolved no purchase order matches "#MEGCPO9185"
12 IRN010002024 #MEGCP09165 Repeated scan — compare copies BORN010000034 is also claimed by page 10 of this batch, which has not been posted — compare the two before posting either
16 22433700 MEGCP09239 Already posted — compare source 22433700 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
18 VCINV073799 #MEGCPO9109 Repeated scan — compare copies VCINV073799 is also scanned on pages 31, 70 of this batch — compare the copies and keep only one before posting
20 VCINV074057 #MEGCPO9109 Repeated scan — compare copies VCINV074057 is also scanned on pages 50, 53, 68 of this batch — compare the copies and keep only one before posting
21 VCINV074056 #MEGCPO9109 Already posted — compare source VCINV074056 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
22 VCINV074055 #MEGCPO9109 Repeated scan — compare copies VCINV074055 is also scanned on pages 48, 66 of this batch — compare the copies and keep only one before posting
23 VCINV074079 #MEGCPO9109 Repeated scan — compare copies VCINV074079 is also scanned on pages 45, 64, 71 of this batch — compare the copies and keep only one before posting
26 VCINV073832 #MEGCPO9109 Repeated scan — compare copies VCINV073832 is also scanned on pages 35, 41, 61 of this batch — compare the copies and keep only one before posting
27 VCINV073787 #MEGCPO9109 Already posted — compare source VCINV073787 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
28 VCINV073801 #MEGCPO9109 Repeated scan — compare copies VCINV073801 is also scanned on pages 33, 39, 59 of this batch — compare the copies and keep only one before posting
29 VCINV073900 #MEGCPO9109 Ready for human posting Checks passed; human posting decision
30 VCINV073802 #MEGCPO9109 Repeated scan — compare copies VCINV073802 is also scanned on pages 34, 37, 57 of this batch — compare the copies and keep only one before posting
31 VCINV073799 #MEGCPO9109 Repeated scan — compare copies VCINV073799 is also scanned on pages 18, 70 of this batch — compare the copies and keep only one before posting
32 VCINV073800 #MEGCPO9109 Repeated scan — compare copies VCINV073800 is also scanned on pages 38, 58 of this batch — compare the copies and keep only one before posting
33 VCINV073801 #MEGCPO9109 Repeated scan — compare copies VCINV073801 is also scanned on pages 28, 39, 59 of this batch — compare the copies and keep only one before posting
34 VCINV073802 #MEGCPO9109 Repeated scan — compare copies VCINV073802 is also scanned on pages 30, 37, 57 of this batch — compare the copies and keep only one before posting
35 VCINV073832 #MEGCPO9109 Repeated scan — compare copies VCINV073832 is also scanned on pages 26, 41, 61 of this batch — compare the copies and keep only one before posting
36 VCINV073935 #MEGCPO9109 Ready for human posting Checks passed; human posting decision
37 VCINV073802 #MEGCPO9109 Repeated scan — compare copies VCINV073802 is also scanned on pages 30, 34, 57 of this batch — compare the copies and keep only one before posting
38 VCINV073800 #MEGCPO9109 Repeated scan — compare copies VCINV073800 is also scanned on pages 32, 58 of this batch — compare the copies and keep only one before posting
39 VCINV073801 #MEGCPO9109 Repeated scan — compare copies VCINV073801 is also scanned on pages 28, 33, 59 of this batch — compare the copies and keep only one before posting
40 VCINV073787 #MEGCPO9109 Already posted — compare source VCINV073787 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
41 VCINV073832 #MEGCPO9109 Repeated scan — compare copies VCINV073832 is also scanned on pages 26, 35, 61 of this batch — compare the copies and keep only one before posting
42 VCINV074143 #MEGCPO9109 Already posted — compare source VCINV074143 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
43 VCINV074156 #MEGCPO9109 Ready for human posting Checks passed; human posting decision
44 VCINV074078 #MEGCPO9109 Already posted — compare source VCINV074078 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
45 VCINV074079 #MEGCPO9109 Repeated scan — compare copies VCINV074079 is also scanned on pages 23, 64, 71 of this batch — compare the copies and keep only one before posting
46 VCINV0746T7 #MEGCPO9109 Other checks / manual review Inspect candidate and batch state
47 VCINV074063 #MEGCPO9109 Other checks / manual review Inspect candidate and batch state
48 VCINV074055 #MEGCPO9109 Repeated scan — compare copies VCINV074055 is also scanned on pages 22, 66 of this batch — compare the copies and keep only one before posting
49 VCINV074056 #MEGCPO9109 Already posted — compare source VCINV074056 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
50 VCINV074057 #MEGCPO9109 Repeated scan — compare copies VCINV074057 is also scanned on pages 20, 53, 68 of this batch — compare the copies and keep only one before posting
51 VCINV074058 #MEGCPO9109 Already posted — compare source VCINV074058 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
53 VCINV074057 #MEGCPO9109 Repeated scan — compare copies VCINV074057 is also scanned on pages 20, 50, 68 of this batch — compare the copies and keep only one before posting
54 VCINV074058 #MEGCPO9109 Already posted — compare source VCINV074058 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
55 VDN074597 #MEGCPO9109 Repeated scan — compare copies 1 match no PO line
56 VDN074673 #MEGCPO9109 Repeated scan — compare copies 1 match no PO line
57 VCINV073802 #MEGCPO9109 Repeated scan — compare copies VCINV073802 is also scanned on pages 30, 34, 37 of this batch — compare the copies and keep only one before posting
58 VCINV073800 #MEGCPO9109 Repeated scan — compare copies VCINV073800 is also scanned on pages 32, 38 of this batch — compare the copies and keep only one before posting
59 VCINV073801 #MEGCPO9109 Repeated scan — compare copies VCINV073801 is also scanned on pages 28, 33, 39 of this batch — compare the copies and keep only one before posting
60 VCINV073787 #MEGCPO9109 Already posted — compare source VCINV073787 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
61 VCINV073832 #MEGCPO9109 Repeated scan — compare copies VCINV073832 is also scanned on pages 26, 35, 41 of this batch — compare the copies and keep only one before posting
62 VCINV074143 #MEGCPO9109 Already posted — compare source VCINV074143 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
63 VCINV074078 #MEGCPO9109 Already posted — compare source VCINV074078 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
64 VCINV074079 #MEGCPO9109 Repeated scan — compare copies VCINV074079 is also scanned on pages 23, 45, 71 of this batch — compare the copies and keep only one before posting
65 VCINV074077 #MEGCPO9109 Repeated scan — compare copies VDN074606 is also claimed by page 46 of this batch, which has not been posted — compare the two before posting either
66 VCINV074055 #MEGCPO9109 Repeated scan — compare copies VCINV074055 is also scanned on pages 22, 48 of this batch — compare the copies and keep only one before posting
67 VCINV074056 #MEGCPO9109 Already posted — compare source VCINV074056 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
68 VCINV074057 #MEGCPO9109 Repeated scan — compare copies VCINV074057 is also scanned on pages 20, 50, 53 of this batch — compare the copies and keep only one before posting
69 VCINV074058 #MEGCPO9109 Already posted — compare source VCINV074058 is already in delivery notes; the posted receipt has no supplier relation, so compare its source before posting another
70 VCINV073799 #MEGCPO9109 Repeated scan — compare copies VCINV073799 is also scanned on pages 18, 31 of this batch — compare the copies and keep only one before posting
71 VCINV074079 #MEGCPO9109 Repeated scan — compare copies cannot convert: RUBBER RINGS S & S 1050 DIA (ea → m)
72 VDN074699 #MEGCPO9109 Repeated scan — compare copies VDN074699 is also claimed by page 43 of this batch, which has not been posted — compare the two before posting either
1 DEL53312 MEGCPO9289 PO line decision 1 need a product decision
1 IO019079 MEGCPO9256 PO line decision 5 need a product decision, 3 match no PO line
1 LI513543 MEGCPO9366 Other checks / manual review Inspect candidate and batch state
1 T0255611 MEGCPO9323 PO line decision no line items read from the slip

Additional batch grouping work

Two older split-review batches contain 14 blank candidate/page records without a document number (13 pages in batch yv09sfps7nt3f1z, one in cksugz9n4mwhhfg). They are not part of the visible document queue. They require source-page classification or dismissal before any PO/quantity decision.

Review rule

Keep one verified source document for each genuine delivery. Compare repeated scans and invoice/delivery-note pairs against their attachments before dismissing a copy or posting a candidate. Do not add all scans' preview quantities together. Posted totals come only from delivery_note_items; possibleDoubleCountQuantity flags invoice/note overlap for review.