Description
Clear the mf postings - called from the UI
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program7/bcinvoice.p)
/* ========================================================================================= */
/* not used for multiple instances */
/* it will delete all mf postings records */
/* needed to initialize postings only switching from an allocated to a non-allocated invoice */
/* this is executed from ui on leave of reason code */
/* ========================================================================================= */
assign oiReturnStatus = -98.
for each tCInvoice where
tCInvoice.tc_Status <> "D":U :
for each tCInvoicePosting where
tCInvoicePosting.tc_ParentRowid = tCInvoice.tc_Rowid:
if tCInvoicePosting.CInvoicePostingType = {&INVOICEPOSTINGTYPE-ALLOCATION} and
tCInvoicePosting.tc_Status = "N":U
then delete tCInvoicePosting.
else do:
<Q-52 run PostingByPostingId (all) (Read) (NoCache)
(input ?, (CompanyId)
input tCInvoicePosting.Posting_ID, (PostingId)
input ?, (JournalTypeCode)
output dataset tqPostingByPostingId) in BPosting >
find first tqPostingByPostingId no-error.
assign vcLayerType = if available tqPostingByPostingId
then tqPostingByPostingId.tcLayerTypeCode
else "":U.
if vcLayerType = {&LAYERTYPECODE-TRANSIENT}
then do :
if vcPostingIds = "":U
then vcPostingIds = string(tCInvoicePosting.Posting_ID) + ",".
else vcPostingids = vcPostingIds + string(tCInvoicePosting.Posting_ID) + ",".
end.
end. /*else do*/
end. /*for each tCInvoicePosting*/
end. /*for each tCInvoice*/
if viBJournalEntryCIID = 0 or viBJournalEntryCIID = ?
then do:
assign oiReturnStatus = -3.
<M-5 run SetMessage
(input trim(#T-9'Internal error. The system cannot reinitialize all related tables when no posting instance is available.':250(63310)t-9#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8103':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
Return.
end.
/* ======================================================================== */
/* make instance of posting empty */
/* clear all tables of the posting, so posting, postingline, postingvat, .. */
/* ======================================================================== */
<I-34 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
if vcpostingids <> "":U
then do:
<M-84 run DeleteTransPosting
(input vcpostingids (icPostingId),
output viExternalStatus (oiReturnStatus)) in BJournalEntry>
end.
else do:
<M-54 run ClearData (output viExternalStatus (oiReturnStatus)) in BJournalEntry>
end.
<I-85 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
if viExternalStatus <> 0 then assign oiReturnStatus = viExternalStatus.
if viExternalStatus < 0 then return.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.