icPostingIDToDelete | input | character | PostingIDToDelete; Posting-IDs of the postings that need to be marked as deleted. The list Comma-separated, |
icPostingLineIDToDelete | input | character | PostingLineIDToDelete; PostingLine-IDs of the posting-lines that need to be marked as deleted. Note that the vat information of the posting-line will be deleted as well. The list Comma-separated, |
icPostingIDToKeep | input | character | PostingIDToKeep; Comma-separated list of PostingIDs. if this paramater is filled than all Postings with a Posting-ID that cannot be found in this list will be deleted. If you keep this parameter empty, than no action will be taken on this parameter. The list Comma-separated, |
oiReturnStatus | output | integer | Return status of the method. |
/* ================================= */ /* Set default return status */ /* ================================= */ assign oiReturnStatus = -98. /* ================================= */ /* Initialise all unknown paramaters */ /* ================================= */ if icPostingIDToDelete = ? then assign icPostingIDToDelete = "":U. if icPostingLineIDToDelete = ? then assign icPostingLineIDToDelete = "":U. if icPostingIDToKeep = ? then assign icPostingIDToKeep = "":U. /* =========================================================================== */ /* Call a submethod that performs the required actions for paramaters */ /* icPostingIDToDelete and icPostingLineIDToDelete */ /* =========================================================================== */ <M-1 run MarkInstanceDataAsDeleted (input icPostingIDToDelete (icPostingIDToDelete), input icPostingLineIDToDelete (icPostingLineIDToDelete), output viFcReturnSuper (oiReturnStatus)) in BJournalEntry> if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper. if viFcReturnSuper < 0 then return. /* =========================================================================== */ /* Set all Postings that are not in the list of Postings-To-Keep, as deleted */ /* =========================================================================== */ if icPostingIDToKeep <> "":U then do : for each tPosting : if lookup(string(tPosting.Posting_ID),icPostingIDToKeep) = 0 then do: for each tPostingLine where tPostingLine.tc_ParentRowid = tPosting.tc_Rowid : for each tPostingVat where tPostingVat.tc_ParentRowid = tPostingLine.tc_Rowid : IF tPostingVat.tc_Status = "N":U THEN DELETE tPostingVat. ELSE assign tPostingVat.tc_Status = "D":U. end. /* for each tPostingVat where */ for each tPostingWHT where tPostingWHT.tc_ParentRowid = tPostingLine.tc_Rowid : IF tPostingWHT.tc_Status = "N":U THEN DELETE tPostingWHT. ELSE assign tPostingWHT.tc_Status = "D":U. end. /* for each tPostingWHT where */ for each tPostingVatDelay where tPostingVatDelay.tc_ParentRowid = tPostingLine.tc_Rowid : IF tPostingVatDelay.tc_Status = "N":U THEN DELETE tPostingVatDelay. ELSE assign tPostingVatDelay.tc_Status = "D":U. end. /* for each tPostingVatDelay where */ for each tPostingSaf where tPostingSaf.tc_ParentRowid = tPostingLine.tc_Rowid : IF tPostingSaf.tc_Status = "N":U THEN DELETE tPostingSaf. ELSE assign tPostingSaf.tc_Status = "D":U. end. /* for each tPostingSaf where */ IF tPostingLine.tc_Status = "N":U THEN DELETE tPostingLine. ELSE assign tPostingLine.tc_Status = "D":U. end. /* for each tPostingLine where */ IF tPosting.tc_Status = "N":U THEN DELETE tPosting. ELSE assign tPosting.tc_Status = "D":U. end. /* if lookup */ end. /* for each tPosting : */ end. /* if icPostingIDToKeep <> "":U */ /* ================================= */ /* Set return status = ok */ /* ================================= */ if oiReturnStatus = -98 then assign oiReturnStatus = 0.