---
title: "Tax Calculation"
space: "X POS"
url: "https://docs.kodlyft.com/xpos/tax-calculation"
updated: "2026-05-29"
---


X POS calculates taxes automatically based on the tax template configured in the POS Profile. It supports both **tax-inclusive** and **tax-exclusive** pricing, per-item tax overrides, and multiple tax rows.

---

## Tax Configuration

Taxes are defined in the **Sales Taxes and Charges Template** linked to the POS Profile. Each tax row in the template has:

| Field | Options | Description |
|-------|---------|-------------|
| **Account Head** | (Tax Account) | The ledger account for this tax (e.g. "VAT - Company") |
| **Description** | Free text | Label shown on the receipt (e.g. "VAT 15%") |
| **Rate** | Number | Tax percentage |
| **Charge Type** | "On Net Total" / "Actual" | How the tax is calculated |
| **Included in Print Rate** | Checkbox | Whether the item price already includes this tax |

### Charge Types

| Type | Calculation | Use Case |
|------|------------|----------|
| **On Net Total** | Percentage of item net amount | Most common — GST, VAT, sales tax |
| **Actual** | Fixed amount added to the total | Service charges, flat fees |

---

## Tax-Inclusive vs Tax-Exclusive

### Tax-Exclusive (Default)

The item's selling price does **not** include tax. Tax is added on top.

**Example:** Item price = 100, Tax rate = 15%
- Net amount = 100
- Tax = 100 × 15 / 100 = **15**
- Total = 100 + 15 = **115**

### Tax-Inclusive

The item's selling price **already includes** tax. The tax is extracted (backed out) from the price.

**Example:** Item price = 115 (tax-inclusive), Tax rate = 15%
- Tax = 115 × 15 / (100 + 15) = **15**
- Net amount = 115 - 15 = **100**
- Total = **115**

Tax-inclusive mode is controlled by the `included_in_print_rate` flag on each tax row. Different tax rows in the same transaction can have different inclusive/exclusive settings.

---

## Calculation Process

When items are in the cart, taxes are recalculated in real time. Here is the exact calculation flow:

### Step 1 — Calculate Item Net Amounts

For each item in the cart:

```
net = quantity × rate - discount_amount
```

If the item has a percentage discount instead:

```
discount_amount = quantity × rate × discount_percentage / 100
net = quantity × rate - discount_amount
```

### Step 2 — Apply Tax Rows

For each tax row in the profile:

1. **Check inclusive flag** — Is this tax included in the print rate?
2. **For each item**, determine the effective tax rate:
   - If the item has an **item-level tax override** (via `item_tax_map`), use the override rate for this account head
   - Otherwise, use the profile tax rate
3. **Calculate tax amount** based on charge type:

| Charge Type | Inclusive | Formula |
|-------------|----------|---------|
| On Net Total | No | `net × rate / 100` |
| On Net Total | Yes | `net × rate / (100 + rate)` |
| Actual | — | Fixed rate amount |

4. **Sum** the tax from all items → total for this tax row

### Step 3 — Handle Extra Item-Level Taxes

Some items may have taxes in their `item_tax_map` that are **not** in the profile's tax template. For these:

1. Identify tax accounts in `item_tax_map` that don't match any profile tax `account_head`
2. Calculate: `net × rate / 100` for each extra tax
3. Add these as additional tax rows in the result

### Step 4 — Aggregate

The system produces an array of calculated tax rows:

| Property | Type | Description |
|----------|------|-------------|
| `description` | String | Tax label (e.g. "VAT 15%") |
| `rate` | Number | Tax rate percentage |
| `amount` | Number | Calculated tax amount (rounded to 2 decimal places) |
| `included_in_print_rate` | Boolean | Whether this tax is inclusive |

---

## Tax Display in Cart

The Cart Summary section shows tax information:

### Tax-Exclusive Taxes
- Displayed as a separate line item below the subtotal
- Each tax row shows: description and amount
- These amounts are **added** to the subtotal to get the grand total

### Tax-Inclusive Taxes
- Shown as informational text (e.g. *"Includes VAT 15%: 150.00"*)
- These amounts are **not** added to the total (already included in item prices)

### Summary Breakdown

```
Subtotal (Net Total)          1,000.00
  VAT 15%                   +  150.00    ← tax-exclusive
  Service Charge 5%         +   50.00    ← tax-exclusive
                            ──────────
  Includes GST 10%            100.00     ← tax-inclusive (info only)
                            ──────────
Grand Total                  1,200.00
```

---

## Per-Item Tax Overrides

Individual items can have their own tax rates that override the profile defaults. This is useful when different products have different tax rates within the same transaction.

### How It Works

1. Each item can have an **Item Tax Template** assigned
2. The template contains a mapping: `{ "account_head": rate }`
3. When calculating taxes, the system checks:
   - Does this item have an `item_tax_map` entry for this account head?
   - If yes → use the item's rate
   - If no → use the profile's default rate

### Setting Item Tax

In ERPNext, per-item tax templates are configured on the Item master:

- **Item → Tax → Item Tax Template**: Select a template
- The template maps account heads to rates
- Example: "Zero-Rated VAT" template maps "VAT Account" → 0%

When such an item is added to the cart, the POS automatically:
1. Loads the item's `item_tax_template` name
2. Loads the `item_tax_map` (JSON object of account → rate)
3. Applies the per-item rates during tax calculation

---

## Tax in Payment Dialog

The Payment Dialog shows the final tax-inclusive grand total. The tax breakdown is visible in the summary section:

| Line | Value |
|------|-------|
| Net Total | Sum of item nets |
| Tax 1 (name) | Amount (if exclusive) |
| Tax 2 (name) | Amount (if exclusive) |
| **Grand Total** | **Net + exclusive taxes** |
| Includes Tax (name) | Amount (informational, if inclusive) |

---

## Tax in Printed Receipt

The printed receipt includes:
- Each tax-exclusive tax as a separate line with description and amount
- Tax-inclusive taxes as a note (e.g. "Includes VAT: 150.00")
- The grand total inclusive of all exclusive taxes

---

## Common Scenarios

### Single Tax Rate (Most Common)
- POS Profile has one tax row: VAT 15%, On Net Total
- All items taxed at 15%
- Tax-inclusive or exclusive per the profile setting

### Multiple Tax Rates
- POS Profile has two tax rows: VAT 15% + Service Charge 5%
- Both applied to every item
- Calculated independently and summed

### Mixed Tax Rates Per Item
- POS Profile has VAT 15%
- Some items have Item Tax Template overriding VAT to 0% (zero-rated)
- Tax is calculated per-item with the correct rate, then summed

### Tax-Inclusive Pricing
- POS Profile tax row has `included_in_print_rate = 1`
- Item prices on shelf already include tax
- Tax is backed out mathematically: `price × rate / (100 + rate)`
- Grand total equals the sum of item prices (no tax added on top)


