Everyone

Invoice Numbering Scheme

How to configure the invoice number format, yearly resets, and zero-padding in Opterius Commerce.

Last updated 1776211200
  • How the Sequence Works
  • Changing the Prefix
  • Examples by Configuration
  • Related Topics
  • Where to Configure

    Go to Admin → Settings → Billing → Invoice Settings.

    The numbering scheme applies to all invoices system-wide. Changes take effect on the next invoice created — existing invoices keep their original numbers.

    Scheme Format

    Invoice numbers are assembled from three parts:

    {prefix}{year}-{sequence}
    

    Example: INV-2026-00042

    Part Example Setting
    Prefix INV- Invoice Prefix field
    Year 2026 Inserted automatically when Yearly Reset is enabled
    Sequence 00042 Zero-padded to the configured width

    If yearly reset is disabled, the year segment is omitted:

    INV-00042
    

    Configuration Fields

    Invoice Prefix

    A short text string prepended to every invoice number. Common choices:

    Prefix Result
    INV- INV-2026-00042
    ACME- ACME-2026-00042
    `` (blank) 2026-00042

    The prefix is free text — use letters, numbers, and hyphens. Avoid characters that break filenames (e.g. /, \, ?) since the number is used in PDF filenames.

    Yearly Reset

    When enabled, the sequence counter resets to 1 on January 1st of each year. This produces predictable per-year numbering and is required in some jurisdictions for accounting.

    [!IMPORTANT] The reset is triggered by the first invoice created after midnight on January 1st. If no invoices are created on that day, the reset happens on the first invoice of the new year whenever that occurs.

    When disabled, the sequence is a single ever-increasing number across all years.

    Zero-Padding Width

    Controls how many digits the sequence is padded to. A width of 5 means:

    Sequence value Displayed as
    1 00001
    42 00042
    1000 01000
    99999 99999
    100000 100000 (no truncation — pads but never clips)

    A width of 0 disables padding entirely: sequence 42 is shown as 42.

    Starting Number

    You can set the starting sequence number once, before any invoices exist. This is useful when migrating from another system and you want the new sequence to continue from where the old one left off.

    [!WARNING] Do not change the starting number after invoices have been created. The sequence is driven by a database counter — manually adjusting it can cause duplicate invoice numbers, which breaks accounting records. If you must change it, update the sequence in the database directly and verify no conflicts exist.

    How the Sequence Works

    The sequence uses a database-level atomic counter (auto-increment). This means:

    • Numbers are never reused, even if an invoice is cancelled
    • There are no gaps filled — a cancelled invoice leaves a gap in the sequence, which is normal and expected
    • Concurrent invoice creation is safe — two invoices created simultaneously will always receive different numbers

    [!TIP] Gaps in invoice numbers caused by cancelled invoices are normal. Auditors understand this. What matters is that numbers are unique and sequential — not that there are zero gaps.

    Changing the Prefix

    You can change the prefix at any time. The change applies to the next invoice only. Existing invoices retain their original number. If you rebrand (e.g. from INV- to ACME-), old invoices will still show the old prefix.

    Examples by Configuration

    Prefix Yearly Reset Padding Result
    INV- On 5 INV-2026-00042
    INV- Off 5 INV-00042
    SI- On 6 SI-2026-000042
    `` On 0 2026-42
    REC- Off 0 REC-42

    Related Topics