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

/*
	Commuter module for STATUS_BOARD dialog window.
	
	10/22/2009 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, Center_Window
DECLARE SUBROUTINE ErrMsg, Send_Message, Btree.Extract, Utility, SetInitDirOptions
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Center_Window, Send_Message, Start_MDIChild
DECLARE FUNCTION FieldStore, OleCallMethod

EQU CRLF$	TO \0D0A\


$INSERT APPCOLORS
$INSERT PS_EQUATES
$INSERT COMPANY_EQU
$INSERT COA
$INSERT LOGICAL

ErrTitle = 'Error in Status_Board'
ErrorMsg = ''

Result = ''


BEGIN CASE
	CASE EntID = @WINDOW
		BEGIN CASE
			
			CASE Event = 'CREATE' 			; GOSUB Create
			CASE Event = 'CLOSE'			; GOSUB Close
			
			CASE 1
				ErrorMsg = 'Unknown Parameters ':EntID:' - ':Event:' passed to commuter'
				ErrMsg(ErrorMsg)
		
		END CASE
		
	*CASE EntID = @WINDOW:'.SAVE' AND Event = 'CLICK'	; GOSUB Save
	CASE EntID = @WINDOW:'.CANCEL' AND Event = 'CLICK'	; GOSUB Close
			
	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:
* * * * * * *

SysSize = get_property( 'SYSTEM', 'SIZE' )
WinSize = get_property( @WINDOW, 'SIZE' )

Width  = SysSize<3>
Height = SysSize<4>

DEBUG

X = SysSize<1>/2-Width/2
Y = SysSize<2>/2-Height/2

Set_Property( @WINDOW, 'SIZE', X:@FM:Y:@FM:Width:@FM:Height)			;* Center window in desktop

Set_Property(@WINDOW,'STATUSLINE',@WINDOW:'.STATUSLINE')		;* Routes system errors to STATUSLINE control


*Start_MDIChild(mdichildgroupID, mdiframeID, createparam, mdichildinstanceID, mdichildtitle, initialappearancemode [, initx, inity, winStruct])

MDIChildID = Start_MDIChild('WO_DAILY_SCHED_ALL', @WINDOW  "", "", "", '')
MDIChildID = Start_MDIChild('WO_DAILY_SCHED_ALL2', @WINDOW  "", "", "", '')
MDIChildID = Start_MDIChild('TOOL_STATUS', @WINDOW  "", "", "", '')


GOSUB Refresh

RETURN


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

RETURN




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



RETURN












******************************************************************************************

/*
	Commuter module for Status Board (STATUS_BOARD) dialog window
	
	10/16/2009 - John C. Henry, J.C. Henry & Co., Inc.
*/
/*
DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, 
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, obj_AppWindow, 
DECLARE SUBROUTINE obj_Notes, Security_Err_Msg, End_Window, obj_Tables

DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, obj_Tables
DECLARE FUNCTION Send_Message, Msg, Security_Check

$INSERT MSG_EQUATES
$INSERT APPCOLORS


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

EQU COL$CLEANS		TO 1
EQU COL$SURFSCAN	TO 2
EQU COL$PACKAGE		TO 3
EQU COL$TWS			TO 4
EQU COL$CHEMICALS	TO 5
EQU COL$PRODUCT		TO 6

EQU COL$SCROLL		TO 1
EQU COL$BULLETINS	TO 2


ErrTitle = 'Error in STATUS_BOARD commuter module.'
ErrorMsg = ''

Result = ''


BEGIN CASE
	CASE EntID = @WINDOW
		BEGIN CASE
			
			CASE Event = 'CREATE' 			; GOSUB Create
			CASE Event = 'CLOSE'			; GOSUB Close
			
			CASE 1
				ErrorMsg = 'Unknown Parameters ':EntID:' - ':Event:' passed to commuter'
				ErrMsg(ErrorMsg)
		
		END CASE
		
	CASE EntID = @WINDOW:'.CANCEL' AND Event = 'CLICK'	; GOSUB Close
			
	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)

otcParms = 'CONFIG':@RM:'COVERAGE'
CoverageRec = obj_Tables('ReadRec',otcParms)		;* Reads and locks for update

IF Get_Status(errCode) THEN
	ErrMsg('Another workstation is currently updating Coverage information.')
	Set_Status(0)
	RETURN
END


otbParms = 'CONFIG':@RM:'BULLETINS'
BulletinRec = obj_Tables('ReadRec',otbParms)

IF Get_Status(errCode) THEN
	ErrMsg('Another workstation is currently updating Bulletin information.')
	Set_Status(0)
	obj_Tables('UnlockRec',otcParms)
	RETURN
END


Ctrls  = @WINDOW:'.CHECK_CLEANS':@RM		; Props  = 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_SURFSCAN':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_PACKAGE':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_TWS':@RM			; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_CHEMICALS':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_PRODUCT'			; Props := 'CHECK'

CONVERT @FM TO @RM IN CoverageRec

Set_Property(Ctrls,Props,CoverageRec)

Scroll = BulletinRec<COL$SCROLL>
Bulletins = BulletinRec<COL$BULLETINS>

Set_Property(@WINDOW:'.SCROLL','TEXT',Scroll)
Set_Property(@WINDOW:'.BULLETINS','TEXT',Bulletins)

Set_Property(@WINDOW,'@CONFIG_LOCK',otcParms)
Set_Property(@WINDOW,'@BULLETIN_LOCK',otbParms)


RETURN



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

otcParms = Get_Property(@WINDOW,'@CONFIG_LOCK')
obj_Tables('UnlockRec',otcParms)

otbParms = Get_Property(@WINDOW,'@BULLETIN_LOCK')
obj_Tables('UnlockRec',otbParms)

End_Dialog(@WINDOW,'')

RETURN



* * * * * * *
Save:
* * * * * * *

Ctrls  = @WINDOW:'.CHECK_CLEANS':@RM		; Props  = 'CHECK':@RM		; 
Ctrls := @WINDOW:'.CHECK_SURFSCAN':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_PACKAGE':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_TWS':@RM			; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_CHEMICALS':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.CHECK_PRODUCT'			; Props := 'CHECK'

CoverageRec = Get_Property(Ctrls,Props)

CONVERT @RM TO @FM IN CoverageRec

otcParms = Get_Property(@WINDOW,'@CONFIG_LOCK')

otcParms = FIELDSTORE(otcParms,@RM,4,0,CoverageRec)
obj_Tables('WriteRec',otcParms)

BulletinRec		= Get_Property(@WINDOW:'.SCROLL','TEXT')
BulletinRec<2>	= Get_Property(@WINDOW:'.BULLETINS','TEXT')

otbParms = Get_Property(@WINDOW,'@BULLETIN_LOCK')

otbParms = FIELDSTORE(otbParms,@RM,4,0,BulletinRec)
obj_Tables('WriteRec',otbParms)

End_Dialog(@WINDOW,'')

RETURN

*/


