ERP for Pharmacies and Pharmaceutical Distributors: Batches, FEFO Expiry, Drug Classes, and Reporting
In this article
- Summary
- Why pharmaceuticals differ from ordinary retail
- Batches, expiry, and the FEFO principle
- Drug classes, prescriptions, and supporting documents
- Purchasing and sales: tiered prices and credit terms
- Multi-branch stock and purchase planning
- Reporting and integration
- Common mistakes
- Getting started
- Frequently asked questions
- Conclusion
Pharmacy and pharmaceutical distribution businesses run on two things that are rarely negotiable: accuracy and compliance. One medicine with the wrong batch number, one expired product still on sale, or one sale of a controlled drug without the right paperwork is not just a stock loss; it puts the operating license and patient safety at risk. That is why the system you use cannot be treated like an ordinary retail system, even though the basic flow of buying, storing, and selling looks similar.
Many pharmacies and distributors still rely on a mix of a simple point-of-sale program, stock spreadsheets, and a notebook for purchase orders. While volume is small, this works. Once branches multiply, suppliers grow, and institutional customers such as clinics and hospitals start asking for credit terms, the weaknesses show: expired stock piles up unnoticed, reporting on certain drug classes takes days, and nobody can quickly answer a basic question such as which medicines will expire in three months.
This article covers the needs specific to an ERP for pharmacies and pharmaceutical distributors: batch and expiry management, handling of drug classes and related documents, purchasing and sales with tiered pricing, and reporting. It is system guidance, not legal advice. Licensing and reporting rules must always be checked against the regulations in force and against the pharmacist in charge at your business.
Summary
- Batch and expiry tracking must apply to every transaction, from receiving and sale to returns and destruction
- The FEFO principle (first expired, first out) replaces FIFO so that stock expiring sooner leaves first
- Certain drug classes require extra documents, restrictions, and records that must be built into the system flow rather than remembered by staff
- Tiered prices, tiered discounts, and credit terms for institutional customers need tidy price management
- Reports on expiring stock, turnover, and regulatory submissions become much faster when transaction data is clean from the start

Why pharmaceuticals differ from ordinary retail
Several traits make a system for a pharmaceutical business more demanding. First, every item has a more detailed identity than a product code: a batch number, production date, and expiry date. Two packs of the same medicine can come from different batches with different shelf lives, and the system must tell them apart.
Second, some products are subject to special rules. Some over-the-counter medicines can be sold like ordinary goods, some require a prescription, and some classes are supervised more strictly, with procurement and sales that must be recorded with specific documents. A system that does not distinguish these classes forces staff to remember the rules one by one, and in busy hours it is exactly that memory that fails.
Third, storage conditions affect quality. Some products need a specific temperature or a cold chain. The system does not have to measure temperature itself, but it must provide a place to record storage location, storage requirements, and the action taken when a deviation occurs.
Fourth, margins per product are generally thin and prices are regulated or capped in some categories. Small errors in purchase price, discounts, or rounding accumulate into a large gap by month-end. Price data accuracy is therefore as important as stock data accuracy.
Batches, expiry, and the FEFO principle
The core of a pharmaceutical system is tracking at the batch level. Every goods receipt records the product, batch number, expiry date, quantity, and storage location. Every sale or issue reduces a specific batch, not just the total quantity of the product. That way, if a manufacturer recalls a batch, you can trace where it was sold in minutes rather than days.
FEFO, not FIFO
For ordinary goods, FIFO is enough: first in, first out. In pharmaceuticals, the order of arrival does not always match the order of expiry. A batch that arrives later may expire sooner. The system therefore uses FEFO, meaning the batch with the nearest expiry date is suggested or required to leave first. In practice, when staff pick goods for an order, the pick list already sorts batches from the nearest expiry.
Alerts and minimum remaining shelf life
Two simple settings save a lot of loss. The first is early warning: an automatic report on batches that will expire within ninety, sixty, and thirty days, leaving time for promotions, returns to the supplier, or transfer to a branch with faster turnover. The second is a minimum remaining shelf life at receiving and at sale. Many institutional customers reject goods with less than a certain remaining shelf life, so the system should refuse or warn on receipt of goods that are already too close to expiry.
Quarantine and destruction
Damaged, recalled, or expired goods must leave sellable stock without disappearing from the records. Use a quarantine status that blocks sales, then a destruction process that records quantity, batch, reason, date, and who approved it. This trail matters during inspections and also for calculating losses honestly. The principle is the same as in lot, batch, and expiry tracking with ERP, but in pharmaceuticals there is no room for shortcuts.
Drug classes, prescriptions, and supporting documents
A good system stores the drug class or regulatory category on the product record, then turns it into rules in the transaction flow. A few examples of how that looks:
- A product that requires a prescription cannot be completed at the register without filling in prescription data, including the doctor's name and the prescription date
- A strictly supervised class can only be bought from official suppliers and sold with the appropriate documents, with records that cannot be edited by just anyone
- Certain products may only be sold by users in particular roles, such as the pharmacist in charge, so the system checks access rights before the transaction completes
- Purchase orders, purchase invoices, and delivery documents are linked to the transaction so they can be printed and found again
Design access rights strictly. A clear division of roles, as discussed in designing user access rights, prevents unauthorized staff from changing class data or deleting records. All important changes should enter the audit trail, in line with the practice in audit trails and internal controls in an ERP system.
Remember that the system helps enforce rules but does not replace the person responsible. The list of classes, the forms, and the reporting frequency should be set together with the pharmacist in charge and matched to the applicable regulations, then expressed as configuration rather than hard-coded logic that is hard to change when rules change.
Purchasing and sales: tiered prices and credit terms
On the purchasing side, a pharmaceutical business typically deals with many suppliers and wholesalers, each with different discounts, bonus goods, and payment terms. The ERP needs to record purchase prices per supplier, tiered discounts, and bonuses so that the recorded cost reflects the real one. Without that, the margins in reports cannot be trusted. Supplier evaluation, such as delivery punctuality and conformity of goods, can follow the approach in supplier management and vendor scoring with ERP.
On the sales side, a distributor serves customers with different characteristics. Small pharmacies buy in small quantities at higher prices, hospitals and clinics buy large quantities at contract prices with long credit terms, and retail customers pay immediately. The system must support several price lists, tiered discounts by quantity or contract, credit limits per customer, and billing according to terms. Automated reminders and collection as in automating invoicing and B2B receivables collection help greatly because receivables are the distributor's largest working-capital burden.
Delivery and returns
Shipping medicines requires documents that list the batch and expiry on every line, so the recipient can check conformity. Returned goods need a recorded reason, such as wrong delivery, damage, near expiry, or product recall, because the reason determines the treatment: back to stock, into quarantine, or destroyed. This pattern overlaps with warranty, returns, and after-sales service with ERP.
Multi-branch stock and purchase planning
Pharmacy chains face a classic problem: one branch runs out of a fast-selling medicine while another piles up stock that is about to expire. A centralized system gives a view of stock per branch per batch, so inter-branch transfers can be decided with data. The same consolidation principles are discussed in multi-branch report consolidation and franchise and branch network management.
For reordering, avoid ordering by gut feeling. Calculate the reorder point from average daily sales, supplier lead time, and safety stock, then adjust for the seasonality of certain illnesses such as flu and dengue in the rainy season. The general approach is in stock planning and repurchasing. In pharmaceuticals, add one consideration: do not buy more than you can sell before expiry. Goods that are cheap thanks to a volume discount become expensive if part of them must be destroyed.

Reporting and integration
Reporting in pharmaceuticals serves two purposes: compliance and business decisions. For compliance, the system must be able to produce sales and procurement reports for particular drug classes per period from the same transaction data, not reassembled by hand. For decisions, the most frequently used reports are:
- Stock about to expire by day range, with its monetary value
- Stock turnover and days of inventory per product category
- Margin per product, per supplier, and per customer group
- Receivables aging for institutional customers
- Slow-moving products that tie up capital
Reports like these can be shown on a daily dashboard as discussed in business dashboards for daily decisions. On the tax side, tidy and consistent invoices make compliance easier, as in e-invoicing and tax compliance with ERP.
Integrations that are often needed include pharmacy point of sale, supplier catalogs, online ordering platforms, and messaging apps for order confirmation. If the pharmacy wants to serve orders over WhatsApp, refer to WhatsApp Business integration for customer service, with special care around customers' health data in line with the principles of personal data protection.
Common mistakes
A few mistakes recur in pharmaceutical system projects and can be avoided from the start.
- Treating product and batch as the same thing: stock is recorded only per product so expiry is not tracked
- Untidy product master data: one medicine has many codes and units so stock is fragmented, when the foundation should be [clean ERP master data](/blog/master-data-erp-kode-barang-pelanggan-pemasok)
- Units not converted correctly: box, strip, and tablet scramble stock and prices if the conversion is wrong
- Class rules living only in staff heads rather than in the system
- Migrating stock data without batch and expiry, so the new system is full of blank data on day one; see [data migration preparation for a new system](/blog/persiapan-migrasi-data-sistem-baru)
- No periodic stock count per batch, even though small variances pile up easily; a safe pattern is in [stock counts without stopping operations](/blog/stock-opname-tanpa-menghentikan-operasional)
Getting started
Start from an inventory of problems, not a feature list. Record real incidents from the last three months: how much stock expired, how many times system stock did not match the shelf, how long it took to prepare one regulatory report. These numbers become the basis of the business case.
The next step is to tidy product data: one code per item, units and their conversions, drug class, storage condition, and main supplier. Then apply batch and expiry tracking at goods receipt, because that is the point where the data is created. After that add sales with FEFO, the expiry report, and only then regulatory reporting and integrations. A staged order like this is consistent with the first ERP modules to implement and phased ERP implementation. Involve the pharmacist in charge from the start, because they understand what the system must enforce.
Frequently asked questions
Can a generic ERP be used for a pharmacy?
Yes, as long as it supports batches, expiry dates, FEFO, product classes, and unit conversion. If any of these is missing, you will patch it with spreadsheets, and at that point the risk comes back. Check these features before choosing, or consider customizing the existing system.
Does the system guarantee regulatory compliance?
No. The system helps enforce rules and provides data for reporting, but compliance remains the responsibility of the license holder and the technical person in charge. Configure the system with them and review it when regulations change.
What about stock that already exists when the new system starts?
Do a stock count that records the batch and expiry of each item, then enter it as the opening balance. This is tiring initial work, but without batches in the opening balance the expiry features are useless for months.
Are barcode scanners necessary?
Strongly recommended. Scanning reduces picking errors and speeds up receiving and stock counts. Make sure the barcode on the packaging can be linked to the product code in the system, and prepare labels for items without barcodes.
Conclusion
An ERP for pharmacies and pharmaceutical distributors is essentially a stock and sales system that is far more disciplined: every item has a batch and expiry, every class has rules, and every transaction leaves a traceable trail. With FEFO, early warnings, tiered pricing, and reports sourced from clean data, a business reduces expired stock, speeds up collection, and faces inspections with more confidence.
Need a pharmaceutical stock and sales system that tracks batches, expiry, and documents neatly?
The AG·SORA team helps design and build ERP tailored to pharmacies and distributors, from batch tracking to reporting. The initial consultation is free and carries no obligation.
Free ConsultationRecommended for you
Reading related to this topic
ERP for Fashion and Apparel Businesses: Size-Color Variants, Seasonal Collections, and Cross-Channel Stock
Typical fashion needs in an ERP: model and variant structure, collection lifecycle, purchase planning, cross-channel stock, high returns, and sell-through reports.
ERP for Third-Party Logistics (3PL): Multi-Client Stock, Activity-Based Billing, and Warehouse SLAs
3PL system needs: multi-owner data, the flow from receiving to shipping, activity-based rates and billing, SLA measurement, client portals, and profitability.
Lot, Batch, and Expiry Date Tracking with ERP: From FEFO to Product Recalls
How lot tracking works in an ERP, FEFO rules, two way traceability, barcode scanning, recall readiness, and implementation steps that keep the warehouse moving.
Free checklist: choosing a software house
24 points to evaluate a vendor before you sign. Can be saved as a PDF.
Ready to build a system that grows with your business?
Discuss your needs with the AG·SORA team, no cost, no commitment.