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

/*
	Commuter module for Tool_Wfr window
	
	09/2/2016 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status,Print_React_Read_Worksheet, Start_Window
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, obj_AppWindow, 
DECLARE SUBROUTINE End_Window,obj_React_Reads

DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Popup, Collect.Ixvals
DECLARE FUNCTION Send_Message, Msg, Security_Check, obj_WO_Log, WO_Purge, Set_Property

$INSERT WO_WFR_EQUATES
$INSERT WO_MAT_EQUATES
$INSERT WO_MAT_WFR_EQUATES

$INSERT MSG_EQUATES
$INSERT APPCOLORS



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

ErrTitle = 'Error in Tool_Wfr commuter module'
ErrorMsg = ''

Result = ''


BEGIN CASE

	CASE EntID = @WINDOW
		BEGIN CASE
			CASE Event = 'CREATE' 			; GOSUB Create
			
			CASE Event = 'DELETE'			; GOSUB Delete
		
			*CASE Event = 'WRITE'			; *GOSUB Write
		
		END CASE
	
	
	CASE EntID = @WINDOW:'.WFR_ID' 			AND Event = 'DBLCLK'	; GOSUB WfrIDDC
	
	
	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',@WINDOW)


RETURN



* * * * * * *
WfrIDDC:
* * * * * * *

CtrlEntID = @WINDOW:'.WFR_ID'

CurrPos = Get_Property(CtrlEntID,'SELPOS')
CurrCol = CurrPos<1>
CurrRow = CurrPos<2>

CtrlList	= Get_Property(CtrlEntID,'LIST')



IF CurrCol = 1 THEN

	WfrID = CtrlList<CurrRow,1>
	
	obj_Appwindow('ViewRelated','WO_WFR':@RM:WfrID:@RM:'')

END

IF CurrCol = 2 THEN

	RDSNo = CtrlList<CurrRow,2>
    IF RDSNo NE '' then Start_Window('REACT_RUN', '', RDSNo)
    
* 	IF RDSNo = '' THEN
*		RETURN
* 	END ELSE
*		obj_Appwindow('ViewRelated','REACT_RUN':@RM:RDSNo:@RM:'')
* 	END
	
END

/*
IF CurrCol = COL$TOOL_TYPE THEN

	CellValue = CtrlList<CurrRow,COL$TOOL_TYPE>
	
	IF INDEX(CellValue,'*',1) THEN
		obj_Appwindow('ViewRelated','LOCATION':@RM:CellValue:@RM:'')	;* This is the key to a LOCATION record
	END ELSE
		obj_Appwindow('ViewRelated','TOOL_CLASS':@RM:CellValue:@RM:'')	;* * This is the Key to a TOOL_CLASS record
	END


END
*/





RETURN



* * * * * * *
Delete:
* * * * * * *

Result = 0

ErrMsg('Deletions NOT allowed.')

RETURN
