# Inpatient — Bill Cancellations and Refunds (Overview) The inpatient module provides dedicated cancellation and refund pages for each bill type. All cancellations require privilege and record a reason; cancelled bills are retained in the database for audit purposes. --- ## Cancellation Pages | Bill Type | Page | Notes | |---|---|---| | Final bill | `/inward/inward_cancel_bill_final.xhtml` | Cancels the final bill; returns BHT to pre-settlement state | | Deposit bill | `/inward/inward_cancel_bill_deposit.xhtml` | Cancels a deposit (Deposit Reprint → **To Cancel**) | | Payment bill | `/inward/inward_deposit_cancel_bill_payment.xhtml` | Cancels a payment made during the stay (Payment Reprint → **To Cancel**) | | Professional fee bill | `/inward/inward_cancel_bill_professional.xhtml` | Cancels a professional fee bill | | Provisional bill | `/inward/inward_cancel_bill_provisional.xhtml` | Cancels a provisional bill | | Refund bill | `/inward/inward_cancel_bill_refund.xhtml` | Cancels an already-issued refund | | Service bill | `/inward/inward_cancel_bill_service.xhtml` | Cancels a services & investigations bill | | BHT bill (general) | `/inward/bht_bill_cancel.xhtml` | General BHT bill cancellation | | Other payment bills | `/inward/inward_cancel_bill_payment.xhtml` | Used for payment bill types that have no dedicated page above | Each of these pages (other than the general BHT bill page) has an **Inpatient Dashboard** button next to its back buttons, both before and after the bill is cancelled, so you can return to the patient's dashboard without searching for the admission again. ![Inpatient Dashboard button after cancelling a deposit](images/24284-deposit-cancel-dashboard-button.png) *The cancelled deposit's receipt header, with Inpatient Dashboard beside Back to Bill List.* ### Cancellation receipts After a **deposit** or **payment** is cancelled, the Cancellation Bill panel shows the cancellation receipt in the paper format set for inward payment bills. Use the **Settings** button on the panel to change it: | Paper format setting | Cancellation receipt printed | |---|---| | POS Paper | POS receipt | | 5×5 Paper or 5×5 Custom 3 Paper | 5×5 receipt | | A4 Paper | A4 receipt | | None selected | POS receipt | The receipt shows the cancellation bill number, the original bill number, the cancellation date and time, the reason and the amount. ![5x5 deposit cancellation receipt](images/24322-deposit-cancel-5x5.png) *A deposit cancellation receipt on 5×5 paper.* ![A4 deposit cancellation receipt](images/24322-deposit-cancel-a4.png) *The same cancellation on A4 paper.* A cancelled **professional fee** bill always prints its cancellation receipt on 5×5 paper. It does not depend on a paper type. --- ## Refund Pages | Refund Type | Page | Notes | |---|---|---| | General inpatient refund | `/inward/inward_bill_refund.xhtml` | Refund against a settled bill | | Service bill refund | `/inward/inward_bill_service_refund.xhtml` | Refund for a specific service bill item — `InwardServiceController` | --- ## Pharmacy Cancellations Pharmacy-related inpatient cancellations (issue cancellations, reprint) are handled by the pharmacy module. See: - [Inward Issue Cancellation](Inward-Issue-Cancellation) - [Inward Issue Reprint](Inward-Issue-Reprint) --- ## How Cancellations Work When a bill is cancelled: - The bill record is flagged `cancelled = true` and a `CancelledBill` record is created — the bill itself is **not** deleted - Bill items and fee lines remain `retired = false` so that cancellation print-outs display correctly - A new contra-bill may be created depending on the cancellation type - The BHT totals are recalculated > **Note:** Cancellation does NOT set `retired = true` on bill fee lines. This distinction is important for reports and print-outs — cancelled bills remain queryable. --- ## Nursing Discharge Restriction (Service Bills) Once a patient's nursing discharge has been confirmed (**Inward > Search > Admissions > Nursing WorkBench > Nursing Discharge**), the **Return** and **To Cancel** actions on that patient's inward service bills (`/inward/inward_reprint_bill_service.xhtml`, reached via **Inward > Search > Service Bill**) are disabled by default: ![Return and To Cancel enabled before nursing discharge](images/23576-before-nursing-discharge-toolbar.png) *Before nursing discharge: both Return and To Cancel are enabled.* ![To Cancel disabled after nursing discharge](images/23576-after-nursing-discharge-toolbar.png) *After nursing discharge: To Cancel is disabled. Return stays enabled here only because this user holds the escape-hatch privilege below.* This mirrors the nursing-discharge check that already existed for **Add Charges** (`InwardAddChargesAfterNursingDischarge`). Each action has its own escape-hatch privilege for staff who genuinely need to act after nursing discharge: | Action | Escape-hatch privilege | |---|---| | Return | `InwardProcessReturnAfterNursingDischarge` | | Cancel | `InwardProcessCancelAfterNursingDischarge` | A user without the relevant privilege sees the button disabled in the UI; the same check is enforced server-side (`InwardSearch.navigateToCancelInpatientBill()` / `.cancelBillService()`, `InwardServiceRefundController.navigateToRefundInwardServiceBill()` / `.refundInwardServiceBill()`), so the restriction cannot be bypassed by a direct form submission. ### The escape-hatch privilege does NOT override a processed lab sample or a validated surgery The privileges above only unlock cancel/return for a bill that is still genuinely **pending** — nothing has been done with it yet. They are not a blanket override. Once a lab sample has been collected from the patient, an OPD bill has started lab processing, or a surgery has been validated/closed, cancellation and return are blocked **unconditionally** — no privilege, including the ones above, can bypass this (issue #23576, reopened 2026-09-08 after the initial fix above missed this; the threshold was tightened from "accepted" to "sent to lab" in issue #23598, then from "sent to lab" to "sample collected" in a 2026-09-27 follow-up to #23598). Returning a collected-sample test shows *Cannot return "" - the sample has already been collected for this test.*; cancelling shows "This bill is processed in the Laboratory." ![To Cancel enabled for a privileged user even though the sample has already been accepted](images/23576-cancel-enabled-privileged-user.png) *The "To Cancel" button is enabled here because this user holds `InwardProcessCancelAfterNursingDischarge` — but the bill's lab investigation has already reached `SAMPLE_ACCEPTED`.* ![Cancellation blocked with "This bill is processed in the Laboratory."](images/23576-blocked-sample-accepted.png) *Submitting the cancellation is still blocked server-side, with "This bill is processed in the Laboratory." — the privilege only covers pending bills.* | Bill type | What locks it | Enforced in | |---|---|---| | Inward service bill (incl. lab/OPD investigations billed as an inward service) | Lab sample reaches `SAMPLE_COLLECTED` or later, or a report has been entered | `InwardSearch.checkCancelBill()` / `.checkInvestigation()` (cancel), `InwardServiceRefundController.checkLabSampleGuard()` (return) | | OPD bill | Same lab-processing check | `BillSearch.cancelOpdBill()` (cancel), `BillSearch.sampleHasBeenCollected()` via `.refundOpdBill()` (return) | | Surgery bill | Surgery has been validated (`Bill.completed`, set by **Validate Surgery**, `InwardSurgeryValidate`) | `InwardSearch.cancelSurgeryBill()` | A regular (non-lab) inward service that is still pending remains cancellable/returnable by a user holding the nursing-discharge escape-hatch privilege, exactly as documented above — that behavior is unchanged. --- ## Audit Trail Every cancellation records: - Cancelling user - Cancellation timestamp - Reason for cancellation --- ## Related Articles - [Inpatient — Final Bill Generation](Inpatient-Final-Bill-Generation) — the bill being cancelled - [Inpatient — Patient Deposits](Inpatient-Patient-Deposits) — deposit cancellations - [Inpatient — Final Bill Payment](Inpatient-Final-Bill-Payment) — payment cancellations