# Product Requirements Document (PRD)
## Pharmacy Management System (PMS)

| | |
|---|---|
| **Document Version** | 1.0 |
| **Date** | July 2026 |
| **Status** | Draft for Review |
| **Owner** | Product/Engineering Team |

---

## 1. Executive Summary

The Pharmacy Management System (PMS) is a full-featured, web-based (and optionally desktop/mobile) application designed to digitize and streamline the day-to-day operations of a pharmacy or chain of pharmacies. The system will manage **employees/staff**, **inventory**, **medicines (with brand, generic name, batch, and expiry tracking)**, **sales and billing**, **suppliers/purchasing**, **customers/prescriptions**, and **reporting/analytics** — all from a single, secure, role-based platform.

---

## 2. Problem Statement

Pharmacies today often rely on manual registers, spreadsheets, or fragmented tools to track stock, staff, and sales. This leads to:

- Stock-outs or overstocking of medicines
- Sale of expired or near-expiry medicines
- No visibility into which brand/batch is moving fastest
- Difficulty tracking employee attendance, shifts, and performance
- No consolidated reporting for owners/managers
- Manual, error-prone billing

**Goal:** Build a single system that removes these pain points with an intuitive, reliable, and scalable pharmacy management platform.

---

## 3. Goals & Objectives

| Goal | Success Metric |
|---|---|
| Centralize inventory management | Real-time stock accuracy ≥ 99% |
| Reduce expired-stock loss | Expiry-based alerts reduce wastage by 80% |
| Simplify employee management | 100% of staff records, attendance, and payroll data digitized |
| Speed up billing/checkout | Average checkout time < 1 minute |
| Enable data-driven decisions | Owner/manager dashboard with real-time KPIs |
| Support multi-branch operations | Single system supports unlimited branches |

---

## 4. Target Users / User Roles

| Role | Description | Key Permissions |
|---|---|---|
| **Super Admin / Owner** | Owns the business, full control | Full access to all modules, branches, financials |
| **Branch/Store Manager** | Manages a specific branch | Inventory, staff, reports for their branch |
| **Pharmacist** | Licensed staff dispensing medicine | Sell medicine, verify prescriptions, view stock |
| **Cashier / Sales Staff** | Handles billing and POS | POS/billing, view stock, print receipts |
| **Inventory/Stock Manager** | Manages purchase and stock | Add/edit stock, manage suppliers, purchase orders |
| **Accountant** | Manages finances | View sales, expenses, generate financial reports |
| **HR Manager (optional)** | Manages employees | Attendance, payroll, leave management |

Role-Based Access Control (RBAC) will govern what each role can view/edit.

---

## 5. Scope

### 5.1 In Scope (Core Modules)
1. Authentication & User/Role Management
2. Employee Management
3. Medicine & Inventory Management
4. Supplier & Purchase Management
5. Sales / Point of Sale (POS) & Billing
6. Customer & Prescription Management
7. Reports & Analytics Dashboard
8. Notifications & Alerts
9. Multi-Branch Support
10. Settings & Configuration

### 5.2 Out of Scope (Phase 1)
- Integration with national health insurance systems (future phase)
- Home delivery / logistics tracking (future phase)
- E-commerce storefront (future phase)

---

## 6. Functional Requirements

### 6.1 Authentication & User Management
- Secure login (email/username + password), password reset via OTP/email
- Role-based access control (RBAC)
- Two-factor authentication (2FA) for Admin/Owner accounts
- Session timeout & activity logging
- Multi-branch login (user tied to one or more branches)

### 6.2 Employee Management
- Add/Edit/Delete employee profiles (name, photo, contact, NID, designation, department, branch, joining date)
- Role & permission assignment
- Attendance tracking (check-in/check-out, biometric/manual)
- Shift & schedule management
- Leave management (apply, approve/reject, leave balance)
- Salary/payroll management (basic salary, bonus, deductions, payslip generation)
- Performance tracking (sales targets vs achieved, per employee)
- Employee document storage (contracts, certificates, ID copies)
- Employee activity log (audit trail of actions performed in system)

### 6.3 Medicine & Inventory Management
This is the core of the system — tracking **what medicine, which brand, and how much stock**.

**Medicine Master Data:**
- Medicine name (generic name)
- Brand name / Manufacturer
- Category (Tablet, Syrup, Injection, Ointment, Drops, Capsule, Device, etc.)
- Therapeutic class (Antibiotic, Painkiller, Antacid, etc.)
- Strength/Dosage (e.g., 500mg)
- Pack size / Unit of measure (strip, bottle, box, piece)
- Barcode / SKU / QR code support
- Prescription-required flag (OTC vs Rx)
- Storage requirements (e.g., refrigerated)

**Batch & Stock Tracking:**
- Batch number tracking per purchase
- Expiry date tracking per batch (FEFO – First Expiry First Out)
- Manufacture date
- Purchase price & selling price (MRP) per batch
- Quantity in stock per batch, per branch
- Stock adjustment (damage, returns, theft, correction) with reason logging
- Stock transfer between branches/warehouses
- Reorder level / minimum stock threshold per medicine
- Multiple brand variants of the same generic medicine (e.g., Paracetamol → Napa, Ace, Fast)

**Inventory Views:**
- Current stock by medicine / brand / category / branch
- Low-stock report
- Near-expiry / expired stock report
- Fast-moving vs slow-moving medicine report
- Stock valuation report (total inventory value)

### 6.4 Supplier & Purchase Management
- Supplier/vendor master (name, contact, address, payment terms)
- Purchase order creation & approval workflow
- Goods Received Note (GRN) — record actual received quantity vs ordered
- Purchase return to supplier (damaged/expired goods)
- Supplier ledger (dues, payments made, outstanding balance)
- Auto-generate purchase suggestions based on low stock

### 6.5 Sales / Point of Sale (POS) & Billing
- Fast search by medicine name, brand, or barcode scan
- Cart-based billing with quantity, discount, tax (VAT)
- FEFO-based batch auto-selection (sell nearest-expiry stock first)
- Multiple payment methods (cash, card, mobile banking — bKash/Nagad, etc.)
- Split payment support
- Sales return / refund processing
- Prescription image upload/attachment for Rx medicines
- Print or SMS/email digital receipt
- Discount & promotion management (percentage, flat, loyalty points)
- Daily cash register / drawer reconciliation per cashier

### 6.6 Customer Management
- Customer profile (name, phone, address, allergies/notes — optional)
- Purchase history per customer
- Loyalty/reward points system (optional)
- Prescription history linked to customer
- Due/credit sales tracking (if pharmacy allows credit customers)

### 6.7 Reports & Analytics Dashboard
- Real-time dashboard: today's sales, profit, top-selling medicines, low stock alerts
- Sales reports (daily/weekly/monthly/yearly, by branch, by employee, by category)
- Profit & loss report
- Inventory valuation report
- Expiry/wastage report
- Employee performance report
- Supplier purchase report
- Tax/VAT report
- Exportable to PDF/Excel

### 6.8 Notifications & Alerts
- Low stock alert (push/email/SMS to manager)
- Expiry alert (30/60/90 days before expiry, configurable)
- Purchase order approval notifications
- Daily sales summary notification to owner
- Employee attendance/leave notifications

### 6.9 Multi-Branch Support
- Central admin can view/manage all branches
- Branch-wise stock, sales, and staff isolation
- Inter-branch stock transfer with approval
- Consolidated company-wide reports

### 6.10 Settings & Configuration
- Company/branch profile setup
- Tax/VAT configuration
- Currency & unit settings
- Printer/receipt template configuration
- Backup & data export settings
- User role & permission matrix configuration

---

## 7. Non-Functional Requirements

| Category | Requirement |
|---|---|
| **Performance** | POS billing screen should respond in < 1 second per action |
| **Scalability** | Support 50,000+ medicine SKUs and multiple branches without degradation |
| **Availability** | 99.5% uptime for cloud-hosted version |
| **Security** | Encrypted passwords (bcrypt), HTTPS, role-based access, audit logs |
| **Data Backup** | Automated daily backups, restore capability |
| **Offline Support** | POS should support offline mode with sync-on-reconnect (optional, for unstable internet areas) |
| **Compliance** | Support for local pharmacy/drug regulatory record-keeping requirements |
| **Usability** | Simple UI usable by non-technical pharmacy staff with minimal training |
| **Localization** | Multi-language support (e.g., English + Bengali), local currency (BDT) |
| **Device Support** | Responsive web app; works on desktop, tablet, and mobile browsers |

---

## 8. Suggested Database Schema (High-Level)

**Core Tables:**
- `users` (id, name, email, password_hash, role_id, branch_id, status)
- `roles` (id, name, permissions_json)
- `employees` (id, user_id, designation, department, salary, join_date, branch_id)
- `attendance` (id, employee_id, date, check_in, check_out, status)
- `branches` (id, name, address, phone)
- `medicines` (id, generic_name, category_id, strength, unit, requires_rx, barcode)
- `brands` (id, medicine_id, brand_name, manufacturer)
- `batches` (id, brand_id, batch_no, mfg_date, exp_date, purchase_price, selling_price, branch_id, quantity)
- `suppliers` (id, name, contact, address, payment_terms)
- `purchase_orders` (id, supplier_id, branch_id, status, order_date)
- `purchase_order_items` (id, po_id, brand_id, quantity, unit_price)
- `sales` (id, invoice_no, branch_id, cashier_id, customer_id, total, discount, tax, payment_method, created_at)
- `sale_items` (id, sale_id, batch_id, quantity, unit_price, subtotal)
- `customers` (id, name, phone, address, loyalty_points)
- `stock_adjustments` (id, batch_id, quantity_change, reason, adjusted_by, date)
- `stock_transfers` (id, from_branch, to_branch, batch_id, quantity, status)
- `notifications` (id, type, message, target_role, read_status, created_at)

---

## 9. Suggested Technology Stack

| Layer | Recommended Options |
|---|---|
| **Frontend** | React.js / Next.js (web), Flutter (mobile app, optional) |
| **Backend** | Node.js (Express/NestJS) or Laravel (PHP) or Django (Python) |
| **Database** | PostgreSQL or MySQL (relational, ideal for inventory/batch relationships) |
| **Authentication** | JWT-based auth with refresh tokens, RBAC middleware |
| **Hosting** | Cloud (AWS/GCP/Azure) or local VPS depending on client budget |
| **Barcode/Printer** | Barcode scanner integration (USB/Bluetooth), thermal receipt printer support |
| **Notifications** | Firebase Cloud Messaging (push), Twilio/local SMS gateway, SMTP for email |
| **Reporting** | Chart.js/Recharts for dashboards, PDF export via jsPDF/Puppeteer |

---

## 10. UI/UX Considerations

- Clean, minimal POS screen optimized for speed (keyboard shortcuts + barcode scan)
- Color-coded stock alerts (red = expired, orange = near-expiry, yellow = low stock)
- Dashboard with widgets: today's sales, top medicines, low stock count, expiring soon count
- Mobile-friendly layout for managers checking reports on the go
- Dark/light theme toggle (optional)

---

## 11. Key Differentiators / Advanced Features (Optional Add-ons)

- AI-based demand forecasting (predict reorder quantity based on sales trends)
- Automatic reorder / purchase suggestion engine
- Integration with government drug regulatory databases (where available)
- Customer SMS reminders for prescription refills
- Multi-currency support for import medicines
- Voice-search for medicine lookup
- QR-code based digital receipts

---

## 12. Milestones / Rollout Plan

| Phase | Duration (Est.) | Deliverables |
|---|---|---|
| **Phase 1 — MVP** | 6–8 weeks | Auth, Employee Mgmt, Medicine/Inventory, Basic POS |
| **Phase 2** | 4–6 weeks | Supplier/Purchase Mgmt, Reports Dashboard, Alerts |
| **Phase 3** | 4 weeks | Multi-branch support, Customer & Loyalty, Payroll |
| **Phase 4** | Ongoing | AI forecasting, mobile app, offline sync, integrations |

---

## 13. Risks & Mitigations

| Risk | Mitigation |
|---|---|
| Incorrect stock data during migration from manual records | Provide bulk import via Excel with validation |
| Staff resistance to new system | Simple UI + training sessions + phased rollout |
| Internet downtime affecting POS | Offline-first POS with local caching and sync |
| Data loss | Automated backups + audit trail |
| Regulatory/compliance changes | Configurable tax/compliance settings module |

---

## 14. Open Questions (For Stakeholder Input)

1. Single pharmacy or multi-branch chain from day one?
2. Should the system support credit/due sales to regular customers?
3. Is offline POS support required (based on internet reliability at location)?
4. Should payroll/salary processing be part of Phase 1 or a later phase?
5. Any specific government/regulatory reporting requirements to comply with?
6. Preferred platform: Web-only, or also native mobile apps for staff/owner?

---

*End of Document*
