project QadFinancials > class BPaymentSelection > method AdditionalUpdates

Description

This empty method allows to do additional updates on class temp-tables after records were received (and validated) from outside, using method SetPublicTables.
You can start instances of other business classes to do those updates.


Parameters


oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BPaymentSelection.APITransferPayments
method BPaymentSelection.ChangeStatusPaymentSelection
method BPaymentSelection.ChangeStatusPaymentSelInBatch

QadFitnesse
method BPaymentSelection.ApiPaymentSelectionCreate


program code (program/bpaymentselection.p)

/* Hold translated values of CREDIT/DEBIT in the class data item (for performance). */
if vcCreditTR = "":U then assign vcCreditTR = {&CREDITDEBITABBREVIATION-CREDIT-TR}.

/* Update the IsSelected flag of the linked Debtor Credit Notes. */
<M-69 run AdditionalUpdatesDInvoice (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>

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

if oiReturnStatus < 0
then do:

    <M-84 run StopExternalInstances
       (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
    return.
end.

/* Banknumber is mandatory. */
if vcActivityCode = {&PAYMENTSELECTIONACTIVITY-REGISTER} or 
   vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTE} or 
   vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTEAGAIN}
then do:
    <M-81 run AdditionalUpdatesCheckBankNumber (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.

    if oiReturnStatus < 0
    then do:

        <M-85 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.
    end.
end.


/* Register */
if vcActivityCode = {&PAYMENTSELECTIONACTIVITY-REGISTER}
then do:
    <M-71 run AdditionalUpdatesRegister (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>

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

        <M-86 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.
    end.
end.

/* Unconfirm */
if vcActivityCode = {&PAYMENTSELECTIONACTIVITY-UNCONFIRM}
then do:
    <M-97 run AdditionalUpdatesUnconfirm  (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
    if viFcReturnSuper < 0 or
       oiReturnStatus  = 0
    then assign oiReturnStatus = viFcReturnSuper.
    
    if oiReturnStatus < 0
    then do:
        <M-98 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.
    end.
end.

else
/* Execute */
if vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTE}
then for each tExportReferences,
         first tPaySelLine where
               tPaySelLine.PaySelLine_ID = tExportReferences.tiPaySelLineId:
    if tPaySelLine.PaySelLineIsRefInFile <> tExportReferences.tlPaySelLineIsRefInFile
    then do:
        assign tPaySelLine.PaySelLineIsRefInFile = tExportReferences.tlPaySelLineIsRefInFile.

        if tPaySelLine.tc_Status = "":U
        then assign tPaySelLine.tc_Status = "C":U.
    end.
end.



/* Finish CInvoice */
if vlBCInvIsStartedFromPaySel
then do:

    <I-63 {bFcOpenInstance
            &CLASS           = "BCInvoice"}>

    <M-64 run ValidateBCAndAdditionalUpdates (output viReturn (oiReturnStatus)) in BCInvoice>
  
    <I-66 {bFcCloseInstance
            &CLASS           = "BCInvoice"}>
  

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

    if oiReturnStatus < 0
    then do:

        <M-88 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.

    end.
end.

/* Finish DInvoice */
if vlBDInvIsStartedFromPaySel
then do:
    <I-75 {bFcOpenInstance
            &CLASS           = "BDInvoice"}>

    <M-79 run ValidateBCAndAdditionalUpdates (output viReturn (oiReturnStatus)) in BDInvoice>
           
    <I-77 {bFcCloseInstance
            &CLASS           = "BDInvoice"}>
          
    if viReturn       < 0 or
       oiReturnStatus = 0
    then assign oiReturnStatus = viReturn.

    if oiReturnStatus < 0
    then do:

        <M-89 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.
    end.

end.

/* BankNumber */
if vlBankNumberStartedFromPaySel
then do:

    <I-91 {bFcOpenInstance
         &CLASS           = "BBankNumber"}>
     
    <M-92 run ValidateBCAndAdditionalUpdates  (output viReturn (oiReturnStatus)) in BBankNumber>

    <I-93 {bFcCloseInstance
         &CLASS           = "BBankNumber"}>
 
    if viReturn       < 0 or
       oiReturnStatus = 0
    then assign oiReturnStatus = viReturn.

    if oiReturnStatus < 0
    then do:
        <M-94 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.
    end.
end.

/* PrePayments */
if vcActivityCode <> {&PAYMENTSELECTIONACTIVITY-EXECUTE}      and
   vcActivityCode <> {&PAYMENTSELECTIONACTIVITY-EXECUTEAGAIN} and
   can-find(first tPaySelPrepayRefPS)
then do:
    <M-21 run AdditionalUpdatesPrepayment (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>

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

    if oiReturnStatus < 0
    then do:
        <M-90 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        return.
    end.
end.
 /* History */

<M-95 run AdditionalUpdatesHistory (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>

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

if oiReturnStatus < 0
then do:
    <M-96 run StopExternalInstances
       (output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
    return.
end.
<ANCESTOR-CODE>

/* ================================================================================================  *
* In the instance we are keeping all data as to be with Debit/Credit indication                     *
* which means + Payment, + Discount, + Interest  - Invoice, Credit note, Prepayment, New prepayment *
*             - Payment, - Discount, - Interest  - Invoice Correction, Credit note correction       *         
* But in the database data have to be saved as real movement value                                  *
* which mens  + Payment  - Outgoing payment  - Invoice, Credit Note Correction, New prepayment      *
*             - Discount - Outgoing payment  - Invoice, Credit Note Correction, New prepayment      *
*             + Interest - Outgoing payment  - Invoice, Credit Note Correction, New prepayment      *
*             - Payment  - Incomming payment - Credit note, Invoice Correction, Existing prep       *
*             + Discount - Incomming payment - Credit note, Invoice Correction, Existing prep       *
*             - Interest - Incomming payment - Credit note, Invoice Correction, Existing prep       *
* ================================================================================================  */
for each tPaySelLine:
        
    assign tPaySelLine.PaySelLineDiscountTC = - tPaySelLine.PaySelLineDiscountTC. 
           
    if tPaySelLine.tcPaymentCrDt = vcCreditTR
    then assign tPaySelLine.PaySelLineAmountTC   = - tPaySelLine.PaySelLineAmountTC
                tPaySelLine.PaySelLineIntAmtTC   = - tPaySelLine.PaySelLineIntAmtTC        
                tPaySelLine.PaySelLineDiscountTC = - tPaySelLine.PaySelLineDiscountTC.
end.