<%@ page language="java" contentType="text/html; charset=GB2312"  pageEncoding="GB2312"%>
<%@ include file="/linksql/linksql.jsp"%>
<%@ page import="java.sql.*"%> 
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=GB2312"> <link href="style/dhh.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
<!--
body {
font-family:"宋体";
font-size:9pt;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body >
<center>

<form id='searchForm' name=form1 method="POST" action="income.jsp"  onSubmit="getElById('11').disabled=true; " >
<table width="100%"  height="10%" border="0" cellpadding="1" cellspacing="0"  borderColor="red"  bgcolor="DAF4FC">
<tr>
<td>
<table width="100%"  height="8%" border="0" cellpadding="1" cellspacing="0"  >
<tr>
<td >
<br>
</td>
</tr>
<tr>
<td><div align=right>查询开始日期:&nbsp</div></td>
<td><input type="text" id="111" name="begin" size="15"  onFocus="new WdatePicker()"  class="Wdate"> </td>
<td><div align=right>查询结束日期:&nbsp</div></td>
<td><input type="text" id="222" name="end" size="15"  class="Wdate" onFocus="new WdatePicker()"></td> <td><div align=right>提交人:&nbsp</div></td>
<td><input type="text" id="333" name="tijiao" size="15" ></td>
</tr>
<tr>
<td >
<br>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td><div align=right><input name="11" type="submit" value="提交" ></div></td>
<td><div align=left><input name="22" type="reset" value="重置" ></div></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table id="data" width="100%" border="0" cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#98D3F8" align="center">
<tr align=center bgcolor="DAF4FC">
<td>日期</td>
<td>门票</td>
<td>导游费</td>
<td>小卖部</td>
<td>导览镜</td>
<td>提交者</td>
<td>修改</td>
</tr>
<% int PageSize=19;
int ShowPage=1;
int RowCount=0;
int PageCount=0;
String begin_time=null;
String end_time=null;
String tijiao=null;
int begin_ymd;
int end_ymd;
String select=null;

begin_time=request.getParameter("begin");//格式为YYYY-MM-DD
end_time=request.getParameter("end"); //格式为YYYY-MM-DD
tijiao=request.getParameter("tijiao");

if(begin_time!=null && end_time!=null )
{
String begin_year=begin_time.substring(0,4);//获得年份
String begin_month=begin_time.substring(5,7);//获得月
String begin_date=begin_time.substring(8,10);//获得日
String begin_yearmonthdate=begin_year+begin_month+begin_date;//格式为YYYYMMDD
begin_ymd=Integer.parseInt(begin_yearmonthdate);//转化为int

String end_year=end_time.substring(0,4);//获得年份
String end_month=end_time.substring(5,7);//获得月
String end_date=end_time.substring(8,10);//获得日
String end_yearmonthdate=end_year+end_month+end_date;//格式为YYYYMMDD
end_ymd=Integer.parseInt(end_yearmonthdate);//转化为int select="select * from income  where yearmonthdate>='"+begin_ymd+"'  and yearmonthdate<='"+end_ymd+"' and ren ='"+tijiao+"' order by yearmonthdate ";

ResultSet  RS_select_look; connSQLServer(); RS_select_look=executeQuery(select); if(RS_select_look.next())
{ RS_select_look.last(); RowCount=RS_select_look.getRow(); PageCount=((RowCount % PageSize)==0 ? (RowCount/PageSize):(RowCount/PageSize)+1); %>  
<% String ToPage=request.getParameter("ToPage");
%>

<% if (ToPage!=null)
{
ShowPage=Integer.parseInt(ToPage);//取得指定显示的分页页数
if(ShowPage>PageCount)//判断用户输入的页数是否正确
{
ShowPage=PageCount;//判断指定页数是否大于总页数,是则设置显示最后一页
}
else if(ShowPage<=0)//若指定页数小于0,则设置显示第一页的记录
{
ShowPage=1;
}
}
RS_select_look.absolute((ShowPage-1)*PageSize+1);
%>
<%
for (int ii=1;ii<=PageSize;ii++)
{
int qq=RS_select_look.getInt(1);
String qqq=String.valueOf(qq);
String pp=qqq.substring(0,4);
String mm=qqq.substring(4,6);
String nn=qqq.substring(6,8);
%>
<tr align=center onMouseOver="this.className='tr_over'" onMouseOut="this.className=''" align=center>
<td width=100 ><b><%=pp%>-<%=mm%>-<%=nn%>
<td width=100 ><b><%= RS_select_look.getInt(3)%>
<td width=100><b><%= RS_select_look.getInt(4)%>
<td width=100><b><%= RS_select_look.getInt(5)%>
<td width=100><b><%= RS_select_look.getInt(6)%>
<td width=100><b><%= RS_select_look.getString(8)%>
</tr>
<%
//判断语句用于防止输出最后一页记录时,将记录指针移至最后一笔记录之后
//判断是否到达最后一笔记录
if(!RS_select_look.next())
break;
}
%>
</table> <table   border="0" align=right>
<tr valign=baseline align=right>
<%
//判断目前所在分页是否为第一页,不是则显示第一页与上一页的超链接
if(ShowPage!=1)
{
%>
   <td width=100>
<a href=income.jsp?ToPage=1><font size="2">第一页</font></a>
   </td>
   <td width=100>
<a href=income.jsp?ToPage=<%= ShowPage-1 %>><font size="2">上一页</font></a>
   </td>
<%
}
//判断目前所在分页是否为最后一页,不是则显示最后一页与下一页的超链接
if (ShowPage!=PageCount)
{
//下面建立的各超链接将链接至自己,并将欲显示的分页以ToPage参数传递自己
%>
   <td width=100>
<a href=income.jsp?ToPage=<%= ShowPage+1 %>&&yearmonthdate&gt;=<%=begin_ymd%>&&yearmonthdate&lt;=<%=end_ymd%>&&ren='<%= tijiao%>'><font size="2">下一页</font></a>
   </td>
   <td width=100>
<a href=income.jsp?ToPage=<%= PageCount %>><font size="2">最后一页</font></a>
   </td>
<%
}
%>
 <td width=150>
<!-- 下面是个表单,用于跳转到所输入的页面,提交后的处理页面也是本页面  --> 
<form action=income.jsp method=post>
<font size="2">到</font><input type="text" name="ToPage" style="hight:25px;width:40px" 
value=<%= ShowPage%>><font size="2">页</font>
<font size=2 color=red><%= ShowPage %></font>/<font size=2 color=red><%= PageCount %></font><font size="2">页</font>
</form>
</td>
</tr>
</table>
<%}}%></center>
</body>
</html>