project QadFinancials > class BDDocument > method AdditionalUpdatesDeductions


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDDocument.AdditionalUpdates


program code (program1/bddocument.p)

/* =================================================================================================== */
/* Method      : AdditionalUpdatesDeductions                                                            */
/* Desc        : This method does additional updates on Deductions                                    */
/* --------------------------------------------------------------------------------------------------- */
/* Params:       none                                                                                  */
/* =================================================================================================== */


for each tDDocument where tDDocument.tc_status = "C":U:

    /*Only handle the DDocument which linked with Deduction Invoice*/
    find first tDDocumentInvoiceXref where
         tDDocumentInvoiceXref.tc_ParentRowid = tDDocument.tc_Rowid 
         and tDDocumentInvoiceXref.tcDInvoiceType = {&INVOICETYPE-DEDUCTION} no-error.

    find first t_iDDocument where t_iDDocument.tc_Rowid = tDDocument.tc_Rowid no-error. 

    if available(t_iDDocument) and available(tDDocumentInvoiceXref) then
    do:

        if t_iDDocument.DDocumentStatus <> tDDocument.DDocumentStatus  
            and  ( tDDocument.DDocumentStatus = {&DOCUMENTSTATUS-BOUNCED} or tDDocument.DDocumentStatus = {&DOCUMENTSTATUS-INIT}) then
        do:
        
            /* Update DInvoice */
            if viBDInvoiceDDocID = 0 or viBDInvoiceDDocID = ?
            then do:
                <I-5 {bFcStartAndOpenInstance
                     &ADD-TO-TRANSACTION = "true"
                     &CLASS              = "BDInvoice"}>
        
                assign vlBDInvoiceDDocWasStartedHere = true.
            end. /* if viBDInvoiceDDocID = 0 or viBDInvoiceDDocID = ? */
            else do:
                <I-6 {bFcOpenInstance
                     &CLASS           = "BDInvoice"}>
            end. /* else do */
        
        
            <M-1 run UpdateDeductionForBouncedDDoc
               (input  tDDocument.DDocument_ID (iiDDocumentID), 
                input  tDDocument.DDocumentStatus (icDDocStatus), 
                output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
        
        
            if viFcReturnSuper < 0 or oiReturnStatus  = 0
            then assign oiReturnStatus = viFcReturnSuper.
        
            <M-10 run ValidateBCAndAdditionalUpdates  (output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
            
            if viFcReturnSuper < 0 or oiReturnStatus  = 0
            then assign oiReturnStatus = viFcReturnSuper.
        
            <I-8 {bFcCloseInstance
                 &CLASS           = "BDInvoice"}>
        
        end.
    end.
end.