Function NDW_SCHEDULE_SEARCH_EVENTS(CtrlEntId, Event, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15)
/******************************************************************************************************** 

    This program is proprietary and is not to be used by or disclosed to others, nor is it to
    be copied without written permission from SRP Computer Solutions, Inc.

    Name        :   

    Description :
    
	Tags		:	[SRP]

    Parameters  :

    History (Date, Initials, Notes)
        09/17/08    fjt     Initial development

********************************************************************************************************/

$insert SRP_APP_INSERTS
$insert SRP_EVENT_SETUP

Equ Sched_Win$ to "WO_MASTER_SCHEDULER"
Equ Ctrl$	   to Sched_Win$:".OLE_SCHEDULE"

Declare subroutine SRP_Redirect_OLE_Events, Update_Index, Extract_SI_Keys
Declare function   SRP_Rotate_Array

Begin Case

	Case Event EQ "OnClick"
		Begin Case
			Case Control EQ "HYP_GO"			; GoSub OnClick.HYP_GO
			Case Control EQ "HYP_FIND"			; GoSub OnClick.HYP_FIND
		End Case
		
	Case Event EQ "OnItemClick"
		Begin Case
			Case Control EQ "RPT_RESULTS"		; GoSub OnItemClick.RPT_RESULTS
		End Case

    Case Control EQ Window
        Begin Case
        	Case Event EQ "CREATE"              ; GoSub Window.CREATE
        End Case

End Case

If Assigned(Ans) else Ans = 1
Return Ans



OnClick.HYP_GO:
	rv = Get_Property(@Window:".COB_REACT_NO", "TEXT")
	If rv then Send_Message(Ctrl$, "OLE.EnsureVisible", rv)
return


OnClick.HYP_FIND:
	List  = ""
	Table = "WO_MAST_SCHED"
	Find  = Get_Property(@Window:".EDL_FIND", "TEXT")
	Field = Get_Property(@Window:".COB_FIELD", "TEXT")
	If Find and Field then
		Begin Case
			Case Field EQ "WO"  ; Field = "WO_NO2"
			Case Field EQ "PSN" ; Field = "PSN_NO"
		End Case
		Update_Index(Table, Field, No$, Yes$)
		Extract_SI_Keys(Table, Field, Find, Keys)
		rv = Xlate(Table, Keys, "REACT_NO", "X") :@FM: Xlate(Table, Keys, "WO_NO", "X") :@FM: Keys
		Appts = "";!!
		Cnt = Count(rv<3>, @VM) + (rv<3> NE "")
		For i = 1 to Cnt
			List<i> = "R":rv<1,i> :" : ": "WO":rv<2,i> :@VM: rv<3,i>
		Next i
		Set_Property(@Window:".RPT_RESULTS", "OLE.List", List)
	end
return


OnItemClick.RPT_RESULTS:
	If Param2 EQ "Left" then
		Row  = Get_Property(CtrlEntId, "OLE.RowData[":Param1:"]")
		Appt = Row<2>
		If Appt then
			Send_Message(Ctrl$, "OLE.EnsureVisible", Appt)
			Set_Property(Ctrl$, "OLE.SelAppt", Appt)
		end
	end
return


Window.CREATE:
	// Result reporttable setup
	rv = ""
	rv<01> = "Results" :@VM:"Text":@VM:"045":@VM:1:@VM:1:@VM:@VM:1
	rv<02> = "Key"     :@VM:"Text":@VM:"0":@VM:0:@VM:0:@VM:@VM:0
	Set_Property(@Window:".RPT_RESULTS", "OLE.ColumnList", rv)

	// Reactor dropdown
	rv = ""
	For i = 20 to 69
		rv := i :@FM
	Next i
	rv[-1,1] = ""
	Set_Property(@Window:".COB_REACT_NO", "LIST", rv)
	
	SRP_Redirect_OLE_Events()
return

