⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statistics.asp

📁 设置员工上下班时间
💻 ASP
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>考勤查询统计</title>
</head><!--#include file="connection.asp"-->
<%
	
	Set rs=Server.CreateObject("ADODB.Recordset")
	LeaveYear=trim(Request("LeaveYear")+"")
	LeaveMonth=trim(Request("LeaveMonth")+"")
	LeaveYMS=""
	LeaveYME=""
	if len(LeaveMonth)<1 then
		if len(LeaveYear)>0 then
			LeaveYMS=LeaveYear+"-1-1"
			LeaveYME=DateAdd("yyyy",1,CDate(LeaveYMS))
		end if
	else
		if len(LeaveYear)>0 then
			LeaveYMS=LeaveYear+"-"+LeaveMonth+"-1"
			LeaveYME=DateAdd("yyyy",1,CDate(LeaveYMS))
		end if
	end if
	Employee=trim(Request("Employee")+"")
		
	if len(LeaveYear)<1 and len(LeaveMonth)>0 then
	Response.Write "<script>alert('请输入年度!');history.go(-1);</script>"
		else
		strsql="SELECT a.employeeid,b.name,count(*) as latenum ,(SELECT count(*)  " 
		strsql =strsql +"from attendance where 1=1 "
		if len(Employee)>0 then
 			strsql =strsql +" and a.employeeid="+Employee
		end if
		if len(LeaveYear)>0 then
			strsql =strsql +" and onduty_date>=#"+LeaveYMS+"# "
			strsql =strsql +" offduty_date<#"+LeaveYME+"# "
		end if
		strsql =strsql +" and  employeeid=a.employeeid "
		strsql =strsql +" and  Timevalue(offduty_date)<(select offduty_time "
		strsql =strsql +" from settime where duty_type='0')) as outnum ,"
		strsql =strsql +" (select count(*) from leave where employeeid=a.employeeid  "
		if len(LeaveYear)>0 then
 			strsql =strsql +" and leave_sdate>=#"+LeaveYMS+"# and leave_edate<#"+LeaveYME+"#  "
		end if
		strsql =strsql +" and ischeck='1') as leavenum"
 		strsql =strsql +" from attendance a ,employee b where 1=1 "
		if len(LeaveYear)>0 then
			strsql =strsql +" and onduty_date>=#"+LeaveYMS+"# "
			strsql =strsql +"offduty_date<#"+LeaveYME+"# "
		end if
		strsql =strsql +" and a.employeeid=b.keyid "
		if len(Employee)>0 then
 			strsql =strsql +" and a.employeeid="+Employee
		end if
		strsql =strsql +" and Timevalue(onduty_date)>(select onduty_time from settime where duty_type='0')"
		strsql =strsql +" group by a.employeeid,b.name"
		rs.Open  strsql,con,1,3
	end if
	
	Set empl_rs=Server.CreateObject("ADODB.Recordset")		
	strsql="select * from employee"
	empl_rs.Open  strsql,con	
%>
<body>
<form name="form1" method="post" action="">
	<input name="IsPostBack" type="hidden" value="PostBack">
  <table width="100%" border="0">
    <tr>
	  <td  width="30%">员工: <select name="Employee" id="Employee">
	  	<option value="" >--请选择--</option>
		<% do while not (empl_rs.EOF) %>
		<option value="<%=trim(empl_rs("keyid")) %>"
			<% if trim(empl_rs("keyid"))=Employee then%> selected <%end if%>>
			<%=empl_rs("name")%></option>
		<%empl_rs.MoveNext
		loop 
		empl_rs.Close	%>       </select></td>
      <td >日期:年<input type="text" name="LeaveYear"  value="<%=LeaveYear%>" width="60" maxlength="4">
	  月<input type="text" name="LeaveMonth"  value="<%=LeaveMonth%>" width="60" maxlength="2"></td>
	</tr>
	<tr>
	  <td ><font color="red" ><%=msgErr %></font></td>
      <td align="right" >
	  	<input type="submit" name="SubmitQuery" value="查询">
	  </td>
    </tr>
  </table>
  <table width="100%" border="1">
    <tr>
	  <td align="center" width="20%">员工姓名</td>
      <td align="center" width="20%">迟到次数</td>
      <td align="center" width="20%">早退次数</td>
	  <td align="center" width="10%">请假次数</td>
    </tr>
	<%do while not rs.EOF %>
    <tr>
      <td><%=trim(rs("name")) %></td>
      <td><%=trim(rs("latenum")) %></td>
	  <td><%=trim(rs("outnum")) %></td>
	  <td><%=trim(rs("leavenum")) %></td>
    </tr>
	<% rs.MoveNext
	loop 
	rs.Close
	con.Close%>
  </table>
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -