Hello Experts,
I have a requirement where i want to show the sum of tax amount of all the order made on a particular customer.
For Example - On Customer US-001 there are total 10 open orders. So i want to show the sum of tax amount of those 10 orders.
Can any one please help on this, Most often i dont get any reply, I appreciate if someone can help me on this.
Any Help on this?
can someone please help on this?
It's not clear what you need from us. Giving you a solution is difficult if you don't give us enough information about your problem.
Do you want to write X++ code to get the value, or do you need a query in a form, or what?
Do you know how to get a tax amount for a single order?
Are you familiar with database queries and aggregation functions?
public static real CheckDraftOrderTax(CurrencyCode _currencycode, CustAccount _custaccount, Noyes _isdraft = NoYes::Yes) { SalesTable salestable; SalesLine salesline; TaxOnItem taxOnItem; TaxGroupData taxGroupData; real taxAmount; TaxValue taxValue; while select CurrencyCode from salestable group by CurrencyCode where salestable.CustAccount == _custaccount && salestable.Draft_CAP == _isdraft join sum(LineAmount) from salesline where salesline.SalesId == salestable.SalesId && salesline.SalesStatus != SalesStatus::Invoiced { while select sum(LineAmount), TaxItemGroup, TaxGroup from salesline join TaxItemGroup from taxOnItem where taxOnItem.TaxItemGroup == salesline.TaxItemGroup join TaxGroup,TaxCode from taxGroupData where taxGroupData.TaxGroup == Salesline.TaxGroup && taxGroupData.TaxCode == TaxOnItem.TaxCode { taxValue = TaxData::find(TaxOnItem.TaxCode, Systemdateget(), 0).taxValue; taxAmount = taxAmount (Salesline.LineAmount * TaxValue) / 100; } } return taxAmount;
tried this code idea was to write a logic in this method and then use this method in my display method which i have created on salestable only.
Please give us a more detailed description of the problem than mere "that is not working". If you haven't done it yet, use the debugger to find out which part of your code doesn't behave as expected.
There a few strange things in your code. For instance, you keep overwriting taxAmount - I guess you want to assign it with +=. You also never use any value from salesLine in the outer while select, therefore summarizing LineAmount there has no effect.
The fields you select from TaxGroupData aren't used either.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 724 Most Valuable Professional
André Arnaud de Cal... 619 Super User 2025 Season 2
Sohaib Cheema 400 User Group Leader