> ## Documentation Index
> Fetch the complete documentation index at: https://q.odontox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Numbering

> Configure automatic numbering formats for invoices, receipts, quotations, insurance claims, lab cases, prescriptions, and patient records.

# Document Numbering

The platform automatically assigns unique numbers to every financial and clinical document your clinic creates. You control the format — add prefixes, include dates, and set zero-padding to match your clinic's conventions or regulatory requirements.

<Note>
  **Admin only** — document numbering is configured in **Clinic Settings > Document Settings**.
</Note>

***

## Supported document types

You can configure independent numbering formats for each of these document types:

| Document Type       | Example Use                    |
| ------------------- | ------------------------------ |
| **Invoice**         | Patient billing documents      |
| **Receipt**         | Payment confirmation records   |
| **Quotation**       | Treatment cost estimates       |
| **Insurance Claim** | Insurer reimbursement requests |
| **Lab Case**        | Laboratory work orders         |
| **Prescription**    | Medication prescriptions       |
| **Patient**         | Medical record numbers (MRN)   |

Each document type has its own format configuration and its own independent sequence counter.

***

## Format tokens

Build your numbering format using these tokens:

| Token     | Description                              | Example Output        |
| --------- | ---------------------------------------- | --------------------- |
| `{SEQ}`   | Auto-incrementing sequence number        | `1`, `2`, `3`, ...    |
| `{SEQ:5}` | Sequence number, zero-padded to 5 digits | `00001`, `00002`, ... |
| `{YYYY}`  | Four-digit year                          | `2026`                |
| `{YY}`    | Two-digit year                           | `26`                  |
| `{MM}`    | Two-digit month                          | `04`                  |
| `{DD}`    | Two-digit day                            | `19`                  |

You can combine tokens with any prefix, suffix, or separator characters.

***

## Configuration

<Steps>
  ### Open Document Settings

  Navigate to **Clinic Settings > Document Settings**.

  ### Select the document type

  Choose which document type you want to configure (e.g., Invoice, Receipt).

  ### Enter your format

  Type your desired format using the tokens above. You can include any literal text as a prefix or suffix.

  ### Preview and save

  The system shows a preview of what the next generated number will look like. Once you are satisfied, click **Save**.
</Steps>

***

## Format examples

Here are some commonly used formats:

<AccordionGroup>
  <Accordion title="INV-{YYYY}{MM}-{SEQ:5}">
    **Output:** `INV-202604-00001`, `INV-202604-00002`, ...

    A popular choice for invoices — includes the year and month for easy sorting, with a zero-padded sequence for clean alignment.
  </Accordion>

  <Accordion title="REC-{SEQ}">
    **Output:** `REC-1`, `REC-2`, `REC-3`, ...

    A simple format for receipts with no padding or date component.
  </Accordion>

  <Accordion title="QT-{YYYY}-{SEQ:4}">
    **Output:** `QT-2026-0001`, `QT-2026-0002`, ...

    Quotation format with year and 4-digit zero-padded sequence.
  </Accordion>

  <Accordion title="MRN-{SEQ:6}">
    **Output:** `MRN-000001`, `MRN-000002`, ...

    Medical record number with a 6-digit padded sequence — useful for patient IDs.
  </Accordion>

  <Accordion title="CLM-{YYYY}{MM}{DD}-{SEQ:3}">
    **Output:** `CLM-20260419-001`, `CLM-20260419-002`, ...

    Insurance claim format with full date and 3-digit sequence.
  </Accordion>

  <Accordion title="RX/{YY}-{SEQ:4}">
    **Output:** `RX/26-0001`, `RX/26-0002`, ...

    Prescription format with a two-digit year and slash separator.
  </Accordion>
</AccordionGroup>

***

## How sequences work

### Independent per clinic

Every clinic has its own sequence counters. If your organization operates multiple clinics, each one maintains separate numbering — Clinic A's invoices start at 1 independently of Clinic B.

### Race-safe numbering

The system guarantees that **no duplicate numbers are ever generated**, even when multiple staff members create documents at the same time. Each number is assigned atomically, so concurrent invoice creation always produces unique, sequential numbers.

### Sequence continuity

The sequence counter increments continuously and does not reset automatically. If your format includes `{YYYY}` or `{MM}`, the date portion changes naturally, but the sequence itself keeps counting up.

<Tip>
  If you want a visual "reset" at the start of each year, include `{YYYY}` in your format. The sequence number will continue incrementing, but the year prefix makes it clear which year each document belongs to. For example: `INV-2025-00847`, then `INV-2026-00848`.
</Tip>

***

## Changing the format

You can update the numbering format at any time. When you do:

* **Existing documents** keep their current numbers — they are never retroactively renumbered.
* **New documents** use the updated format starting from the next sequence number.
* The sequence counter continues from where it left off.

<Warning>
  Changing the format mid-year can produce numbers that look inconsistent (e.g., some invoices with the old format and some with the new one). Plan format changes at natural boundaries like the start of a new year or fiscal period.
</Warning>

***

## Best practices

<CardGroup cols={2}>
  <Card title="Use zero-padding" icon="hashtag">
    Padding (e.g., `{SEQ:5}`) ensures your document numbers sort correctly in spreadsheets and file systems. Without padding, `INV-10` sorts before `INV-2`.
  </Card>

  <Card title="Include the year" icon="calendar">
    Adding `{YYYY}` to your format makes it easy to identify when a document was created and helps with annual record-keeping.
  </Card>

  <Card title="Keep it readable" icon="eye">
    Use clear separators (hyphens, slashes) between the prefix, date, and sequence. Avoid overly long formats that are hard to read or communicate verbally.
  </Card>

  <Card title="Plan for growth" icon="chart-line">
    If your clinic creates hundreds of documents per month, use at least 4-5 digits of padding to avoid running out of space.
  </Card>
</CardGroup>

***

<AccordionGroup>
  <Accordion title="Can I use different formats for the same document type across branches?">
    Yes. Each clinic configures its own formats independently. If your organization has multiple clinics, each one can use a different format for the same document type.
  </Accordion>

  <Accordion title="What happens if I delete the format?">
    Every document type must have a format configured. If no custom format is set, the system uses a default format (typically the document type abbreviation plus a simple sequence).
  </Accordion>

  <Accordion title="Can I include custom text in the format?">
    Yes. Any text outside of the `{...}` tokens is treated as literal text. For example, `ACME/INV-{SEQ:4}` would produce `ACME/INV-0001`.
  </Accordion>
</AccordionGroup>

***

## Related articles

* [Invoices](/finance/invoices) — invoice numbering in action
* [Receipts & Payments](/finance/receipts) — receipt numbering
* [Quotations](/finance/quotations) — quotation numbering
* [Insurance Claims](/finance/insurance-claims) — claim numbering
