Skip to content

[BUG]: Percentage tax is calculated before discounts #276

Open

Description

@arahanxd

Description

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.

Activity

  1. gitcordapp commented on Oct 13, 2026

    @gitcordapp

    Link your account with Gitcord

    Thanks for opening this issue, @arahanxd!

    To receive Discord notifications and contributor tracking for this organization:

    1. Join Discord: https://discord.gg/YzDKeEfWtS
    2. In Discord, run /link arahanxd
    3. Paste the verification code into your GitHub bio (or a public gist)
    4. Click Verify in Discord (or run /verify-link arahanxd)

    Once linked, Gitcord can notify you about assignments, mentions, and more.

    — Posted by Gitcord

  2. Atharva0506 commented on Oct 16, 2026

    @Atharva0506
    Member

    @arahanxd, are you currently working on this issue?

  3. Thushara3005 commented on Oct 17, 2026

    @Thushara3005
    Contributor

    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.

  4. arahanxd commented on Oct 17, 2026

    @arahanxd
    Author

    Hi @Atharva0506, I'm currently working on this issue and investigating the problem. I'll keep you updated on my progress. Thanks for checking!

  5. Atharva0506 commented on Oct 17, 2026

    @Atharva0506
    Member

    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.

  6. arahanxd commented on Oct 18, 2026

    @arahanxd
    Author

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions