project QadFinancials > class BPosting > method AddTaxPostingGetExchRates

Description

get the exchange rates


Parameters


iiCompanyIDinputinteger
iiCurrencyIdinputintegerCurrency ID
icExchangeRateTypeinputcharacterExchange Rate Type
itTaxPointDateinputdateTax Point Date
bdExchangeRateLCinput-outputdecimalExchange Rate from TC to LC
bdExchangeRateScaleLCinput-outputdecimalScale factor for exchange rate from TC to LC
bdExchangeRateCCinput-outputdecimalExchange Rate for CC
bdExchangeRateScaleCCinput-outputdecimalScale factor for cc exchange rate
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.AddTaxPosting


program code (program6/bposting.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.

RATEBLOCK:
DO:
    if iiCurrencyId = 0 or 
       iiCurrencyId = ? 
    then assign iiCurrencyId = viCompanyLCId.
    
    if iiCurrencyId = viCompanyLCId 
    then assign bdExchangeRateLC      = 1
                bdExchangeRateScaleLC = 1.
    else if bdExchangeRateLC = 0 or 
            bdExchangeRateLC = ?
         then do:
             <M-55 run GetExchangeRate
                (input  iiCompanyID (iiCompanyID), 
                 input  iiCurrencyId (iiFromCurrencyID), 
                 input  ? (icFromCurrencyCode), 
                 input  viCompanyLCId (iiToCurrencyID), 
                 input  ? (icToCurrencyCode), 
                 input  ? (iiExchangeRateTypeID), 
                 input  icExchangeRateType (icExchangeRateTypeCode), 
                 input  itTaxPointDate (itValidityDate), 
                 output bdExchangeRateLC (odExchangeRate), 
                 output bdExchangeRateScaleLC (odExchangeScaleFactor), 
                 output viFcReturnSuper (oiReturnStatus)) in BPosting>
             if viFcReturnSuper <> 0
             then assign viLocalReturnStatus = viFcReturnSuper.
             if viFcReturnSuper < 0
             then leave RATEBLOCK.         
         end. /* else if bdExchangeRateLC = 0 or */
    
    if viCompanyCCId = 0 or 
       viCompanyCCId = ? or 
       viCompanyCCId = iiCurrencyId
    then assign bdExchangeRateCC      = 1
                bdExchangeRateScaleCC = 1.
    else if bdExchangeRateCC = 0 or
            bdExchangeRateCC = ?
    then do:
        if vlDomainIsStatutory = false
        then assign bdExchangeRateCC      = bdExchangeRateLC
                    bdExchangeRateScaleCC = bdExchangeRateScaleLC.
        else do:
            <M-28 run GetExchangeRate
               (input  iiCompanyID (iiCompanyID), 
                input  iiCurrencyId (iiFromCurrencyID), 
                input  ? (icFromCurrencyCode), 
                input  viCompanyCCId (iiToCurrencyID), 
                input  ? (icToCurrencyCode), 
                input  ? (iiExchangeRateTypeID), 
                input  {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateTypeCode), 
                input  itTaxPointDate (itValidityDate), 
                output bdExchangeRateCC (odExchangeRate), 
                output bdExchangeRateScaleCC (odExchangeScaleFactor), 
                output viFcReturnSuper (oiReturnStatus)) in BPosting>
            if viFcReturnSuper <> 0
            then assign viLocalReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0
            then leave RATEBLOCK.
        end. /* else do: (if vlDomainIsStatutory = false) */
    end. /* else do: */
end. /* RATEBLOCK: */

assign oiReturnStatus = viLocalReturnStatus.