project QadFinancials > class BCashReport > method CashReportGLDelete

Description

Delete CashReportGL:
this method will remove a single CashReportGL-record and all related CashReportGLLine records. This is done based on the input information.


Parameters


icCashReportGLRowidinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program6/bcashreport.p)

/* ========================================================================== */
/* Validate input parameters                                                  */
/* ========================================================================== */
if icCashReportGLRowid = ? then assign icCashReportGLRowid = "":U.
if icCashReportGLRowid = "":U 
then do :
    assign oiReturnStatus = -3
           vcMessage      = trim(#T-7'You must specify the Cash Report GL (row ID) to delete.':255(69443)t-7#).
    <M-1 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-8083':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCashReport>
    return.
end. /* if icCashReportGLRowid  = ?  */
else do :
    find tCashReportGL where 
         tCashReportGL.tc_Rowid   = icCashReportGLRowid and 
         tCashReportGL.tc_Status <> "D":U
         no-lock no-error.
    if not available tCashReportGL
    then do :
        assign oiReturnStatus = -3
               vcMessage      = trim(substitute(#T-8'The system cannot locate the Cash Report GL based on its row ID (&1).':255(69444)t-8#,string(icCashReportGLRowid))).
        <M-2 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-8084':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BCashReport>
        return.
    end. /* if not available tCashReportGL */
end. /* not if icCashReportGLRowid  = ? */

/* ==================================================================== */
/* Mark the corresponding CashReportGL-records for deletion             */
/* Mark the corresponding CashReportGLLine-records for deletion         */
/* ==================================================================== */
for each tCashReportGL where
         tCashReportGL.tc_Rowid  = icCashReportGLRowid and
         tCashReportGL.tc_Status <> "D":U:
    for each tCashReportGLLine where
             tCashReportGLLine.CashReportGL_ID = tCashReportGL.CashReportGL_ID and
             tCashReportGLLine.tc_Status       <> "D":U:
        if tCashReportGLLine.tc_Status <> "N":U
        then assign tCashReportGLLine.tc_Status = "D":U.
        else delete tCashReportGLLine.
    end. /* for each tCashReportGLLine */
    if tCashReportGL.tc_Status <> "N":U
    then assign tCashReportGL.tc_Status = "D":U.
    else delete tCashReportGL.
end. /* or each tCashReportGL */