Skip to content

Let the invoice number counter start at a chosen number - #193

Merged
kittendevv merged 1 commit into
kittendevv:mainfrom
Bouni:feat/invoice-number-start
Nov 25, 2026
Merged

kittendevv merged 1 commit into
kittendevv:mainfrom
Bouni:feat/invoice-number-start

Conversation

@Bouni

@Bouni Bouni commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #190

Adds a "Start counter at" setting under Settings → Numbering. The next {SEQ} number (and the legacy PREFIX-YYYY-NNN number) is never lower than this value. This allows starting a new number range, e.g. 1000000001 for a second location as described in #152, or continuing from numbers issued by previous billing software.

  • The next number is max(highest existing + 1, start), so lowering the start later never goes backwards or reuses an existing number.
  • {CSEQ} (per-customer counter) is not affected.
  • Empty, zero, negative or non-numeric values mean the default start of 1.

Changes

  • backend/src/database/init.ts: read invoiceNumberStart, apply it to {SEQ} and legacy numbering (parseNumberStart, nextCounterValue).
  • frontend/src/routes/settings/+page.svelte: "Start counter at" field with a short explanation.
  • Translations for the two new strings in all locales.

Verification

  • New backend/src/database/numbering_test.ts (5 tests): parsing, never going below the start or backwards, {SEQ} starting at 1000000001 and continuing, legacy numbering, default start of 1.
  • Other backend tests pass, deno check and svelte-check have no errors.
  • On a fresh instance built from this branch: pattern BG-{SEQ} with start 1000000001 shows BG-1000000001 in the new-invoice form, and the setting survives a reload.

Note: this touches the same numbering code as #192, so whichever is merged second needs a small conflict resolution.

🤖 Generated with Claude Code

Adds a "Start counter at" setting under Numbering. The next {SEQ}
number (and the legacy PREFIX-YYYY-NNN number) is never lower than this
value, so a new number range can begin at e.g. 1000000001, or numbering
can continue from previous billing software. The counter still never
goes backwards or reuses an existing number when the start is lowered.
{CSEQ} (per-customer counter) is not affected.

Closes kittendevv#190

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Bouni Bouni mentioned this pull request Nov 20, 2026
@kittendevv
kittendevv merged commit 6dc8833 into kittendevv:main Nov 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invoice numbering: configurable starting number for the counter

2 participants