---
title: "GST Tax Calculation"
description: "How GST is configured and calculated on invoices in NICE HMS — the CGST/SGST/IGST fields, the per-line formula, the database tables that store tax data, and where the GST number appears on printed documents."
date: 2026-08-29
lastModified: 2026-08-29
category: "billing"
author: "Dr. Umesh Bilagi"
beta: true
---

## Overview

GST in NICE HMS is calculated **per line item** on each invoice. The tax rates are configured once on the item master, inherited by every invoice line, and stored alongside the transaction so the breakdown (CGST/SGST/IGST, taxable value, tax amount) is always auditable.

## Where Tax Rates Are Configured

Each item carries its own GST rates. Set them in **Accounts → Masters → Items** (see [Item Management](/docs/item-management)):

| Field | Type | Meaning |
|-------|------|---------|
| **cgst** | `decimal(6,3)` | Central GST rate (percentage) |
| **sgst** | `decimal(6,3)` | State GST rate (percentage) |
| **igst** | `decimal(6,3)` | Integrated GST rate (percentage) — reserved, currently unused |
| **hsn_sac_code** | `varchar` | HSN (goods) or SAC (services) code for the item |

For example, an 18% intra-state item is configured as `cgst = 9.000` and `sgst = 9.000`.

## How GST Is Calculated

The calculation happens on the frontend (`components/accounts/transactions/Invoice/index.tsx`) and is re-validated on the server (`pages/api/admin/accounts/transfer/patient-billing/invoice/create-invoice.ts`). Per line item:

```
itemAmount = quantity × salePrice
itemAmount = itemAmount × (100 − discount%) / 100     // pre-GST taxable value (rounded 2dp)
gstAmount  = round(itemAmount × cgst/100, 2) + round(itemAmount × sgst/100, 2)
totalItemAmount = itemAmount + gstAmount              // amount the patient pays
```

So, in words: **GST = (salePrice × quantity − discount) × (CGST% + SGST%)**.

### Worked Example

An item with `salePrice = ₹500`, `quantity = 2`, `cgst = 9%`, `sgst = 9%`, and a `10%` discount:

| Step | Calculation | Result |
|------|-------------|--------|
| Gross | 500 × 2 | ₹1000.00 |
| After discount | 1000 × (100 − 10) / 100 | ₹900.00 |
| CGST | 900 × 9 / 100 | ₹81.00 |
| SGST | 900 × 9 / 100 | ₹81.00 |
| **gstAmount** | 81 + 81 | **₹162.00** |
| **totalItemAmount** | 900 + 162 | **₹1062.00** |

## IGST Status

The `igst` field exists but is **not currently active**. The invoice UI hardcodes `igst = 0` (with a note that choosing between IGST vs CGST/SGST is future work), so today the system only computes **intra-state CGST + SGST**. The server-side code already has the inter-state branch ready (`if (igst != 0) → treat the entire GST as IGST`) but it never triggers because the UI always sends `igst = 0`.

## Where GST Data Is Stored

Three tables hold tax-related data:

| Table | Role | GST columns |
|-------|------|-------------|
| **Item Master** (config) | One row per configured item, holds the rates | `cgst`, `sgst`, `igst`, `hsn_sac_code`, `salePrice` |
| **`item`** (invoice line items) | One row per billed line, stores the applied rates and computed amounts | `cgst`, `sgst`, `igst`, `gstAmount`, `itemAmount`, `totalItemAmount`, `quantity`, `discount`, `salePrice` |
| **`voucher`** (header) | The invoice header | total `amount` |

Field meanings on the `item` line-item table (see `models/models/interfaces/Accounts.ts`):

- **itemAmount** — pre-GST taxable value (after discount)
- **gstAmount** — the tax amount for the line
- **totalItemAmount** — `itemAmount + gstAmount`

## GST Number on Printed Documents

There is **no dedicated GSTIN field on the printed invoice**. The organization's GST number should be embedded in the **letterhead/header image**:

- **Hospital billing** — `accountHeaderUrl`
- **Pharmacy billing** — `accountHeaderPharmacyUrl`

See [Printing and Letter Pad Header](/docs/printing-and-set-up-of-letter-pad-header) for how to upload these images. (Account entities do have optional GST/PAN text fields in the Accounts Master, but the printed document carries the GSTIN via the letterhead image.)

## FAQ

**Q: Where do I set the GST rate for an item?**
A: **Accounts → Masters → Items** — set `cgst`, `sgst`, and (for future inter-state use) `igst`, plus the `hsn_sac_code`. See [Item Management](/docs/item-management).

**Q: Is IGST supported?**
A: Not yet. The field is reserved and the UI currently hardcodes `igst = 0`, so only CGST + SGST (intra-state) is calculated.

**Q: How is discount handled before GST?**
A: Discount is applied first as a percentage of the gross line amount, then GST is computed on the discounted value. GST is never charged on the discount.

**Q: Can I see the GST breakdown on a saved invoice?**
A: Yes — each line stores `cgst`, `sgst`, `gstAmount`, `itemAmount`, and `totalItemAmount`, and the printed invoice shows a CGST/SGST column breakdown plus a GST summary.

**Q: Where does the hospital's GST number go on the invoice?**
A: In the letterhead/header image (`accountHeaderUrl` / `accountHeaderPharmacyUrl`), not a dedicated field.

## Related

- [Bill Transaction](/docs/bill-transaction)
- [Item Management](/docs/item-management)
- [Accounts Master](/docs/accounts-master)
- [Purchase](/docs/purchase)
- [Printing and Letter Pad Header](/docs/printing-and-set-up-of-letter-pad-header)
