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

/*
	Commuter module for WO_Wfr window
	
	03/14/2016 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status,Print_React_Read_Worksheet
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 COL$LOC_DTM		TO 1
EQU COL$LOC_BY		TO 2
EQU COL$LOC_EVENT	TO 3
EQU COL$SLOT_ID		TO 4
EQU COL$RUN_LOC		TO 5
EQU COL$CARR_SLOT	TO 6
EQU COL$INV_LOC		TO 7
EQU COL$TOOL_ID		TO 8
EQU COL$NCR			TO 9
EQU COL$TW_USE		TO 10



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

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

Result = ''


BEGIN CASE

	CASE EntID = @WINDOW
		BEGIN CASE
			CASE Event = 'CREATE' 			; GOSUB Create
			CASE Event = 'CLEAR'			; GOSUB Clear
			CASE Event = 'CLOSE'			; GOSUB Close
			CASE Event = 'DELETE'			; GOSUB Delete
			CASE Event = 'READ'				; GOSUB Read
			CASE Event = 'WRITE'			; GOSUB Write
			CASE Event[1,3] = 'QBF'			; GOSUB Refresh
		END CASE
	
	/*
	CASE EntID = @WINDOW:'.LU_WO' 			AND Event = 'CLICK'	; GOSUB LUWONo
	CASE EntID = @WINDOW:'.START_PURGE'		AND Event = 'CLICK'	; GOSUB StartPurge
	CASE EntID = @WINDOW:'.DONE'			AND Event = 'CLICK'	; GOSUB Close
	CASE EntID = @WINDOW:'.CLEAR'			AND Event = 'CLICK'	; GOSUB Clear
	
	CASE EntID = @WINDOW:'.WO_NO' AND Event = 'POSCHANGED'		; GOSUB WONoPC
	CASE EntID = @WINDOW:'.WO_NO' AND Event = 'CLICK'			; GOSUB WOClick
	CASE EntID = @WINDOW:'.WO_NO' AND Event = 'INSERTROW'		; GOSUB InsertRow
	CASE EntID = @WINDOW:'.WO_NO' AND Event = 'DELETEROW'		; GOSUB DeleteRow
	*/
	
	
	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)


GOSUB Refresh

RETURN


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

GOSUB Refresh

RETURN


* * * * * * *
Write:
* * * * * * *

GOTO Close

RETURN

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


GOTO Refresh

RETURN

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

obj_Appwindow('DetailReturn')

RETURN


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


Result = 0	;* Stops the DELETE event chain 

RETURN



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

LocCtrl = @WINDOW:'.LOC_DTM'


LocList = Get_Property(LocCtrl,'LIST')
	
LocCnt = COUNT(LocList,@FM) + (LocList NE '')

FOR I =1 TO LocCnt
	
	IF LocList<I,COL$INV_LOC> NE '' THEN
		stat = Send_Message(LocCtrl,'COLOR_BY_POS',COL$INV_LOC,I,YELLOW$)
	END
	
	IF LocList<I,COL$TOOL_ID> NE '' THEN
		stat = Send_Message(LocCtrl,'COLOR_BY_POS',COL$TOOL_ID,I,YELLOW$)
	END

NEXT I


/*

* 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

ETSymbolics = Get_Property(@WINDOW,'@ET_SYMBOLICS')		;* Loaded during 'Create' in obj_Appwindow

ETCtrls	= ETSymbolics<1>
ETCols	= ETSymbolics<2>

FOR I = 1 TO COUNT(ETCtrls,@VM) + (ETCtrls NE '')
	ETCtrl	= ETCtrls<1,I>
	
	ETList = Get_Property(ETCtrl,'LIST')
	FOR Line = 1 TO COUNT(ETList,@FM) + (ETList NE '')
		IF ETList<Line,1> NE '' THEN
			FOR N = 1 TO COUNT(ETCols<1,I>,@SVM) + (ETCols<1,I> NE '')
				stat = Send_Message(ETCtrl,'COLOR_BY_POS',ETCols<1,I,N>,Line,GREEN$)
			NEXT N
		END
	NEXT Line
	
NEXT I


*/




RETURN





