project QadFinancials > class BDDocument > method StopExternalInstances

Description

Stop instances that are started in AdditionalUpdates as part of current transaction


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDDocument.AdditionalUpdates
method BDDocument.ValidateComponent


program code (program/bddocument.p)

if vlBDCollectionDDocWasStartedHer and
   viBDCollectionDDocID <> 0
then do:
    <I-1 {bFcStopInstance
            &CLASS           = "BDCollection"}>

    assign viBDCollectionDDocID            = 0
           vlBDCollectionDDocWasStartedHer = false.
end.

if vlBDInvoiceDDocWasStartedHere and
   viBDInvoiceDDocID <> 0
then do:

    for each tDDocumentInvoiceXref where
             tDDocumentInvoiceXref.tcDInvoiceType = {&INVOICETYPE-PREPAYMENT} and
             tDDocumentInvoiceXref.tc_Status      = "N":U:
        <M-67 run DeleteDInvoiceFromTempTable
           (input  tDDocumentInvoiceXref.DInvoice_ID (iiDInvoice_ID), 
            output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
            
        delete tDDocumentInvoiceXref.
    end.

    <I-2 {bFcStopInstance
            &CLASS           = "BDInvoice"}>

    assign viBDInvoiceDDocID             = 0
           vlBDInvoiceDDocWasStartedHere = false.         
end.

if vlBDPayDDocWasStartedHere and
   viBDPayDDocID <> 0
then do:
    <I-3 {bFcStopInstance
            &CLASS           = "BDPay"}>

    assign viBDPayDDocID             = 0
           vlBDPayDDocWasStartedHere = false.
end.

if vlBJournalEntryDDocWasStartedHe and
   viBJournalEntryDDocID <> 0
then do:
    <I-4 {bFcStopInstance
            &CLASS           = "BJournalEntry"}>

    assign viBJournalEntryDDocID           = 0
           vlBJournalEntryDDocWasStartedHe = false.
end.

if vlBDebtorIsStartedFromDoc and
   viBDebtorDocID <> 0
then do:
    <I-5 {bFcStopInstance
            &CLASS           = "BDebtor"}>

    assign viBDebtorDocID            = 0
           vlBDebtorIsStartedFromDoc = false.
end.

if vlBDPaySelectionWasStartedHere and
   viBDPaymentSelectionID <> 0
then do:
    <I-6 {bFcStopInstance
            &CLASS           = "BDPaymentSelection"}>

    assign viBDPaymentSelectionID         = 0
           vlBDPaySelectionWasStartedHere = false.
end.

<ANCESTOR-CODE>

/* Remove all newly created posting lines */
for each tDDocumentPostingLine where
         tDDocumentPostingLine.tc_status = "N":U:
    delete tDDocumentPostingLine.
end.

for each t_sDDocumentPostingLine where
         t_sDDocumentPostingLine.tc_status = "N":U:
    delete t_sDDocumentPostingLine.
end.