project QadFinancials > class BPosting > method DeletePosting

Description

Delete a already loaded posting


Parameters


icPostingRowIdinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.ValidateComponentReversingPostingModifyOriginal
method BJournalEntry.DeleteTransPosting


program code (program1/bposting.p)

/* ====================================================================================== *
 * Method       : DeletePosting                                                           *
 * Description  : This method deletes the posting                                         *
 * -------------------------------------------------------------------------------------- *
 * Parameters   :  (I) PostingRowId                                                       *
 * ====================================================================================== */
 
assign oiReturnStatus = -98
       viLocalReturn  = 0.

MAIN_BLOCK:
do on error undo, return:
    /* Delete posting in bodBuffer */
    for each bodPosting where
             bodPosting.tc_Rowid = icPostingRowId:

        for each bodPostingLine where
                 bodPostingLine.tc_ParentRowid = bodPosting.tc_Rowid:

            for each bodPostingSaf where
                     bodPostingSaf.tc_ParentRowid = bodPostingLine.tc_Rowid:
                if bodPostingSaf.tc_Status = "N"
                then delete bodPostingSaf.
                else assign bodPostingSaf.tc_Status = "D":U.
            end. /* for each bodPostingSaf where */

            for each bodPostingVat where
                     bodPostingVat.tc_ParentRowid = bodPostingLine.tc_Rowid:
                if bodPostingVat.tc_Status = "N"
                then delete bodPostingVat.
                else assign bodPostingVat.tc_Status = "D":U.
            end. /* for each bodPostingVat where */

            for each bodPostingVatDelay where
                     bodPostingVatDelay.tc_ParentRowid = bodPostingLine.tc_Rowid:
                if bodPostingVatDelay.tc_Status = "N"
                then delete bodPostingVatDelay.
                else assign bodPostingVatDelay.tc_Status = "D":U.
            end. /* for each bodPostingVat where */

            if bodPostingLine.tc_Status = "N"
            then delete bodPostingLine.
            else assign bodPostingLine.tc_Status = "D":U.
        end. /* for each bodPostingLine where */

        if bodPosting.tc_Status = "N"
        then delete bodPosting.
        else assign bodPosting.tc_Status = "D":U.
    end. /* for each bodPosting where */

    /* Delete posting in bsdBuffer */
    for each bsdPosting where
             bsdPosting.tc_Rowid = icPostingRowId:

        for each bsdPostingLine where
                 bsdPostingLine.tc_ParentRowid = bsdPosting.tc_Rowid:

            for each bsdPostingSaf where
                     bsdPostingSaf.tc_ParentRowid = bsdPostingLine.tc_Rowid:
                if bsdPostingSaf.tc_Status = "N"
                then delete bsdPostingSaf.
                else assign bsdPostingSaf.tc_Status = "D":U.
            end. /* for each bsdPostingSaf where */

            for each bsdPostingVat where
                     bsdPostingVat.tc_ParentRowid = bsdPostingLine.tc_Rowid:
                if bsdPostingVat.tc_Status = "N"
                then delete bsdPostingVat.
                else assign bsdPostingVat.tc_Status = "D":U.
            end. /* for each bsdPostingVat where */

            for each bsdPostingVatDelay where
                     bsdPostingVatDelay.tc_ParentRowid = bsdPostingLine.tc_Rowid:
                if bsdPostingVatDelay.tc_Status = "N"
                then delete bsdPostingVatDelay.
                else assign bsdPostingVatDelay.tc_Status = "D":U.
            end. /* for each bsdPostingVat where */

            if bsdPostingLine.tc_Status = "N"
            then delete bsdPostingLine.
            else assign bsdPostingLine.tc_Status = "D":U.
        end. /* for each bsdPostingLine where */

        if bsdPosting.tc_Status = "N"
        then delete bsdPosting.
        else assign bsdPosting.tc_Status = "D":U.
    end. /* for each bsdPosting where */
end. /* MAIN_BLOCK */

assign oiReturnStatus = viLocalReturn.