NUM · Document numbers
Contracts (PKS), BASTK, debt letters (surat hutang) and insurance claim codes take their number from one locking function, app.next_document_number(org, entity, kind, period), which counts in document_sequences. Code NUM.
Not yet a rule
Section titled “Not yet a rule”These questions are open in #73. Each gets a rule with a new ID once it is answered.
- NUM open 1 · Surat hutang period
- NUM open 2 · Formats
- Number formats: OQ6 (#32)
R-NUM-01 · Two saves at the same moment never get the same document number
Section titled “R-NUM-01 · Two saves at the same moment never get the same document number”- Status: planned
- Example: given two checkers saving a BASTK for legal entity TOP in the same second, when both ask for the next number, then one gets 0041 and the other 0042.
- Refusal: none: the second call waits for the first.
- Who: every caller of app.next_document_number().
- Source: D9 (P12).
R-NUM-02 · Contracts, BASTK and debt letters (surat hutang) are numbered per legal entity
Section titled “R-NUM-02 · Contracts, BASTK and debt letters (surat hutang) are numbered per legal entity”- Status: planned
- Example: given TOP's last contract of 2026 is 0120 and MOP's is 0045, when MOP signs a contract, then it gets 0046 and TOP's counter stays at 0120.
- Refusal: none.
- Who: every caller of app.next_document_number().
- Source: D9 (Q6); the M0 acceptance checks.
R-NUM-03 · Insurance claim codes are numbered per organization, not per legal entity
Section titled “R-NUM-03 · Insurance claim codes are numbered per organization, not per legal entity”- Status: planned
- Example: given claims filed for a TOP car and then a MOP car, when each takes a code, then they come from one counter with no legal entity, in sequence.
- Refusal: none.
- Who: every caller of app.next_document_number().
- Source: D9 (Q6); the M0 acceptance checks.
R-NUM-04 · A BASTK takes its legal entity from its rental's contract
Section titled “R-NUM-04 · A BASTK takes its legal entity from its rental's contract”- Status: planned
- Example: given a rental whose contract is signed by MOP, when its handover BASTK is numbered, then MOP's counter is used.
- Refusal: none.
- Who: the handover and return functions.
- Source: D9 (Q6).
R-NUM-05 · Contract numbers restart each year
Section titled “R-NUM-05 · Contract numbers restart each year”- Status: planned
- Example: given TOP's last contract of 2026 is 0120, when TOP signs its first contract of 2027, then it is number 1 of period 2027.
- Refusal: none.
- Who: the booking and renewal functions.
- Source: [Ref] Database rules and conventions, Document numbers (contract: per legal entity, per year).
R-NUM-06 · BASTK numbers restart each month
Section titled “R-NUM-06 · BASTK numbers restart each month”- Status: planned
- Example: given TOP's last BASTK of October 2026 is 0310, when the first BASTK of November is numbered, then it is number 1 of period 2026-11.
- Refusal: none.
- Who: the handover and return functions.
- Source: [Ref] Database rules and conventions, Document numbers (BASTK: per month).
R-NUM-07 · Insurance claim codes restart each year
Section titled “R-NUM-07 · Insurance claim codes restart each year”- Status: planned
- Example: given the last claim code of 2026 is 0057, when the first claim of 2027 is filed, then it is number 1 of period 2027.
- Refusal: none.
- Who: the claim function.
- Source: [Ref] Database rules and conventions, Document numbers (insurance claim code: per year).
R-NUM-08 · App users can't read or write the number counters
Section titled “R-NUM-08 · App users can't read or write the number counters”- Status: planned
- Example: given a super_admin, when she reads document_sequences, then no row comes back, and an update to last_no changes nothing.
- Refusal: none: hidden on read; no effect on update.
- Who: every app user, super_admin included. Only app.next_document_number() writes them.
- Source: D9 (P12); [Ref] Roles, policy matrix; the M0 acceptance checks.
R-NUM-09 · A user can't take a number from another organization's counter
Section titled “R-NUM-09 · A user can't take a number from another organization's counter”- Status: planned
- Example: given an admin of organization A, when she calls app.next_document_number() for organization B, then it is refused and B's counter doesn't move.
- Refusal: access.not_member
- Who: every signed-in user.
- Source: the M0 acceptance checks; D9 (P2, P3).