<%
dim title
title = "Complexity Levels and Staffing"
%>
<%
'---Create recordset
Dim sql, objRS, s_name, s_order, s_next_order
sql = "SELECT Complexity, count(*) as ComplexityCount " & _
"FROM tblGeneral " & _
"WHERE AllHCF = 'YES' " & _
"GROUP BY Complexity "
s_name = Request.querystring("sort")
If Request.Querystring("order") = "1" Then
s_order = "ASC"
s_next_order = 0
Else
s_order = "DESC"
s_next_order = 1
End If
Select Case s_name
Case "Complexity"
sql = sql + "ORDER BY Complexity " + s_order + " "
Case "ComplexityCount"
sql = sql + "ORDER BY Count(*) " + s_order + " "
End Select
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sql, objConn
'------------------
'Calculations for staff averages
sqlAvgLibFTE = "SELECT avg(tblStaff.LibFTE) AS AvgLibFTE " & _
"FROM tblStaff "
Set objAvgLibFTE = Server.CreateObject("ADODB.Recordset")
objAvgLibFTE.Open sqlAvgLibFTE, objConn
%>
<html>
<head>
<title><%=title%></title>
<link rel=stylesheet type="text/css" href="/CodeReuse/style.css">
</head>
<body>
<h2 align="left"><font face="Arial" size="4"><%=title%></font></h2>
</p>
<%
If (objRS.EOF) Then
'---NO ROWS TO DISPLAY
Else
'---DISPLAY ROWS IN A HTML FORMATTED TABLE
%>
<table class="CCTable" cellspacing='0' border='1' cellpadding='5' width='400px>
<TR style='background-color: white;'>
<TH class="CCTable" scope='col' width='150px'><font size='1' color='blue'><a href='?sort=Complexity&order=<%=s_next_order%>'><font color='blue'><b>Complexity<br>Level</b></font></a></th>
<TH class="CCTable" scope='col' width='150px'><font size='1' color='blue'><a href='?sort=ComplexityCount&order=<%=s_next_order%>'><b># of Medical<br>Centers</b></a></font></th>
<TH class="CCTable" scope='col' width='150px'><font size='1' color='blue'><a href='?sort=ComplexityCount&order=<%=s_next_order%>'><b>Average # of<br>FTE</b></a></font></th></TR>
<%
Dim r_complexity, r_complexity_count
Do While (NOT objRS.EOF)
r_complexity = Trim( objRS("Complexity") )
r_complexity_count = Trim( objRS("ComplexityCount") )
r_complexity_count = Trim( objRS("ComplexityCount") )
%>
<tr>
<td class="CCTable"><%=r_complexity%> </td>
<td class="CCTable" align="center"><%=r_complexity_count%> </td>
<td class="CCTable" align="center"> </td>
</tr>
<%
'---MOVE TO NEXT ROW
objRS.MoveNext()
Loop
%>
</table>
<%
End If
'---CLEAN UP
objRS.Close
Set objRS= Nothing
%>
</body>
</html>
|