Create 3 total amount fields with different currencies

r-pr-p Member Posts: 33
Hello

I have on report and i want to get:

Depending the currency you pay, the receipt needs to do fill 3 differents fields with the total amount each one with the correct currency amount.

Ex.:
Pay in EUR:
Amount EUR = Amount
Amount USD = Amount * USD Currency Exchange Rate
Amount MZM = Amount * MZM Currency Exchange Rate

Pay in USD:
Amount USD = Amount
Amount EUR = Amount / USD Currency Exchange Rate
Amount MZM = Amount * MZM Currency Exchange Rate

Pay in MZM:
Amount MZM = Amount
Amount EUR = Amount / EUR Currency Exchange Rate
Amount USD = Amount / MZM Currency Exchange Rate

Can you help me building this code with all conditions?

Thanks.

Comments

  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    The trick here is to always use the local currency amount as the base for your calculations.
    Then create 2 decimal variables that will represent the converted amount in the alternate currencies.
    When you calculate the alternate currency amounts, be sure to use the currency exchange rate that was in effect on the posting date of the transaction. If you do not go back to retrieve the correct currency exchange rate, you will have different results each time.

    I am not going to provide the code, but I will help you in the right direction so you will be able to solve this issue yourself.

    Hope this helps,

    Regards,

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
  • r-pr-p Member Posts: 33
    KYDutchie wrote:
    Hi,

    The trick here is to always use the local currency amount as the base for your calculations.
    Then create 2 decimal variables that will represent the converted amount in the alternate currencies.
    When you calculate the alternate currency amounts, be sure to use the currency exchange rate that was in effect on the posting date of the transaction. If you do not go back to retrieve the correct currency exchange rate, you will have different results each time.

    I am not going to provide the code, but I will help you in the right direction so you will be able to solve this issue yourself.

    Hope this helps,

    Regards,

    Willy


    Thanks, i created the code with all the conditions, using the posting date.
    works fine.
Sign In or Register to comment.