PO numbers allocated per business

Each order gets the next PO number for that business, with a database index as the backstop against collisions.

What it is

The next number is derived by scanning the most recent PO numbers for the org and incrementing the highest trailing digits, starting at PO-1001. A unique index rejects a duplicate insert if two are allocated at the same moment; the caller retries.

Also called: PO number · purchase order numbering · next PO

See it
PO numbers allocated per business
Area
Operations
Group
Purchasing
System
Supplier Order Lifecycle
Solves
2 named problems
01nextPoNumber reads the 50 most recent po_number values for the org
02The trailing digits are parsed and the maximum incremented
03The same logic runs server-side in /api/orders/send
The PO Number field showing its 'Auto-generated' placeholder, and the resulting PO-1042 in the workspace header. OrderModals.tsx / supplierOrders.nextPoNumber. Sample data — no customer information appears here.
How it works
  1. 1nextPoNumber reads the 50 most recent po_number values for the org
  2. 2The trailing digits are parsed and the maximum incremented
  3. 3The same logic runs server-side in /api/orders/send
  4. 4The comment is explicit about the trade-off: 'Race-condition tolerant… For real concurrency a sequence would be better, but for typical solo/small-team usage this is fine.'
Why we built it

A PO number is what a supplier quotes back on their invoice and their delivery note. It has to be predictable, per-business, and never silently duplicated — hence the database-level backstop rather than trusting the read.

The problem
  • Hand-typed PO numbers repeat
  • Numbers shared across businesses collide
Sound familiar?
What you get
A number the supplier can reference
Duplicates rejected at the database, not hoped against

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 →