You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Percentage tax is calculated before discounts #276
getLineAmountDetails computes percentage tax from lineTotalWei before subtracting the discount. For invoices where discounts reduce the taxable base, this overstates the tax and invoice total.
Reproduction
Create a line item with quantity 10, unit price 10, flat discount 5, and percentage tax 10%.
Pre-discount subtotal: 100
Current tax calculation: 10% of 100 = 10
Current invoice total: 100 - 5 + 10 = 105
Expected where discount is applied before tax: 95 + 9.5 = 104.5
Expected behavior
Calculate percentage tax from the discounted taxable amount (or make the taxable-base rule explicit/configurable where tax rules differ) and use that same result in previews, invoice totals, and exports.
Impact
Invoices can charge recipients too much tax in jurisdictions where discounts reduce the taxable amount.
Hi @Atharva0506 ,I'd like to work on this issue.
If no one is actively working on it, I'd be happy to investigate the problem and submit a PR with a fix.
Confirmed on main: getLineAmountDetails in invoiceCalculations.js takes percentage tax from the pre-discount line total. Valid, but changing it alters invoice totals, so it needs a decision on the taxable-base rule first. Not planned before the current release.
@Atharva0506 Thanks for confirming the current behavior. I investigated getLineAmountDetails in invoiceCalculations.js, its callers, and the existing calculation tests.
The implementation calculates percentage tax on the original line subtotal before subtracting the discount. The existing tests also expect this behavior, but I couldn't find documentation establishing whether discounts should reduce the taxable base.
Since changing this would affect invoice totals, I haven't modified the implementation.
Could you clarify the intended taxable-base rule for percentage taxes when a discount is applied? Once the expected behavior is established, I'd be happy to implement the appropriate fix and add regression tests.
Activity
gitcordapp commentedon Oct 13, 2026
Link your account with Gitcord
Thanks for opening this issue, @arahanxd!
To receive Discord notifications and contributor tracking for this organization:
/link arahanxd/verify-link arahanxd)Once linked, Gitcord can notify you about assignments, mentions, and more.
— Posted by Gitcord
Atharva0506 commentedon Oct 16, 2026
@arahanxd, are you currently working on this issue?
Thushara3005 commentedon Oct 17, 2026
Hi @Atharva0506 ,I'd like to work on this issue.
If no one is actively working on it, I'd be happy to investigate the problem and submit a PR with a fix.
arahanxd commentedon Oct 17, 2026
Hi @Atharva0506, I'm currently working on this issue and investigating the problem. I'll keep you updated on my progress. Thanks for checking!
Atharva0506 commentedon Oct 17, 2026
Confirmed on main:
getLineAmountDetailsininvoiceCalculations.jstakes percentage tax from the pre-discount line total. Valid, but changing it alters invoice totals, so it needs a decision on the taxable-base rule first. Not planned before the current release.arahanxd commentedon Oct 18, 2026
@Atharva0506 Thanks for confirming the current behavior. I investigated
getLineAmountDetailsininvoiceCalculations.js, its callers, and the existing calculation tests.The implementation calculates percentage tax on the original line subtotal before subtracting the discount. The existing tests also expect this behavior, but I couldn't find documentation establishing whether discounts should reduce the taxable base.
Since changing this would affect invoice totals, I haven't modified the implementation.
Could you clarify the intended taxable-base rule for percentage taxes when a discount is applied? Once the expected behavior is established, I'd be happy to implement the appropriate fix and add regression tests.