Calculating Tax on a Previous Row’s Amount in ERPNext
Sometimes you need to calculate a tax on a previous tax amount rather than on the item amount. For example, you have 5 items with a Service Charge calculated on their Net Total, and you then need 5% VAT charged on the Service Charge not on the invoice’s Net Total. ERPNext handles this with the “On Previous Row Amount” tax type.
Steps
- In the Sales Invoice, under the Sales Taxes and Charges section, set up the first tax. In row 1, select the Type as On Net Total, choose the Account Head you need, and enter the Rate if it isn’t already set. The amount for this account head is calculated in the Amount column.
- Next, calculate tax on the previous row’s amount (the tax amount from row 1). Add a new row and select the Type as On Previous Row Amount. Set the Account Head and Rate as needed, then expand the row and set the Reference Row # to point at the row whose amount you’re taxing.
With this set, the VAT in the second row is calculated on the Service Charge amount from the first row, exactly as required.
NOTE
The Reference Row # is what makes this work, it tells ERPNext which earlier row’s amount to apply the rate to. Without it set, an “On Previous Row Amount” line has nothing to calculate against, so always confirm the reference points at the correct row.
TIP
If you need a tax calculated on the running total up to a point (rather than a single earlier row), use On Previous Row Total instead of On Previous Row Amount. The two are easy to mix up “Amount” targets one row’s charge, “Total” targets the cumulative total.
Related Topics
- Sales Taxes and Charges Template
- Purchase Taxes and Charges Template
- Sales Invoice
- Consider Tax or Charge For
SUMMARY
To calculate a tax on a previous tax amount rather than the item amount such as VAT on a Service Charge set up two rows in Sales Taxes and Charges. The first row uses Type “On Net Total” for the base charge (e.g. the Service Charge). The second row uses Type “On Previous Row Amount” with the Account Head and Rate, and its Reference Row # set to the first row. The second tax is then calculated on the first row’s amount rather than on the invoice Net Total.