project QadFinancials > class TSetStatutoryCurrency > method SetStatutoryCurrencyBasedOnTCOIAdjust

Description

Assign the Statutory Currency Amounts based on the amounts in TC and the exchange Rate between TC and the newly entered SC.
Split into detail method, because main method would get to big.


Parameters


ocErrorMessageoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTC


program code (program1/tsetstatutorycurrency.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.
   
STATCURRDETBLOCK:
do:
    /* OIAdjust - OIAdjustLn */
    for each Company of Domains no-lock,
        each OIAdjust of Company no-lock,
        each OIAdjustLn of OIAdjust where 
             OIAdjustLn.CInvoice_ID <> 0 and 
             OIAdjustLn.CInvoice_ID <> ?
             Exclusive-lock,
        each CInvoice of OIAdjustLn 
             no-lock Transaction: 
        /* For these fields: use the Statutory-rate at payment date */
        <M-98 run GetExchangeRate
           (input  CInvoice.CInvoiceCurrency_ID (iiFromCurrencyID), 
            input  viNewSCID (iiToCurrencyID), 
            input  viTxExchangeRateTypeID (iiExchangeRateTypeID), 
            input  OIAdjust.OIAdjustPostingDate (itDate), 
            input  viExchangeRateSharedSetID (iiSharedSetID), 
            output vdRate (odExchangeRate), 
            output vdScale (odExchangeRateScale), 
            output ocErrorMessage (ocErrorMessage), 
            output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
        if viFcReturnSuper <> 0
        then assign viLocalReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then leave STATCURRDETBLOCK.
        assign OIAdjustLn.OIAdjustLnWHTCCRate  = vdRate
               OIAdjustLn.OIAdjustLnWHTCCScale = vdScale
               OIAdjustLn.OIAdjustLnWHTAmtCC   = <M-31 RoundSCAmount  (input  OIAdjustLn.OIAdjustLnWHTAmtTC * OIAdjustLn.OIAdjustLnWHTCCRate * OIAdjustLn.OIAdjustLnWHTCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
    end. /* for each OIAdjust of company exclusive-lock Transaction: */
end. /* STATCURRDETBLOCK */

assign oiReturnStatus = viLocalReturnStatus.