# Document references

New customer advances, payroll runs, purchase requisitions, LPOs, sales orders,
website food orders and website room bookings use short sequential references:

| Document | Example |
| --- | --- |
| Customer advance | ADV0056 |
| Payroll | PAY0001 |
| Purchase requisition | REQ0001 |
| Purchase order | LPO0001 |
| Sales order | SO0001 |
| Website food order | FO0001 |
| Website booking | WB0001 |

Each document type has its own counter, shared across branches and computers.
Counters start beyond existing IDs and matching numeric references; they do not
restart every day, month or year. Four digits is a minimum, not a limit.
Requisitions use REQ to distinguish them from purchase returns (PR).

Existing references, including long references already printed or posted to
accounting, remain unchanged. Internal request UUIDs, website retry identifiers,
API keys, station credentials and licence/security identifiers are not shortened.
Other modules already using readable numbered references retain their format.

Advance payments have separate Date and Ref. columns. The search accepts a
reference as well as customer name or phone. The advance reference on the receipt,
activity log and journal remains the same as the reference on the list.
Bank and M-Pesa payment references entered by users are not changed.

Deployment requires the updated code and migration:

```text
php artisan migrate --force
php artisan view:clear
```

Migration `2026_10_11_120000_create_document_reference_sequences` adds only the
counter table. It does not rename documents or change transactions or balances.
Keep this table in database backups. Do not manually reset its counters.
