---
title: "Pharmacy Billing"
description: "How pharmacy billing works in NICE HMS — enabling the pharmacy ledger, managing pharmacy items with batch tracking, the four pharmacy voucher types, the pharmacist role, and stock tracking."
date: 2026-07-19
lastModified: 2026-07-26
category: "pharmacy"
author: "Dr. Umesh Bilagi"
beta: false
---

## Overview

Pharmacy in NICE HMS is an **accounting channel** within the Accounts module, not a standalone module with its own pages. There is no dedicated "Pharmacy" sidebar menu — pharmacy users access everything through **Accounts**.

Pharmacy transactions use the same forms as other billing workflows (invoice, purchase, debit note, credit note) but with pharmacy-specific voucher types, print headers, and the `accountHeaderPharmacyUrl` letterhead. The **pharmacist** role is restricted to pharmacy voucher types only.

## Enabling Pharmacy Billing

Before using pharmacy billing, enable it in organization settings:

1. **Admin → Organization → Settings**
2. Toggle **Pharmacy Billing** to ON.
3. This creates a PHARMACY ledger account for the organization.

The pharmacy toggle is at the organization level. Once enabled, the **Pharmacy** card appears on the Accounts landing page (`/admin/accounts`) with two links: **Purchase** and **Debit Note**.

## Pharmacy Items

Pharmacy items (medicines, consumables) are created through **Item Management** (Accounts → Masters → Items), not through a separate pharmacy inventory page. See [Item Management](/docs/item-management) for the full item creation form.

Key configuration for pharmacy items:

| Setting | Value |
|---------|-------|
| **Category** | Pharmacy |
| **Sub Category** | Pharmacy |
| **Purchasable** | TRUE (can be bought from vendors) |
| **Saleable** | TRUE (can be sold to patients) |

### Batch Tracking

Medicines can be tracked by batch through the `batchMaster` table. Each batch record stores:

| Field | Description |
|-------|-------------|
| **Batch** | Batch number |
| **Expiry Date** | Expiration date |
| **Manufacturing Date** | Date of manufacture |
| **Item** | Linked item ID |

Batch tracking applies to all inventory items, not just pharmacy. During purchase entry, batch details are recorded so that stock is tracked per batch.

## Pharmacy Voucher Types

Four voucher types handle pharmacy transactions. They use the same UI components as their non-pharmacy counterparts but are routed through pharmacy-specific APIs and print with pharmacy headers:

| Voucher Type | Purpose | Counterpart |
|-------------|---------|-------------|
| **INVOICE_P** | Sale of medicines to a patient | INVOICE |
| **CREDIT_NOTE_P** | Return/refund for pharmacy sale | CREDIT_NOTE |
| **PURCHASE_P** | Purchase of stock from a vendor | PURCHASE |
| **DEBIT_NOTE_P** | Return of stock to a vendor | DEBIT_NOTE |

### Access

| Transaction | Access Path |
|-------------|-------------|
| **Patient sale (invoice)** | Accounts → Pharmacy → use the general **Invoice** link with `vouchertype=INVOICE_P` |
| **Vendor purchase** | Accounts → Pharmacy → **Purchase** (`/admin/accounts/bill/create?vouchertype=PURCHASE_P`) |
| **Purchase return** | Accounts → Pharmacy → **Debit Note** (`/admin/accounts/bill/create?vouchertype=DEBIT_NOTE_P`) |

### Form Fields

The purchase and invoice forms are the same as the generic bill and invoice forms (see [Bill Transaction](/docs/bill-transaction) and [Purchase](/docs/purchase)). The voucher type parameter determines:
- Which API endpoint handles the transaction
- Which accounts (Dr/Cr) are available
- Which letterhead appears on the printed document

### Pharmacist Role Restrictions

The **pharmacist** role can only create pharmacy-tagged vouchers. The create-purchase API rejects pharmacists for non-pharmacy purchase types:

```typescript
if (user.role == "pharmacist" && type != "PURCHASE_P" && type != "DEBIT_NOTE_P") {
  throw new Error("forbidden");
}
```

Similarly, the create-invoice API restricts pharmacists to `INVOICE_P` and `CREDIT_NOTE_P` types only.

## Stock Tracking

Stock levels for pharmacy items are tracked through the shared stock system alongside hospital-category items. The stock is calculated from purchase and invoice voucher quantities.

### Current Stock Report

**Sidebar → MIS Reports → Stock → Current** (`/admin/mis-reports/stock/current/0?category=Pharmacy`)

Filter by `category=Pharmacy` to view only pharmacy items. The report shows current stock levels per item with batch-wise breakdown.

### Expiry Tracking

The `batchMaster` table stores expiry dates per batch. An `expiryStock()` function queries batches approaching expiry, but there is no dedicated expiry alerts page — use the batch master data to identify items nearing expiration.

### Physical Stock Adjustment

Use **Physical Stock** vouchers (`PHYSICAL_POSITIVE` / `PHYSICAL_NEGATIVE` types) to adjust stock levels for physical verification corrections, wastage, or damage. This is a shared inventory feature, not pharmacy-specific.

## Printing

Pharmacy vouchers automatically use the pharmacy-specific letterhead:

- Printed headings show: **INVOICE (Pharmacy)**, **CREDIT NOTE (Pharmacy)**, **PURCHASE (Pharmacy)**, or **DEBIT NOTE (Pharmacy)**
- The letterhead image uses `accountHeaderPharmacyUrl` from organization uploads (see [Printing and Letter Pad Header](/docs/printing-and-set-up-of-letter-pad-header))

The invoice component detects the `_P` suffix in the voucher type and switches to the pharmacy header automatically.

## FAQ

**Q: Where do I find the pharmacy menu?**
A: There is no separate pharmacy menu. Go to **Sidebar → Accounts**. If pharmacy billing is enabled in organization settings, a **Pharmacy** card appears with Purchase and Debit Note links. For patient sales, use the general Invoice link with a pharmacy item.

**Q: How do I add new medicines to the pharmacy?**
A: Use **Accounts → Masters → Items** (see [Item Management](/docs/item-management)). Set the category to "Pharmacy" and mark it as purchasable and saleable.

**Q: Can I track medicine expiry dates?**
A: Yes. Batch tracking records manufacturing and expiry dates for each batch of medicine. Use the batch master data to identify items approaching expiry.

**Q: What can a pharmacist user do?**
A: A user with the pharmacist role can create and edit pharmacy vouchers (INVOICE_P, CREDIT_NOTE_P, PURCHASE_P, DEBIT_NOTE_P), create receipts/payments, and view MIS reports. They cannot create non-pharmacy transactions.

**Q: Does pharmacy billing work differently from regular billing?**
A: The forms are identical. The difference is the voucher type suffix (`_P`), which routes through pharmacy-specific accounting and uses the pharmacy letterhead for printed documents.

**Q: How do I dispense medicines against a prescription?**
A: There is no dedicated dispensing interface. Create a pharmacy invoice (INVOICE_P) for the patient with the prescribed medicines as line items. Stock is reduced automatically when the invoice is saved.

**Q: Is there integration with the ABDM Drug Registry?**
A: Not currently. A medication resolver integration is planned but not yet implemented.
