Skip to content

Configure Invoice/Quote etc Numbering Format in Company Settings #793

Description

@nielsdrost7

SMART Plan — Configure Invoice Numbering Format in Company Settings

refs #236

Specific

A Select field (and possibly TextInput for custom format) labelled "Invoice Numbering Scheme" in the Invoices tab of the Company Settings page (Modules/Core/Filament/Company/Pages/CompanySettings.php). Allows selection of an existing Numbering scheme or creation of a company-specific one. The selected numbering scheme is applied when generating new invoice numbers for this company.

Measurable

  • The field appears in the Invoices section of the Company Settings page
  • The field shows available Numbering records filtered by type (NumberingType::INVOICE)
  • Saving the form persists the selection to link the company to the chosen Numbering record
  • New invoices created for this company use the selected numbering scheme to generate invoice numbers
  • Invoice numbers follow the configured format (e.g., INV-2026-001 based on format tokens)

Achievable

  1. Add a Select::make('numbering_id')->relationship('numbering', 'name')->label('Invoice Numbering Scheme') field to the Invoices tab in CompanySettings.php
  2. Add numbering() BelongsTo relationship to the Company model if not already present
  3. Filter the select to show only Numbering records where type = NumberingType::INVOICE
  4. Add Setting::KEY_NUMBERING_ID = 'numbering_id' constant to Modules/Core/Models/Setting.php
  5. Update invoice creation logic to use the company's selected numbering scheme

Relevant

The invoice numbering format feature (Modules/Core/Models/Numbering.php, NumberingService.php) already exists and handles format tokens ({{prefix}}, {{number}}, {{year}}, {{month}}, etc.), but there's no UI in the company settings to configure which numbering scheme each company uses. This bridges that gap, giving company admins control over their invoice numbering format.

Time-bound

Small to Medium — reuses existing Numbering model and relationship patterns. Primary work is adding the Filament form field and ensuring the selected scheme is applied during invoice creation.


Implementation Notes

Code references:

  • Numbering model: Modules/Core/Models/Numbering.php
  • Numbering service: Modules/Core/Services/NumberingService.php
  • Numbering types enum: Modules/Core/Enums/NumberingType.php
  • Company settings page: Modules/Core/Filament/Company/Pages/CompanySettings.php
  • Company model: Modules/Core/Models/Company.php
  • Existing admin numbering UI: Modules/Core/Filament/Admin/Resources/Numberings/

Related issues:

Test Plan

  • CompanySettingsTest: Save and reload company's selected numbering scheme
  • CompanySettingsTest: New invoice uses the selected company numbering scheme
  • CompanySettingsTest: Multi-tenancy — different companies can have different numbering schemes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions