<!--#include file="../SQLconn.asp"-->
<html>
<head><title>各级单科统计对比</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link rel="stylesheet" type="text/css" href="../css/style.css" />
<style type="text/css">
<!--
.STYLE2 {color: #FF0000}
-->
</style>
</head>
<body background="../images/table/line.JPG" text="#000000">
<% '登陆控制，放置未登录查看
    if request.cookies("tname")="" then
        response.redirect("../Index.asp")
     end if
    %>
<form method="post" action="totalSubject.asp">			
			<%		
			strYears = TRIM( Request( "selYears" ) )
			strGrade = TRIM( Request( "selGrade" ) )
			strClass = TRIM( Request( "selClass" ) )
			strTestName = TRIM( Request( "selTestName" ) )
			strSubject = TRIM( Request( "selSubject" ) )
			strmanfen = TRIM( Request( "manfen" ) )
			if strmanfen="" then 
			strmanfen=100
			end if
			strdifen=strmanfen*0.3
			strgaofen=strmanfen*0.8
			strhege=strmanfen*0.6
			%>
			
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td valign="middle"><table width="856" border="0" align="center" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8">
			<TR>
			  <TD width="37" nowrap class="STYLE1"><div align="center" class="STYLE2">入口：</div></TD>
			  <TD width="1" nowrap class="STYLE1">&nbsp;</TD>
			  <TD width="24" height="27" nowrap class="STYLE1"><div align="left">学期</div></TD>
			<TD width="131" nowrap class="STYLE1">
			  <div align="left">
			    <select name="selyears" id="selyears" style= "width:130px ">
			      <option><%=strYears%></option>
			      <% Set RSsel = Conn.Execute("select vname,shuoming from  varset where name='xueqi'")
			While NOT RSsel.EOF %>
			      <option value=<%=RSsel( "vname" )%>><%=RSsel( "vname" )%></option>
			      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
	            </select>
	          </div></TD>
			<TD width="24" nowrap class="STYLE1"><div align="left">级别</div></TD>
			<TD width="101" valign="middle" nowrap class="STYLE1">
			  <div align="left">
			    <select name="selgrade" id="selgrade" style= "width:100px ">
			      <option selected value=<%=strGrade%>><%=strGrade%></option>
			      <% Set RSsel = Conn.Execute("select vname from  varset where name='grade'")
			While NOT RSsel.EOF %>
			      <option value=<%=RSsel( "Vname" )%>><%=RSsel( "vname" )%></option>
			      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
	            </select>
	          </div></TD>
			<TD width="0" valign="middle" nowrap class="STYLE1"><div align="left"></div></TD>
			<TD width="0" valign="middle" nowrap class="STYLE1"><div align="left"></div></TD>
			<TD width="48" valign="middle" nowrap class="STYLE1"><div align="left">考试名称</div></TD>
			<TD width="101" valign="middle" nowrap class="STYLE1">
			  <div align="left">
			    <select name="seltestname" id="seltestname" style= "width:100px ">
			      <option selected value=<%=strTestName%>><%=strTestName%></option>
			      <% Set RSsel = Conn.Execute("select vname from  varset where name='testname' order by vid ")
			While NOT RSsel.EOF %>
			      <option value=<%=RSsel( "Vname" )%>><%=RSsel( "vname" )%></option>
			      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
	            </select>
	          </div></TD>
			<TD width="24" valign="middle" nowrap class="STYLE1"><div align="left">科目</div></TD>
			<TD width="101" valign="middle" nowrap class="STYLE1">
			  <div align="left">
			    <select name="selsubject" id="selsubject" style= "width:100px ">
			      <option selected value=<%=strsubject%>><%=strsubject%></option>
			      <% Set RSsel = Conn.Execute("select vname from  varset where name='subject'")
			While NOT RSsel.EOF %>
			      <option value=<%=RSsel( "Vname" )%>><%=RSsel( "vname" )%></option>
			      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
			      <option value=英语总分>英语总分</option>
			      <option value=政治总分>政治总分</option>
			      <option value=主科总分>主科总分</option>
			      <option value=男主科总分>男主科总分</option>
			      <option value=女主科总分>女主科总分</option>
	            </select>
	          </div></TD>
			<TD width="43" rowspan="2" valign="middle" nowrap class="STYLE1"><div align="left">满分值</div></TD>
			<TD width="50" rowspan="2" valign="middle" nowrap class="STYLE1"><input name="manfen" type="text" id="manfen" style= "width:50px " value=<%=strmanfen%> size="3"></TD>
			<TD width="81" rowspan="2" valign="middle" nowrap class="STYLE1">
			  <div align="left">
			    <input name=submit1 type=submit class="topanniu" id=submit1 style="LEFT: 393px; TOP: 72px" value=开始对比>
		      </div></TD>
			</TR>
			<TR>
			  <TD nowrap class="STYLE1"><div align="center" class="STYLE2">出口：</div></TD>
			  <TD nowrap class="STYLE1">&nbsp;</TD>
			  <TD height="34" nowrap class="STYLE1"><div align="left">学期</div></TD>
			  <TD nowrap class="STYLE1">
                  <div align="left">
                    <select name="selyears" id="selyears" style= "width:130px ">
                      <option><%=strYears%></option>
                      <% Set RSsel = Conn.Execute("select vname,shuoming from  varset where name='xueqi'")
			While NOT RSsel.EOF %>
                      <option value=<%=RSsel( "vname" )%>><%=RSsel( "vname" )%></option>
                      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
                    </select>
                  </div></TD>
			  <TD nowrap class="STYLE1"><div align="left">级别</div></TD>
			  <TD valign="middle" nowrap class="STYLE1">
                  <div align="left">
                    <select name="selgrade" id="selgrade" style= "width:100px ">
                      <option selected value=<%=strGrade%>><%=strGrade%></option>
                      <% Set RSsel = Conn.Execute("select vname from  varset where name='grade'")
			While NOT RSsel.EOF %>
                      <option value=<%=RSsel( "Vname" )%>><%=RSsel( "vname" )%></option>
                      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
                    </select>
                  </div></TD>
			  <TD valign="middle" nowrap class="STYLE1"><div align="left"></div></TD>
			  <TD valign="middle" nowrap class="STYLE1"><div align="left"></div></TD>
			  <TD valign="middle" nowrap class="STYLE1"><div align="left">考试名称</div></TD>
			  <TD valign="middle" nowrap class="STYLE1">
                  <div align="left">
                    <select name="seltestname" id="seltestname" style= "width:100px ">
                      <option selected value=<%=strTestName%>><%=strTestName%></option>
                      <% Set RSsel = Conn.Execute("select vname from  varset where name='testname' order by vid ")
			While NOT RSsel.EOF %>
                      <option value=<%=RSsel( "Vname" )%>><%=RSsel( "vname" )%></option>
                      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
                    </select>
                  </div></TD>
			  <TD valign="middle" nowrap class="STYLE1"><div align="left">科目</div></TD>
			  <TD valign="middle" nowrap class="STYLE1">
                  <div align="left">
                    <select name="selsubject" id="selsubject" style= "width:100px ">
                      <option selected value=<%=strsubject%>><%=strsubject%></option>
                      <% Set RSsel = Conn.Execute("select vname from  varset where name='subject'")
			While NOT RSsel.EOF %>
                      <option value=<%=RSsel( "Vname" )%>><%=RSsel( "vname" )%></option>
                      <% RSsel.MoveNext
			Wend
			RSsel.Close%>
                      <option value=英语总分>英语总分</option>
                      <option value=政治总分>政治总分</option>
                      <option value=主科总分>主科总分</option>
                      <option value=男主科总分>男主科总分</option>
                      <option value=女主科总分>女主科总分</option>
                    </select>
                  </div></TD>
			  </TR>
			</TABLE></td>
			</tr>
			</table>
			</FORM>
			
			<p>
			
			</p>
			<div align="center" class="STYLE1">
			
			</div>
			<table width="100%" align="center" border="1" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8"  class="mtable">   
			<tr style="background-color:#D6E4FF"  class="TableHeader">
			<td width=88 height="30" align=middle class="STYLE1"><div align="center">班别 </div></td>
			<td width=93  align=middle class="STYLE1"> <div align="center">计分人数 </div></td>
			<TD width="106"  class="STYLE1" awidth=80 lign=middle ><div align="center">考试人数</div></TD>
			
			<TD width=139   align=middle class="STYLE1" ><div align="center">总人平均分</div></TD>
			<TD width=114   align=middle class="STYLE1" ><div align="center">实考平均分</div></TD>
			<TD width=120   align=middle class="STYLE1" >  <div align="center">低分人数  </div></TD>
			<TD width=110   align=middle class="STYLE1" >  <div align="center">低分率(%)  </div></TD>
			<TD width=93   align=middle class="STYLE1" ><div align="center">合格人数</div></TD>
			<TD width=95  align=middle class="STYLE1" ><div align="center">合格率(%)</div></TD>
			<TD width=82   align=middle class="STYLE1" ><div align="center">高分人数</div></TD>
			<TD width=101   align=middle class="STYLE1" ><div align="center">高分率(%)</div></TD>
			</tr>
			
			
			<%
			select   case   strSubject  
			case   "英语总分"   
			database="markenglist"
			case  "政治总分"   
			database="markzhengzhi"
			case   "主科总分"   
			database="markzhuke"
			case   "男主科总分"   
			database="marknan"
			case   "女主科总分"   
			database="marknv"
			case   else   
			database="stuscore"
			end   select
			
			
			Set RSclass = Conn.Execute("select class  from   students  where Years='"&stryears& "'  And grade='"&strgrade& "'  group by class")
			While NOT RSclass.EOF 
			
			
			strsql=" SELECT class, subject,(SELECT COUNT(*) FROM   students  WHERE  Years='"&stryears& "'  and subject ='"&strSubject& "'   And grade='"&strgrade& "' And class='"&RSclass("class")& "'    And  jifen ='是'  ) AS 总人数, (SELECT COUNT(*) FROM  "&database& "          WHERE  Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score>0 AND subject = t1.subject) AS 实考人数,(SELECT COUNT(*) FROM  "&database& "  WHERE  Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and score BETWEEN 1 AND  '"&strdifen& "'  and jifen ='是'  AND subject = t1.subject) AS 低分人数, (SELECT COUNT(*)  FROM  "&database& "     WHERE  Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  and score >='"&strhege& "' AND subject = t1.subject) AS 良, (SELECT COUNT(*) FROM  "&database& "   WHERE   Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and  score >=  '"&strgaofen& "' AND     jifen ='是' and subject = t1.subject) AS 优,   (SELECT sum(score)    FROM  "&database& "     WHERE   Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是' and  subject = t1.subject) AS 总分,      (SELECT AVG(score)      FROM  "&database& "    WHERE  Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and jifen ='是' and score>0 AND subject = t1.subject) AS 实考平均分 FROM  "&database& "  t1  WHERE ( Years='"&stryears& "'  And grade='"&strgrade& "' And class='"&RSclass("class")& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "')   GROUP BY class, subject"
			
			
			
			
			
			
			Set RS = Conn.Execute(strsql) %>
			<%iNumber=1
			While NOT RS.EOF %>
			<tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
			
			<td width=88 height="30" align=middle class="STYLE1"> <div align="center"><%=RSclass("class")%></div></td>
			<td width=93  align=middle class="STYLE1"> <div align="center"><%=RS( "总人数" )%></div></td>
			<td width=106 align=middle class="STYLE1"> <div align="center"><%=RS("实考人数")%></div></td>
			<td width=139  align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RS( "总分" )/RS( "总人数" ),2)%></div></td>
			<td width=114  align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RS( "实考平均分" ),2)%></div></td>
			<td width=120  align=middle class="STYLE1"> <div align="center"><%=RS( "低分人数" )%></div></td>
			<td width=110 align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RS( "低分人数" )/RS( "总人数" )*100,2)%></div></td>
			<td width=93  align=middle class="STYLE1"> <div align="center"><%=RS( "良" )%></div></td>
			<td width=95  align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RS( "良" )/RS( "总人数" )*100,2)%></div></td>
			<td width=82  align=middle class="STYLE1"> <div align="center"><%=RS( "优" )%></div></td>
			<td width=101  align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RS( "优" )/RS( "总人数" )*100,2)%></div></td>
			</tr>
			<%   
			RS.MoveNext
			
			Wend
			RS.close
			
			RSclass.MoveNext
			Wend
			RSclass.Close
			%>
			
			
			
			<%
			strsqltotal=" SELECT  subject,(SELECT COUNT(*) FROM  students  WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'  and subject ='"&strSubject& "'    And  jifen ='是'  ) AS 总人数, (SELECT COUNT(*) FROM  "&database& "          WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'   And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score>0 AND subject = t1.subject) AS 实考人数,(SELECT COUNT(*) FROM  "&database& "  WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'   And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score BETWEEN 0 AND  '"&strdifen& "'  AND subject = t1.subject) AS 低分人数, (SELECT COUNT(*)  FROM  "&database& "    WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'   And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score >='"&strhege& "'  AND subject = t1.subject) AS 良, (SELECT COUNT(*) FROM  "&database& "    WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'   And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score >='"&strgaofen& "'  AND subject = t1.subject) AS 优,   (SELECT sum(score)    FROM  "&database& "  WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'   And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score>0 AND subject = t1.subject)  AS 总分,      (SELECT AVG(score)      FROM  "&database& "     WHERE  Years='"&stryears& "'  And grade='"&strgrade& "'   And  testname ='"&strtestname& "'  and subject ='"&strSubject& "'  and   jifen ='是'  And  score <>0  AND subject = t1.subject) AS 实考平均分 FROM  "&database& "  t1  WHERE ( Years='"&stryears& "'  And grade='"&strgrade& "'  And  testname ='"&strtestname& "'  and subject ='"&strSubject& "')   GROUP BY  subject"
			
			
			
			Set RStotal = Conn.Execute(strsqltotal)
			%>
			
			
			
			<tr> 
			
			<td width=88 height="28" align=middle class="STYLE1"> <div align="center">全级</div></td>
			<td width=93 height="28" align=middle class="STYLE1"> <div align="center"><%=RStotal( "总人数" )%></div></td>
			<td width=106 height="28" align=middle class="STYLE1"> <div align="center"><%=RStotal( "实考人数" )%></div></td>
			<td width=139 height="28" align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RStotal( "总分" )/RStotal( "总人数" ),2)%></div></td>
			<td width=114 height="28" align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RStotal( "实考平均分" ),2)%></div></td>
			<td width=120 height="28" align=middle class="STYLE1"> <div align="center"><%=RStotal( "低分人数" )%></div></td>
			<td width=110 height="28" align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RStotal( "低分人数" )/RStotal( "总人数" )*100,2)%></div></td>
			<td width=93 height="28" align=middle class="STYLE1"> <div align="center"><%=RStotal( "良" )%></div></td>
			<td width=95 height="28" align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RStotal( "良" )/RStotal( "总人数" )*100,2)%></div></td>
			<td width=82 height="28" align=middle class="STYLE1"> <div align="center"><%=RStotal( "优" )%></div></td>
			<td width=101 height="28" align=middle class="STYLE1"> <div align="center"><%=FormatNumber(RStotal( "优" )/RStotal( "总人数" )*100,2)%></div></td>
			</tr>
			</table>
<br>
 <div align="center" class="STYLE1"><%=strGrade%> <%=strTestName%> <%=strSubject%>成绩统计对比表 </div>
 <form>
</body>
</html>
