Currency Conversion X++ AX7, D365FO and AX-2012
Convert currency to currency.
Static void main(Args args)
{
CurrencyExchangeHelper currencyExchangeHelper;
AmountMst amountMST;
CurrencyCode toCurrency = ‘AED’;
CurrencyCode FromCurrency = ‘USD’;
AmountCur amountCur = 5000;
currencyExchangeHelper =
CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());
amountMST =
currencyExchangeHelper.calculateCurrencyToCurrency(toCurrency, fromCurrency,amountCur,true);
info(strFmt(“%1”, amountMST))
}
Convert Transaction currency to company ledger currency.
The method will convert the transaction currency into accounting currency defined in the ledger.
static void Main(Args _args)
{
CurrencyExchangeHelper
currencyExchangeHelper;
CurrencyCode
transCurrency = ‘EUR’;
AmountCur
amountCur = 5500.00;
AmountMst
amountMST;
currencyExchangeHelper
= CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());
amountMST
= currencyExchangeHelper.calculateTransactionToAccounting(transCurrency,
amountCur ,true);
info(strFmt(‘%1’,amountMST));
}
Convert Company currency to transaction currency.
The method calculates the transaction currency amount from an accounting currency given.
static void main(Args _args)
{
CurrencyExchangeHelper
currencyExchangeHelper;
CurrencyCode
transCurrency = ‘AED’;
AmountCur
amountCur;
AmountMst
amountMST = 5500.00;
currencyExchangeHelper
= CurrencyExchangeHelper::newExchangeDate(Ledger::primaryLedger(CompanyInfo::findDataArea("DUM").RecId), systemDateGet());
amountCur
= currencyExchangeHelper.calculateAccountingToTransaction(transCurrency,
amountMST ,true);
info(strFmt(‘%1’,amountcur));
}
Checkout more IT services and other service at Swiftit.ae at affordable price. Feel free to enquire if you're interested.
ReplyDelete