GRN Summary Report - hmislk/hmis GitHub Wiki
GRN Summary Report
Overview
The GRN Summary Report lists Pharmacy GRNs and Direct Purchases for a date range — one row per bill, whichever combination of Approved, Cancelled, or Returned it currently is — with the bill's Amount, Dis. Amount (discount), and Stock Amount (value posted to stock).
Where to Find It
Analytics/Reports → Inventory Reports → 15. GRN Summary Report, or
navigate directly to reports/inventoryReports/grn_summary_report.xhtml.
Set a date range, optionally narrow by Institution, Site,
Department/Store, Payment Mode, or Purchase Type (GRN vs. Direct
Purchase), and click Process.
The report button is privilege-gated per department (
ReportsGrnSummaryReport), separately from which department's data you point the report at with the Department/Store filter. If the button is missing from your current department's Inventory Reports tab, it may only be granted for a different department you also have access to — switch to that department to reach the menu entry, then use the report's own Department/Store filter to select the department whose GRNs you actually want to see.
Amount Column Sign: Positive = Received, Negative = Reversed
The Amount column shows a signed value that reflects whether the row added value to stock or reversed a prior receipt:
- Approved GRN / Direct Purchase — positive (value received).
- Cancelled or Returned GRN / Direct Purchase — negative (value reversed).
This has changed twice on the same issue (#23604), so it's worth stating the history plainly:
- Originally, HMIS printed
Bill.netTotalraw. Internally this field is signed the opposite way — negative for an Approved purchase (money out), positive for a Cancelled/Returned reversal (money back in) — so every ordinary Approved row showed a confusing negative number. - The first fix (issue #23604, closed 2026-09-11) made every row an absolute value, so everything displayed positive, including Cancelled/Returned rows. This satisfied "purchases shouldn't look negative" but broke the opposite, equally real expectation that a Return/Cancellation — money leaving the GRN total — should read as negative like a deduction. The issue was reopened over this.
- The current, final behavior (below) instead flips the sign of the
internal value for display (
display = -1 * Bill.netTotal), rather than taking its absolute value. This makes an Approved row positive and a Cancelled/Returned row negative, satisfying both expectations from the same rule.
Internal storage is unchanged throughout — Bill.netTotal is still
negative for Approved purchases and positive for reversals in the database,
exactly as it always has been. Only the on-screen/PDF/Excel/Print
display value is derived differently.

Main Pharmacy, 20–27 Sep 2026. Rows 1–2 (Direct Purchase Refund, GRN Return) show negative Amount; rows 3–4 (Direct Purchase, GRN, both Approved) show positive Amount.
A Cancelled GRN behaves the same as a Return — e.g. MPGRNCAN/33
("Pharmacy GRN Cancelled") shows Amount -85,897.50 (previously
+85,897.50 under the abs-value behavior, and the original raw negative
before that).
This sign rule applies consistently across the on-screen table, the PDF export (including its Total footer row — the sum of the displayed per-row signed values, not a separate absolute-value calculation), the Excel (Download) export (which mirrors whatever the on-screen table shows), and the Print view (see below).
The Dis. Amount (discount) column is not part of this sign rule — it
continues to show a plain magnitude (Math.abs) regardless of row type, as
no complaint has been raised about it and its internal sign convention is
inconsistent with netTotal's (see
Pharmacy financial-total sign convention inconsistent across bill types
(#21070) for background).
The Stock Amount column is unaffected by any of this and can still show a negative value (e.g. for a cancelled GRN, reflecting stock removed) — it reflects a separate, pre-existing sign convention on stock valuation that is tracked separately.
Print View Follows the Same Sign Rule
Clicking Print opens a separate printable page
(grn_summary_view.xhtml) with its own PO Sub Total and GRN Sub
Total columns:
- GRN Sub Total is the same underlying field as the main table's Amount column, and follows the identical sign rule: positive for Approved, negative for Cancelled/Returned. The footer Total row is the sum of the displayed per-row values.
- PO Sub Total is a different concept — it references the value of the linked Purchase Order/GRN bill for comparison, not this row's own money movement — and intentionally keeps showing a plain positive magnitude regardless of row type. It is not part of the Amount sign rule.

Print view, Main Pharmacy, 20–27 Sep 2026 — GRN Sub Total is negative for the Direct Purchase Refund and GRN Return rows, positive for the Direct Purchase and GRN rows; PO Sub Total stays positive throughout; the GRN Sub Total footer (3,791.84) is the sum of the four signed row values.