-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Calculate Tax properly #7843
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/6k1eFMBvTp2sV8Dpmkqu4rXaEMgZ |
Codecov Report
@@ Coverage Diff @@
## development #7843 +/- ##
===============================================
+ Coverage 18.56% 18.59% +0.02%
===============================================
Files 613 614 +1
Lines 7201 7206 +5
Branches 149 149
===============================================
+ Hits 1337 1340 +3
- Misses 5837 5839 +2
Partials 27 27
Continue to review full report at Codecov.
|
app/models/order.js
Outdated
if (taxType) { | ||
return ((taxRate * this.amount) / (100 + taxRate)).toFixed(2); | ||
} else { | ||
return ((this.amount) / (1 + taxRate / 100) * (taxRate / 100)).toFixed(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share thoght process behind this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let x be amount without taxIncluded
So we need to calculate tax which will can be calculated by totalAmount = x + x*taxRate/100;
where x * taxRate / 100
is tax added on top of it which is given by
totalAmount / ( 1 + taxRate / 100 ) * ( taxRate / 100 ) which gives
(taxRate * totalAmount) / (100 + taxRate)
here both if else statement means same, so I'll change that.
@maze-runnar pls have a look
ok, so if my ticket price is 100, and the tax rate is 50%. And I have selected tax is included in the price, it is showing 33.33 tax amount price. |
@maze-runnar it is correct because 100 is ticket price inlcuding tax so actual ticket is of 66.66 + 33.33(tax) which gives 100 |
yes, it is 🔥. good work. |
This did not solve the issue. Tax is still not showing up e.g. compare here https://test.eventyay.com/e/554ef820 |
@mariobehling This porblem is not showing on localsystem. bcz the changes made in PR #3820 is also not showing (below ScreenShot). I think the problem is in deployment and same goes with this PR. |
@daretobedifferent18 We are not deploying on live server. The server with the latest changes of the dev branch is https://test.eventyay.com. |
@mariobehling ok let me see what is the problem |
Fixes #7835
Short description of what this resolves:
If we buy paid tickets of more than one type, the tax on orders page shows 0.00 for all tickets. There is probably some calculation issue in tax system.
Checklist
development
branch.