Articles

Invoice numbering: the small decision that breaks an audit

A gap in the sequence is the first thing an auditor asks about. One contiguous series per document type, cancel instead of delete.

By Anes Hamdaoui6 min read
  • numbering
  • invoicing
  • operations
All articles

A document number is the identity of the record, not a label on a page, and a hole in the sequence is a question that arrives before anyone has read a line. The rules are unglamorous: one contiguous series per document type, cancelled documents kept and marked rather than deleted, credit notes in a series of their own. A business that needs none of this is one never asked to produce a document on demand.

Should the number be a running count, or should it mean something?

Contiguous. A number carrying meaning — customer code, month, branch, type — has to be decoded by everyone who reads it, and the decoding is a rule nobody wrote down. The year in the prefix is the usual version: it looks like free information and turns into a liability the first time a December delivery is invoiced in January.

A contiguous number, with date, branch and type in their own fields, says the same without baking an assumption into the identity. In an interchange format such as UBL 2.1 the invoice number is a field of its own because it is an identifier, not a summary of the document.

Question Contiguous Meaningful
What a reader gets The order of issue Date, branch, type, sometimes the customer
What breaks Nothing when a field changes Any backdated or reissued document
What it costs One lookup A decoding rule everyone must remember

Who decides the numbering rule?

Your accountant, or your auditor, or the format the tax administration imposes. Not the developer, and not the software's default.

The rule is an assertion about how the books are kept, so the person who signs the accounts is the one who must defend the sequence. Ask for it in writing, on one page: which document types are numbered, who may issue a number, whether a series may skip, what happens when a document is wrong. A system that invents its own convention has made an accounting decision by accident, and the person left explaining it is not the one who made it.

What happens to an invoice you cancel?

It stays in the sequence, marked cancelled, with who cancelled it, when and why. Never deleted, and its number never given to another document.

Delete one and you create a gap indistinguishable from one lost, withheld or never recorded — the three possibilities an auditor is paid to separate. A cancellation is a legible answer to "where is number 41"; a deletion is not. Whether a wrong invoice is cancelled and reissued or adjusted by credit note is your accountant's call. Deleting it is not a decision anyone gets to make.

Do credit notes get their own series?

Yes: their own series, their own prefix, and a reference to the invoice they correct. The same goes for delivery notes, purchase orders and receipts — one series per document type.

The reason is arithmetic. A sequence mixing invoices and credit notes cannot be summed or checked for completeness; its total is a number nobody uses. When an auditor asks for the invoices of a period, the answer has to be a range, and a range only means something inside one series.

What if two branches issue from the same series?

Then two counters eventually produce the same number twice, and the collision surfaces months later as two documents claiming one identity. Decide before the second branch opens.

Two answers work. One central series, where the system allocates the next number and no branch keeps a counter. Or a series per branch, with the branch inside the series key, so the number is unique only within its series. The failure is two independent counters wearing the same prefix.

Either way, make the identity a compound key in the database — series and number, with a uniqueness constraint the application cannot bypass; a check in application code has a race condition, a constraint does not. Retrofitting is expensive, because renumbering a document already printed and filed breaks every reference to it.

How do you import old documents without inventing numbers?

Keep the old numbers exactly as they are, and record where they came from.

Renumbering history cannot be undone: the invoice a customer holds no longer matches the record you produce, and every statement citing it becomes unverifiable. Import old documents under a legacy series, keep the original number in its own field, and store the source system alongside.

A document that never had a number — a handwritten slip, a supplier's unnumbered note — arrives with an empty number and a note saying so. Inventing one produces a record that looks issued when it was not, worse than a visible gap. And do not merge ranges: start the new series above the highest old number, or keep them visibly apart. The proof that the import worked is a count: documents per old series, before and after, must match.

The order to do this in

  1. Get the rule in writing from the accountant: which documents are numbered, who issues the number, whether a series may skip.
  2. List every numbered document type — invoice, credit note, delivery note, purchase order, receipt — each with its own series.
  3. Choose contiguous numbering, and move date, branch and type into their own fields.
  4. Decide the cancellation rule: a status, a reason, a name, a timestamp; nothing deleted by anyone.
  5. Make series plus number the identity, unique in the database, not in the form.
  6. Write the import rule before the first import, not during it.
  7. Add one report nobody has to ask for: a count per series per month, with gaps listed and explained.

Where this goes wrong

  • The test invoice is deleted. The first document is usually a test, so the series starts at 2, and years later the hole needs a story.
  • The number is generated in the browser or at print time. Two tills or a retried request produce duplicates that surface as two customers holding one number.
  • The prefix field is editable. Once a human can type it, INV-2025, INV-25 and inv-2025 become three series, and the report counting them is quietly wrong.
  • A gap is "fixed" by reusing the number. Two documents then share one identity, worse than the hole it closed.

What this does not cover

This is about identity and sequence, not retention periods, the format a tax administration requires, or electronic invoice interchange — all three depend on your jurisdiction and on your accountant's reading of it. Nor is it about internal documents: a picking slip can follow any scheme that helps the people using it. And it assumes a single issuer; a group issuing from several legal entities needs a series per entity, again the accountant's question.

We build the numbering layer around a rule your accountant states: one series per document type, a number committed before the document is shown, and a gap report that arrives before the auditor asks for one.

Services in this article

Start a project

Have something to build?

One short brief is enough. You get a written scope and a fixed quote before anything starts.