project QadFinancials > class BBankImportLine > method CreatePrePaymentByBankImpLine


Parameters


iiDDocumentIdinputinteger
iiBankImpLineBatchNbrinputinteger
iiBankImpLineIdinputinteger
icBankImpLineRowIdinputcharacter
icDDocumentRowIdinputcharacter
idUnBalanceAmountinputdecimal
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program6/bbankimportline.p)

assign oiReturnStatus       = -98
           vcToStatus       = {&DOCUMENTSTATUS-INCASSO}
           vcBankImpLineRef = "":U
           viLocalReturn    = 0.

/* =================================================================================================== */
/* Allocate Invoices if existing and Create Prepayment                                                 */
/* =================================================================================================== */
<M-46 run AllocateInvoices
   (input  tInvoiceXref (tDocInvoiceXref), 
    input  tInvoiceStageXref (tDocInvoiceStageXref), 
    input  iiDDocumentId (iiDocumentId), 
    input  icDDocumentRowId (icParentRowId), 
    input  idUnBalanceAmount (idUnAllocatedAmount), 
    output viFcReturnSuper (oiReturnStatus)) in BDDocument>

if viFcReturnSuper <> 0 
then assign viLocalReturn = viFcReturnSuper.

/*====================================================================================================*/
/* Set the Return Status to 3 when it's value is less than zero because it is not a blocking error and*/
/* we can save the tBankImpLine successfully later                                                    */
/*====================================================================================================*/
if viLocalReturn < 0 
then assign viLocalReturn = 3.

/* Create processing info */
<M-12 run CreateBankImpLineProcessInfo
   (input  'AllocateInvoices':U (icProcessName), 
    input  #T-10'Allocate invoices to payment':255(590428421)T-10# (icProcessDesc), 
    input  ? (icProcessResult), 
    input  ? (icProcessParam), 
    input  'CreatePrePaymentByBankImpLine':U (icParentRowName), 
    input  viLocalReturn (iiProcessStatus), 
    output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>

if viLocalReturn <> 0  then assign oiReturnStatus = viLocalReturn.

/* =================================================================================================== */
/* Change status                                                                                       */
/* =================================================================================================== */
if viLocalReturn = 0
then do:
    if iiBankImpLineBatchNbr <> 0 and
       iiBankImpLineBatchNbr <> ?
    then do:
        assign vcBankImpLineRef = string(iiBankImpLineBatchNbr).
    end.
    else do:
        <Q-93 run GetBankImpByLineID (all) (Read) (NoCache)
           (input iiBankImpLineId, (BankImpLineID)
            output dataset tqGetBankImpByLineID) in BBankImportLine>
        find first tqGetBankImpByLineID where
                   tqGetBankImpByLineID.tiBankImpLine_ID = iiBankImpLineId
                   no-error.
        if available tqGetBankImpByLineID
        then assign vcBankImpLineRef = tqGetBankImpByLineID.tcBankImpFileName.
    end.
    
    <M-2 run ChangeStatus
       (input  iiDDocumentId (iiDDocumentId), 
        input  vcToStatus (icToStatus), 
        input  vcBankImpLineRef (icBankImpLineRef), 
        input  icBankImpLineRowId (icBankImpLineRowID), 
        output viFcReturnSuper (oiReturnStatus)) in BDDocument>
    if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.

    /*====================================================================================================*/
    /* Set the Return Status to 3 when it's value is less than zero because it is not a blocking error and*/
    /* we can save the tBankImpLine successfully later                                                    */
    /*====================================================================================================*/
    if viLocalReturn < 0 
    then assign viLocalReturn = 3.
    
    /* Create Processing Info */
    assign vcParam = "ToStatus = " + vcToStatus.
    <M-41 run CreateBankImpLineProcessInfo
       (input  'ChangeStatus':U (icProcessName), 
        input  #T-95'Change customer payment status':255(213914093)T-95# (icProcessDesc), 
        input  vcParam (icProcessResult), 
        input  ? (icProcessParam), 
        input  'CreatePrePaymentByBankImpLine':U (icParentRowName), 
        input  viLocalReturn (iiProcessStatus), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
    
    if viLocalReturn <> 0  then assign oiReturnStatus = viLocalReturn.
    if viLocalReturn = 3 then return.
end.

assign oiReturnStatus = 0.