Skip to main content

Notifications

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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,934 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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,934 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.

  • piyush02 Profile Picture
    piyush02 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.

  • piyush02 Profile Picture
    piyush02 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

  • Martin Dráb Profile Picture
    Martin Dráb 230,934 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
    piyush02 60 on at
    RE: Sum of tax amount of salesorders created on a particular customer

    can someone please help on this?

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

    Any Help on this?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,111 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,934 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans