Admin Bill Batch vs Individual Linking - hmislk/hmis GitHub Wiki
Batch Bill vs Individual Bill Linking to Departments
Overview
When a patient visits multiple departments in one OPD encounter (e.g. consults a doctor and then goes to the lab), HMIS can generate bills in two ways: as individual bills per department, or as a single batch bill that links all department charges together. Understanding this distinction is important for report configuration, bill numbering, and financial reconciliation.
The Two Billing Patterns
Pattern 1: Batch Bill Linked to Payments
In the batch bill pattern:
- One single bill (the "batch bill" or "payment bill") is the main financial document
- It captures the payment method, payment amounts, and is linked to the cashier's float
- Multiple individual department bills (one per department visited) are created separately and linked back to the batch bill via the
backwardReferenceBillrelationship - The batch bill has a separate bill number (suffixed according to the
Bill Number Suffix for OPD_BATCH_BILL_WITH_PAYMENTconfig key) - Reports and cashier summaries count the payment record (on the batch bill) — not the individual department bills
When this is used:
- Multi-department OPD encounters where the patient pays once at the cashier counter for all services
- Package billing where multiple services from different departments are grouped
- Scenarios where financial tracking should be on the payment side
Financial flow:
Patient → [individual bill: Radiology] ──┐
Patient → [individual bill: Lab] ──┤──▶ Batch Bill ──▶ Payment record
Patient → [individual bill: OPD Consult]──┘
Pattern 2: Individual Bills Linked to Departments
In the individual bill pattern:
- Each department generates its own independent bill
- Each bill has its own payment record
- Bills are not linked to each other
- The bill number is generated per department (configured by
Bill Number Suffix for OPD_BILL_WITH_PAYMENT) - Reports count each bill and each payment independently
When this is used:
- Departments that operate independently and collect their own payments
- Scenarios where per-department financial reporting is the primary requirement
- Departments with their own cashier counters and floats
Financial flow:
Patient → [Bill + Payment: Radiology]
Patient → [Bill + Payment: Lab]
Patient → [Bill + Payment: OPD Consult]
Why This Matters for Reports
The HMIS financial report distinction between Daily Return and All Cashier Summary relates directly to this pattern:
- Daily Return counts bills directly — this captures all department-level bills
- All Cashier Summary counts payments — this captures the payment records, which in the batch pattern are on the batch bill, not the department bills
If your hospital uses the batch bill pattern, a department bill with no associated payment will appear in the Daily Return but NOT in the Cashier Summary — this is expected behaviour, not a data error.
Bill Number Configuration
Two configuration keys control bill number suffixes for these patterns:
| Config Key | Applies To |
|---|---|
Bill Number Suffix for OPD_BILL_WITH_PAYMENT |
Individual OPD bills with embedded payments |
Bill Number Suffix for OPD_BATCH_BILL_WITH_PAYMENT |
Batch bills at the cashier |
These keys are in the Application-Level Configuration and affect the departmentBillNumberGeneratorYearly bill number generation methods.
Viewing Batch Bills
Navigate to OPD → Batch Bill Search (or /opd/analytics/opd_batch_bill_search) to see all batch bills and their linked individual department bills.
Choosing the Right Pattern
| Scenario | Recommended Pattern |
|---|---|
| Patient pays once for multi-department visit | Batch bill |
| Each department collects its own payment | Individual bills |
| Centralised cashier for all OPD | Batch bill |
| Decentralised counters (each dept is a cashier) | Individual bills |
| Package billing | Batch bill |
Technical Notes (Admin/Developer)
Individual department bills link to the batch bill via bill.backwardReferenceBill. The batch bill links to department bills via the reverse forwardReferenceBill collection. The query SELECT b FROM Bill b WHERE b.backwardReferenceBill.id = :id retrieves all individual bills for a given batch. Batch bill bill-type is OPD_BATCH_BILL_WITH_PAYMENT; individual bill type is OPD_BILL_WITH_PAYMENT. The batchBill field in OpdBillController holds the current batch bill during billing. Payment records are always on the batch bill (or individual bill for the non-batch pattern) — never on department-only sub-bills.