project QadFinancials > class BCPay > method UpdateCPay

Description

This method reset the PaySelLine_id on the CPay records


Parameters


tPayByPaySelLineToUpdateBCDocinputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCDocument.AdditionalUpdatesPosting


program code (program6/bcpay.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.
PROCESSBLOCK:
do:
    assign vcListCPayRowIdsToUpdate = "":U.

    for each tPayByPaySelLineToUpdateBCDoc where
             tPayByPaySelLineToUpdateBCDoc.tc_Rowid <> "":U :

        if vcListCPayRowIdsToUpdate = "":U
        then assign vcListCPayRowIdsToUpdate = tPayByPaySelLineToUpdateBCDoc.tc_Rowid.
        else assign vcListCPayRowIdsToUpdate = vcListCPayRowIdsToUpdate + ",":U + tPayByPaySelLineToUpdateBCDoc.tc_Rowid.
        
        /* if vcListCPayRowIdsToUpdate > 100000, load the data to prevent vcListCPayRowIdsToUpdate to get out of 32K limit */
        if length(vcListCPayRowIdsToUpdate,"CHARACTER") > 100000
        then do:
        
            <M-1 run DataLoad
               (input  vcListCPayRowIdsToUpdate (icRowids), 
                input  '':U (icPkeys), 
                input  '':U (icObjectIds), 
                input  '':U (icFreeform), 
                input  true (ilKeepPrevious), 
                output viFcReturnSuper (oiReturnStatus)) in BCPay>
    
    
            if viFcReturnSuper <> 0
            then assign viLocalReturnStatus = viFcReturnSuper.
    
            if viFcReturnSuper < 0
            then leave PROCESSBLOCK.
            
            assign vcListCPayRowIdsToUpdate = "":U.
        end. /* if length(vcListCPayRowIdsToUpdate,"CHARACTER") > 100000 */
    end. /* for each tPayByPaySelLineToUpdateBCDoc */

    if vcListCPayRowIdsToUpdate <> "":U
    then do:
        
        <M-35 run DataLoad
           (input  vcListCPayRowIdsToUpdate (icRowids), 
            input  '':U (icPkeys), 
            input  '':U (icObjectIds), 
            input  '':U (icFreeform), 
            input  true (ilKeepPrevious), 
            output viFcReturnSuper (oiReturnStatus)) in BCPay>
            
        if viFcReturnSuper <> 0
        then assign viLocalReturnStatus = viFcReturnSuper.

        if viFcReturnSuper < 0
        then leave PROCESSBLOCK.

        assign vcListCPayRowIdsToUpdate = "":U.
    end. /* if vcListCPayRowIdsToUpdate <> "":U */              
    
    for each tCPay:
        if can-find(tPayByPaySelLineToUpdateBCDoc where tPayByPaySelLineToUpdateBCDoc.tc_Rowid = tCPay.tc_Rowid)
        then do:
            assign tCPay.PaySelLine_ID = 0
                   tCPay.tc_Status     = 'C':U.
        end.
    end. /* for each tCPay */
    
end.
assign oiReturnStatus = viLocalReturnStatus.