Description
StopExternalInstancesExceptBJE
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bopenitemadjustment.p)
/* ========================================================================== */
/* Stop the different component but only after running a method that returns */
/* the IDs of all linked postins and postinglines for the newly created stuff */
/* ========================================================================== */
if viBCInvoiceInOIAID <> 0 and viBCInvoiceInOIAID <> ?
then do :
<I-5 {bFcOpenInstance
&CLASS = "BCInvoice"}>
<M-7 run GetPostingInfoOfInstance
(output vcPostingIDToDelete (ocPostingIDs),
output vcPostingLineIDToDelete (ocPostingLineIDs),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
assign vcAllPostingLineIDToDelete = vcPostingLineIDToDelete.
<I-6 {bFcCloseAndStopInstance
&CLASS = "BCInvoice"}>
assign viBCInvoiceInOIAID = 0.
end. /* if */
if viBDInvoiceInOIAID <> 0 and viBDInvoiceInOIAID <> ?
then do:
<I-8 {bFcOpenInstance
&CLASS = "BDInvoice"}>
<M-10 run GetPostingInfoOfInstance
(output vcPostingIDToDelete (ocPostingIDs),
output vcPostingLineIDToDelete (ocPostingLineIDs),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign vcAllPostingLineIDToDelete = (if vcAllPostingLineIDToDelete = "":U
then "":U
else vcAllPostingLineIDToDelete + ",":U) +
vcPostingLineIDToDelete.
<I-9 {bFcCloseAndStopInstance
&CLASS = "BDInvoice"}>
assign viBDInvoiceInOIAID = 0.
end. /* if */
/* ================================== */
/* Stop the BWithHoldingTax component */
/* ================================== */
if vlBWHTIsStartedFromOIAdj and
viBWithholdingTaxInOIAID <> 0 and
viBWithholdingTaxInOIAID <> ?
then do:
<I-68 {bFcStopInstance
&CLASS = "BWithholdingTax"}>
assign viBWithholdingTaxInOIAID = 0
vlBWHTIsStartedFromOIAdj = false.
end. /* if vlBWHTIsStartedFromOIAdj and */
/* ====================================================================================================== */
/* Extend the list with PostingLiens to delete with the posting-lines that were created for the discounts */
/* ====================================================================================================== */
for each tOIAdj where
tOIAdj.tcCreatedDiscountPostingLines <> "":U and
tOIAdj.tcCreatedDiscountPostingLines <> ? :
assign vcAllPostingLineIDToDelete = (if vcAllPostingLineIDToDelete = "":U
then "":U
else vcAllPostingLineIDToDelete + ",":U) +
(if tOIAdj.tcCreatedDiscountPostingLines begins ",":U
then substring(tOIAdj.tcCreatedDiscountPostingLines,2,-1,"character":U)
else tOIAdj.tcCreatedDiscountPostingLines).
end. /* for each tOIAdj where */
/* ================================================================================================ */
/* Mark the postings and postinglines of the stopped components as deleted */
/* We do not remove the whole posting but only the posting-lines of the DI/CI: even for new DI/CI, */
/* we cannot remove the whole posting because the posting will also contain the manulay entered */
/* posting-line (in Form 'Allocate G/L'). We will simply delete all the posting-lines related to */
/* the CI/DI without removing the posting itself */
/* ================================================================================================ */
if viBJournalEntryID <> 0 and
viBJournalEntryID <> ? and
vcAllPostingLineIDToDelete <> "":U and
vcAllPostingLineIDToDelete <> ?
then do :
<I-11 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
<M-13 run MarkInstanceDataAsDeleted
(input ? (icPostingIDToDelete),
input vcAllPostingLineIDToDelete (icPostingLineIDToDelete),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
<I-12 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end. /* if viBJournalEntryID <> 0 and */