project QadFinancials > class BJournalEntry > method MarkInstanceDataAsDeleted

Description

MarkInstanceDataAsDeleted; This method allows you to remove some postings and some posting-lines from a BJournalEntry instance.


Parameters


icPostingIDToDeleteinputcharacterPostingIDToDelete; Posting-IDs of the postings that need to be marked as deleted.
The list Comma-separated,
icPostingLineIDToDeleteinputcharacterPostingLineIDToDelete; 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,
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankEntry.StopExternalInstances
method BCInvoice.StopExternalInstances
method BCInvoice.DefaultValuesGeneralInfo
method BDInvoice.StopExternalInstances
method BDInvoice.DefaultValuesGeneralInfo
method BJournalEntry.MarkInstanceDataAsDeletedExtended
method BOpenItemAdjustment.StopExternalInstancesExceptBJE


program code (program7/bjournalentry.p)

/* ================================= */
    /* 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.