project QadFinancials > class BBankImportLine > method UpdateBankImportLineStatusAndLog


Parameters


tBankImpLineLogForUpdateinputtemp-table
tBankImpLineForUpdateinputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankImportLineProcess.UpdateBankImpLineStatusAndLog


program code (program1/bbankimportline.p)

for each tBankImpLineForUpdate:
    if vcList = "":U then assign vcList = string(tBankImpLineForUpdate.BankImpLine_ID).
    else assign vcList = vcList + chr(4) + string(tBankImpLineForUpdate.BankImpLine_ID).

    /* Continue data load because of 32K limit */
    if length(vcList, "CHARACTER") > 10000
    then do:
        <M-2 run DataLoad
           (input  '' (icRowids), 
            input  vcList (icPkeys), 
            input  ? (icObjectIds), 
            input  '' (icFreeform), 
            input  true (ilKeepPrevious), 
            output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>

        if viFcReturnSuper <> 0
        then assign oiReturnStatus = viFcReturnSuper.

        if viFcReturnSuper < 0 then return.

        assign vcList = '':U.
    end.
end.

if vcList <> '':U and vcList <> ?
then do:
    <M-41 run DataLoad
       (input  '' (icRowids), 
        input  vcList (icPkeys), 
        input  ? (icObjectIds), 
        input  '' (icFreeform), 
        input  true (ilKeepPrevious), 
        output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>

    if viFcReturnSuper <> 0
    then assign oiReturnStatus = viFcReturnSuper.

    if viFcReturnSuper < 0 then return.
end.

for each tBankImpLineForUpdate:
    find first tBankImpLine where 
        tBankImpLineForUpdate.BankImpLine_ID = tBankImpLine.BankImpLine_ID no-error.
    if available tBankImpLine then
    do:
        find first tBankImpLineLogForUpdate where 
            tBankImpLineLogForUpdate.tc_ParentRowid = tBankImpLine.tc_Rowid no-error.
        if not available tBankImpLineLogForUpdate and 
            tBankImpLine.BankImpLineProcessedStatus <> {&BANKIMPPROCSTATUS-PROCESSED-OK} then
            tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-NOT-PROCESSED}.
        else
            tBankImpLine.BankImpLineProcessedStatus = tBankImpLineForUpdate.BankImpLineProcessedStatus.
        tBankImpLine.tc_Status = "C":U.
    end.
end.

for each tBankImpLineLog:
    tBankImpLineLog.tc_Status = "D":U.
end.

for each tBankImpLineLogForUpdate:

    <M-22 run AddDetailLine
       (input  'BankImpLineLog' (icTable), 
        input  tBankImpLineLogForUpdate.tc_ParentRowid (icParentRowid), 
        output oiReturnStatus (oiReturnStatus)) in BBankImportLine>
    buffer-copy tBankImpLineLogForUpdate 
        except tc_Status tc_Rowid BankImpLineLog_ID BankImpLine_ID to tBankImpLineLog.
    tBankImpLineLog.BankImpLineLogRowid = string(rowid(tBankImpLineLog)).
end.
    
<M-32 run ValidateBC  (output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then 
do:
    assign oiReturnStatus = viFcReturnSuper.
    return.
end.

<M-48 run AdditionalUpdates  (output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then 
do:
    assign oiReturnStatus = viFcReturnSuper.
    return.
end.

<M-15 run DataSave  (output oiReturnStatus (oiReturnStatus)) in BBankImportLine> 
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then 
do:
    assign oiReturnStatus = viFcReturnSuper.
    return.
end.