project QadFinancials > class BJournalEntry > method DeleteInstanceLinesForGL


Parameters


iiPostingidinputinteger
icGLCodeinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program3/bjournalentry.p)

if icGLCode = ? then assign icGLCode = "":U.

if iiPostingId = 0
then do:
    assign vcMessage      = trim(#T-45'You must enter the posting ID if you want to delete the instance lines.':150(2735)T-45#)
           oiReturnStatus = -1.
                      
    <M-60 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-29682':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>       
    return.
end.

/* ======================================================================================== */
/* If GL Account is specified, delete all lines except lines with this G/L account          */
/* ======================================================================================== */
if icGLCode <> "":U
then do:
    for each tPostingLine where
             tPostingLine.Posting_ID = iiPostingId and
             tPostingLine.tcGLCode   = icGLCode:
        for each tPostingVat where
                 tPostingVat.tc_ParentRowid = tPostingLine.tc_Rowid :
            delete tpostingvat.
        end.
        for each tPostingwht where
                 tPostingwht.tc_ParentRowid = tPostingLine.tc_Rowid :
            delete tPostingwht.
        end.
        for each tPostingVatDelay where
            tPostingVatDelay.tc_ParentRowid = tPostingLine.tc_Rowid :
            delete tPostingVatDelay.
        end.
        for each tPostingSaf where
                 tPostingSaf.tc_ParentRowid = tPostingLine.tc_Rowid :
            delete tPostingSaf.
        end.
        delete tPostingLine.
    end.
end.