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)

Tax amount calculation for Sales order

(0) ShareShare
ReportReport
Posted on by 1,737

I am Customize the sales Invoice Report Morphx Report In ax 2012, 

I am Writing the code to get the total tax amount and Individual Tax amount for Particular Sales order

Below code  and call in the fetch method.

public real TaxAmountLoc3(SalesLine saleLine)
{
TmpTaxWorkTrans tmpTax;
SalesTotals salesTotals;
CustInvoiceJour _CustInvoiceJourLoc;
TaxData taxData;

;
_CustInvoiceJourLoc = element.args().record();
salesTotals = salesTotals::construct(salesTable);

// Calculate Tax
salesTotals.calc();

// Load tmpTaxWorkTrans
tmpTax.setTmpData(salesTotals.tax().tmpTaxWorkTrans());

// Showing taxes with tax value
while
select tmpTax
{
select taxTable
where taxTable.TaxCode == tmpTax.TaxCode
join taxData
where taxData.TaxCode == TaxTable.TaxCode;
if(taxTable.TaxType_IN == TaxType_IN::None)
{
None += tmpTax.TaxAmount;
}
if(taxTable.TaxType_IN == TaxType_IN::Excise)
{
Excise += tmpTax.TaxAmount;
ExciseValue += taxData.TaxValue;
}
if(taxTable.TaxType_IN == TaxType_IN::VAT)
{
Vat += tmpTax.TaxAmount;
VatValue += taxData.TaxValue;
}
if(taxTable.TaxType_IN == TaxType_IN::SalesTax)
{
CST += tmpTax.TaxAmount;
CSTValue += taxData.TaxValue;
}
/*if(taxTable.TaxType_IN == TaxType_IN::ServiceTax)
{
ServiceTax += tmpTax.TaxAmount;
}*/
}
return None+Excise+Vat+CST;

}

But the Problem is If Tax amount is setup for the Particular Sales order it is running and tax amount is calculated.

Suppose  "tax is not setup" in the Sales order it is Throwing the below Error.

"A currency to convert from is required to retrieve exchange rate information."

How to solve this Please Help me.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Bashir Ahmad Profile Picture
    5,248 on at

    have you tried to debug the code? and identified exactly on which line you are getting this message. if not place break point and debug the code after that hopefully you will understand exactly on which statement you are getting error. seems like on tax field empty string is being passed to some method

  • srinivas pamidi Profile Picture
    1,737 on at

    Hi Bashir,

    Thank you for your reply, i am getting this error on

    this line in the above code

    salesTotals.calc();

    if i commented this line error comes in the next line.

    what i do now Please help me.

  • Suggested answer
    Bashir Ahmad Profile Picture
    5,248 on at

    in class salesTotals there is no calc() method.

    is some custom method written in this class if so please share the method detail code inside method body by pressing F12 on the method calc()  the method body will be shown.

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