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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

conversion of currency

(0) ShareShare
ReportReport
Posted on by 213

 hello experts,

i have wriiten the below code for converting  given currency into  default currency . i am geeting wrong value, plse hlp me out.

[
SysEntryPointAttribute(false)
]

public void processReport()
{
SintoPCurrencyContractClass Contract;
Contract= this.parmDataContract();
accountNum=contract.parmAccountNum();


while select * from vendTrans

where

vendTrans.AccountNum ==accountNum


{
SintoPCuurencyTmp.AccountNum = vendTrans.AccountNum;
SintoPCuurencyTmp.Voucher = vendTrans.Voucher;
SintoPCuurencyTmp.AmountCur=vendTrans.AmountCur;
SintoPCuurencyTmp.Invoice=vendTrans.Invoice;
SintoPCuurencyTmp.CurrencyCode=vendTrans.CurrencyCode;
SintoPCuurencyTmp.IndAmountCur = any2real (Currency::amountCur2MST (vendTrans.AmountCur,"jpy"));


currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet());
SintoPCuurencyTmp.IndAmountCur = currencyExchangeHelper.calculateCurrencyToCurrency('INR', vendTrans.CurrencyCode,vendTrans.AmountCur,true);


// SintoPCuurencyTmp.IndAmountCur=vendTrans.AmountMST;
// SintoPCuurencyTmp.IndCurrencyCode=vendTrans.CurrencyCode;
SintoPCuurencyTmp.VendName=vendTrans.vendTableName();


SintoPCuurencyTmp.insert();
}

}

I have the same question (0)
  • pradeep M B Profile Picture
    213 on at
    RE: conversion of currency

    Thank you sir,

    Now currency amount is working fine.

    regards,

    Pradeep

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: conversion of currency

    Yes, we are happy to help you. Let's start by getting the relevant facts from your side - so could you please answer my previous question?

  • pradeep M B Profile Picture
    213 on at
    RE: conversion of currency

    thank you for response,

    i want  to convert any amount(us,jpy..etc) to indian currency

    so  can u hlp me out.

    regards,

    pradeep

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: conversion of currency

    This is the line of code that will set your IndAmountCur field:

    SintoPCuurencyTmp.IndAmountCur = currencyExchangeHelper.calculateCurrencyToCurrency('INR', vendTrans.CurrencyCode,vendTrans.AmountCur,true);

    Could you share us

    - what values you pass to all these parameters

    - what is the actual return value

    - what is the expected return value?

    Thanks!

  • Verified answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at
    RE: conversion of currency

    Hi pradeep,

    Have you checked the standard accounting currency conversion functionality that is available in the periodic section of the GL module?

    What do you miss from this standard function that some coding is needed?

    Best regards,

    Ludwig

  • Verified answer
    Crispin John Augustine Profile Picture
    37,081 on at
    RE: conversion of currency

    you have 2 lines with currency conversion.

    "...Currency::amountCur2MST (vendTrans.AmountCur,"jpy")..."

    "...currencyExchangeHelper.calculateCurrencyToCurrency('INR', vendTrans.CurrencyCode,vendTrans.AmountCur,true)..."

    Where exactly do you get a wrong value?

  • Verified answer
    Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: conversion of currency

    Do you realize that you assign IndAmountCur twice? Because the second assignment overwrites the first one, it's like if the first one wasn't ever there. If you don't want to use the first one, delete it. If you want, delete the second assignment.

    If you still have a problem, come back and explain which calculation are you using.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 775 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 634 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 622 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans