project QadFinancials > class BERS > method ModifyERS

Description

Modify ERS record


Parameters


iiERSIdinputinteger
itEndDateinputdate
iiEndTimeinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BERSProcessor.ERSProcessFinishERS


program code (program5/bers.p)

/* =================================================================================================== */
/* Method      : ModifyERS                                                                             */
/* Desc        : Modify existing ERS record                                                            */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I)  ERSId                ID of ERS record                                                 */
/*          (I)  EndDate              End date                                                         */
/*          (I)  EndTime              End time                                                         */
/* =================================================================================================== */

assign oiReturnStatus = -98.

/* =================================================================================================== */
/* Load record                                                                                         */
/* =================================================================================================== */
find tERS where
     tERS.ERS_ID = iiERSId
     no-error.

if not available tERS
then do:
    <M-2 run DataLoad
       (input  ? (icRowids), 
        input  ? (icPkeys), 
        input  string(iiERSId) (icObjectIds), 
        input  ? (icFreeform), 
        input  true (ilKeepPrevious), 
        output viFcReturnSuper (oiReturnStatus)) in BERS>
    if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper <  0 then return.

    find tERS where
         tERS.ERS_ID = iiERSId
         no-error.
end.

if not available tERS
then do:
    <M-3 run SetMessage
       (input  #T-1'ERS record cannot be read.':255(70284)T-1# (icMessage), 
        input  ? (icArguments), 
        input  'ERS.ERS_ID':U (icFieldName), 
        input  string(iiERSId) (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-8312':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BERS>
    assign oiReturnStatus = -1.
    return.
end.

/* =================================================================================================== */
/* Update record values                                                                                */
/* =================================================================================================== */
assign tERS.ERSEndDate = itEndDate
       tERS.ERSEndTime = iiEndTime
       tERS.tc_Status  = if tERS.tc_Status = "":U then "C":U else tERS.tc_Status.

/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.