project QadFinancials > class BPaymentSelection > method AdditionalUpdatesPrepayment

Description

UpdatePrepayments


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.AdditionalUpdates


program code (program5/bpaymentselection.p)

if viBPrepaymentID = 0 or
   viBPrepaymentID = ?
then do:
    <I-1 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BPrepayment"}>

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

<M-3 run UpdatePaySelPrepay (input  tPaySelPrepayRefPS (t_sPaySelPrepayRef), 
                             output tPaySelPrepayConversionPS (tPaySelPrepayConversion), 
                             output viReturn (oiReturnStatus)) in BPrepayment>

/* ========================================================================================================= */
/* Normally we would here close BPrePayment 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                                               */
/* ========================================================================================================= */

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

if oiReturnStatus < 0
then return.

for each tPaySelLine where
         tPaySelLine.PaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENT}:
    find first tPaySelPrepayConversionPS where
               tPaySelPrepayConversionPS.tiOldId = tPaySelLine.PaySelLineParentObject_ID
               no-error.

    if available tPaySelPrepayConversionPS
    then assign tPaySelLine.PaySelLineParentObject_ID = tPaySelPrepayConversionPS.tiNewId.
end.