Function SVC_Scheduler_Filters(Service, Param1)

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

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

    Name        :   SVC Scheduler Filters

    Description :   

    Tags		:	[SRP]   

    Parameters  :

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

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

$insert SRP_APP_INSERTS
$insert SERVICE_INSERT

Equ Schedule$ to "WO_MASTER_SCHEDULER.OLE_SCHEDULE"

Declare function   SRP_Rotate_Array, SRP_Clean_Array, SVC_Dopant

Begin Case
	Case Service _eqc "<none>"				; GoSub Clear
	Case Service _eqc "byReactorType"		; GoSub ReactorType
	Case Service _eqc "byCurrentDopant"		; GoSub CurrentDopant
	Case Service _eqc "byGroup"				; GoSub Group
	Case Service _eqc "NotReceived"			; GoSub Not_Received
	Case Service _eqc "EscalatedReactors"	; GoSub Escalated_Reactors
	Case Service _eqc "EventsOnly"			; Gosub Events
	Case Service _eqc "byDopant"			; GoSub Dopant
End Case

Return Ans


!----- SERVICES -----------------------------------------------------------------------------------------


Clear:
	For i = 20 to 74
		Ans := i:","
	Next i
return


CurrentDopant:
	Msg(@Window, "", "OK", "", "Schedule Filters" :@FM: "Filter under development.")
return


Dopant:
	Types = SVC_Dopant("Reactor")
	Convert @FM to @VM in Types
	Pop = ""
	Pop<08> = Types
	Pop<09> = 1:@SVM:15:@SVM:"L":@SVM:"L":@SVM:@SVM:"Type"
	Pop<12> = "Dopant Types"
	rv = Popup(@Window, Pop, "WO_MS_LITERAL")
	If rv GT "" then
		For i = 20 to 74
			Rec = Xlate("REACTOR", i, "", "X")
			Gas = Xlate("GAS_SRC", Rec<5>, 1, "X")
			Locate rv in Gas using @VM setting Pos then
				Ans := i:","
			end
		Next i
	end
return


Escalated_Reactors:
	For i = 20 to 74
		Type = Xlate("REACTOR", i, 1, "X")		;// Reactor type
		rv = Xlate("REACTOR", i, "ACT_ESC_DTM", "X")<0,1>
		If rv GT "" and Type GT "" then Ans := i:","
	Next i
return


Events:
	Msg(@Window, "", "OK", "", "Schedule Filters" :@FM: "Filter under development.")
return


Group:
	rv = Popup(@Window, "", "WO_MS_REACTOR_GROUPS")
	Groups = "Front Odds,Front Evens,Tunnel,Back Odds,Back Evens,EpiPro,HTR Odds,HTR Evens,HTR Back"
	Locate rv in Groups using "," setting Pos then
		Begin Case
			Case Pos EQ 1 ; Ans = "21,23,25,27,29,31"
			Case Pos EQ 2 ; Ans = "20,22,24,26,28,30,32"
			Case Pos EQ 3 ; Ans = "39,41,43,45,47,49,51,53,55"
			Case Pos EQ 4 ; Ans = "57,59,61,63,65"
			Case Pos EQ 5 ; Ans = "56,58,60,62,64,66"
			Case Pos EQ 6 ; Ans = "40,42,46,48,50,52,54"	;// EpiPro
			Case Pos EQ 7 ; Ans = "31,33,35,37"				;// HTR Odds
			Case Pos EQ 8 ; Ans = "30,32,34,36,38"			;// HTR Evens
			Case Pos EQ 9 ; Ans = "68,70,72,74"				;// HTR Back
		End Case
	end
return


Not_Received:
	Msg(@Window, "", "OK", "", "Schedule Filters" :@FM: "Filter under development.")
return


ReactorType:
	List  = Get_Property(Schedule$, "OLE.EntityList")
	List  = SRP_Rotate_Array(List)
	Types = List<5>

	Convert @VM to @FM in Types
	Convert Char(13):Char(10) to @VM in Types
	Types = SRP_Rotate_Array(Types)
	Types = Types<1>
	List<5> = Types
	Types = SRP_Clean_Array(Types, @VM, "UNIQUE")
	Convert @FM to @VM in Types
	
	Pop = ""
	Pop<08> = Types
	Pop<09> = 1:@SVM:15:@SVM:"L":@SVM:"L":@SVM:@SVM:"Type"
	Pop<12> = "Reactor Types"
	rv = Popup(@Window, Pop, "WO_MS_LITERAL")
	
	If rv GT "" then
		Cnt = Count(List<5>, @VM) + (List<5> NE "")
		For i = 1 to Cnt
			If List<5,i> _eqc rv then Ans := List<3,i>:","
		Next i
	end
return



