📄 attendance.jsp
字号:
<%@ page language="java" import="java.util.*,java.text.*" pageEncoding="gbk"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>联信OA-部门办公</title>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
body {
margin-left: 10px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #333333;
}
a:active {
text-decoration: none;
color: #333333;
}
html,body{
scrollbar-face-color: #f2f2f2;
scrollbar-highlight-color: #ffffff;
scrollbar-shadow-color: #999999;
scrollbar-3dlight-color: #999999;
scrollbar-arrow-color: #999999;
scrollbar-track-color: ##FFFFFF;
scrollbar-darkshadow-color: #ffffff;
}
-->
</style>
<link href="../../oa/css/css.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
<script type="text/javascript">
function checkfrm(){
var year=form.year.value;
var month=form.month.value;
if(year=="0"||month=="0"){
alert("请选择日期!");
return false;
}
return true;
}
function tongji(j,a){
document.getElementById(j).innerHTML = a;
}
function huoqu(){
// alert(document.getElementById("aa").innerHTML);
var content = document.getElementById("aa").innerHTML;
document.getElementsByName("k")[0].value=content;
frm.action = "<%=request.getContextPath()%>/saveattendance.do";
frm.submit();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<% SimpleDateFormat format5 = new SimpleDateFormat("yyyy-MM");
java.util.Date r=new java.util.Date();
String adate = format5.format(r);
%>
<form action="" method="post" name="frm" style="display:none">
<input type="hidden" name="k" id="k"/>
<input type="hidden" name="adate" value="<%=adate %>"/>
</form>
<%
out.print("<script>ac();</script>");
out.flush();
%>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="406" height="30" bgcolor="#A4B5E3" style="BORDER-LEFT: #B5B5FF 1px solid;cellSpacing:"> 以下显示的是公司本月(<span class="STYLE1"><%=adate %></span>)的考勤记录</td>
<td width="359" bgcolor="#A4B5E3" style="BORDER-RIGHT: #B5B5FF 1px solid;cellSpacing:"> <input type="button" name="Submit2" value="保存本月考勤记录" onClick="huoqu()"/></td>
</tr>
</table>
<table width="740" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td height="5"></td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<% Calendar thisMonth=Calendar.getInstance();
int maxIndex=thisMonth.getActualMaximum(Calendar.DAY_OF_MONTH);
%>
<tr>
<td bgcolor="#EAF2FE" style="padding-bottom:3px; BORDER-LEFT: #B5B5FF 1px solid; BORDER-RIGHT: #B5B5FF 1px solid; BORDER-BOTTOM: #B5B5FF 1px solid;cellSpacing:">
<div id="aa" >
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#B5B5FF">
<tr>
<td bgcolor="#CCCCCC"><div align="center">姓名</div></td>
<td height="25" colspan="<%=maxIndex %>" bgcolor="#CCCCCC"><div align="center">日 期</div></td>
<td colspan="7" bgcolor="#CCCCCC"><div align="center">考勤统计</div></td>
</tr>
<tr>
<td width="49" height="40" bgcolor="#E7E7E7"> </td>
<% for(int i=1;i<=maxIndex;i++){
%>
<td width="16" height="25" bgcolor="#E7E7E7"><div align="center"><%=i %></div></td>
<%} %>
<td width="33" bgcolor="#E7E7E7"><div align="center">出勤</div></td>
<td width="33" bgcolor="#E7E7E7"><div align="center">请假</div></td>
<td width="33" bgcolor="#E7E7E7"><div align="center">旷工</div></td>
<td width="33" bgcolor="#E7E7E7"><div align="center">迟到</div></td>
<td width="33" bgcolor="#E7E7E7"><div align="center">早退</div></td>
<td width="33" bgcolor="#E7E7E7"><div align="center">出差</div></td>
<td width="33" bgcolor="#E7E7E7"><div align="center">休息</div></td>
</tr>
<%
List list2 = (List)request.getAttribute("list");
Iterator it = list2.iterator();
Calendar am = Calendar.getInstance();
Calendar pm = Calendar.getInstance();
Calendar cm = Calendar.getInstance();
Calendar tm = Calendar.getInstance();
int j = 0;
do {
j++;
String realname = (String) it.next();//真实姓名
%>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><%=realname %></div></td>
<%for(int i=1;i<=maxIndex;i++){
Calendar km = Calendar.getInstance();
km.set(km.get(Calendar.YEAR),km.get(Calendar.MONTH),i,0,0,0);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy");
java.util.Date year=new java.util.Date();
int y=Integer.parseInt(format2.format(km.getTime()));
SimpleDateFormat format3 = new SimpleDateFormat("MM");
java.util.Date month=new java.util.Date();
int m=Integer.parseInt(format3.format(km.getTime()));
SimpleDateFormat format4 = new SimpleDateFormat("dd");
java.util.Date day=new java.util.Date();
int d=Integer.parseInt(format4.format(km.getTime()));
if (m == 1) {
m = 13;
y = y - 1;
}
if (m == 2) {
m = 14;
y = y - 1;
}
int w = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;
String str = "";
switch (w) {
case 0:
str = "星期一";
break;
case 1:
str = "星期二";
break;
case 2:
str = "星期三";
break;
case 3:
str = "星期四";
break;
case 4:
str = "星期五";
break;
case 5:
str = "星期六";
break;
case 6:
str = "星期日";
break;
}%>
<td height="6" bgcolor="#FFFFFF">
<div align="center"><span class="STYLE4">
<%//if (str.equals("星期六")||str.equals("星期日")) {
if (str.equals("星期日")) { %>
<input type="text" size="1" style="border-width:0px;" value="★"/>
<%}else{ %>
<input type="text" size="1" style="border-width:0px;"/>
<%} %>
</span></div>
</td>
<%} %>
<td height="25" bgcolor="#FFFFFF" align="center" id="tb<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
<td height="25" bgcolor="#FFFFFF" align="center" id="ta<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
<td height="25" bgcolor="#FFFFFF" align="center" id="tm<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
<td height="25" bgcolor="#FFFFFF" align="center" id="tc<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
<td height="25" bgcolor="#FFFFFF" align="center" id="td<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
<td height="25" bgcolor="#FFFFFF" align="center" id="te<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
<td height="25" bgcolor="#FFFFFF" align="center" id="tk<%=j %>">
<div align="center">
<input type="text" size="3" style="border-width:0px;"/>
</div>
</td>
</tr>
<%} while (it.hasNext()); %>
</table>
</div>
</td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="800" height="24" bgcolor="#EAF2FE"> 说明:出勤记“√”, 请假记“○”, 迟到记“△”,早退记“▲”,节假日记“★”,其它如出差、轮休请特别注明。</td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<%--<form action="<%=request.getContextPath() %>/queryjilu.do" method="post" name="form" onSubmit="return checkfrm()">
<td width="360" height="24" bgcolor="#EAF2FE"> 查看考勤记录
<select name="year">
<%
SimpleDateFormat fy=new SimpleDateFormat("yyyy");
SimpleDateFormat fm=new SimpleDateFormat("MM");
SimpleDateFormat fd=new SimpleDateFormat("dd");
%>
<option value="0" selected="selected">选择</option>
<%
for(int i=2007;i<2011;i++){
%>
<option value="<%=i %>"><%=i %></option>
<% } %>
</select>年
<select name="month">
<option value="0" selected="selected">选择</option>
<%
for(int i=1;i<13;i++){
String stri=Integer.toString(i);
if(stri.length()==1){
stri="0"+stri;
}
%>
<option value="<%=stri %>" ><%=stri %></option>
<% } %>
</select>月 <input type="submit" name="Submit2" value="查 看" />
</td>
</form>
--%><td height="35" bgcolor="#A4B5E3">
<div align="center">
<input type="button" name="Submit" value="打 印" onClick="javascript:window.print();"/>
</div>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -