project QadFinancials > class BDDocument > method ChangeStatus


Parameters


iiDDocumentIdinputinteger
icToStatusinputcharacter
icBankImpLineRefinputcharacter
icBankImpLineRowIDinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankImportLine.ProcessBankImpLineDDocStatusChg
method BBankImportLine.ProcessBankImpLineNewDDocument
method BBankImportLine.CreatePrePaymentByBankImpLine


program code (program6/bddocument.p)

/* =================================================================================================== */
/* Method      : ChangeStatus                                                                          */
/* Desc        : This method changes customer document status                                          */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I   DDocumentId          The document of which status to be changed                       */
/*          (I)  ToStatus             Status to be changed to                                          */
/* =================================================================================================== */

assign oiReturnStatus = -98.

/* =================================================================================================== */
/* Change status of records in temp-table                                                              */
/* =================================================================================================== */
find first tDDocument where tDDocument.DDocument_ID = iiDDocumentId no-error.
if available tDDocument then assign tDDocument.DDocumentStatus = icToStatus.
else do:
    /* =================================================================================================== */
    /* Change status of records in database                                                                */
    /* =================================================================================================== */
    <M-1 run DataLoad
       (input  '':U (icRowids), 
        input  string(iiDDocumentId) (icPkeys), 
        input  '':U (icObjectIds), 
        input  '':U (icFreeform), 
        input  true (ilKeepPrevious), 
        output viFcReturnSuper (oiReturnStatus)) in BDDocument>
    if viFcReturnSuper < 0
    then do:
        assign vcMessage = trim( substitute(#T-2'The system could not change the payment status. The specified customer (&1) is not defined in the system.':255(68313)t-2#,iiDDocumentId)).
        <M-3 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'S':U (icType), 
            input  1 (iiSeverity), 
            input  '':U (icRowid), 
            input  'QadFin-7606':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BDDocument>
        assign oiReturnStatus = -1.
        return.
    end. /* if viFcReturnSuper < 0 */
    
    /* find first tDDocument no-error.
    if available tDDocument
    then do:
    */
    /*Support the batch mode for bank iimport line*/
    for each tDDocument where tDDocument.DDocument_ID = iiDDocumentId:
       assign tDDocument.DDocumentStatus = icToStatus.

       if tDDocument.DDocumentBankImpRef = "":U or
          tDDocument.DDocumentBankImpRef = ?
       then assign tDDocument.DDocumentBankImpRef = icBankImpLineRef
                   tDDocument.tcExternalUniqueIdentifier = icBankImpLineRowID.              
    end. /* if available tDDocument */
end. /* if else available tDDocument */

/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.