Party codes
Every customer, business partner, employee and supplier has a permanent code, given by the system. Quote it on the phone, put it on a spreadsheet, type it into a search box.
Rules: 21 · Parties and their codes (PTY-001 … PTY-006).
| Party | Code | Example | Where it is kept |
|---|---|---|---|
| Customer / traveller | CU- and six digits |
CU-000123 |
Customer.customerCode |
| Business partner | BP- and four digits |
BP-0012 |
Agent.partnerCode |
| Employee | EM- and four digits |
EM-0007 |
EmployeeProfile.employeeCode |
| Supplier | SU- and four digits |
SU-0005 |
Supplier.supplierCode |
- The code is given when the record is made. Nobody types it and nobody can change it. A change is refused: "Customer code CU-000123 is permanent and cannot be changed" (PTY-002).
- Numbers grow past their width: after
BP-9999comesBP-10000. - A deleted record keeps its code; a code is never given to anyone else.
- Records made before 27 Sep 2026 were numbered oldest first.
- An employee code typed by hand before 27 Sep 2026 was kept as it was. Every staff login has a code: the profile is made, empty, when a login gets its first staff role (PTY-003). A partner's or a traveller's login that leads a departure is not an employee and has no employee code.
- Booking numbers (
BK-00001) and group codes are not party codes and did not change.
Where the code is shown
Web
| Screen | What shows |
|---|---|
Customers list (/sales/customers), its profile sheet and view dialog |
the customer code beside the name |
Customer 360 (/customers/:id) |
the code in the header |
Partners list (/agents) |
the partner code beside the agency name |
Partner record (/partners/:id) |
the code in the header and the details |
Employees (/people/employees) |
the employee code beside the name |
Employee record (/admin/users/:id) |
the code in the header and the details; the profile form shows it read-only |
My profile (/me) |
a member of staff sees their employee code; a partner sees their partner code, to quote to the office |
Suppliers list (/suppliers) and supplier page (/suppliers/:id) |
the supplier code beside the name |
Booking page (/sales/bookings/:id) |
the customer's, the payer's and the partner's codes |
Bookings list (/sales/bookings) |
the customer code on the row; the customer's, payer's and partner's codes when a row is opened |
| Group invoice (Groups → Invoices) | the payer's code beside the payer's name |
Phone layout (/m/customers) |
the customer code |
| Finance ledger browser | customers, partners and suppliers with their codes |
Printed documents
| Document | What shows |
|---|---|
| Booking invoice | the customer's, the payer's and the partner's codes beside their names |
| Group invoice | the payer's code beside the payer's name |
| E-ticket sheet and hotel voucher (issued as files) | "Booked through Crescent Tours (BP-0012)" |
| Vouchers and receipts | the party ledger's name, which carries the code (PTY-004) |
| Statements | the party's name with its code |
Not built: the partner portal's invoice list and its printout (/partner/invoices) do not
show codes yet.
The Alhuda Travels app
| Screen | What shows |
|---|---|
| Partner home and More | "Your partner code BP-0012", selectable to copy |
| My profile | the partner code (partners), the employee code (staff) |
| The traveller's own profile | "Your customer code" |
| Staff: users list and a user | the employee code |
| Staff: partners list and a partner | the partner code |
| Staff: bookings list and a booking | the customer and partner codes |
| Staff: suppliers list and a supplier | the supplier code |
| Staff: customers list and a customer | the customer code; on the customer, tap it to copy (PTY-007) |
| Staff: Find | the customer and partner codes on each result |
Search by code
Type the exact code into the search box:
| List | How it matches |
|---|---|
| Customers list (web and phone layout) | in the database, customers_list_page (and the fallback read) |
| Partners list | in the browser, over every partner row |
| Employees | in the browser, over every login row |
| Suppliers list | in the browser |
| Staff app: users, partners, suppliers | admin_users_list in the database; the partners and suppliers lists in the app |
| Staff app: customers, partners, Find | customers_list_page and the Agent read; the app pads a short code first, so cu123 finds CU-000123 and bp12 finds BP-0012 (PTY-007) |
| Finance: ledger browser, chart of accounts, party pickers | the ledger's name, which carries the code |
Not built: the bookings list does not find a booking by its customer's or partner's code. Search the customer or partner by code, then open their bookings. There is no global search box in the ERP; the staff app has one (Find, native app).
The booking import
The Excel booking import (Bookings → Import) has two code columns (PTY-005):
- Partner code (
BP-0012) on the first row of a booking names the partner. The olderagentIdandagentEmailcolumns still work. If a row has a partner code and anagentIdoragentEmailthat names a different partner, the booking is refused. - Customer code (
CU-000123, optional) on a passenger's row books that existing customer instead of making a new one. A code that does not exist is an error on that row, naming the code. So is a code whose customer has a different passport number.
The template and its Instructions sheet explain both. The import reads only the codes the
sheet names (src/services/partyCodeService.ts), under the same access rules as the
partners and customers lists.
Finance
The ledger account codes did not change: CUS-, AGR-, AGP- and SUP- with the first
eight characters of the internal id. Only the ledger's display name carries the party code.
See Chart of accounts and
PTY-004.
Where to look
- Migration:
supabase/migrations/20261001100000_every_party_has_a_code.sql - Test:
supabase/tests/every_party_has_a_code.sql - Browser helpers:
src/lib/partyCode.ts; import:src/services/bookingImportService.ts,src/services/partyCodeService.ts(testsrc/services/bookingImportService.test.ts) - App helper:
apps/mobile/src/lib/partyCode.ts