Compile function React_Item_Services(@Service, @Params)
/***********************************************************************************************************************

    This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
    permission from SRP Computer Solutions, Inc.

    Name        :   React_Item_Services

    Description :   Handler program for all module related services.

    Notes       :   The generic parameters should contain all the necessary information to process the services. Often
                    this will be information like the data Record and Key ID.

    Parameters  :
        Service         [in] -- Name of the service being requested
        Param1-10   [in/out] -- Additional request parameter holders
        Response       [out] -- Response to be sent back to the Controller (MCP) or requesting procedure

    History     :   (Date, Initials, Notes)
        08/02/22    djs     Original programmer.

***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler

$Insert APP_INSERTS
$Insert SERVICE_SETUP
$Insert RLIST_EQUATES
$Insert REACT_ITEM_EQUATES

Declare function   Database_Services, Error_Services, SRP_JSON, NextKey, SRP_Date, obj_React_Item, SRP_Array
Declare subroutine SRP_JSON, Error_Services, Btree.Extract, Database_Services, Update_Index

GoToService else
	Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
end

Return Response else ''

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Service Parameter Options
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Options BOOLEAN     = True$, False$

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Services
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Service GetReactItems(RIType, CurrStatus, EntryDtStart, EntryDtEnd, RetireDtStart, RetireDtEnd, IncludeNullRetireDt=BOOLEAN)
    
    ErrorMsg = ''
    Response = ''
    If ( (RIType NE '') or (CurrStatus NE '') or (EntryDtStart NE '') or (EntryDtEnd NE '') or (RetireDtStart NE '') or (RetireDtEnd NE '') or (IncludeNullRetireDt NE '') ) then
        If EntryDtStart  NE '' and Not(Num(EntryDtStart))  then EntryDtStart  = IConv(EntryDtStart, 'D')
        If EntryDtEnd    NE '' and Not(Num(EntryDtEnd))    then EntryDtEnd    = IConv(EntryDtEnd, 'D')
        If RetireDtStart NE '' and Not(Num(RetireDtStart)) then RetireDtStart = IConv(RetireDtStart, 'D')
        If RetireDtEnd   NE '' and Not(Num(RetireDtEnd))   then RetireDtEnd   = IConv(RetireDtEnd, 'D')
        Open 'DICT.REACT_ITEM' to DictReactItem then
            SearchString = ''
            If RIType NE '' then
                Swap ',' with @VM in RIType
                SearchString := 'RI_TYPE':@VM:RIType:@FM
            end
            Begin Case
                Case ( (EntryDtStart NE '') and (EntryDtEnd NE '') )
                    EntryDtStart = OConv(EntryDtStart - 1, 'D4/')
                    EntryDtEnd   = OConv(EntryDtEnd + 1, 'D4/')
                    SearchString := 'ENTER_DT':@VM:EntryDtStart:'~':EntryDtEnd:@FM
                Case (EntryDtStart NE '')
                    EntryDtStart  = OConv(EntryDtStart, 'D4/')
                    SearchString := 'ENTER_DT':@VM:'>=':EntryDtStart:@FM
                Case (EntryDtEnd NE '')
                    SearchString := 'ENTER_DT':@VM:'<=':EntryDtEnd:@FM
                Case Otherwise$
                    Null
            End Case
            Begin Case
                Case ( (RetireDtStart NE '') and (RetireDtEnd NE '') )
                    RetireDtStart  = OConv(RetireDtStart - 1, 'D4/')
                    RetireDtEnd    = OConv(RetireDtEnd + 1, 'D4/')
                    SearchString  := 'RETIRE_DT':@VM:RetireDtStart:'~':RetireDtEnd
                    If IncludeNullRetireDt then SearchString := @VM:''
                    SearchString := @FM                    
                Case (RetireDtStart NE '')
                    RetireDtStart  = OConv(RetireDtStart, 'D4/')
                    SearchString  := 'RETIRE_DT':@VM:'>=':RetireDtStart
                    If IncludeNullRetireDt then SearchString := @VM:''
                    SearchString  := @FM                    
                Case (RetireDtEnd NE '')
                    SearchString := 'RETIRE_DT':@VM:'<=':RetireDtEnd
                    If IncludeNullRetireDt then SearchString := @VM:''
                    SearchString := @FM
                Case IncludeNullRetireDt
                    SearchString  := 'RETIRE_DT':@VM:'':@FM
                Case Otherwise$
                    Null
            End Case
            If CurrStatus NE '' then
                Swap ',' with @VM in CurrStatus
                SearchString := 'CURR_STATUS_STATIC':@VM:CurrStatus:@FM
            end
            Flag    = ''
            RIKeys  = ''
            Btree.Extract(SearchString, 'REACT_ITEM', DictReactItem, RIKeys, 'E', Flag)
            If Flag EQ 0 then
                EnterDtms = Xlate('REACT_ITEM', RIKeys, 'ENTER_DTM', 'X')
                Array     = RIKeys:@FM:EnterDtms
                Array     = SRP_Array('SortRows', Array, 'DN2', 'ARRAY', @FM, @VM)
                Response  = Array<1>
            end else
                ErrorMsg = 'Error in ':Service:' service. Error calling Btree.Extract.'
            end
        end else
            ErrorMsg = 'Error in ':Service:' service. Error opening REACT_ITEM dictionary.'
        end
    end else
        AllKeys  = ''
        RList('SELECT REACT_ITEM', TARGET_ACTIVELIST$, '', '', '')
        Done     = False$
        Loop
            Readnext KeyId else Done = True$
        Until Done
            AllKeys<1, -1> = KeyId
        Repeat
        Response       = AllKeys
    end
    If ErrorMsg NE '' then
        Error_Services('Add', ErrorMsg)
    end
    
End Service


Service ConvertRecordToJSON(KeyID, Record, ItemURL)
    
    jsonRecord    = ''
    
    If KeyID NE '' then
        
        If Record EQ '' then Record = Database_Services('ReadDataRow', 'REACT_ITEM', KeyID)
        If Error_Services('NoError') then
            @DICT    = Database_Services('GetTableHandle', 'DICT.REACT_ITEM')
            @ID      = KeyID
            @RECORD  = Record
            If SRP_JSON(objJSON, 'New', 'Object') then
                
                If SRP_JSON(objReactItem, 'New', 'Object') then 
                    SRP_JSON(objReactItem, 'SetValue', 'keyId', @ID)
                    SRP_JSON(objReactItem, 'SetValue', 'description', {DESC})
                    SRP_JSON(objReactItem, 'SetValue', 'retireDt', OConv({RETIRE_DT}, 'D4/'))
                    SRP_JSON(objReactItem, 'SetValue', 'partType', {PART_TYPE})
                    SRP_JSON(objReactItem, 'SetValue', 'mfrCd', {MFR_CD})
                    SRP_JSON(objReactItem, 'SetValue', 'mfrPartNo', {MFR_PART_NO})
                    SRP_JSON(objReactItem, 'SetValue', 'mfrPartNoRev', {MFR_PART_NO_REV})
                    SRP_JSON(objReactItem, 'SetValue', 'serialNo', {SERIAL_NO})
                    SRP_JSON(objReactItem, 'SetValue', 'riType', {RI_TYPE})
                    SRP_JSON(objReactItem, 'SetValue', 'CurrentStatus', {CURR_STATUS})
                    // Add available disposition codes
                    DispCodes = Xlate('SYSREPOSPOPUPS', 'LSL2**REACT_ITEM_DISP', 'DISPLAY', 'X')
                    If SRP_JSON(objReactItemDispArray, 'New', 'Array') then
                        For each DispCode in DispCodes using @VM setting vPos
                            If SRP_JSON(objDisp, 'New', 'Object') then
                                SRP_JSON(objDisp, 'SetValue', 'dispCode', DispCode<0, 0, 1>)
                                SRP_JSON(objDisp, 'SetValue', 'dispDesc', DispCode<0, 0, 2>)
                            end
                            SRP_JSON(objReactItemDispArray, 'Add', objDisp)
                            SRP_JSON(objDisp, 'Release')
                        Next DispCode
                        SRP_JSON(objReactItem, 'Set', 'dispCodes', objReactItemDispArray)
                        SRP_JSON(objReactItemDispArray, 'Release')
                    end
                    SRP_JSON(objJSON, 'Set', 'reactItem', objReactItem)
                    SRP_JSON(objReactItem, 'Release')
                end
                
                If itemURL NE '' then
                    // The itemURL was passed in so add HAL+JSON properties.
                    // Create the _links property and then all link objects needed for this resource.
                    If SRP_JSON(objLinks, 'New', 'Object') then
                        // Create a self link.
                        If SRP_JSON(objLink, 'New', 'Object') then
                            SRP_JSON(objLink, 'SetValue', 'href', ItemURL, 'String')
                            SRP_JSON(objLink, 'SetValue', 'title', 'Self', 'String')
                            SRP_JSON(objLinks, 'Set', 'self', objLink)
                            SRP_JSON(objLink, 'Release')
                        end
                        SRP_JSON(objJSON, 'Set', '_links', objLinks)
                        SRP_JSON(objLinks, 'Release')
                    end
                    
                    // Create the _class property for this resource.
                    SRP_JSON(objJSON, 'SetValue', '_class', 'resource')
                end
                jsonRecord = SRP_JSON(objJSON, 'Stringify', 'Styled')
                SRP_JSON(objJSON, 'Release')
            end else
                Error_Services('Add', 'Unable to create JSON representation in the ' : Service : ' service.')
            end
        end
    end else
        Error_Services('Add', 'KeyID argument was missing in the ' : Service : ' service.')
    end
    
    Response    = jsonRecord
    
end service


Service ConvertJSONToRecord(JSON)
    
    Record = ''
    If JSON NE '' then
        If SRP_JSON(objJSON, 'Parse', JSON) EQ '' then
            objReactItem                        = SRP_JSON(objJSON, 'Get', 'reactItem')
            KeyID                               = SRP_JSON(objReactItem, 'GetValue', 'keyId', '')
            Record<REACT_ITEM_DESC$>            = SRP_JSON(objReactItem, 'GetValue', 'description', '')
            Record<REACT_ITEM_ENTER_BY$>        = SRP_JSON(objReactItem, 'GetValue', 'enterBy', '')
            Record<REACT_ITEM_ENTER_DTM$>       = IConv(SRP_JSON(objReactItem, 'GetValue', 'enterDtm', ''), 'DT')
            Record<REACT_ITEM_RETIRE_BY$>       = SRP_JSON(objReactItem, 'GetValue', 'retireBy', '')
            Record<REACT_ITEM_RETIRE_DT$>       = IConv(SRP_JSON(objReactItem, 'GetValue', 'retireDt', ''), 'D')
            Record<REACT_ITEM_PART_TYPE$>       = SRP_JSON(objReactItem, 'GetValue', 'partType', '')
            Record<REACT_ITEM_MFR_CD$>          = SRP_JSON(objReactItem, 'GetValue', 'mfrCd', '')
            Record<REACT_ITEM_MFR_PART_NO$>     = SRP_JSON(objReactItem, 'GetValue', 'mfrPartNo', '')
            Record<REACT_ITEM_MFR_PART_NO_REV$> = SRP_JSON(objReactItem, 'GetValue', 'mfrPartNoRev', '')
            Record<REACT_ITEM_SERIAL_NO$>       = SRP_JSON(objReactItem, 'GetValue', 'serialNo', '')
            Record<REACT_ITEM_RI_TYPE$>         = SRP_JSON(objReactItem, 'GetValue', 'riType', '')
            Record<REACT_ITEM_SUSC_SIZE$>       = SRP_JSON(objReactItem, 'GetValue', 'suscSize', '')
            Record<REACT_ITEM_PKT_QTY$>         = SRP_JSON(objReactItem, 'GetValue', 'pktQty', '')
            Record<REACT_ITEM_PKT_SIZE$>        = SRP_JSON(objReactItem, 'GetValue', 'pktSize', '')
            Record<REACT_ITEM_NOTES$>           = SRP_JSON(objReactItem, 'GetValue', 'notes', '')
            Record<REACT_ITEM_PPLUS_RDS_NO$>    = SRP_JSON(objReactItem, 'GetValue', 'pPlusRdsNo', '')
            Record<REACT_ITEM_SERIAL$>          = SRP_JSON(objReactItem, 'GetValue', 'serial', '')
            Record<REACT_ITEM_TUBE_GRADE$>      = SRP_JSON(objReactItem, 'GetValue', 'tubeGrade', '')
            Record<REACT_ITEM_TUBE_PRESS$>      = SRP_JSON(objReactItem, 'GetValue', 'tubePress', '')
            Record<REACT_ITEM_TUBE_STYLE$>      = SRP_JSON(objReactItem, 'GetValue', 'tubeStyle', '')
            SRP_JSON(objReactItem, 'Release')
            SRP_JSON(objJSON, 'Release')
        end else
            Error_Services('Add', 'Error in ':Service:' service. Unable to parse JSON payload.')
        end
    end else
        Error_Services('Add', 'Error in ':Service:' service. Null JSON passed in.')
    end
    
    Response = Record
    
end service


Service GetReactItemTemplateJSON()
    
    jsonRecord = ''
    
    If SRP_JSON(objJSON, 'New', 'Object') then
        
        If SRP_JSON(objReactItem, 'New', 'Object') then 
            SRP_JSON(objReactItem, 'SetValue', 'description', '')
            SRP_JSON(objReactItem, 'SetValue', 'retireDt', '')
            
            PartTypes = Xlate('SYSREPOSPOPUPS', 'LSL2**RI_PART_TYPE', 'DISPLAY', 'X')
            If SRP_JSON(objPartTypeArray, 'New', 'Array') then
                For each PartType in PartTypes using @VM
                    If SRP_JSON(objPartType, 'New', 'Object') then
                        SRP_JSON(objPartType, 'SetValue', 'code', PartType<0, 0, 1>)
                        SRP_JSON(objPartType, 'SetValue', 'description', PartType<0, 0, 2>)
                        SRP_JSON(objPartTypeArray, 'Add', objPartType)
                        SRP_JSON(objPartType, 'Release')
                    end
                Next RIType
                SRP_JSON(objReactItem, 'Set', 'partTypeOptions', objPartTypeArray)
                SRP_JSON(objPartTypeArray, 'Release')
            end
            
            SRP_JSON(objReactItem, 'SetValue', 'mfrCd', '')
            SRP_JSON(objReactItem, 'SetValue', 'mfrPartNo', '')
            SRP_JSON(objReactItem, 'SetValue', 'mfrPartNoRev', '')
            SRP_JSON(objReactItem, 'SetValue', 'serialNo', '')
            
            SuscPockets = Xlate('SYSREPOSPOPUPS', 'LSL2**SUSCEPTOR_POCKETS', 'DISPLAY', 'X')
            If SRP_JSON(objSuscPocketsArray, 'New', 'Array') then
                For each SuscPocket in SuscPockets using @VM
                    If SRP_JSON(objSuscPocket, 'New', 'Object') then
                        SRP_JSON(objSuscPocket, 'SetValue', 'numPockets', SuscPocket<0, 0, 1>)
                        SRP_JSON(objSuscPocket, 'SetValue', 'reactTypeCode', SuscPocket<0, 0, 2>)
                        SRP_JSON(objSuscPocket, 'SetValue', 'reactTypeDesc', SuscPocket<0, 0, 3>)
                        SRP_JSON(objSuscPocketsArray, 'Add', objSuscPocket)
                        SRP_JSON(objSuscPocket, 'Release')
                    end
                Next SuscPocket
                SRP_JSON(objReactItem, 'Set', 'pktQtyOptions', objSuscPocketsArray)
                SRP_JSON(objSuscPocketsArray, 'Release')
            end
            
            RITypes = Xlate('SYSREPOSPOPUPS', 'LSL2**REACT_ITEM_TYPE', 'DISPLAY', 'X')
            If SRP_JSON(objRITypeArray, 'New', 'Array') then
                For each RIType in RITypes using @VM
                    If SRP_JSON(objRIType, 'New', 'Object') then
                        SRP_JSON(objRIType, 'SetValue', 'code', RIType<0, 0, 1>)
                        SRP_JSON(objRIType, 'SetValue', 'description', RIType<0, 0, 2>)
                        SRP_JSON(objRITypeArray, 'Add', objRIType)
                        SRP_JSON(objRIType, 'Release')
                    end
                Next RIType
                SRP_JSON(objReactItem, 'Set', 'riTypeOptions', objRITypeArray)
                SRP_JSON(objRITypeArray, 'Release')
            end
            
            TubeStyles = Xlate('SYSREPOSPOPUPS', 'LSL2**TUBE_STYLE', 'DISPLAY', 'X')
            If SRP_JSON(objTubeStylesArray, 'New', 'Array') then
                For each TubeStyle in TubeStyles using @VM
                    If SRP_JSON(objTubeStyle, 'New', 'Object') then
                        SRP_JSON(objTubeStyle, 'SetValue', 'code', TubeStyle<0, 0, 1>)
                        SRP_JSON(objTubeStyle, 'SetValue', 'description', TubeStyle<0, 0, 2>)
                        SRP_JSON(objTubeStylesArray, 'Add', objTubeStyle)
                        SRP_JSON(objTubeStyle, 'Release')
                    end
                Next TubeStyle
                SRP_JSON(objReactItem, 'Set', 'tubeStyleOptions', objTubeStylesArray)
                SRP_JSON(objTubeStylesArray, 'Release')
            end
            
            Vendors = Xlate('SYSREPOSPOPUPS', 'LSL2**REACT_VENDOR', 'DISPLAY', 'X')
            If SRP_JSON(objVendorsArray, 'New', 'Array') then
                For each Vendor in Vendors using @VM
                    If SRP_JSON(objVendor, 'New', 'Object') then
                        SRP_JSON(objVendor, 'SetValue', 'code', Vendor<0, 0, 1>)
                        SRP_JSON(objVendor, 'SetValue', 'description', Vendor<0, 0, 2>)
                        SRP_JSON(objVendorsArray, 'Add', objVendor)
                        SRP_JSON(objVendor, 'Release')
                    end
                Next Vendor
                SRP_JSON(objReactItem, 'Set', 'mfrCdOptions', objVendorsArray)
                SRP_JSON(objVendorsArray, 'Release')
            end
            
            WaferSizes = Xlate('SYSREPOSPOPUPS', 'LSL2**WAFER_SIZES', 'DISPLAY', 'X')
            If SRP_JSON(objWaferSizesArray, 'New', 'Array') then
                For each WaferSize in WaferSizes using @VM
                    If SRP_JSON(objWaferSize, 'New', 'Object') then
                        SRP_JSON(objWaferSize, 'SetValue', 'code', WaferSize<0, 0, 1>)
                        SRP_JSON(objWaferSize, 'SetValue', 'description', WaferSize<0, 0, 2>)
                        SRP_JSON(objWaferSizesArray, 'Add', objWaferSize)
                        SRP_JSON(objWaferSize, 'Release')
                    end
                Next WaferSize
                SRP_JSON(objReactItem, 'Set', 'ptySizeOptions', objWaferSizesArray)
                SRP_JSON(objWaferSizesArray, 'Release')
            end
            
            WaferSizes = Xlate('SYSREPOSPOPUPS', 'LSL2**WAFER_SIZES', 'DISPLAY', 'X')
            If SRP_JSON(objWaferSizesArray, 'New', 'Array') then
                For each WaferSize in WaferSizes using @VM
                    If SRP_JSON(objWaferSize, 'New', 'Object') then
                        SRP_JSON(objWaferSize, 'SetValue', 'code', WaferSize<0, 0, 1>)
                        SRP_JSON(objWaferSize, 'SetValue', 'description', WaferSize<0, 0, 2>)
                        SRP_JSON(objWaferSizesArray, 'Add', objWaferSize)
                        SRP_JSON(objWaferSize, 'Release')
                    end
                Next WaferSize
                SRP_JSON(objReactItem, 'Set', 'suscSizeOptions', objWaferSizesArray)
                SRP_JSON(objWaferSizesArray, 'Release')
            end
            
            SRP_JSON(objJSON, 'Set', 'reactItem', objReactItem)
            SRP_JSON(objReactItem, 'Release')
        end
        
        jsonRecord = SRP_JSON(objJSON, 'Stringify', 'Styled')
        SRP_JSON(objJSON, 'Release')
    end else
        Error_Services('Add', 'Unable to create JSON representation in the ' : Service : ' service.')
    end
    
    Response    = jsonRecord
    
end service


Service CreateReactItem(Record)
    
    ErrMsg = ''
    KeyID  = ''
    If Record NE '' then
        //Need to do some parameter checks here
        ReactItemType = Record<REACT_ITEM_RI_TYPE$>
        If ReactItemType EQ '' then
            ErrMsg := 'React Item Type was blank!' : CRLF$
        end
        If ErrMsg EQ '' then
            KeyID = NextKey('REACT_ITEM')
            If Error_Services('NoError') and KeyID NE '' then
                Database_Services('WriteDataRow', 'REACT_ITEM', KeyID, Record)
            end else
                ErrMsg := 'Failed to generate a key for a new react item. ' : CRLF$
            end
        end
    end
    If ErrMsg NE '' then
        Error_Services('Add', Errmsg)
    end
    Response = KeyID
    
end service


Service ConvertRecordToJSONQuick(KeyID, Record, ItemURL)
    
    jsonRecord    = ''
    
    If KeyID NE '' then
        
        If Record EQ '' then Record = Database_Services('ReadDataRow', 'REACT_ITEM', KeyID)
        If Error_Services('NoError') then
            @DICT    = Database_Services('GetTableHandle', 'DICT.REACT_ITEM')
            @ID      = KeyID
            @RECORD  = Record
            If SRP_JSON(objJSON, 'New', 'Object') then
                
                If SRP_JSON(objReactItem, 'New', 'Object') then 
                    SRP_JSON(objReactItem, 'SetValue', 'keyId', @ID)
                    SRP_JSON(objReactItem, 'SetValue', 'description', {DESC})
                    SRP_JSON(objReactItem, 'SetValue', 'serialNo', {SERIAL_NO})
                    SRP_JSON(objJSON, 'Set', 'reactItem', objReactItem)
                    SRP_JSON(objReactItem, 'Release')
                end
                
                If itemURL NE '' then
                    // The itemURL was passed in so add HAL+JSON properties.
                    // Create the _links property and then all link objects needed for this resource.
                    If SRP_JSON(objLinks, 'New', 'Object') then
                        // Create a self link.
                        If SRP_JSON(objLink, 'New', 'Object') then
                            SRP_JSON(objLink, 'SetValue', 'href', ItemURL, 'String')
                            SRP_JSON(objLink, 'SetValue', 'title', 'Self', 'String')
                            SRP_JSON(objLinks, 'Set', 'self', objLink)
                            SRP_JSON(objLink, 'Release')
                        end
                        SRP_JSON(objJSON, 'Set', '_links', objLinks)
                        SRP_JSON(objLinks, 'Release')
                    end
                    
                    // Create the _class property for this resource.
                    SRP_JSON(objJSON, 'SetValue', '_class', 'resource')
                end
                jsonRecord = SRP_JSON(objJSON, 'Stringify', 'Styled')
                SRP_JSON(objJSON, 'Release')
            end else
                Error_Services('Add', 'Unable to create JSON representation in the ' : Service : ' service.')
            end
        end
    end else
        Error_Services('Add', 'KeyID argument was missing in the ' : Service : ' service.')
    end
    
    Response    = jsonRecord
    
end service


Service UpdateReactItemStatus(RINo)
    
    If RINo NE '' then
        If RowExists('REACT_ITEM', RINo) then
            RIRec                     = Database_Services('ReadDataRow', 'REACT_ITEM', RINo)
            If Error_Services('NoError') then
                Update_Index('REACT_ITEM_HIST', 'RI_NO', False$, True$)
                ReactItemCurrStatus       = obj_React_Item('CurrStatus', RINo:@RM:RIRec)
                ReactItemCurrStatusStatic = RIRec<REACT_ITEM_CURR_STATUS_STATIC$>
                If ReactItemCurrStatus NE ReactItemCurrStatusStatic then
                    Open 'REACT_ITEM' to hTable then
                        WriteV ReactItemCurrStatus on hTable, RINo, REACT_ITEM_CURR_STATUS_STATIC$ else
                            Error_Services('Add', 'Error in ':Service:' service. Error writing CURR_STATUS_STATIC, ':ReactItemCurrStatus:', for REACT_ITEM ':RINo:'.')
                        end
                    end else
                        Error_Services('Add', 'Error in ':Service:' service. Error opening REACT_ITEM table for status update.')
                    end
                end
            end
        end
    end
    
end service

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

ClearCursors:
    
    For counter = 0 to 8
        ClearSelect counter
    Next counter
    
return

