📄 statistics1.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>统计考勤</title>
</head>
<!--#include file="connection.asp"-->
<body><form id="form1" name="form1" method="post" action="statistics.asp?action=Chkstatistics">
<table width="755" border="1" align="center">
<tr>
<td width="252"> <label>员工姓名:
</label> <label>
<input type="text" name="name" value="<%=session("name")%>" readonly>
</label></td>
<td width="487"> <label>日期:年
<input type="text" name="LeaveYear" value="<%=LeaveYear%>" />
</label> <label>月
<input type="text" name="LeaveMonth" value="<%=LeaveMonth%>" />
</label></td>
</tr>
<tr>
<td colspan="2" align="right">
<label>
<input type="submit" name="Submit" value="查询" />
</label>
</td>
</tr>
</table>
<table width="756" border="1" align="center">
<tr>
<td width="175">员工姓名</td>
<td width="153">迟到次数</td>
<td width="189">早退次数</td>
<td width="211">请假次数</td>
</tr><% Set rs=Server.CreateObject("ADODB.Recordset")
strsql="select* from employee,attendance"
rs.Open strsql,con,1,3
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 %>
</table>
</form>
<%
If Request("action")="Chkstatistics" Then
Call Chkstatistics()
End If
%>
<%
Sub Chkstatistics()
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>"
Response.End
else
strsql="select a.employeeid,b.name,count(*) as latenum,"
strsql=strsql+"(select count(*) 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"
strsql=strsql+" where employeeid=a.employeeid"
if len(LeaveYear)>0 then
strsql=strsql+"and leave_sdate>=#"+LeaveYMS+"# "
strsql=strsql+"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"
strsql=strsql+"settime where duty_type='0')"
strsql=strsql+"group by a.employeeid,b.name"
rs.Open strsql,con,1,3
end if
end Sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -