您的位置:首页 > 其它

Convert From One Currency to Another

2008-08-08 14:26 330 查看
The function is ConvertCurrency to convert currency from US dollar to any other currency on the PS_RT_RATE_TBL .

ConvertCurrency(amt, currency_cd, exchng_to_currency, exchng_rt_type, effdt, converted_amt [, error_process [, round] [, rt_index]])

The result of your conversion is placed in converted_amt. ConvertCurrency returns a Boolean value where True means a conversion rate was found and converted_amt calculated, and False means a conversion rate was not found and a value of one (1) was used.

Here is a sample code on how to use it:

/*get the max effective date from PS_RT_RATE_TBL to use in the function*/

SQLExec("select %dateout(max(effdt)) from PS_RT_RATE_TBL where from_cur = :1 and to_cur = 'USD' and rt_type = :2", &TXN_CURRENCY_CD, &rt_type, &effdt);

If ConvertCurrency(&AMOUNT, &TXN_CURRENCY_CD, "USD", &rt_type, &effdt, &AMOUNT_CONVERTED, "I") Then

&AMOUNT = &AMOUNT_CONVERTED;

End-If;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: