Announcements
Hello experts,
I have a requirement to override the sales tax for each sales line while sales invoice posting.
can someone please help?
I had similar requirements - POS receipt lines were calculated line by line, and rounded tax from each small quantity, but it was sent to tax authorities and resulting AX sales invoice didnt match, because it was created for summary amount and summary tax. To solve this I created class something like TaxRetail, which created tmpTaxWorkTrans in calc method based on data from RetailStatement table. Tables name are not exact, but anyway - the idea is to create class which is inherited from tax - and create your own calculation.
Hi Mohammad,
I'm not sure if you can adjust taxes for each line independently, but you can adjust taxes for the whole order.
Check TaxRegulation::adjustTaxInvoice method, it's used when credit note is created and tax is adjusted from original invoice. You can probably develop something similar.
Hello Will WU,
thanks for providing the link.
This is not of much help as my requirement at the time of sales invoice.
This link does show which object to modify but I need a place where should I write the code.
Regards,
Raziq
Hi Mohammad,
Please see the updateTaxRegulationAmount method in the class TaxRegulationDetail .
And have a look at this old thread:
community.dynamics.com/.../sales-tax-override-on-pending-vendor-invoice-lines
No, the problem here is the transaction coming from POS does not have a sales tax code and the sales amount must be overridden with the existing sales tax amount.
Perhaps the easiest solution (which would also not require customization of tax calculation) would be to let D365 calculate the same tax for you by setting up the tax setup correctly. Your integration needs to simply tell which tax code applies to each sales line, and whether tax is included in the price or not.
Wouldn't this produce the outcome that you need?
Thanks for the reply Nikolaos,
Sales tax amount value coming from POS which I am saving on sales line through extension and this sales tax must be considered/overridden with the existing sales tax amount (through sales tax code on each sales line) while posting retail statement which then creates a sales order and invoices it.
I have sales tax amount ready on each line. I just need code and place to write the code.
Best regards,
Raziq.
What exactly do you mean by "overriding sales tax"? Could you share your actual business requirement?
You can impact the tax calculation with tax setup.
André Arnaud de Cal...
294,233
Super User 2025 Season 1
Martin Dráb
232,982
Most Valuable Professional
nmaenpaa
101,158
Moderator