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, |
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. /* =========================================================================== */ /* Set all marked Postings (and their postingLines and PostingVats) as deleted */ /* =========================================================================== */ do viCounter = num-entries(icPostingIDToDelete) to 1 by -1 : find tPosting where tPosting.Posting_ID = INTEGER(entry(viCounter,icPostingIDToDelete)) no-error. if not available tPosting then next. 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. /* do viCounter */ /* =========================================================================== */ /* Set all marked PostingLines (and their PostingVats) as deleted */ /* =========================================================================== */ do viCounter = num-entries(icPostingLineIDToDelete) to 1 by -1 : find tPostingLine where tPostingLine.PostingLine_ID = INTEGER(entry(viCounter,icPostingLineIDToDelete)) no-error. if not available tPostingLine then next. 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. /* do viCounter */ /* ================================= */ /* Set return status = ok */ /* ================================= */ if oiReturnStatus = -98 then assign oiReturnStatus = 0.