Functional Description
Purpose
This business function will perform soft rounding during currency conversion. If sent a domestic
amount, it will calculate a foreign amount. If sent a foreign amount, it will calculate a domestic
amount.
mnTriangulationRate1 and mnTriangulationRate1 are returned from the Get Exchange Rate (B0000033)
business function if the from and to currency codes go through a third triangulation currency. In the
case of triangulation a zero should be passed into the Currency Conversion Rate parameter of this
function. The cCurrencyConversionMethod is used to tell this function how to used the rate to convert the
amount ('Y' = multiplier method, 'Z' = divisor method). The value to pass into this parameter can be
retrieved from Get Exchange Rate (B0000033) or Get Method (B0000172). If no value is passed into this
parameter and we are not doing triangulation then the date passed into the jdTransactionDate parameter
is used to retrieve the correct method. If the triangulation rates are passed in for conversion then
this function does not even look at the cCurrencyConversionMethod parameter. Note : The amounts
passed into mnDomesticAmount and mnForeign amount must have the correct currency codes in their data
structures.
Setup Notes and Prerequisites
Before calling this function, Get Exchange Rate (B0000033) should be called to retrieve the rates
needed and the currency conversion method. The mnDefaultRate parameter passed back from B0000033 should
be passed into the mnExchangeRate parameter of this function. mnTriangulationRate1 and
mnTriangulationRate2 passed back from B0000033 should be passed into mnTriangulationRate1 and mnTriangulationRate2
of this function respectively. There is no need to check to see which parms are zero, the function
will do that for you and determine what type of calculation needs to be performed. In order to correctly
convert the amount you need to be sure szCurrencyCodeFrom and szCurrencyCodeTo passed into B0000033
match the currencies of the amounts passed into mnForeignAmount and mnDomesticAmount of this function.
You should think of it as szCurrencyCodeFrom equals the foreign currency so it must match the
currency code on mnForeignAmount. Likewise, szCurrencyCodeTo equals the domestic currency so it must match
the currency code on the mnDomesticAmount. For example, if you were converting a domestic amount of
$100 (USD) to japanese yen (JPY), you would pass USD in the szCurrencyCodeTo parameter of B0000033 and
JPY in the szCurrencyCodeFrom parameter to get the correct rates and conversion method. You would then
pass the rates returned from B0000033 (mnDefaultRate, mnTriangulationRate1, mnTriangulationRate2)
into the rate parameters (mnExchangeRate, mnTriangulationRate1, mnTriangulationRate2) as well as the
currency conversion method for this function. When then calling this function mnDomesticAmount would have
the value 100 with USD as the currency in it's data structure and mnForeignAmount would have the value
0 with JPY as the currency in it's data structure.
Special Logic
When converting from the domestic amount to the foreign amount we will divide using the rate when the
conversion method is 'Y' and multiply when the conversion method is 'Z'. This is done because the
method represents the action performed using the rate when going from foreign to domestic. Example:
'Y': Foreign * Rate = Domestic
'Z': Foreign / Rate = Domestic
Therefore,
'Y': Domestic / Rate = Foreign
'Z': Domestic * Rate = Foreign
Inorder to do soft rounding addtional parameters (mnAmountGross and mnAmountForeignGross) are
provided. These parameters will be updated by the function and simply need to have their values retained by
the calling function. In the case of a balancing transaction the values of these two parameters need
to be zeroed out at the begining of each transaction. If the transaction does not net to zero then
inorder for soft rounding to occur you need to initialize these two parameters with the net amounts of
the transaction.
Technical Specification
D0000028 - CurrencyConvSftRound
^
Parameter Name | Data Item | Data Type | Req/Opt | I/O/Both |
---|---|---|---|---|
mnDomesticAmount | AG | MATH_NUMERIC | NONE | NONE |
| ||||
mnForeignAmount | ACR | MATH_NUMERIC | NONE | NONE |
The foreign currency amount entered on the transaction. If the Multi-Currency Conversion option on the General Accounting constants is set
| ||||
mnExchangeRate | CRR | MATH_NUMERIC | OPT | NONE |
A number (exchange rate) that a foreign currency amount is multiplied by to calculate a domestic currency amount.
The number in this field
| ||||
mnAmountGross | AAP | MATH_NUMERIC | NONE | NONE |
| ||||
mnAmountForeignGross | FAP | MATH_NUMERIC | NONE | NONE |
| ||||
mnTriangulationRate1 | CRR | MATH_NUMERIC | OPT | NONE |
| ||||
mnTriangulationRate2 | CRR | MATH_NUMERIC | OPT | NONE |
| ||||
cCurrencyConversionMethod | CRCM | char | OPT | NONE |
| ||||
jdTransactionDate | EFT | JDEDATE | OPT | NONE |
|
B0000027 CurrencyConvForAndDom |
None |