Currency Converter in Dynamics Ax



Description:-

For example if my accounting currency is USD and I have configured GBP for currency conversion, then if I select GBP and double click on the Currency converter form, then the values in all the forms in AX should be shown in GBP or any other currency.
Here is the sample code to convert the Amount in one currency to another currency.

In Dynamics Ax 2009

static void CurrencyConverter(Args _args)
{
  CurrencyExchHelper currencyExchangeHelper;
  AmountMst amountMST;
  AmountCur amountCur;
  ;
  amountCur = 5000.00;
  currencyExchangeHelper = CurrencyExchHelper::newExchDate("KSI","USD",systemDateGet());
  amountMST = currencyExchangeHelper.calculateAmountCurToMst(amountCur ,true);
  info(strFmt('%1',amountMST));
}

In Dynamics Ax 2012

Static void SR_CEH_Example11(Args _args)
{
  CurrencyExchangeHelper currencyExchangeHelper;
  CurrencyCode transCurrency = 'EUR';
  AmountCur amountCur = 500.00;
  AmountMst amountMST;

  currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());
  amountMST = currencyExchangeHelper.calculateTransactionToAccounting(transCurrency, amountCur ,true);
  info(strFmt('%1',amountMST));
}

Related Posts

Previous
Next Post »

Thanks for comments.....