<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%
chk=requestA("chk")
yueid=requestA("yueid")

if chk="ok" then
if CheckTable("MX_KQXT")=0 then response.write "<script language=JavaScript>" & "alert('考勤系统尚未安装，请在插件管理中安装考勤系统！');" & "history.back()" & "</script>":response.end
conn.execute("insert into MX_KQXT(ZD_YGXM,ZD_QDSJ,tjsj,zduser,gid,g1id) values('"&nowuserhao&"','"&now()&"','"&now()&"','"&nowuserhao&"',0,0)")
response.write "<script language=JavaScript>" & "alert('考勤签到成功！');" & "history.back()" & "</script>":response.end
end if

Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 

call chksunzom()
if instr(quanxs,"m"&mxid&"x")<=0 and nowuserid<>1 then call sunzomqx()


sExport=requestA("export")
If sExport = "excel" Then
	Response.ContentType = "application/vnd.ms-excel"
	Response.AddHeader "Content-Disposition", "attachment; filename="&mxname&".xls"
End If
If sExport = "word" Then
	Response.ContentType = "application/vnd.ms-word"
	Response.AddHeader "Content-Disposition:", "attachment; filename="&mxname&".doc"
End If
If sExport = "csv" Then
	Response.ContentType = "application/csv"
	Response.AddHeader "Content-Disposition:", "attachment; filename="&mxname&".csv"
End If


'返回值：当月天数 调用:response.write findDays("2008","01")
function findDays(yy,mm) 
   dt=dateSerial(yy,mm,1) 
   findDays=datediff("d",dt,dateadd("m",1,dt)) 
end function
tianshu=findDays(year(now()),month(now()))
d=date()
nian=year(now())
nyue=month(now())
yue=""&year(now())&"-"&month(now())&""
if yueid="" then yueid=yue
%>
<html>
<head>
<title><%=mxname%> -考勤报表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/sunzom.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../inc/jquery.js"></script>
<script type="text/javascript" src="../xheditor.js"></script>
<meta http-equiv="pragma" content="no-cache">
<META http-equiv="Cache-Control" CONTENT="no-cache, must-revalidate">
<META http-equiv="expires" CONTENT="0">
<style media="print" type="text/css"> .NoPrint{DISPLAY:none}</style>
<script language=javascript>
function doPrint() { 
bdhtml=window.document.body.innerHTML; 
sprnstr="<!--startprint-->"; 
eprnstr="<!--endprint-->"; 
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 
window.document.body.innerHTML=prnhtml; 
window.print(); 
window.document.body.innerHTML=bdhtml;
}
function killErrors() {return true;}
window.onerror = killErrors;
</script>

</HEAD>
<BODY>

<!--startprint-->

<form name="form2"><h2 align="center">
<select name="yueid" onChange="form2.submit()" style="float: right" size="1">
<option>请选择月份</option>
<%
if 1<nyue<13 then nyue1=nyue-nyue+1
for i=nyue1 to nyue
%>
<option value="<%=nian%>-<%=i%>" <%if yueid=""&nian&"-"&i&"" then%>selected<%end if%>><%=nian%>-<%=i%></option>
<%next
nian1=nian
%>
</select><%=yueid%>考勤签到报表</h2></form><!--class="NoPrint"-->
<table border="1" width="100%" cellspacing="0" cellpadding="4" style="border-collapse: collapse" bordercolor="#000000">
	<tr>
		<td style="border-color: #000000" bgcolor="#F3F3F3" width="40px">日期<br>星期</td>
<%
for i=1 to tianshu
%><td align="center" style="border-color: #000000" bgcolor="#F3F3F3"><u><%=i%></u><br><%=weekday(""&year(now())&" -"&month(now())&" - "&i&"")%></td>
<%
next%>
		<td align="center" style="border-color: #000000" bgcolor="#F3F3F3">备注</td>
	</tr>
<%
sql="select * from login where id>1 order by id"
set rskq=conn.execute(sql)
do while rskq.eof=false
%>
<tr>
<td style="border-color: #000000" title="编号：<%=rskq("username")%>"><%=rskq("bianhao")%></td>
<%
for d=1 to tianshu
%><td style="border-color: #000000">

<%
gesj=""&year(now())&"-"&month(now())&"-"&d&""
yueid1=yueid&"-"&d&""
'sqla="select ZD_QDSJ from MX_KQXT where ZD_YGXM='"&rskq("bianhao")&"' and DATEDIFF('d',ZD_QDSJ,'"&gesj&"')=0 order by id"
sqla="select ZD_QDSJ from MX_KQXT where ZD_YGXM='"&rskq("bianhao")&"' and DATEDIFF('d',ZD_QDSJ,'"&yueid1&"')=0 order by id"
set rs1kq=conn.execute(sqla)
do while rs1kq.eof=false
response.write ""&hour(rs1kq(0))&":"&minute(rs1kq(0))&"<br>"
rs1kq.movenext
loop
rs1kq.close
set rs1kq=nothing
%>

</td>
<%
next%>
		<td style="border-color: #000000"></td>
	</tr>
<%
rskq.movenext
loop
rskq.close
set rskq=nothing
%>
</table>

<hr>请及时更新系统数据有利于更准确的统计！<span style="float: right">制表人：<%=nowuser%></span><b><%'=gszhang%></b>
<%if sExport="" then%>
<!--endprint--><br><br><p align="center"><%=dayin%>  &nbsp;&nbsp;<a title="数据导出为Excel" href="baoZ.asp?mxid=<%=mxid%>&m1id=<%=m1id%>&xxid=<%=xxid%>&sid=<%=sid%>&export=excel"><img src="../images/exportxls.gif" width="16" height="16" border="0" class="NoPrint"></a>
&nbsp;&nbsp;<a  title="数据导出为WORD" href="baoZ.asp?mxid=<%=mxid%>&m1id=<%=m1id%>&xxid=<%=xxid%>&sid=<%=sid%>&export=word"><img src="../images/exportdoc.gif" width="16" height="16" border="0" class="NoPrint"></a>
&nbsp;&nbsp;<a  title="数据导出为CSV" href="baoZ.asp?mxid=<%=mxid%>&m1id=<%=m1id%>&xxid=<%=xxid%>&sid=<%=sid%>&export=csv"><img src="../images/exportcsv.gif" width="16" height="16" border="0" class="NoPrint"></a></p>
<%end if%>
</body>
</html>