Currency conversion

kolaboykolaboy Member Posts: 446
Hi Experts,
I have a field call grant total in report which is defined in C/AL globals as decimal and is use to calculate Grand total for totals. How do you convert this field values which is in foreign currency to a local currency?

Thanks.

Comments

  • David_CoxDavid_Cox Member Posts: 509
    What exchange rate do you want to use as at today?
    Assuming your report has a group total by "Currency Code"

    Hint:
    Look at the code on the Sales Line table search for FCYtoLCY

    David
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: [email protected]
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • kolaboykolaboy Member Posts: 446
    I am using 30.00 for a test.
    The variable is not a standard field in the table. I defined it to take the results of the calculated total for the totals of certain amounts. this value is in foreign currency USD and i want to convert the equivalent to LCY.
    I have not seen FCYtoLCY in the sales line table.
    can you please tell me what i should do to get the equivalence in LCY Please!!!
    Thanks.
  • David_CoxDavid_Cox Member Posts: 509
    The "Currency Exchange Rate" tables has currency functions for
    LCY to FCY
    FCY to LCY
    FCY to FCY

    Currency = Record = Currency
    CurrExchRate = Record = Currency Exchange Rate
    AmountLCY = Decimal
    AmountFCY = Decimal

    You also need a "Currency Code"
    This function will return the currency factor
    CurrExchRate.ExchangeRate(WORKDATE,"Currency Code")
    //Sets the Defaults
    Currency.InitRoundingPrecision;
    IF "Currency Code" <> '' THEN
      AmountLCY :=
        ROUND(
          CurrExchRate.ExchangeAmtFCYToLCY(
            WORKDATE,"Currency Code",
            AmountFCY,CurrExchRate.ExchangeRate(WORKDATE,"Currency Code")),
          Currency."Amount Rounding Precision")
    ELSE
      AmountLCY :=
        ROUND(AmountFCY,Currency."Amount Rounding Precision");
    

    David
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: [email protected]
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • kolaboykolaboy Member Posts: 446
    Thank you very much David, It has worked.

    =D>
  • rsgilbertrsgilbert {member_location}Member Posts: 3
    Thanks David.
  • txerifftxeriff Member Posts: 480
    if you are using a document in the header you will find a field called "currency factor". That's the rate applied for the day the document was created.

    Just do a calcfields() to amounts in the header and then *"currency factor"
Sign In or Register to comment.