IntegrationsHL7 (Old Flow)Inbound
Bill Cancel
Inbound HL7/SFTP documentation for cancelling an existing bill through ORC CA.
👤 Development Team📅 Updated: May 5, 2026📁 Integrations🏷️ HL7🏷️ SFTP🏷️ Inbound🏷️ Bill Cancel
Bill Cancel
This operation cancels an existing active bill when the inbound HL7 order sends
a cancellation status. It is handled synchronously inside
hl7/2_3/createOrder/.
When This Flow Runs
All conditions must be true:
orderNumberis present.- An active bill exists for the same lab and order number, or for the numeric
labBillIdequivalent of the order number. uniqueOrderNo = 1.cancelBill = 1.orm_statusisCA, case-insensitively.
orm_status is parsed from ORC-1.
Implementation Path
| Step | Function | Description |
|---|---|---|
| Existing bill lookup | hl7/2_3/createOrder/ | Finds active matching bill. |
| Cancellation payload creation | hl7/2_3/createOrder/ | Builds the cancellation payload from the existing bill and inbound comments. |
| Bill cancellation | cancelBillCommonFunction | Applies standard Crelio bill cancellation behavior. |
Internal Cancellation Payload
The router creates an internal cancellation payload for
cancelBillCommonFunction.
| Field | Value |
|---|---|
labBillId | Existing bill's labBillId. |
labId | Lab ID resolved from authKey. |
labUserId | Existing bill user ID, falling back to token user ID. |
deductionFlag | 0. This integration path does not request payment deletion. |
billComment | Inbound bill comments, usually from NTE. |
labUserName | Lab user name from the inbound token. |
fromApi | 0. |
orgSMSFlag | 0. |
Cancellation Effects
cancelBillCommonFunction applies the normal product cancellation flow:
- Marks the bill as cancelled with
isCancel = 1. - Clears refund and write-off flags on the bill.
- Updates
lastEditedByandlastUpdatedTime. - Appends cancellation details to the bill comments.
- Updates organization due and ledger entries where applicable.
- Marks related
billingInforows as dismissed. - Marks related
labReportRelationrows as dismissed. - Clears rack/location fields on related collected samples.
- Updates report/sample search indexes through existing helpers.
- Calls
cancelBillTaskCallfor asynchronous cancellation side effects.
Response
{
"status": 200,
"Message": "Bill canceled successfully for Order Number : <orderNumber>"
}Important Notes
- This flow cancels the full bill.
- It does not selectively cancel only the tests listed in OBR.
- Test/sample-level cancellation through sample status is documented in Update Order.
- If
uniqueOrderNo = 0, this bill-cancel branch is not used. - If
cancelBill = 0, the same inboundCAmessage can be acknowledged as a duplicate order instead of cancelling the bill.
Common Issues
| Issue | Check |
|---|---|
| Cancellation is not triggered | Confirm uniqueOrderNo = 1, cancelBill = 1, and ORC-1 = CA. |
| Bill is not found | Confirm the inbound orderNumber matches an active bill order number or numeric labBillId. |
Request returns Bill already exists | The bill was found, but cancellation conditions were not all met. |
| Only one test should be cancelled | Use a test/sample cancellation flow, not the full bill cancel configuration. |