COMPILE FUNCTION Comm_Dialog_React_Serv_LU(EntID,Event,Parm1,Parm2,Parm3,Parm4,Parm5)

/*
	Commuter module for Dialog_React_Serv_LU window.
	
	10/24/2013 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, ErrMsg, RList, Send_Message
DECLARE SUBROUTINE obj_Appwindow, Start_Window, Btree.Extract, Msg, Send_Info
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Send_Message, Popup, Collect.IXVals, Msg


$INSERT APPCOLORS
$INSERT MSG_EQUATES
$INSERT RLIST_EQUATES
$INSERT POPUP_EQUATES
$INSERT REACT_SERVS_EQUATES


EQU CRLF$	TO \0D0A\
EQU TAB$	TO \09\


ErrTitle = 'Error in Comm_Dialog_React_Serv_LU'
ErrorMsg = ''
ErrCode = ''

Result = ''

BEGIN CASE
	CASE EntID = @WINDOW
		BEGIN CASE
			CASE Event = 'CREATE'			; GOSUB Create
		END CASE
		
	CASE EntID = @WINDOW:'.NAVIGATOR'
		BEGIN CASE
			CASE Event = 'DBLCK'			; GOSUB NavigatorDC
		END CASE
		
	CASE 1
		
		ErrorMsg = 'Unknown Parameters ':EntID:' - ':Event:' passed to commuter'
		ErrMsg(ErrorMsg)
		
END CASE

IF ErrorMsg NE '' THEN
	ErrMsg(ErrTitle:@SVM:ErrorMsg)
END

RETURN Result


* * * * * * *
Create:
* * * * * * *

obj_AppWindow('Create')

Set_Property(@WINDOW,'STATUSLINE',@WINDOW:'.STATUSLINE_FIX')

SelectSent = 'SELECT REACT_SERVS BY REACT_SYSTEM BY REACT_ITEM BY ACTION BY SVC_DESC'


RList(SelectSent,TARGET_ACTIVELIST$,'','','')

IF Get_Status(errCode) THEN ErrMsg(errCode)

OPEN 'REACT_SERVS' TO ReactServTable ELSE
	ErrMsg('Unable to Open "REACT_SERVS" table for read')
	RETURN
END



Done = 0
PrevSystem = ''
PrevItem = ''
PrevAction = ''

DispLine = 1
DispList = ''

LOOP
	READNEXT ReactServID ELSE Done = 1
UNTIL Done
	READ ReactServRec FROM ReactServTable,ReactServID THEN
		
		System	= ReactServRec<REACT_SERVS_REACT_SYSTEM$>
		Item	= ReactServRec<REACT_SERVS_REACT_ITEM$>
		Action	= ReactServRec<REACT_SERVS_ACTION$>
		SvcDesc	= ReactServRec<REACT_SERVS_SVC_DESC$>
		
		IF System = '' THEN System = 'N/A'
		
		IF System NE PrevSystem THEN
			DispList := '1-1:':'System - ':System:@FM
			PrevSystem = System
		END
		
		IF Item NE PrevItem THEN
			DispList := '2-2:':Item:@FM
			PrevItem = Item
		END
		
		IF Action NE PrevAction THEN
			DispList := '3-3:':Action:@FM
			PrevAction = Action
		END
			
		IF SvcDesc NE '' THEN
			DispList := '4-4:':SvcDesc:@FM
		END
		
	END ;* End of ReactServRec read.
REPEAT


Set_Property(@WINDOW:'.NAVIGATOR', 'LIST', DispList)

*Send_Message(@WINDOW:'.NAVIGATOR', 'EXPAND', 0, 1)




RETURN


* * * * * * *
NavigatorDC:
* * * * * * *



RETURN

* * * * * * *
Refresh:
* * * * * * *

RETURN




* * * * * * *
LUReactor:
* * * * * * *

IF NOT(ASSIGNED(Parm1)) THEN FocusControl = ''	ELSE FocusControl = Parm1
IF NOT(ASSIGNED(Parm2)) THEN FocusPos = ''		ELSE FocusPos = Parm2

Set_Status(0)

TypeOver = ''
TypeOver<PSELECT$>	= '2'		;* Multiple Select
TypeOver<PTYPE$> 	= 'E'		;* Return entire row

ReactData = Popup(@WINDOW,TypeOver,'REACTORS')

IF ReactData = '' THEN RETURN

Set_Property(@WINDOW:'.REACT_NO','LIST',ReactData)

LineCnt = COUNT(ReactData,@FM) + (ReactData NE '')
ColCnt = 7

FOR Line = 1 TO LineCnt
	FOR Column = 2 TO ColCnt
		stat = Send_Message(@WINDOW:'.REACT_NO','COLOR_BY_POS',Column,Line,GREEN$)
	NEXT Column
NEXT Line

RETURN


* * * * * * *
LUEventTYpe:
* * * * * * *

IF NOT(ASSIGNED(Parm1)) THEN FocusControl = ''	ELSE FocusControl = Parm1
IF NOT(ASSIGNED(Parm2)) THEN FocusPos = ''		ELSE FocusPos = Parm2

Set_Status(0)

TypeOver = ''
TypeOver<PSELECT$>	= '2'		;* Multiple Select
TypeOver<PTYPE$> 	= 'E'		;* Return entire row

EventTypes = Popup(@WINDOW,TypeOver,'REACT_EVENT_TYPE')

IF EventTypes = '' THEN RETURN

Set_Property(@WINDOW:'.EVENT_TYPE','LIST',EventTypes)

LineCnt = COUNT(EventTypes,@FM) + (EventTypes NE '')
ColCnt = 2

FOR Line = 1 TO LineCnt
	FOR Column = 2 TO ColCnt
		stat = Send_Message(@WINDOW:'.EVENT_TYPE','COLOR_BY_POS',Column,Line,GREEN$)
	NEXT Column
NEXT Line

RETURN









* * * * * * *
Cancel:
* * * * * * *

RETURN



* * * * * * *
PerformQuery:
* * * * * * *

SearchString = ''




End_Dialog(@WINDOW,EventKeys)

RETURN




