Pharmacy Management System Project in PHP with Source Code and Report
By Prakash Panthi, Founder · Published September 30, 2026 · Updated September 30, 2026
A pharmacy management system project in PHP is a good final-year choice because it is small enough to finish and rich enough to discuss: stock that changes with every purchase and sale, expiry dates, supplier and customer ledgers, invoices and reports. This guide explains what a complete one contains, how to run it on XAMPP, what your project report must cover and which viva questions to expect — using our Pharmacy Management System in PHP (CodeIgniter 3, 31 tables) as the worked example.
What the system does
Seven modules, two roles (administrator and counter staff):
- Products & categories — medicines with generic name, category, supplier, box size, purchase and selling price, tax, shelf location and expiry date; barcode and QR labels.
- Suppliers & purchases — purchases with chalan number and line items; supplier ledger.
- Customers & sales — multi-item invoices with discount, tax, paid and due; printable invoice; customer ledger with receipts.
- Stock — a stock history per product and date.
- Accounts & banking — bank accounts, cheques, daily closing, deposits, payment methods, tax rates.
- Reports — sales, purchase, stock, expiry and ledger statements.
- Users & settings — logins with user type, company information, language.
Each feature is one CodeIgniter controller — Cproduct, Cpurchase, Cinvoice, Creport, Caccounts and so on — with its model and views. Classic MVC, which is what most PHP syllabi teach.
The design idea that carries the whole viva
Stock is a consequence of transactions, not a number someone types.
- A purchase inserts a
product_purchaseheader and oneproduct_purchase_detailsrow per line, writes astock_historyrow (quantity purchased) and posts the total tosupplier_ledger. - An invoice inserts an
invoiceheader andinvoice_detailslines (with both the selling rate and the supplier rate, so profit can be reported), writesstock_historyrows (quantity sold) and posts the total and the paid amount tocustomer_ledger, leaving the difference as due. - Current stock = purchased − sold. Stock on any past date can be reconstructed, and the figure always agrees with the transactions.
Two more points examiners like: sales_report and purchase_report are flat copies of each line written at save time so reports run without five-table joins (a deliberate denormalisation — the transaction tables stay the source of truth); and expiry is one expire_date per product, which is the honest limitation to put under Future Scope (batch-wise stock with first-expiry-first-out).
Running it on XAMPP
- Install XAMPP and start Apache and MySQL.
- Copy the
pharmafolder intohtdocs. - Create a database in phpMyAdmin (for example
pharma_db) and importmindsuxn_pharma.sql— 31 tables. - Edit
application/config/database.phpand set$config['base_url']inconfig.phptohttp://localhost/pharma/. - Log in, add a category, a supplier and a product, purchase 10 units, sell 2 and check that the stock report shows 8.
That last step is your first test case, and the screenshot of stock_history in phpMyAdmin after it is the best screenshot in your report.
What the project report must contain
| Chapter | For a pharmacy management system |
|---|---|
| Abstract | Inventory + billing, CodeIgniter + MySQL, 31 tables, the purchase-to-sale stock flow. |
| 1. Introduction | Problem (manual stock cards, expired stock found late, ledgers that disagree), objectives, scope. |
| 2. System analysis | Existing vs proposed, feasibility, 12 functional requirements, non-functional, hardware/software. |
| 3. System design | MVC architecture, roles, modules with tables, DFD level 0/1, 12 ER relationships, use cases (add medicine, purchase, bill, receipt, expiry check, daily closing). |
| 4. Database design | The 19 core tables with columns and keys, plus an appendix of all 31. |
| 5. Implementation | Folder structure, install steps, the purchase and invoice flows table by table, security, declaration of the licensed base. |
| 6. Testing | Purchase updates stock and ledger, invoice reduces stock, selling more than stock, receipt clears due, expiry report, injection attempt. |
| 7. Screenshots | Product form with expiry, purchase entry, billing screen, printed invoice, stock and expiry reports, phpMyAdmin after a sale. |
| 8. Conclusion & future scope | Batch-wise stock (FEFO), low-stock and expiry alerts, GST invoices, prescriptions, multi-branch. |
The product download includes a college-project-pack folder with this report as a Word template (the database chapter is generated from the real .sql), 29 viva questions with answers and a README on declaring the base — see the college projects page.
Sample viva questions
Q. How is current stock calculated?
From stock_history: total purchased minus total sold per product. It is never stored as a single editable number.
Q. Why does invoice_details store the supplier rate too?
So profit per line can be reported later even after the product's purchase price changes.
Q. Isn't sales_report duplicate data?
Yes, deliberately — a flat copy written at save time so reports avoid joins; invoice_details remains the source of truth.
Q. What happens on the server when you save an invoice?
Validate every line, recompute totals in PHP (never trust the browser), insert header and details, write stock and report rows, post to the customer ledger, load the printable view.
Q. How would you handle two batches with different expiry dates?
Add a batch table with quantity and expiry per batch and pick the earliest-expiring batch at billing time.
Make it yours
- Add the batch table and FEFO selection — the single most impressive change for this project.
- Add a low-stock and near-expiry widget on the dashboard.
- Add GST columns (HSN, CGST/SGST) to invoice details and a GST summary report.
- Add a profit report from the selling rate and supplier rate already stored per line.
Originality
Licensed base code is fine when it is declared; the report template already contains the declaration paragraph. Add your own change, write the report in your own words, and check your university's plagiarism policy. Before you build on any free download instead, read our guide to PHP source code licences — many free pharmacy projects are educational-use only.
Start here: the Pharmacy Management System in PHP — source code, database, report template and viva questions in one download.
Available systems in this category
The system this guide was written for is not available for new purchases right now. These PHPGuru-developed systems cover related needs — check each page for exactly what it includes.
- Blood Bank Manager — Donor eligibility, blood-unit stock with expiry, and safe issuing, in PHP
- Clinic Appointment Booking — Doctor time slots and appointment booking with no double-booking, in PHP
- Diet & Meal Planner — Client profiles, meal plans with calorie and macro totals, and a weight tracker, in PHP