Repository navigation
Let the invoice number counter start at a chosen number - #193
Merged
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #190
Adds a "Start counter at" setting under Settings → Numbering. The next
{SEQ}number (and the legacyPREFIX-YYYY-NNNnumber) is never lower than this value. This allows starting a new number range, e.g.1000000001for a second location as described in #152, or continuing from numbers issued by previous billing software.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.Changes
backend/src/database/init.ts: readinvoiceNumberStart, apply it to{SEQ}and legacy numbering (parseNumberStart,nextCounterValue).frontend/src/routes/settings/+page.svelte: "Start counter at" field with a short explanation.Verification
backend/src/database/numbering_test.ts(5 tests): parsing, never going below the start or backwards,{SEQ}starting at1000000001and continuing, legacy numbering, default start of 1.deno checkandsvelte-checkhave no errors.BG-{SEQ}with start1000000001showsBG-1000000001in 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