-
Notifications
You must be signed in to change notification settings - Fork 139
GRN Summary Report
The GRN Summary Report lists Pharmacy GRNs, Direct Purchases, their cancellations, and their returns for a date range, one row per bill. Each row shows the bill's Amount, Dis. Amount (discount) and Stock Amount (value posted to stock). A Total row under the table adds up all three columns for the whole result, not just the page on screen.
Analytics/Reports → Inventory Reports → 15. GRN Summary Report. Set a date range, optionally narrow by Institution, Site, Department/Store, Payment Mode, or Purchase Type, 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.
| Option | Shows |
|---|---|
| All Types | Everything below |
| GRN | GRNs and GRN cancellations |
| Direct Purchase | Direct Purchases and Direct Purchase cancellations |
| GRN Return | Approved GRN Returns only |
| Direct Purchase Return | Approved Direct Purchase Returns only |
Each purchase option carries its own cancellations, so that option's Total row gives the correct net value for the period (issue #24107).

Purchase Type = GRN Return: one approved return, shown as a negative Amount and Stock Amount, with the Total row underneath. GRN numbers, invoice numbers and vendor names are masked in this screenshot.
- GRNs and Direct Purchases are included once they have a bill number, i.e. once they were received. Saved-but-never-received drafts have no bill number, never moved stock, and are left out.
- GRN Returns and Direct Purchase Returns are included only after they are approved (issue #24110). A return that has only been saved or finalized has not reduced stock yet, so it does not appear until it is approved.
- Cancellations are always included.
Every row belongs to the period by its own date. A cancellation is therefore counted in the period in which the cancellation was made, whatever the date of the bill it cancels:
- GRN received and cancelled inside the period: two rows appear. The original shows +X with Status Approved (Cancelled), and the cancellation shows −X with Status Cancelled. They net to zero in the Total.
- GRN received before the From date but cancelled inside the period: only the cancellation row appears (−Y), and it reduces this period's Total. The original GRN was already counted in the earlier period.
Example: 10 GRNs in the period, 1 of them cancelled in the period, and 1 cancellation of a GRN from an earlier period. The Total is the sum of the 10 GRNs minus both cancellations.

A Direct Purchase received and cancelled on the same day: +5,088.00 "Approved (Cancelled)" and −5,088.00 "Cancelled". GRN numbers, invoice numbers and vendor names are masked.
Amount, Dis. Amount and Stock Amount all follow one rule, decided by the type of bill:
- GRN / Direct Purchase: positive (value received).
- Cancellation or Return of either: negative (value reversed).
Earlier versions derived the sign from the stored value
(display = -1 × Bill.netTotal, issue #23604). That broke for GRN
Returns: depending on which return screen created them, their netTotal
is stored as either positive or negative, so some returns showed a
positive Amount (issue #24108). The sign is now taken from the bill
type, and only the size of the stored value is used, so every return
reads negative however it was saved. Internal storage is unchanged.
The discount and stock columns use the same rule, so the three Total figures net correctly: a cancellation's discount and stock value are subtracted, not added.
The rule applies to the on-screen table and its Total row, the PDF export (its Total row sums the displayed values), the Excel (Download) export (it exports the on-screen table, including the Total row), and the Print view (see below).
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 value as the main table's Amount column and follows the identical sign rule: positive for GRN / Direct Purchase, negative for cancellations and returns.
- 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.
Both footer Total rows are the sum of the values displayed in the rows
above them — not a separate calculation. A CodeRabbit review on PR #24090
caught this for PO Sub Total: an earlier version of the fix computed its
footer from a different net calculation
(calculateTotalPOAmount(), which nets a reversal against its own
netTotal rather than its linked bill's) wrapped in Math.abs(), which for
a mixed purchase/refund batch produced a footer smaller than the sum of the
rows above it. Fixed to sum each row's displayed value directly.

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; both footer totals (10,879.98 and 3,791.84) are the sum of the four rows above them.
Analytics/Reports → Inventory Reports → 9. GRN opens a second, older
report — "GRN and Direct Purchase" — that queries the exact same underlying
bills and shows its own PO Sub Total/GRN Sub Total columns, in both
a Summary table and a per-item Detail table (toggle via the
Type field), plus its own PDF and Excel exports. It shares
grn_summary_view.xhtml for its Print button, so that page's fix
(above) already covered it — but its on-screen tables and its own separate
PDF/Excel exports had never been fixed by either #23604 or #24089 and still
showed the pre-fix raw/absolute values. Fixed alongside #24089 using the
same helper methods and sign rule as the rest of this page.
Because it loads its bills the same way, the rules in Which Bills Are Included apply to it too: it leaves out unapproved returns and never-received drafts (issues #24107, #24110).

"GRN and Direct Purchase" report, Summary view, Main Pharmacy, 20–28 Sep 2026 — same four bills, same signed GRN Sub Total / positive PO Sub Total convention, same footer total (3,791.84).
Field name note: this report's own Department filter maps to
Bill.department(the department/store that owns the bill — use this to scope to e.g. Main Pharmacy). Its separate Store filter maps toBill.toDepartment, which is typically unset on GRN/Direct Purchase bills — setting it alongside Department will usually return zero rows. Use Department only unless you specifically need to filter by stock destination.