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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to calculate sum tax for Sales Order

(0) ShareShare
ReportReport
Posted on by

1. Is there SumTax I could find before SO Invoiced. 

 

2.  I just could get  last  value from below  code, but I need sumTax value for  order. 

And  Tax::calcTaxAmount  have return type AmountCur.

 While select  salesLine where salesLine.SalesId == salesTable.SalesId

      {

 taxAmount1 = Tax::calcTaxAmount(salesLine.TaxGroup, salesLine.TaxItemGroup, Systemdateget(), Salesline.CurrencyCode, Salesline.LineAmount, TaxModuleType::Sales);

}

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    hi!!

    try

    While select  salesLine where salesLine.SalesId == salesTable.SalesId

         {

    taxAmount1 = taxAmount1 + Tax::calcTaxAmount(salesLine.TaxGroup, salesLine.TaxItemGroup, Systemdateget(), Salesline.CurrencyCode, Salesline.LineAmount, TaxModuleType::Sales);

          }

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Here you go with code as AX is calculating totals of order and taxes

        static void SalesTotal(Args _args)
        {
            SalesTotals salesTotals;
            SalesTotals_Trans salesTotals1;
            SalesTable salesTable;
            SalesLine salesLine;
         
            TaxAmountCur salesAmt,taxAmount,amt1,discountAmt,totcharges,totOfOrder,contributionRatio;
            Tax tax;
         
            ;
            salesTable = SalesTable::find("000746");
            salesLine = SalesLine::find(salesTable.SalesId);
            salesTotals = SalesTotals::construct(salesTable);
            tax = Tax::construct(NoYes::No);
         
            salesAmt    = salesTotals.totalBalance();
            taxAmount   = salesTotals.totalTaxAmount();
            discountAmt = salesTotals.totalEndDisc();
            totcharges  = salesTotals.totalMarkup();
            totOfOrder  = salesTotals.totalAmount();
            contributionRatio   = salesTotals.totalContributionRatio();
         
            info(Strfmt("Subtotal Amount %1",salesAmt ));
            info(Strfmt("The tax amount is %1",taxAmount ));
            info(Strfmt("The Discount is %1",discountAmt ));
            info(Strfmt("Charges/ Markup %1",totcharges ));
            info(Strfmt("Invoice Amount %1",totOfOrder ));
            info(Strfmt("Contribution ratio %1",contributionRatio ));
        }
    
    

  • Community Member Profile Picture
    on at

    Hi Roberto,

    Thx, it works, So could I use Container to save these values base on salesLine   and use  info message showing them one by one?

  • Community Member Profile Picture
    on at

    Sorry, just saw this has reply already..

    What about SalesTotals class?

    SalesTotals salesTotals = SalesTotals::construct(_record);

    salesTotals.calc();

    salesTotals.tax();

  • Community Member Profile Picture
    on at

    Hi Sohib,

    I was using SalesTotal.Calc(), but it doesn't work.

    when I debugging, I found the tmpTax table doesn't have data. That is only issue which compare to running Total directly.  

    Do you have idea  what happen here?

  • Community Member Profile Picture
    on at

    No, it doesn't work,  tmpTaxtable doesn't have value.

    I'm not sure what's the problem here, cause when I go through

    Total button directly, it works well, the only difference is tmpTable doesn't have value

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans