Batches, expiry and low-stock alerts
How batches and their statuses control what can be sold, how expired stock is written off automatically, and how to get alerted when stock runs low.
Every unit of stock in LeapHealthOS belongs to a batch. Batches decide what can be sold, in what order, and when stock disappears because it has expired. This page explains batches, the automatic expiry write-off, and how to set up low-stock alerts. It is for pharmacy leads and administrators.
What a batch is
A batch is one lot of an item from one supplier, identified by its batch number. It is created when the stock is first received (through Record inward or the CSV import) and records:
- the expiry date and manufacturing date,
- the MRP, which is the price used when the batch is billed,
- the cost per unit, which is used to value the stock.
The same batch can sit in several stores after a transfer. Its status applies everywhere at once.
Batch statuses
Batch statuses
| From → To | Trigger | Actor | Condition | Side effects |
|---|---|---|---|---|
| ActiveQuarantined | Quarantine | Store MANAGER or AUDITOR | Batch stops being picked in every store | |
| QuarantinedActive | Release | Store MANAGER | ||
| ActiveExpired | Expiry date passes | LeapHealthOS | Remaining stock written off | |
| QuarantinedExpired | Expiry date passes | LeapHealthOS | Remaining stock written off | |
| ActiveExpired | Mark expired | Store MANAGER | Batch stops being sold; stock stays on record |
- Activeinitial
- Can be sold, transferred and dispensed until its expiry date.
- Quarantined
- Held back everywhere. It cannot be picked, sold or transferred.
- Expiredterminal
- Past its expiry date, or marked expired early. It cannot be sold, transferred or dispensed.
Only active batches that have not expired are offered when a prescription is billed, picked for a transfer, or deducted when a bill is paid. Stock is always taken from the batch that expires first.
Batch actions have no screen yet
Quarantining, releasing and marking a batch as expired are not available on any LeapHealthOS screen yet. Ask your implementation team if you need to hold back a batch, for example after a recall.
Expired stock is written off automatically
After a batch's expiry date has passed, LeapHealthOS automatically:
- writes off all the remaining quantity in every store that holds it, together with its value, and
- marks the batch Expired.
You do not need to do anything: after the expiry date, the batch drops out of the Stock tab and out of the store's stock value on its own.
Check physical stock against the screen
The write-off only changes the records. Remove expired packs from the shelves yourself. If a refund returns stock into a batch that has since expired, the batch keeps that quantity, so check it before selling.
Seeing what will expire
- The Expiring soon card on the Pharmacy Stock tab counts items with a batch that expires soon.
- The Nearest expiry column shows each item's earliest expiry.
- The item detail page lists batches oldest expiry first.
No expiry alerts
LeapHealthOS does not send expiry warnings or raise alerts for expiring stock. Review the Expiring soon card regularly.
Low stock and reorder thresholds
An item is low in a store when the quantity on hand is at or below its reorder point. The reorder point comes from one of two places:
Source | Set where | Used for |
|---|---|---|
Store reorder rule (per item and store) | No screen yet; set up by your implementation team | Low stock status and low-stock alerts |
Item reorder threshold | Reorder threshold in Edit SKU or Edit item | Low stock status in stores without a store rule |
The store rule wins when both exist. The Low stock card and the Low stock badge use whichever applies.
Only store reorder rules raise alerts
Low-stock alerts are based on store reorder rules only. An item that has just a reorder threshold set on the SKU shows as Low stock on screen but never raises an alert. Ask your implementation team to create store reorder rules for the items you want to be alerted about.
Set up a low-stock alert
Low-stock alerts are alert rules, like any other alert. For stock, pick the metric hos.inventory.low_stock_margin in the rule. It measures the quantity on hand minus the reorder point, for every item and store with a store reorder rule. A value of 0 or less means the item is at or below its reorder point.
Create the alert rule
AdministratorSettings > Platform Configuration > Alert Rules
On the Rules tab, click New rule and fill in:
- Name: for example "Pharmacy stock below reorder point".
- Rule key: for example
pharmacy-low-stock. - Metric:
hos.inventory.low_stock_margin. - Aggregation: Latest. Condition: is at or below (≤). Threshold: 0.
- Group alerts by:
store_uuidanditem_uuid, so you get one alert per item in each store. - Severity: Warning.
Click Create rule.
Expected result: "Rule created. It is evaluated on the next check."
Decide who is told
Settings > Platform Configuration > Notification Rules
Find Alert Fired under Operational Alerts and click its edit icon. In the Staff section set Strategy to STORE_ASSIGNED and Store Role to MANAGER, pick the channels and templates, and click Save.
Expected result: The managers of the store involved receive a message each time a low-stock alert opens.
Group by store, or the store cannot be found
STORE_ASSIGNED sends to the staff of the store named in the alert. The alert only names a store if the rule groups by store_uuid. Without it, nobody receives the message.
The alert resolves by itself once stock is received and the quantity rises above the reorder point. Alerts appear on the Alerts page, where staff can acknowledge or silence them. See Alerts feed, Alert rules and silences and Notification rules.
Related pages
Last updated on