复杂表头分页页面
<%
int curpage=1;//当前页
int page_record=10;//每页显示的记录数
int introwcount=0; // 记录数
int pagecount; //总页数
//选取页数
String pagesize = Util.null2String(request.getParameter("pagesize"));
//当前页数
String cpage = Util.null2String(request.getParameter("curpage"));
if(!"".equals(cpage)){
curpage=Integer.valueOf(cpage);
}
if(!"".equals(pagesize)){
page_record=Integer.valueOf(pagesize);
}
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM id="noteForm" name="noteForm" method="post" action="laborReportIframe.jsp" >
<input type="hidden" name="curpage" id="curpage" value="<%=curpage%>"/>
<input type="hidden" name="pagesize" id="pagesize" value="<%=pagesize %>"/>
<table width="100%" cellspacing='0' cellpadding='0' border='0' align="center" class="ListStyle" style="table-layout: fixed;" >
<thead>
<tr class="HeaderForXtalbe">
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">员工姓名</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">部门</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">所属分公司</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">夏装</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">春秋装</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">冬装</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">防寒大衣</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">防静电布鞋</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">防寒鞋</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">雨鞋</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" colspan="2">雨衣</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">工作帽</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">单手套</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">棉手套</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowspan="2">腰包</th>
</tr>
<tr class="HeaderForXtalbe">
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">发放时间</th>
<th style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center">型号</th>
</tr>
</thead>
<%
String sqlWhere=" where 1=1 ";
String sqlWhere1=" ";
String countsql = " select count(id) as num from uf_glbypffdjkbd a left join hrmresource b on a.hr_ygxm=b.id "+sqlWhere;
rs.executeSql(countsql);
if(rs.next())
introwcount = rs.getInt("num");
if(introwcount%page_record==0){
pagecount=introwcount/page_record;
}else{
pagecount=(introwcount/page_record)+1;
}
String sql=" select t.*,rownum as rn from(select a.*,b.subcompanydesc,c.departmentname,d.lastname from uf_glbypffdjkbd a left join hrmsubcompany b on a.hr_ygxmfb =b.id "+
" left join hrmdepartment c on a.hr_ygxmbm=c.id left join hrmresource d on a.hr_ygxm=d.id "+sqlWhere+")t ";
String querySql="select t1.* from ("+sql+")t1 where rn <= "+(curpage)*page_record+" and rn > "+(curpage-1)*page_record;
querySql="select t1.*,(select count(*) from ( "+querySql+") a ) as rcount from ("+sql+")t1 where rn <= "+(curpage)*page_record+" and rn > "+(curpage-1)*page_record;
//out.println(querySql);
rs.executeSql(querySql);
int count=0,rcount=0;
String hr_ygxm="";
while(rs.next()){
rcount=rs.getInt("rcount");
count=rcount*2-1;
%>
<tbody>
<tr class="HeaderForXtalbe" style="border: 1px solid #f5f6f8;">
<%if("".equals(hr_ygxm)||!hr_ygxm.equals(rs.getString("hr_ygxm"))){
hr_ygxm=rs.getString("hr_ygxm");
%>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowSpan="<%=count%>"><%=rs.getString("lastname")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowSpan="<%=count%>"><%=rs.getString("departmentname")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center" rowSpan="<%=count%>"><%=rs.getString("subcompanydesc")%></td>
<%}else{ %>
<td align="center" ></td>
<td align="center" ></td>
<td align="center" ></td>
<% }%>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("xz_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("xz_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("cqz_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("cqz_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("dz_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("dz_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("fhdy_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("fhdy_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("fjdbx_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("fjdbx_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("fhx_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("fhx_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("yx_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("yx_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("yy_ffsj")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("yy_xh")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("txt_gzm")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("txt_dst")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("txt_mst")%></td>
<td style="BORDER-LEFT: #d4e9e9 1px solid; cursor: hand " align="center"><%=rs.getString("txt_yb")%></td>
</tr>
</tbody>
<%} %>
</table>
<div align="right">
<span class="e8_pageinfo">
<span class="e8_numberspan weaverTablePrevPageOfDisabled weaverTablePage" > <a href="#" οnclick="jumpUp(<%= curpage%>)"> <</a></span>
<span class="e8_numberspan weaverTableCurrentPageBg" ><input type="hidden" name="pagecount" id="pagecount" value="<%=pagecount%>"/><%=pagecount %></span>
<span class="e8_numberspan weaverTablePrevPageOfDisabled weaverTablePage" ><a href="#" οnclick="jumpDown(<%= curpage%>)">></a></span>
<span style="height: 30px; color: #666666; line-height: 30px; text-decoration: none; float: left;">第</span>
<span id="-weaverTable-0_XTABLE_GOPAGE_buttom_go_page_wrap" style="left: 0px; top: 5px; width: 30px; height: 20px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 1px; margin-bottom: 0px; margin-left: 1px; border-top-color: #fff; border-right-color: #fff; border-bottom-color: #fff; border-left-color: #fff; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; float: left; display: inline-block; position: relative;">
<input id="jumpnum" style="left: 0px; top: 0px; width: 30px; height: 18px; text-align: center; color: #666666; line-height: 18px; border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; border-left-color: transparent; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; float: left; position: absolute; outline-width: medium; outline-style: none; outline-color: invert;" οnchange="jumppage()" type="text" size="3" value="<%=curpage %>"/>
</span>
<span style="height: 30px; color: #666666; line-height: 30px; padding-right: 10px; text-decoration: none; float: left;">页</span>
<span class="e8_splitpageinfo">
<span style="height: 21px; padding-top: 2px; text-decoration: none; position: relative;">
<select id="size1" name="size1" οnchange="setSize()">
<option value="10" <%if(page_record==10){ %> selected="selected" <%} %>>10</option>
<option value="20" <%if(page_record==20){ %> selected="selected" <%} %>>20</option>
<option value="50" <%if(page_record==50){ %> selected="selected" <%} %>>50</option>
<option value="100" <%if(page_record==100){ %> selected="selected" <%} %>>100</option>
</select> 条/页 | 共<%=introwcount %>条
</span>
</span>
</span>
</div>
</BODY>
</HTML>
<script type="text/javascript">
function onQuery(){
jQuery("#curpage").val('1');
noteForm.submit();
}
function jumpUp(index){
if(index!=1){
index=index-1;
}
jQuery("#curpage").val(index);
noteForm.submit();
}
function jumpDown(index){
var pagecount=jQuery("#pagecount").val()*1;
if(index!=pagecount){
index=index+1;
}
jQuery("#curpage").val(index);
noteForm.submit();
}
function jumppage(){
var num=jQuery("#jumpnum").val()*1;
var pagecount=jQuery("#pagecount").val()*1;
if(num>0 && num<=pagecount){
jQuery("#curpage").val(num);
noteForm.submit();
}else{
jQuery("#jumpnum").val(jQuery("#curpage").val());
}
}
function setSize(){
jQuery("#pagesize").val(jQuery("#size1").val());
noteForm.submit();
}
</script>