project QadFinancials > class BJournalEntry > method GetExchangeRates

Description

Get the exchange rate and cc rate.


Parameters


iiCompanyIDinputinteger
itPostingDateinputdate
icCurrencyTCinputcharacter
odExchangeRateoutputdecimal
odExchangeRateScaleoutputdecimal
odExchangeRateCCoutputdecimal
odExchangeRateCCScaleoutputdecimal
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDInvoiceMultiCy.UpdateDeductionDetailCy
method BDInvoiceMultiCy.UpdateDeductionDetailCyV01


program code (program9/bjournalentry.p)

assign oiReturnStatus = -98
       odExchangeRate = 0
       odExchangeRateScale = 1
       odExchangeRateCC = 0
       odExchangeRateCCScale = 1.
       
if icCurrencyTC = '' or 
   icCurrencyTC = ? 
then return.

if icCurrencyTC = vcCompanyLC 
then do:
   assign odExchangeRate = 1
          odExchangeRateScale = 1.
end.
else do:
    <M-77 run GetExchangeRate
       (input  iiCompanyID (iiCompanyID), 
        input  ? (iiFromCurrencyID), 
        input  icCurrencyTC (icFromCurrencyCode), 
        input  viCompanyLCId (iiToCurrencyID), 
        input  ? (icToCurrencyCode), 
        input  ? (iiExchangeRateTypeID), 
        input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateTypeCode), 
        input  itPostingDate (itValidityDate), 
        output odExchangeRate (odExchangeRate), 
        output odExchangeRateScale (odExchangeScaleFactor), 
        output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
    if viFcReturnSuper < 0 then 
    do:
       assign oiReturnStatus = viFcReturnSuper.
       return.
    end.
end.

if vcCompanyCC = "":U or
   vcCompanyCC = ? 
then do:
    assign oiReturnStatus = 0.
end.
else do:
    assign odExchangeRateCC = odExchangeRate
           odExchangeRateCCScale = odExchangeRateScale.
    if vlDomainIsStatutory = true then
    do:
        <M-84 run GetExchangeRate
           (input  iiCompanyID (iiCompanyID), 
            input  ? (iiFromCurrencyID), 
            input  icCurrencyTC (icFromCurrencyCode), 
            input  viCompanyCCId (iiToCurrencyID), 
            input  ? (icToCurrencyCode), 
            input  ? (iiExchangeRateTypeID), 
            input  {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateTypeCode), 
            input  itPostingDate (itValidityDate), 
            output odExchangeRateCC (odExchangeRate), 
            output odExchangeRateCCScale (odExchangeScaleFactor), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
        if viFcReturnSuper < 0 then 
        do:
           assign oiReturnStatus = viFcReturnSuper.
           return.
        end.
    end.
end.

assign oiReturnStatus = 0.