Overview
Order Update allows authorized lab staff to modify an existing patient order across billing, payments, ledger, doctor revenue, appointments, and search — all within a single atomic transaction.
Order Update
Order Update (internally called Bill Update) allows authorised lab staff to modify a patient order after it has been created. It is one of the most complex flows in the Finance module — a single update cascades into multiple downstream systems simultaneously, all wrapped in a single atomic database transaction.
Order Update opens as a full-screen modal on top of the current page.
Related JIRA Ticket
- EN-7502 — Order Update
What is it?
Order Update is a full-screen editing interface accessible from various contexts across the application. Whether a staff member is in the Waiting List, Accessioning, Registration, or Finance modules, they can quickly trigger the Order Update modal to modify bill details. Staff can open any of the patient's past bills from the sidebar, modify the relevant details, and submit the update — all from one place.
A successful update touches:
- Billing record — core fields (amounts, dates, source, referral, comments)
- Payments — add, update, or delete individual payments
- Organisation ledger — B2B client dues are reconciled automatically
- Doctor revenue — referral revenue is recalculated per test
- Appointments & home collections — linked EMR records are kept in sync
- Lab report metadata — sample and report records are refreshed
- Elasticsearch — search index reflects the changes within seconds
- Fusion webhooks — connected integrations (HMIS, LIS) are notified asynchronously
[!NOTE] The Elasticsearch sync and the Fusion integration webhook run outside the main DB transaction. Everything else is atomic — if any step fails, all changes are rolled back automatically.
Who uses it?
| Role | Access |
|---|---|
| Lab Staff | View and modify bill fields, comments, dates, payments |
| Finance Users | Can change organisation and financial amounts |
| Lab Admin | Full access including locking/unlocking bills |
| Collection Center (CC) Staff | Limited access based on CC-specific flags |
| Referral Login | Read-only — cannot submit updates |
What can be updated?
| Category | What Changes |
|---|---|
| Basic Info | Bill time, source, order number, comments |
| Financial | Total amount, concession, advance, VAT, TDS, additional amount |
| Doctor / Referral | Referring doctor; doctor revenue recalculated automatically |
| Organisation | Linked B2B org; ledger reconciled for old and new org |
| Sample Date | Sample collection date across all tests |
| Emergency Flag | Mark/unmark as Critical / Emergency Report |
| Tests | Test amounts and concessions per test; add new tests |
| Payments | Add, edit, or delete payment entries |
| ICD Codes | Replace the full ICD code set on the bill |
| Modifiers | Replace billing modifiers |
| Lock State | Lock or unlock the bill |
| Insurance | Pre-auth ID/amount, agent details, proposal number |
| Branch | Reassign to a different branch |
What cannot be changed?
- Tests cannot be directly removed from the order (cancellation is a separate flow via Cancel Bill)
- Cancelled bills (
isCancel = 1) cannot be updated — they must be reset first - Locked bills cannot be edited without unlocking
- Bills tied to an active insurance claim cannot be edited while the claim is active
- Bills linked to an invoice require invoice-level access to unlock
Key Constraints
[!WARNING] A bill update is blocked (returns status
6) if the payment detail fields are fully populated, the total amount changed, and the organisation has a prepaid or postpaid payment type. This conflict must be resolved before the update can proceed.
[!NOTE] If a bill has unsaved insurance changes and the user tries to close or submit, an Unsaved Changes modal is shown before discarding or proceeding.