project QadFinancials > class TSetStatutoryCurrency > method SetStatutoryCurrencyBasedOnTCDPaySel

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 on error undo, return:
    /* DPaySelLine */
    for each Company of Domains no-lock,
        each DPaySel of Company no-lock,
        each DPaySelLine of DPaySel where 
             DPaySelLine.DPaySelLineWHTAmtTC <> 0 and 
             DPaySelLine.DPaySelLineWHTAmtTC <> ?
             exclusive-lock,
        each CInvoice where
             CInvoice.CInvoice_ID = DPaySelLine.DPaySelLineParentObject_ID
             no-lock Transaction:
        /* For these fields: use the Statutory-rate at payment date */
        <M-35 run GetExchangeRate
           (input  CInvoice.CInvoiceCurrency_ID (iiFromCurrencyID), 
            input  viNewSCID (iiToCurrencyID), 
            input  viTxExchangeRateTypeID (iiExchangeRateTypeID), 
            input  DPaySel.DPaySelDate (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 DPaySelLine.DPaySelLineWHTAmtCC   = <M-56 RoundSCAmount  (input  DPaySelLine.DPaySelLineWHTAmtTC *  CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
    end. /* for each DPaySel of company exclusive-lock Transaction: */

end. /* STATCURRDETBLOCK */

assign oiReturnStatus = viLocalReturnStatus.