project QadFinancials > class BDebtor > method GetCurrencyAmount


Parameters


icCurrencyFrominputcharacter
icCurrencyToinputcharacter
idAmountinputdecimal
odAmountoutputdecimal
oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BDebtor.ApiGetARBalance
method BDebtor.ApiGetCreditDataV01
method BDebtor.ApiGetFixedCreditLimit
method BDebtor.ApiGetOpenOrdersTotal


program code (program1/bdebtor.p)

/* ====================================== */
/* Initialise oiReturnStatus to -98       */
/* ====================================== */
assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.

if icCurrencyFrom = icCurrencyTo 
then assign odAmount = idAmount.
else do:    
    <M-60 run GetExchangeRate
       (input  viCompanyID (iiCompanyID), 
        input  ? (iiFromCurrencyID), 
        input  icCurrencyFrom (icFromCurrencyCode), 
        input  ? (iiToCurrencyID), 
        input  icCurrencyTo (icToCurrencyCode), 
        input  ? (iiExchangeRateTypeID), 
        input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateTypeCode), 
        input  today (itValidityDate), 
        output vdRate (odExchangeRate), 
        output vdRateScale (odExchangeScaleFactor), 
        output viFcReturnSuper (oiReturnStatus)) in BDebtor>
    if viFcReturnSuper < 0 and
       viFcReturnSuper > 0 or viLocalReturnStatus = 0
    then assign viLocalReturnStatus = viFcReturnSuper.
    if viLocalReturnStatus >= 0
    then assign odAmount = <M-16 RoundAmount
                              (input  idAmount * vdRate * vdRateScale (idUnroundedAmount), 
                               input  0 (iiCurrencyID), 
                               input  icCurrencyTo (icCurrencyCode)) in business>.
end.

/* Return */
assign oiReturnStatus = viLocalReturnStatus.