arrow_backAll work

Inbound Control

Reads supplier packing slips and checks every line against the purchase order.

Context
Internal tool · The Branding Club
Year
2026
Role
Rebuilt from a prototype: design & development
Stack
Cloudflare WorkersSupabaseClaude APIMetabaseVanilla JS

sciencePick a sample slip and watch it being read and matched. Resolve the red lines (a slip line without a reference, cartons instead of pieces, a lid in the wrong size), save, then make a decision under To decide and open the supplier dossier. Everything in this demo is dummy data.

open_in_fullFull screen
lockinbound-control.demo

Inbound Control compares what we bought with what actually came off the truck and with what the supplier invoices. Purchasing and finance use it to see per line, and per supplier, where we receive too much or too little and who should pay for the difference.

The problem

Our ERP marks a purchase line as fully delivered the moment goods come in, so the packing slip was the only real record of what arrived. Nobody compared slips with orders line by line. Over-deliveries that could have been invoiced to the member were absorbed, short deliveries were paid in full, and whether a supplier over-delivers as a habit was a gut feeling. The first version was a prototype on one laptop with a CSV as its database.

The approach

I rebuilt it as a Cloudflare Worker with Supabase for the register, the documents and an append-only audit log. A slip comes in as a PDF, a phone photo (shrunk in the browser first, so small digits stay readable) or a spreadsheet, and one AI call turns it into lines. The matching engine then cleans up references that suppliers print creatively, repairs single-character OCR errors, and falls back to member name, article words and quantity, trying common carton sizes, when there is no reference at all. Each line gets a status from the tolerance rules for its country, and every decision (invoice the member, claim the supplier, dispute, accept) needs a note and is logged.

Highlights

  • checkA JavaScript port of Python's difflib.SequenceMatcher, equal to the original to six decimals, so the prototype's tuned thresholds still hold
  • checkGuards against the expensive mistakes: cartons read as pieces, a duplicate slip, an order line that was already completed
  • checkSupplier dossier that shows patterns: structurally over, under or on target, with the reasons logged at goods receipt
  • checkThree-way check of ordered, delivered and invoiced, and a disputed line keeps the supplier invoice out of the weekly payment run
  • checkFed from three sides: uploads, a batch queue for hundreds of scans, and goods-receipt counts from the warehouse app