How invoice amounts are calculated
Audience: All users (SME) Time: 5 minutes
envoice calculates every amount on your e-invoice the same way LHDN MyInvois expects, and reconciles the final amount to your source document (for example your Zoho total) to the cent. This guide explains how, so you can check any figure yourself.
The one rule that matters
LHDN works out the document tax as the sum of the tax on each line. It does not tax the document total in one step.
This is why a discount given before tax has to reduce the line it applies to, not just the grand total. If it only reduced the total, the per-line tax would still be calculated on the full price and your tax would be too high. envoice handles this for you (see "Discounts" below).
1. How each line is calculated
For every line on the document:
gross = unit price x quantity
discount = the line's discount (before tax)
net = gross - discount (this is the taxable amount)
line tax = net x tax rate % (rounded to 2 decimal places)
line total = net + line tax
So a line of 3 units at RM 50.00 with a RM 10.00 line discount and 6% tax:
gross = 50.00 x 3 = 150.00
net = 150.00 - 10.00 = 140.00
line tax = 140.00 x 6% = 8.40
line total = 140.00 + 8.40 = 148.40
2. How the document total is calculated
subtotal = the sum of every line's net amount
total tax = the sum of every line's tax
discount total = document-level discounts (a discount on the whole invoice)
charge total = document-level charges (for example shipping or a fee)
rounding = a small rounding adjustment, if any
prepayment = any amount already paid in advance
tax exclusive = subtotal - discount total + charge total
tax inclusive = tax exclusive + total tax
amount payable = tax inclusive + rounding - prepayment
- Total Sales Amount is the subtotal (the sum of line nets). A line discount lives inside its line, so it is already reflected here.
- Total Discount Amount on the e-invoice shows document-level discounts only, not line discounts.
- Prepayment lowers the amount payable but is not part of the tax-inclusive total. If you record a prepayment, the amount payable is correctly lower than the invoice total.
3. Discounts (the important bit)
There are two kinds of discount, and they are treated differently:
- A line discount is subtracted from that line's price before tax. Simple.
- A whole-invoice discount given before tax is spread across the lines in proportion to each line's value, so each line's tax is calculated on the discounted amount. This keeps the tax correct.
- A discount applied after tax (or where there is no taxable amount) is recorded as a document-level discount and does not change the tax.
Worked example. Two lines, both 6% tax, with a RM 16.00 whole-invoice discount given before tax:
Line 1: 100.00 Line 2: 50.00 (gross total 150.00)
Discount 16.00 split by value:
Line 1 share = 16.00 x (100 / 150) = 10.67 -> net 89.33
Line 2 share = 16.00 x ( 50 / 150) = 5.33 -> net 44.67
Line tax: 89.33 x 6% = 5.36 ; 44.67 x 6% = 2.68
Total tax = 8.04
Subtotal = 134.00
Amount payable = 134.00 + 8.04 = 142.04
If that RM 16.00 had only been taken off the total (not the lines), the tax would have been worked out on the full 150.00 and come to 9.00 instead of 8.04, overcharging tax. envoice avoids this automatically.
4. Reconciling to Zoho
When you submit from Zoho, your Zoho document already shows a final total. envoice maps your Zoho discounts, shipping, and rounding onto the e-invoice lines using the rules above, then adds a tiny reconciliation adjustment if needed, so that the amount payable on the e-invoice equals your Zoho total exactly.
5. Foreign currency
For an invoice in a currency other than MYR, you provide an exchange rate. envoice files the amounts in the invoice currency and also includes the tax converted to MYR, as LHDN requires.
Back to: View and manage your documents