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

/*
	Commuter module for Reactor Wand History (REACT_WAND) window
	
	1/8/2014 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, Center_Window, Post_Event
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow, 
DECLARE SUBROUTINE obj_Notes, Security_Err_Msg, End_Window, Forward_Event, Start_Window, Create_Note

DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Popup, Collect.Ixvals
DECLARE FUNCTION Send_Message, Msg, Security_Check,  obj_Calendar



$INSERT MSG_EQUATES
$INSERT APPCOLORS
$INSERT LSL_USERS_EQU
$INSERT SECURITY_RIGHTS_EQU
$INSERT REACT_WAND_EQUATES
$INSERT WAND_EQUATES
$INSERT POPUP_EQUATES

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


EQU COL$WAND_ID			TO 1
EQU COL$SVC_HRS				TO 2
EQU COL$SVC_WFRS			TO 3
EQU COL$INST_DTM			TO 4
EQU COL$INST_REACT_HRS		TO 5
EQU COL$INST_REACT_WFRS		TO 6
EQU COL$INST_RL_ID			TO 7
EQU COL$REM_DTM				TO 8
EQU COL$REM_REACT_HRS		TO 9
EQU COL$REM_REACT_WFRS		TO 10
EQU COL$REM_RL_ID			TO 11

EQU SPECIAL_BLUE$	TO 227 + (253*256) + (248*65536)



ErrTitle = 'Error in React_Wand commuter'
ErrorMsg = ''

Result = ''


BEGIN CASE
	CASE EntID = @WINDOW
		BEGIN CASE
			CASE Event = 'CLEAR'			; GOSUB Clear
			CASE Event = 'CREATE' 			; GOSUB Create
			CASE Event = 'CLOSE'			; GOSUB Close
			CASE Event = 'READ'				; GOSUB Read
			CASE Event[1,3] = 'QBF'			; GOSUB Refresh
		END CASE
		
	CASE EntID = @WINDOW:'.LU_REACT_NO' AND Event = 'CLICK' 	; GOSUB LUReactor
	
	
	
		
	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:
* * * * * * *

/*
IF NOT(Security_Check('Reactor Event Log',READ$)) THEN
	Security_Err_Msg('Reactor Event Log',READ$)
	End_Window(@WINDOW)
	RETURN
END
*/

obj_Appwindow('Create',@WINDOW)

GOSUB Refresh

RETURN


* * * * * * *
Clear:
* * * * * * *

IF Get_Property(@WINDOW,'@READONLY') THEN
	obj_AppWindow('ReadOnly',@RM:1)			;* Reenables data bound controls
	Set_Property(@WINDOW,'@READONLY',0)		;* Clear flag on window
END


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


* QBF buttons

Ctrls  = @WINDOW:'.QBF_FIRST_FIX':@RM		; Props  = 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_PREV_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_ABS_FIX':@RM			; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_NEXT_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_LAST_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_STOP_FIX'			; Props := 'ENABLED'

IF Get_Property(@WINDOW,'QBFLIST') = '' THEN
	Vals = 0:@RM:0:@RM:0:@RM:0:@RM:0:@RM:0
END ELSE
	Vals = 1:@RM:1:@RM:1:@RM:1:@RM:1:@RM:1
END

Set_Property(Ctrls,Props,Vals)

* Turn edit table symbolic column backgrounds to green

ETCtrl = @WINDOW:'.REACT_NO'
ETList = Get_Property(ETCtrl,'LIST')
ListCnt = COUNT(ETList,@FM) + (ETList NE '')


FOR Line = 1 TO ListCnt
	
	IF MOD(Line,2) THEN
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$WAND_ID,Line,SPECIAL_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$SVC_HRS,Line,VL_YELLOW$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$SVC_WFRS,Line,VL_YELLOW$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$INST_DTM,Line,SPECIAL_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$INST_REACT_HRS,Line,SPECIAL_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$INST_RL_ID,Line,SPECIAL_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$REM_DTM,Line,SPECIAL_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$REM_REACT_HRS,Line,RCV_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$REM_REACT_WFRS,Line,RCV_BLUE$)
		stat = Send_Message(ETCtrl,'COLOR_BY_POS',COL$REM_RL_ID,Line,RCV_BLUE$)
		
	END ELSE
		FOR N = 1 TO 11
			stat = Send_Message(ETCtrl,'COLOR_BY_POS',N,Line,WHITE$)
		NEXT N
	END
NEXT Line


RETURN





* * * * * * *
Read:
* * * * * * *



GOSUB Refresh

RETURN









* * * * * * *
Close:
* * * * * * *

obj_Notes('Inbox',@USER4)	;* Checks for any new messages

obj_Appwindow('DetailReturn',@WINDOW)

RETURN


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

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


RetVal = Popup(@WINDOW,'','REACTORS')

IF RetVal NE '' THEN
	oaParms = RetVal:@RM:@WINDOW:'.':FocusControl
	obj_Appwindow('LUValReturn',oaParms)
END

RETURN






