Function NDW_EXT_SUMMARY_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)
        12/23/09    fjt     Initial development

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

$insert SRP_APP_INSERTS
$insert SRP_EVENT_SETUP

Equ W$ to @Window:"."

Declare subroutine SRP_Show_Window, SRP_Redirect_OLE_Events
Declare function   SVC_Scheduler, SVC_Process_Time

Begin Case

	Case Event EQ "OnClick"
		Begin Case
			Case Control EQ "HYP_PSN"			; GoSub OnClick.HYP_PSN
			Case Control EQ "PUB_EXIT"			; GoSub OnClick.PUB_EXIT
		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 -------------------------------------------------------------------------------------------


OnClick.HYP_PSN:
	rv = Get_Property(@Window:".EDL_PSN_NO", "DEFPROP")
	If rv GT "" then rv = Start_Window("PROD_SPEC", @Window, rv, "", "")
return


OnClick.PUB_EXIT:
	End_Dialog(@Window, "")
	Ans = 0
return


Window.CREATE:
	SRP_Redirect_OLE_Events()

	If Param1 then
		GoSub Field_List
		GoSub Set_Window_Data
	end else
	end
	SRP_Show_Window(@Window, "", "C", "C", 1)
return


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


Field_List:
	Fields = ""
	Fields<01> = "EDL_APPT_ID"
	Fields<02> = "EDL_WO"
	Fields<03> = "EDL_CUSTOMER"
	Fields<04> = "EDL_EPI_NO"
	Fields<05> = "EDL_PSN_NO"
	Fields<06> = "EDL_THICK"
	Fields<07> = "EDL_RDS_COMP"
	Fields<08> = "EDL_RDS_CNT"
	Fields<09> = "EDL_WAFER"
	Fields<10> = "EDL_MIN_PER"
	Fields<11> = "EDL_COMMIT"
	Fields<12> = "EDL_CYCLES"
	Fields<13> = "EDL_MINREM"
	Fields<14> = "EDB_NOTES"
	Fields<15> = "EDL_EVENT"
	//
	Fields<19> = "EDL_REACTOR"
	//
	Fields<21> = "EDL_RECIPE_NO"
	Fields<22> = "EDL_RECEIPE_NAME"
	Fields<23> = "EDL_DOPANT"
	Fields<24> = "EDL_PRESSURE"
	Fields<25> = "EDL_WAND_RESTRICTOR"
	Fields<26> = "EDL_SUSCEPTOR"
	Fields<27> = "EDL_BOX_PER"
	Fields<28> = "EDL_PROC_TIME"
	Fields<29> = "EDL_WAFER_CNT"
	Fields<30> = "EDL_PROC_HRS"
	Fields<31> = "EDL_WO_QTY"
	Fields<32> = "EDL_COMPLETED"
return


Set_Window_Data:
	Data = SVC_Scheduler("ExtSummary", Param1)
	Cnt  = Count(Fields, @FM) + (Fields NE "")
	For i = 1 to Cnt
		Set_Property(W$:Fields<i>, "DEFPROP", Data<i>)
	Next i
	
	// Status colors
	Set_Property(W$:"OLE_STATUS", "OLE.BackgroundColor", Data<16>)
	Set_Property(W$:"OLE_STATUS", "OLE.CaptionColor",    Data<17>)
	Set_Property(W$:"OLE_STATUS", "OLE.Caption",		 Data<18>)
	
	// Reactor
	Reactor = Data<19>
	Set_Property(W$:"DIV_REACTOR", "OLE.Caption", "Reactor ":Reactor:" Setup")
	
	// Date
	Date = OConv(Data<20>, "DWA") :" - ": OConv(Data<20>, "D4,HL")
	Set_Property(W$:"EDL_APP_DATE", "DEFPROP", Date)
	
	// Related reactor count
	Rel = Xlate("WO_MAST_SCHED_REL", Data<2>, "REACTOR_COUNT", "X")
	If Rel LT 1 then Rel = 1
	Set_Property(W$:"EDL_REL_REACTORS", "INVALUE", Rel)
	
	// Pace time
	rv = SVC_Process_Time("RDSpace", Data<2>)
	Set_Property(W$:"EDL_PACE_HRS", "INVALUE", rv/Rel)
	
	// Total Quantity = WO Quantity vs. Received Quantity
	Set_Property(W$:"EDL_WO_QTY", "INVALUE", Data<31>)
return

