<%@ LANGUAGE="VBScript" %> <% If Not IsEmpty(request.form("Close")) Then %> <% End If timedate=Request("timedate") Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd If timedate="" Or IsEmpty(request.form("Selected_Time")) Then SQLStmt = " select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') timedate from dual " Set RS = Connection.Execute(SQLStmt) timedate = CStr(RS("timedate")) Set RS=nothing End If If Not IsDate(timedate) Then message="Wrong Time/Date format " & timedate %> <% End If timedate_par=replace(timedate," ","%20") %> BLM Monitoring Status

               

<% SQLStmt = " select bc.blm_position,bm.blm_name,to_char(bm.startdate,'MM/DD/YYYY HH24:MI:SS') startdate, " SQLStmt = SQLStmt & " nvl(blm_sp.nspikes,0) nspikes, " SQLStmt = SQLStmt & " to_char(bm.stopdate,'MM/DD/YYYY HH24:MI:SS') stopdate,bm.stopdate-bm.startdate dt,round((bm.stopdate-bm.startdate)*24*60,0) dtm,dose,blm_status, " SQLStmt = SQLStmt & " 24*60*(to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-bm.stopdate)+(1-nvl(bm.missed_data,0))/60 ddif " SQLStmt = SQLStmt & " from phoffline.blm_monitoring bm,phoffline.blm_config bc, " SQLStmt = SQLStmt & " (select max(startdate) startdate,max(blm_name) blm_name from phoffline.blm_monitoring " SQLStmt = SQLStmt & " where startdate between to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-2 and to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS') " SQLStmt = SQLStmt & " group by blm_name ) blm_date " SQLStmt = SQLStmt & " , (select blm_name,sum(n_over_th) nspikes from phoffline.blm_spikes " SQLStmt = SQLStmt & " where startdate between to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS')-2 and to_date('" & timedate & "','MM/DD/YYYY HH24:MI:SS') " SQLStmt = SQLStmt & " group by blm_name ) blm_sp " SQLStmt = SQLStmt & " where bm.startdate=blm_date.startdate " SQLStmt = SQLStmt & " and bm.blm_name=blm_date.blm_name and bc.blm_name=bm.blm_name " SQLStmt = SQLStmt & " and bm.blm_name=blm_sp.blm_name(+) " SQLStmt = SQLStmt & " and bm.startdate between bc.startdate and bc.stopdate " SQLStmt = SQLStmt & " order by bc.blm_position " Set RS = Connection.Execute(SQLStmt) ' response.write(SQLStmt) %>
<% Do While Not RS.EOF ' ' calculate instantenous dose in Rad/hour for display purposes ' dose=CDbl(RS("dose")) ' in mrad dt=24*CDbl(RS("dt")) 'in minutes If RS("blm_status")="0" Then status="OK" Elseif CStr(CHex(RS("blm_status")))="7FFFFFFF" Then status="Overflow" Else status="Error" End If ' ' dose_norm is in Rad/hour ' If dt<>0 and status="OK" Then dose_norm=dose*0.001/dt Else dose_norm=-10 End If wshift=(CInt(RS("blm_position"))-1)*20 %> <% RS.Movenext Loop %>
Position Monitor Last Startdate Duration Dose Status Spikes
      [min] [Rad/h]   last 48 h
<%=RS("blm_position")%> <%=RS("blm_name")%> <% If CDbl(RS("ddif"))" & CStr(RS("startdate")) & "") Else Response.write("" & CStr(RS("startdate")) & "") End If %> <% If CDbl(RS("ddif"))" & CStr(RS("dtm")) & "") Else Response.write("" & CStr(RS("dtm")) & "") End If %> &days=2" onClick="openWindow(this,'BLM<%=CStr(RS("blm_position"))%>',.4,.4,'no',<%=wshift%>,0.5)"><%=Round(dose_norm,2)%> <%=status %> <%=RS("nspikes")%>
<% Connection.Close Set RS=nothing Set Connection=nothing %>