web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Sum of tax amount of salesorders created on a particular customer

(0) ShareShare
ReportReport
Posted on by 60

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.

I have the same question (0)
  • piyush02 Profile Picture
    60 on at
    RE: Sum of tax amount of salesorders created on a particular customer

    Any Help on this?

  • piyush02 Profile Picture
    60 on at
    RE: Sum of tax amount of salesorders created on a particular customer

    can someone please help on this?

  • Martin Dráb Profile Picture
    237,660 Most Valuable Professional on at
    RE: Sum of tax amount of salesorders created on a particular customer

    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?

  • piyush02 Profile Picture
    60 on at
    RE: Sum of tax amount of salesorders created on a particular customer

        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;
    
    hello Martin thanks for your reply. I need to use that in a display method which I will display on sales order screen. I have created a boolean on salestable. if that boolean is trut then display method will show sum of tax amount of all the orders of the customer which is marked as that boolean true. I also created one method to use but that is not working

  • piyush02 Profile Picture
    60 on at
    RE: Sum of tax amount of salesorders created on a particular customer

    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.

  • Martin Dráb Profile Picture
    237,660 Most Valuable Professional on at
    RE: Sum of tax amount of salesorders created on a particular customer

    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.

  • Martin Dráb Profile Picture
    237,660 Most Valuable Professional on at
    RE: Sum of tax amount of salesorders created on a particular customer

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 724 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 619 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 400 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans