<!--#include file="../checkLogin.asp"-->
<!--#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="../images/<%=request.cookies("imgdir")%>/css/style.css" media="all"/>
</head>

<body>
    <%
   

'检查权限
       tname=request.cookies("tname") 
       Set MyOAASPObj= Server.CreateObject("YFSchoolOApro.YFSchoolDll")
           if MyOAASPObj.QuanXian(tname,"员工档案")=0 then 	   
		      
		              response.redirect  "../NoPower.asp"
			end if 
	           

'检查权限结束
%>
<%		
			tiaojianziduan = TRIM( Request( "tiaojianziduan" ) )
			
		
			%>
 
<form name="form1" method="post" action="TotalDangAn.asp">
 <table border="0" align="center" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8">
  
  <TR>
    <TD nowrap class="STYLE1"><div align="center"><strong>请选择统计条件</strong></div></TD>
    <TD nowrap class="STYLE1"><div align="center">
      <label>
      <select name="tiaojianziduan" id="tiaojianziduan">
	    <option selected="selected"><%=tiaojianziduan%> </option>
          <option></option>
          <option>性别</option>
		  <option>年龄</option>
          <option>学历</option>
          <option>学位</option>
          <option>职称</option>
		  <option>所教学科</option>
		  <option>政治面貌</option>
		  <option>岗位级别</option>
		  <option>薪级</option>
		  <option>聘任薪级</option>
		  
		  
      </select>
      </label>
      
    </div></TD>
    <TD valign="middle" nowrap class="STYLE1"><input name=submit1 type=submit class="topanniu" id=submit1 style="LEFT: 393px; TOP: 72px" value=查询></TD>
  </TR>
</TABLE> 
 <div align="center">

  </div>
  </div>
  <br>
  <table width="375" align="center" border="1" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8"  class="mtable">
    <tr style="background-color:#D6E4FF"  class="TableHeader">
      <td align="center" nowrap class="STYLE1">序号</td>
      <td height="30" align="center" nowrap class="STYLE1">统计字段</td>
      <td   align="center" nowrap class="STYLE1"><div align="center">人数</div></td>
    </tr>
    <%
   i=0
   Set Rslist=Server.CreateObject("Adodb.Recordset")
      sqllist="select count(*) as shuliang  from Employee  where 是否离职<>'是'" 
      if tiaojianziduan="性别" then 
           sqllist="select count(*) as shuliang,性别 as ziduan  from Employee  where 是否离职<>'是'  group by  性别  order by 性别" 
	  end if 
	  if tiaojianziduan="年龄" then 
           sqllist="SELECT FLOOR(DATEDIFF(YEAR, 出生日期, GETDATE()) / 5) AS ziduan, COUNT(*)       AS shuliang  FROM Employee  WHERE (是否离职 <> '是')  GROUP BY FLOOR(DATEDIFF(YEAR, 出生日期, GETDATE()) / 5)" 
	  end if  
	  if tiaojianziduan="学历" then 
           sqllist="select count(*) as shuliang,学历 as ziduan  from Employee where 是否离职<>'是'   group by  学历  order by 学历" 
	  end if     
      if tiaojianziduan="学位" then 
           sqllist="select count(*) as shuliang,学位 as ziduan  from Employee where 是否离职<>'是'   group by  学位  order by 学位" 
	  end if  
	  if tiaojianziduan="职称" then 
           sqllist="select count(*) as shuliang,职称 as ziduan  from Employee where 是否离职<>'是'   group by  职称  order by 职称" 
	  end if
	  if tiaojianziduan="所教学科" then 
           sqllist="select count(*) as shuliang,所教学科 as ziduan  from Employee where 是否离职<>'是'   group by  所教学科  order by 所教学科" 
	  end if
	  if tiaojianziduan="政治面貌" then 
           sqllist="select count(*) as shuliang,政治面貌 as ziduan  from Employee where 是否离职<>'是'   group by  政治面貌  order by 政治面貌" 
	  end if
	  if tiaojianziduan="岗位级别" then 
           sqllist="select count(*) as shuliang,岗位级别 as ziduan  from Employee where 是否离职<>'是'   group by  岗位级别  order by 岗位级别" 
	  end if
	  if tiaojianziduan="薪级" then 
           sqllist="select count(*) as shuliang,薪级 as ziduan  from Employee where 是否离职<>'是'   group by  薪级  order by 薪级" 
	  end if
   	  if tiaojianziduan="聘任薪级" then 
           sqllist="select count(*) as shuliang,聘任薪级 as ziduan  from Employee where 是否离职<>'是'  group by  聘任薪级  order by 聘任薪级" 
	  end if
		
		
		
		
		
   Rslist.open sqllist,conn,1,1
   while not Rslist.eof and not Rslist.bof
   i=i+1
%>
    <tr onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#EFF8FF'">
      <td width="11%" height="27" align="center" nowrap class="STYLE1"><%=i%></td>
	  <%  if tiaojianziduan="年龄" then  %>
           <td width="64%" align="center" nowrap class="STYLE1">  <%=Rslist("ziduan")*5%>-<%=(Rslist("ziduan")+1)*5-1%>岁 </td>
	  <%else%>
	      <td width="64%" align="center" nowrap class="STYLE1">  <%=Rslist("ziduan")%> </td>
	  <%end if%>
	  
      <td width="25%" align="center" nowrap class="STYLE1"><%=Rslist("shuliang")%></td>
    </tr>
    <%  Rslist.movenext
    wend
%>
  </table>
  <p align="center" class="STYLE1">&nbsp;</p>
</form>
</body>
</html>
