The Gaps in Your Invoice Numbers
Some organisations have jumps in their invoice numbering from before August 2026 — 41, then 58. The cause was a deliberate compensation for a database constraint, the compensation is gone, and the gaps have deliberately been left where they are.
A missing invoice number is one of the few things in accounting that looks like evidence of something. Usually it is evidence of a database index.
Document numbers here are issued per organisation, per document type, per year. Invoices, quotations, purchase orders, credit notes, till sales, till returns, assets, custodians and employees each have their own run, and each run restarts with the year. The number is taken inside a transaction with the sequence row locked, so two people saving at the same instant cannot receive the same number.
Why some organisations have jumps
Until August 2026, five of those nine types behaved differently: invoices, purchase orders, credit notes, till sales and till returns. For those, the search for the highest number already in use ignored which organisation was asking and scanned the whole table.
So a new invoice number was the greater of your own counter and the highest number anybody on the installation had reached, plus one. Your numbering could jump from 41 to 58 because another business had got to 57 — and nothing on your screen would ever say so.
It was not a bug, which is the part worth understanding
The database carried a single-column uniqueness constraint on each of those five number columns. On a shared installation that makes one number space for everybody: the second organisation to reach a given invoice number would have hit a constraint violation and failed to save. Scanning globally was the correct compensation for that schema. It bought a system that worked, at the price of numbering that skipped for reasons belonging to somebody else.
What changed, and why it was two changes
The fix was a migration and a code change, and they only work together. The migration replaced those five single-column constraints with composite ones covering the organisation and the number, so two businesses can hold the same invoice number without colliding. Only once that is true is it safe to narrow the search back to a single organisation.
-
Narrow the scan without the migration
And the constraint violation comes back: the second organisation to reach a number fails to save its invoice.
-
Run the migration without narrowing the scan
And the skipping continues with nothing requiring it — numbers still jumping for reasons that no longer exist.
-
Do both
Which is what happened. Numbering became genuinely per-organisation from that date, and stayed sequential from wherever each business had reached.
Two changes that are one change. Reverting either alone breaks something different.
The gaps were left alone on purpose
Nothing renumbered. The stored counter for each organisation was already sitting at the old high-water mark, so numbering carried on upward from there rather than reusing anything that had been issued. Existing jumps stayed exactly where they were.
That is the right call and it is worth defending, because the alternative sounds tidier and is much worse. Those numbers are printed on documents your customers hold. They are quoted in remittance advices, entered into your customers' purchase ledgers, referenced in credit notes and cited in payment reconciliations. Renumbering to close a gap would mean the invoice in your system and the invoice in your customer's filing cabinet disagree about what they are called — and it would do that silently, across every historical document, to make a sequence look neater.
| Option | What it costs |
|---|---|
| Renumber to close the gaps | Every issued document disagrees with the copy the customer holds. Reconciliation breaks retroactively. |
| Reuse the skipped numbers going forward | Numbers appear out of chronological order, which is worse to explain to an auditor than a gap. |
| Leave them and be able to explain them | A gap in the sequence, and a reason for it. What actually happened. |
How to explain a gap if you are asked
The question comes up in audits because a missing invoice number can indicate a suppressed sale. The honest answer here is specific and checkable: numbering was generated against a shared sequence until August 2026, so numbers issued to this organisation skipped where another organisation on the same installation had reached a higher number. No document was issued and deleted; the number was never allocated to anything.
What supports that answer is that nothing in the system deletes an invoice out of the sequence. An invoice that should not stand is cancelled or credited, and both leave the original document in place with its number intact. So a gap is a number that was never used, and every number that was used still has a document attached to it.
What the sequence key does and does not contain
Organisation, document type and year. Not branch, not site, not user. Ten locations issuing invoices share one run of numbers, so invoice 000412 is the four hundred and twelfth invoice your organisation issued this year rather than the four hundred and twelfth from that shop. For a single-site business that is invisible; for a multi-site one it is a decision worth knowing you have made.
What AWRA OpsHub does today
- Sequential numbering per organisation, per document type and per year, across nine document types — invoices, quotations, purchase orders, credit notes, till sales, till returns, assets, custodians and employees.
- A locked sequence row inside a transaction, so two documents created at the same instant cannot take the same number.
- A next number taken as the greater of the stored counter and the highest number actually present, so a sequence cannot reissue a number that already exists on a document.
- A race-safe creation of a new year's sequence row, where a simultaneous first document of the year does not fail.
- Composite uniqueness on organisation and number, so two businesses on one installation can hold the same invoice number without colliding.
- Numbering scoped to the organisation since August 2026, so a number no longer moves for reasons belonging to somebody else's business.
- Historical numbers left exactly as issued, because they are printed on documents customers hold.
- Zero padding and a per-type prefix, so a number is readable and sorts correctly.
More we can add to your workspace
- A branch or site segment in the sequence key, so each location can run its own numbering rather than sharing one organisation-wide run.
- A skipped-number report per document type, listing the numbers never issued in a period, so a question from an auditor is answered from a screen rather than from a spreadsheet.
- A stated reason recorded against a historical skip, attached to the sequence rather than kept in somebody's memory of a migration.
- Configurable sequence formats per organisation — segment order, padding width, a separator — for businesses with an existing numbering convention.
- A sequence that continues across the year boundary for organisations whose numbering is not annual.
- A preview of the next number on the document form, before it is saved.
Where we point you to a specialist
- We will not renumber issued documents to tidy a sequence. Those numbers are printed on paperwork your customers hold and quoted in their own ledgers, and quietly changing them would make your records and theirs disagree about what a document is called. A skipped number you can explain beats a sequence you cannot reconcile.
- We will not reuse a skipped number. Slotting one in later puts documents out of chronological order within the sequence, which is a harder thing to explain to an auditor than the skip it was meant to tidy away.
- What your tax authority requires of invoice numbering — whether a skipped number is acceptable, whether sequences must be unbroken, whether a fiscal device governs the number at all — is a question for your tax adviser in your jurisdiction. We will produce whatever sequence they specify, and the interpretation stays theirs.
A skipped-number report is the most useful small piece here: the data is already complete, and it turns an audit question into a screen rather than an exercise.
Numbering that fits how you are organised
The sequence machinery is sound and safe under concurrency. What organisations ask for is a different key and a way to answer questions about it.
A branch segment
Numbering per site as well as per organisation, so each location has its own run and a number identifies where it came from.
A skipped-number report
Which numbers in a period were never issued, per document type, produced from the sequence rather than reconstructed.
Configurable formats
Segment order, padding and separators per organisation, for businesses carrying a numbering convention from a previous system.
We publish scope, not dates.
Scope document numberingOur take
The most interesting thing about this episode is that the original behaviour was correct for the schema it lived in, and was still wrong for the businesses using it. That combination is common and it is the hardest kind of defect to argue about, because everybody involved can point at something that justifies the code. What resolved it was changing the constraint that made the compensation necessary, and doing both halves in one move. The gaps that remain are a permanent, honest artefact — a number never allocated to anything, on a sequence that has since been scoped properly. If an auditor asks, the answer is specific and it is checkable, and that is a better position than a tidy sequence that nobody can account for.
Five questions to ask about document numbering
What is the sequence keyed on?
A good answer sounds like
A named key.
What ours actually is
Organisation, document type and year. No branch segment.
Can two documents get the same number?
A good answer sounds like
No, with the mechanism named.
What ours actually is
No. The sequence row is locked inside a transaction, and the next value is the greater of the counter and the highest number present.
Do numbers ever skip?
A good answer sounds like
An honest answer with a reason.
What ours actually is
Not since August 2026. Before that, five document types drew from a shared installation-wide high-water mark, and those historical gaps remain.
Would you renumber to close a gap?
A good answer sounds like
No.
What ours actually is
No. Those numbers are on documents customers hold, and changing them would make two sets of records disagree silently.
What happens to a cancelled invoice's number?
A good answer sounds like
It stays used.
What ours actually is
It stays used. Cancellation and credit both leave the original document and its number in place, so every issued number still has a document behind it.
If you are preparing for an audit, ask about your gaps first
A jump in an invoice sequence is a five-minute conversation if you know why it is there and a much longer one if you do not. We can tell you which of your document types are affected and over what period.
Talk through numberingFrequently asked questions
Do we have gaps in our invoice numbers?
Only if your organisation was issuing invoices, purchase orders, credit notes, till sales or till returns before August 2026, and only where another organisation on the same installation had reached a higher number than you. Quotations, assets, custodians and employee numbers were never affected, because those four types always scanned within the organisation.
Could a gap mean an invoice was deleted?
Not through the ordinary paths. An invoice that should not stand is cancelled or credited, and both leave the original document in place with its number intact — which is precisely why they exist. So a number missing from the sequence is a number that was never allocated to anything, rather than a document that was removed.
Why not just renumber the old documents?
Because those numbers are printed on paperwork your customers hold, quoted in their purchase ledgers, and referenced in remittances and credit notes. Renumbering would make your records and theirs disagree about what a document is called, silently, across every historical document — to make a sequence look neater. A gap with an explanation is a much better position.
Can each of our branches have its own numbering?
Not today. The sequence key is organisation, document type and year, so ten locations share one run and invoice 000412 is your organisation's four hundred and twelfth this year rather than that shop's. A branch segment is the change that separates them and it is the most-requested item on this list.
What happens on the first of January?
A new sequence row is created for the new year and numbering restarts, per document type. The creation is race-safe, so two people issuing the first document of the year at the same moment do not collide — one creates the row, the other finds it and takes the next number.
Does the system guarantee an unbroken sequence going forward?
It issues numbers sequentially and never reuses one, and since the scoping change nothing external moves your counter. What no system can promise is that a number issued is a number saved — a document abandoned after its number was taken leaves that number unused. Whether an unbroken sequence is required of you is a question for your tax adviser, and the answer varies more between jurisdictions than most people expect.