|
If correct you have the rates against your base currency (buy, sell and mid rate). Than you are going to convert from the from currency to the to currency. When the to currency is your base currency: Multiply amount with the buy rate of the from currency. When the from currency is your base currency: Divide amount through the sell rate of the to currency. When neither currency is your base currency: Convert first to your base currency using the Midrate. Convert than to the to currency using the sell rate. Off course take acount the different decimal positions of the currencies and the rate against how many of each currency!! Have fun, Eduard. fkany@xxxxxxxxxxxxxxxxxx wrote: I'm sure there's other solutions out there, but here's an idea: What do you think about building/updating a table daily with all the conversions? Using the example table below, $5 in japanese dollars is equal to $2.50 in US dollars. Example: |----------+----------+----------+----------+----------| | | | | | | | | US | EUR | GBP | JPY | | | | | | | |----------+----------+----------+----------+----------| | | | | | | | JPY $1 | 0.5 | 1 | 0.75 | 1 | | | | | | | |----------+----------+----------+----------+----------| | | | | | | | US $1 | 1 | 0.5 | 0.8 | 0.3 | | | | | | | |----------+----------+----------+----------+----------| | | | | | | | ETC.. | | | | | | | | | | | |----------+----------+----------+----------+----------| US EUR GBP JPY JPY $1 0.5 1 0.75 1 US $1 1 0.5 0.8 0.3 ETC.. "Butala, Nilesh" @midrange.com on 01/14/2005 11:39:39 AM Please respond to RPG programming on the AS400 / iSeries Sent by: rpg400-l-bounces@xxxxxxxxxxxx To: RPGIV@xxxxxxxxxxxxxxx cc: "'rpg400-l@xxxxxxxxxxxx'" Subject: Formula for Currency Conversion Currently we are receiving Currency exchange rates from Bank against USD (US$). We have Companies in UK and Mexico, Germany, Etc. I am trying to convert rates from Japan (JPY) to (EUR) Euro, EUR to GBP, JPY to GBP etc. If some one has written a code and like to share with me or point me to right direction. Thanks Nilesh -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.