project QadFinancials > class BDDocument > method AdditionalUpdatesDPaymentSelection


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDDocument.AdditionalUpdates


program code (program1/bddocument.p)

if can-find (first tDPaySelRefDDoc where
                   tDPaySelRefDDoc.tc_status <> "":U)
then do:

    /* Update DPaySel and DPaySelCode */
    if viBDPaymentSelectionID = 0 or viBDPaymentSelectionID = ?
    then do:
        <I-1 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BDPaymentSelection"}>

        assign vlBDPaySelectionWasStartedHere = true.
    end.
    else do:
        <I-2 {bFcOpenInstance
            &CLASS           = "BDPaymentSelection"}>
    end.

    <M-3 run UpdateDPaySelAndPayCode
       (input-output tDPaySelRefDDoc (t_sDPaySelRef), 
        input-output tDPaySelPayCodeRefDDoc (t_sDPaySelPayCodeRef), 
        output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>

    if viFcReturnSuper < 0 or oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.        

    <M-58 run RemoveEmptyPaySel
        (input  vcDPaySelRecordsIDChanged (icPaySelIDs), 
        output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>

    if viFcReturnSuper < 0 or oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.                
    
    /* ========================================================================================================= */
    /* Normally we would here close BDPaymentSelection but we will not do it for performance                   */
    /* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it.     */
    /* And in all other scenario's the instance of the class ill be closed by the de-activiate procedure of the  */
    /* appserver that is executed after each call to the appserver                                               */
    /* ========================================================================================================= */
    
    for each tDPaySelRefDDoc:
        for each tDDocument where
                 tDDocument.tc_ParentRowid = tDPaySelRefDDoc.tc_Rowid:
            assign tDDocument.DPaySel_ID = tDPaySelRefDDoc.DPaySel_ID.
        end.
    end.
end.