Function NDW_REACTOR_SCHED_DETAIL_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        :   NDW Reactor Sched Detail Events

    Description :
    
	Tags		:	[SRP]

    Parameters  :

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

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

$insert SRP_APP_INSERTS
$insert SRP_EVENT_SETUP

Declare subroutine SRP_Redirect_OLE_Events, SRP_Show_Window
Declare function   SVC_Reactor_List, SRP_Rotate_Array, SVC_Scheduler

Begin Case

	Case Control EQ "RPT_LIST"
		Begin Case
			Case Event _eqc "OnItemDblClick"	; GoSub OnItemDblClick.RPT_LIST
		End Case

	Case Event _eqc "Changed"
		Begin Case
			Case Control EQ "COB_REACTOR"		; GoSub Changed.COB_REACTOR
		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


!----- EVENTS -------------------------------------------------------------------------------------------


Changed.COB_REACTOR:
	Reactor = Param1
	Data = Get_Property(@Window, "@DATA")
	Locate Reactor in Data<3> using @VM setting Pos then
		Info = Data<5,Pos>
		Swap Char(13):Char(10) with " - " in Info
		Set_Property(@Window:".EDL_INFO", "TEXT", Info)
		GoSub Build_List
	end
return


OnItemDblClick.RPT_LIST:
	Row  = Get_Property(@Window:".RPT_LIST", "OLE.RowData[":Param1:"]")
	Appt = Row<1>

	rv   = SVC_Scheduler("OPEN", Appt)
return


Window.CREATE:
	@USER4 = "SRP_FRANK"

	GoSub Setup_Reactors
	GoSub Setup_Reporttable
	
	SRP_Redirect_OLE_Events()
	SRP_Show_Window(@Window, "", "C", "C", 1)
return


!----- INTERNAL ROUTINES --------------------------------------------------------------------------------


Build_List:
	List = SVC_Reactor_List("Detail", Reactor)
	Set_Property(@Window:".RPT_LIST", "OLE.List", List)
return


Setup_Reactors:
    rv = SVC_Reactor_List("List", Data, Colors)
    Data = SRP_Rotate_Array(Data)
    
    List = Data<3>
    Convert @VM to @FM in List
    Set_Property(@Window:".COB_REACTOR", "LIST", @FM:List)
    Set_Property(@Window, "@DATA", Data)
return


Setup_Reporttable:
	Ctrl = @Window:".RPT_LIST"

    Cols = ""
  	
 	Cols<1> = "Appt"	:@VM:"Number" :@VM:070:@VM:0:@VM:1
    Cols<2> = "WO"	    :@VM:"Number" :@VM:070:@VM:0:@VM:1
    Cols<3> = "Start"	:@VM:"Date"   :@VM:080:@VM:0:@VM:1
    Cols<4> = "End"		:@VM:"Date"   :@VM:080:@VM:0:@VM:1
    Cols<5> = "Est."	:@VM:"Number" :@VM:060:@VM:0:@VM:1
    Cols<6> = "Pace"	:@VM:"Number" :@VM:060:@VM:0:@VM:1
    Cols<-1> = "Rel"	:@VM:"Bool"   :@VM:060:@VM:1:@VM:1
    Cols<-1> = "Event"	:@VM:"Text"   :@VM:060:@VM:1:@VM:1
    
* 	Cols<4> = "Last Scan"	:@VM:"Date"  :@VM:090:@VM:0:@VM:1
*    Cols<5> = "Reorder At"	:@VM:"Number":@VM:065:@VM:0:@VM:1
*    Cols<6> = "Increment"  :@VM:"Number":@VM:065:@VM:0:@VM:1
*    Cols<7> = "Max Qty"	:@VM:"Number":@VM:065:@VM:0:@VM:1
*    Cols<8> = "On Hand"	:@VM:"Number":@VM:065:@VM:0:@VM:1
    
    Cols<1,12> = "###0"
    Cols<2,12> = "###0"
    Cols<3,12> = "mm/dd/yy"
    Cols<4,12> = "mm/dd/yy"
    Cols<5,12> = "###.0"	; Cols<5,10> = "Right"
    Cols<6,12> = "###.0"	; Cols<6,10> = "Right"
    
*    Cols<7,10> = "Right" ; Cols<7,12> = "###0"
*    Cols<8,10> = "Right" ; Cols<8,12> = "###0"
    Set_Property(Ctrl, "OLE.ColumnList", Cols)
    
*    Set_Property(Ctrl, "OLE.GroupOrder", 4)
*    Set_Property(Ctrl, "OLE.SortOrder",  4:@VM:"D" :@FM: 3:@VM:"A")
*    Set_Property(Ctrl, "OLE.MultiSelect", 2)
return
