The shape of it
- You open a counter purchase order, or reach the order screen from a stock list. The app asks the engine for the next number and shows it, so you can write it on the paperwork at the counter.
- The engine hands numbers out one at a time. Two people opening a sheet in the same second get two different numbers. A number is the letters PO followed by the count.
- You save, and the number is stored with the order.
- You close a counter purchase order without saving, and the app hands the number back. The engine takes a number back only if it is still the newest one handed out and no saved order carries it. Otherwise the number stays used.
- A stocking order screen you leave without sending does not hand its number back. Deleting a saved order does not either.
Why it works this way
- The number is ready before saving because the supplier needs it on the paper before the order is placed.
- Stocking orders and counter purchase orders share one sequence so there is one series to look up.
- Only the newest number can go back, because handing back an older one could give two orders the same number.
What can go wrong
- Gaps. A number handed out and never used leaves a gap in the series. Gaps are harmless; what matters is that no number repeats, and the sequence never repeats one.