为什么这个不能统计到总计

飞扬残月 2010-09-21 10:27:35
<%@ page contentType="text/html;charset=GBK"%>
<%@ page session="true" %>
<%@ page isThreadSafe="true" %>
<%@ page import="net.btdz.oa.system.*,java.util.*" %>
<%@page import="www.seeyon.com.crimsist.*,net.btdz.oa.form.*,www.seeyon.com.crimsist.symessage.*"%>
<%@ include file="../../common/js/CheckSession.jsp"%>
<%@ page import="net.btdz.oa.person.*"%>
<%@ page import="java.sql.*"%>

<html>
<head>

<meta content="zh-cn" http-equiv="Content-Language">
<meta content="text/html; charset=GBK" http-equiv="Content-Type">
<meta content="MSHTML 5.00.2920.0" name="GENERATOR">
<style>
body {
font: normal 12px auto , Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
text-align:center;

}

a {
color: #c75f3e;
}

#mytable {
width: 100%;
padding: 0;
margin: 0;
}

caption {
padding: 0 0 0px 0;
width: 700px;
font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
text-align:center;
}
table{
border-left: 0px solid #C1DAD7;
}
th {
font: bold 14px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
color: #4f6b72;
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
border-top: 1px solid #C1DAD7;
letter-spacing: 2px;
text-transform: uppercase;
text-align:center;
padding: 6px 6px 6px 12px;
background: #CAE8EA ;
}

td {
border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #fff;
font-size:11px;
padding: 6px 6px 6px 12px;
color: #4f6b72;
}


td.alt {
background: #F5FAFA;
color: #797268;
}
bg1 {
background: #abcdef;

}
bg2 {
background: #F5FAFA;

}

tr.alt td{background:#ecf6fc;}
/*---------for IE 5.x bug*/
html>body td{ font-size:11px;}
.STYLE1 {
color: #000000;
font-weight: bold;
font-size: 14px;
}
.STYLE2 {
font-size: 14px;
color: #000000;
font-weight: bold;
font-family: "宋体";
}
.STYLE3 {font-size: 16px}
.STYLE4 {font-size: large}
</style>
<link rel="stylesheet" type="text/css" href="../../common270/css/DocMgr.css">
<link rel="stylesheet" type="text/css" href="../../common270/css/tablesort.css">
<script type="text/javascript" src="../../common/js/tablesort/tablesort.js"></script>
<script type="text/javascript" src="js/showDocList.js"></script>

<link rel="STYLESHEET" type="text/css" href="../../common270/css/common270.css">
<link rel="STYLESHEET" type="text/css" href="../../common270/css/list.css">
<script language="javascript" type="text/javascript" src="DatePicker/WdatePicker.js">
onfocus="new WdatePicker('el','dateFmt','showsTime','skin')"
</script>
<script language="javascript">
function tijiao()
{
//var djmc=document.all.select1.value;
var lsh=document.all.textfield1.value;
var bm=document.all.bmid.value;
var bxr=document.all.uid.value;
var date1=document.all.text1.value;
var date2=document.all.text2.value;
var dq=document.all.select7.value;
var fgs=document.all.fid.value;
//var bxr="";
/*if(bxr1!="")
{
Connection con = null;
Statement l= null;
ResultSet re = null;
con = ConnectionPoolBean.getConnection();
l = conn.createStatement();
re=l.executeQuery("select * from person where TURENAME='"+bxr1+"'");
bxr=re.getString(1);
}*/
//var jine=document.all.textfeild3.value;
this.location.href="?lsh="+lsh+"&bm="+bm+"&date1="+date1+"&date2="+date2+"&bxr="+bxr+"&dq="+dq+"&fgs="+fgs+"";
}
function chakan()
{
var total=document.all.textfield5.value;
var total1=document.all.textfield6.value;
alert("全表报销金额合计:"+total+"元。\r\n 全表票据金额合计:"+total1+"元。");
}
function selectfgs()
{
var url="searchfgs.jsp";
var str=window.showModalDialog(url,'',
'scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=200,height=50');
document.all.fname.value=str.split("|")[0];
document.all.fid.value=str.split("|")[1];

}
function selectps()
{
var url="searchperson.jsp";
var str=window.showModalDialog(url,'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=200,height=50');
document.all.uid.value=str.split("|")[0];
document.all.uname.value=str.split("|")[1];
}
function selectbm()
{
var url="searchbm.jsp";
var str=window.showModalDialog(url,'','scrollbars=yes,top=0,left=0,resizable=no,status=no,toolbar=no,location=no,width=200,height=50');
document.all.bm.value=str.split("|")[0];
document.all.bmid.value=str.split("|")[1];
}
</script>
<title>差旅费报销单查询</title>

<style type="text/css">
<!--
.STYLE1 {
font-size: 36px;
font-weight: bold;
}
-->
</style>
</head>
<body >
<p class="STYLE4">差旅费报销单查询
<table width="100%" height="30" border="0" align="center">
<tr><td width="172">办事处
<input name="text" type="text" class="dep" id="bm" onClick="selectbm();" value="" size="14" readonly>
<input type="hidden" id="bmid" value="">
</td>
<td width="167">
流水号
<input type="text" name="textfield1" size="15" value="" class="lsh"> </td>
<td width="163">选人
<input type="text" id="uname" value="" size="10" onClick="selectps();" class="per" readonly>
<input type="hidden" id="uid" value=""> </td><td width="315">

<input name="text2" type="text" class="Wdate" id="text1" onFocus="new WdatePicker(this)" value="" size="12" readonly>

<input class="Wdate" type="text" id="text2" value="" onFocus="new WdatePicker(this)" MINDATE="#F{$('text1').value}" size="12" readonly>
</td>
</tr>
<tr>
<td>
大   区 <select name="select7" style="width:100px" class="lsh">
<option>请选择大区</option>
<option value="0" >川陕大区</option>
<option value="1">北方大区</option>
<option value="2">西部大区</option>
<option value="3">华南大区</option>
</select> </td>
<td>
分公司 <input type="text" name="fname" size="15" value="" class="lsh" onClick="selectfgs();" readonly>
<input type="hidden" id="fid" value=""> </td><th width="55px"><input type="button" name="Submit2" value="提交" onClick="tijiao();" class="search" style="text-align:left;width:55px"></th>
</tr>
</table>

<%
float a=0,b=0,c=0,d=0,fly=0,car=0,shinei=0,ele=0,pj=0,all=0,shisu=0,pj1=0;
//int f1,f2,f3,f4;
//String strPage=null;
//String djmc=request.getParameter("djmc");
String lsh=request.getParameter("lsh");
String bm=request.getParameter("bm");
String bxr=request.getParameter("bxr");
//System.out.print(bxr);
String date1=request.getParameter("date1");
String date2=request.getParameter("date2");
String dq=request.getParameter("dq");
String fgs=request.getParameter("fgs");
//String jine=request.getParameter("jine");
String sql="",sql1="",sql2="",sql3="",sql4="",sql5="",sql6="";
/*
out.print(date1);
out.print(date2);
out.print(dq);
out.print(fgs);
out.print(bxr);
out.print(bm);
out.print(lsh);
*/
if(lsh!="" && !"null".equals(lsh))
{
sql1="where field13='"+lsh+"' and field93=0 ";
}
else
{
sql1="where ID<>0 and field93=0 ";
}
if(bm!="" && !"null".equals(bm))
{
sql2=" and field91="+bm+"";
}
if(bxr!="" && !"null".equals(bxr))
{
sql3=" and field4="+bxr+"";
}
if(date1!="" && !"null".equals(date1)&&!"undefined".equals(date1))
{
sql4=" and field2 >='"+date1+"' ";

//sql4=" and '"+date1+"'<=field2 and field2 <='"+date2+"'";

}
if(date2!="" &&!"null".equals(date2)&&!"undefined".equals(date2))
{
sql4=" and field2 <='"+date2+"' ";

//sql4=" and '"+date1+"'<=field2 and field2 <='"+date2+"'";

}
if(!"".equals(dq) && !"null".equals(dq))
{
sql5=" and field1="+dq+" ";
}
if(fgs!="" && !"null".equals(fgs))
{
sql6=" and field92="+fgs+" ";
}
Person person=null;
int intPageSize; //一页显示的记录数
int intRowCount; //记录总数
int intPageCount; //总页数
int intPage; //待显示页码
String strPage;
int i;
//设置一页显示的记录数
intPageSize = 20;
//取得待显示页码
strPage = request.getParameter("page");
if (strPage == null) {//表明在QueryString中没有page这一个参数,此时显示第一页数据
intPage = 1;
} else {//将字符串转换成整型
intPage = java.lang.Integer.parseInt(strPage);
if (intPage < 1)
intPage = 1;
}

Connection conn = null;
Statement s= null;
ResultSet rs = null;

ResultSet rz = null;
try
{
conn = ConnectionPoolBean.getConnection();
if (conn != null) {

if(lsh==null && bm==null && bxr==null && dq==null && date1==null && date2==null)
{
sql="select * from utm_00504 where field93=0";
}
else
{
sql="select * from utm_00504 "+sql1+sql2+sql3+sql4+sql5+sql6;
}
//out.print(sql);
s = conn.createStatement();

rz=rs=s.executeQuery(sql);

rs.last();//光标在最后一行
rz.last();
int row=rz.getRow();
intRowCount = rs.getRow();//获得当前行号
intPageCount = (intRowCount + intPageSize - 1) / intPageSize;
if (intPage > intPageCount)
intPage = intPageCount;%>

<table cellspacing="0" width="100%" class="listTableStyle" id="mytable">
<thead>
<tr>

<th>流水号</th>
<!--修改号="20050926_0001java22" 区域="15" 结束-->
<th>日期</th>
<th>部门</th>
<th>报销人</th>
<th>出差事由</th>
<th>金额</th>
<th>报销金额</th>
<th>核销金额</th>
</tr>
</thead>
<tbody>
<%if (intPageCount > 0) {
//将记录指针定位到待显示页的第一条记录上
rs.absolute((intPage - 1) * intPageSize + 1);
//显示数据
i = 0;
while (i < intPageSize && !rs.isAfterLast()) {
%>

...全文
61 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
飞扬残月 2010-09-21
这一部分是统计总计的
><%
rz.first();
while(row>0)
{
if(rz.getString("field57")!=null)
{

c+=Float.parseFloat(rz.getString("field57"));

}

if(rz.getString("field97")!=null)
{

d+=Float.parseFloat(rz.getString("field97"));

}
rz.next();
row--;
}

%>
<tr class="listContentTr" onMouseOver="this.className='listContentTrOver'" onmouseout ="this.className='listContentTrOut'">
<td class="listContentTd" type="String" align="center">
<div align="center"></div>
</td>

<td class="listContentTd" type="String"> </td>


<td class="listContentTd" type="String" ><div align="center">

</td>
<td class="listContentTd" type="String" >
<div align="center"></div></td>
<td class="listContentTd" type="String" >
<div align="center"></div>
</td>
<td class="listContentTd" type="String" >表单总计</td>
<td class="listContentTd" type="String" ><%


out.print(c);%></td>
<td class="listContentTd" type="String" ><%


out.print(d);%></td>
</tr>
回复
飞扬残月 2010-09-21
    <tr class="listContentTr" onMouseOver="this.className='listContentTrOver'" onmouseout ="this.className='listContentTrOut'">
<td class="listContentTd" type="String" align="center" width="50px">
<div align="center"><%=rs.getString("field13")%></div>
</td>

<td class="listContentTd" type="String"><div align="center"><%=rs.getString("field2")%></div>

</td>


<td class="listContentTd" type="String" ><div align="center"><%
EnumValue evs1 = EnumValueFinder.findByEnum_idAndValue(102,rs.getString("field92"));
EnumValue evs2 = EnumValueFinder.findByEnum_idAndValue(99,rs.getString("field1"));
EnumValue evs3 = EnumValueFinder.findByEnum_idAndValue(101,rs.getString("field91"));
%><%=evs2.name%><br>
<%=evs1.name%><br>
<%=evs3.name%></div>

</td>
<td class="listContentTd" type="String" width="80px" >
<div align="center"><%
Person per = PersonFinder.findById(rs.getInt("field4"));
%>
<%=per.trueName%></div>


</td>
<td class="listContentTd" type="String" width="200px">
<div align="left"><%=rs.getString("field5")%></div>
</td>
<td class="listContentTd" type="String" ><%
if(rs.getString("field15")!=null)
{
fly+=Float.parseFloat(rs.getString("field15"));
}
if(rs.getString("field16")!=null)
{
fly+=Float.parseFloat(rs.getString("field16"));
}
if(rs.getString("field17")!=null)
{
fly+=Float.parseFloat(rs.getString("field17"));
}
if(fly>0)
{
out.print("飞机:"+fly+"<br>");}
if(rs.getString("field18")!=null)
{
car+=Float.parseFloat(rs.getString("field18"));
}
if(rs.getString("field19")!=null)
{
car+=Float.parseFloat(rs.getString("field19"));
}
if(rs.getString("field20")!=null)
{
car+=Float.parseFloat(rs.getString("field20"));
}
if(car>0)
{
out.print("车船:"+car+"<br>");
}
if(rs.getString("field21")!=null)
{
shinei+=Float.parseFloat(rs.getString("field21"));
}
if(rs.getString("field22")!=null)
{
shinei+=Float.parseFloat(rs.getString("field22"));
}
if(rs.getString("field23")!=null)
{
shinei+=Float.parseFloat(rs.getString("field23"));
}if(shinei>0){
out.print("市内交通:"+shinei+"<br>");
}
if(rs.getString("field24")!=null)
{
ele+=Float.parseFloat(rs.getString("field24"));
}
if(rs.getString("field25")!=null)
{
ele+=Float.parseFloat(rs.getString("field25"));
}
if(rs.getString("field26")!=null)
{
ele+=Float.parseFloat(rs.getString("field26"));
}
if(ele>0)
{ out.print("其他:"+ele+"<br>");}
if(rs.getString("field33")!=null)
{
shisu+=Float.parseFloat(rs.getString("field33"));
}
if(rs.getString("field34")!=null)
{
shisu+=Float.parseFloat(rs.getString("field34"));
}
if(rs.getString("field35")!=null)
{
shisu+=Float.parseFloat(rs.getString("field35"));
}
if(rs.getString("field42")!=null)
{
shisu+=Float.parseFloat(rs.getString("field42"));
}
if(rs.getString("field43")!=null)
{
shisu+=Float.parseFloat(rs.getString("field43"));
}
if(rs.getString("field44")!=null)
{
shisu+=Float.parseFloat(rs.getString("field44"));
}
if(shisu>0){
out.print("食宿:"+shisu+"<br>");
}
all=fly+car+shinei+ele+shisu;

if(rs.getString("field48")!=null)
{
pj+=Float.parseFloat(rs.getString("field48"));
}
if(rs.getString("field49")!=null)
{
pj+=Float.parseFloat(rs.getString("field49"));
}
if(rs.getString("field50")!=null)
{
pj+=Float.parseFloat(rs.getString("field50"));
}

out.print("合计:"+all+"<br>");
if(pj>0){
out.print("票据:"+pj+"<br>");
}
%></td>
<td class="listContentTd" type="String" ><%=rs.getString("field57")%></td>
<td class="listContentTd" type="String" ><%=rs.getString("field97")%></td>
</tr>

<%

if(rs.getString("field57")!=null)
{
a+=Float.parseFloat(rs.getString("field57"));
}

if(rs.getString("field97")!=null)
{
b+=Float.parseFloat(rs.getString("field97"));
}
pj1=+pj;
fly=0;
car=0;
pj=0;
shisu=0;
ele=0;
shinei=0;
rs.next();
i++;
}
}
%>
<tr class="listContentTr" onMouseOver="this.className='listContentTrOver'" onmouseout ="this.className='listContentTrOut'">
<td class="listContentTd" type="String" align="center">
<div align="center"></div>
</td>

<td class="listContentTd" type="String"> </td>


<td class="listContentTd" type="String" ><div align="center">

</td>
<td class="listContentTd" type="String" >
<div align="center"></div></td>
<td class="listContentTd" type="String" >
<div align="center"></div>
</td>
<td class="listContentTd" type="String" >本页合计</td>
<td class="listContentTd" type="String" ><%


out.print(a);%></td>
<td class="listContentTd" type="String" ><%


out.print(b);%></td>
</tr><%
rz.first();
while(row>0)
{
if(rz.getString("field57")!=null)
{

c+=Float.parseFloat(rz.getString("field57"));

}

if(rz.getString("field97")!=null)
{

d+=Float.parseFloat(rz.getString("field97"));

}
rz.next();
row--;
}

%>
<tr class="listContentTr" onMouseOver="this.className='listContentTrOver'" onmouseout ="this.className='listContentTrOut'">
<td class="listContentTd" type="String" align="center">
<div align="center"></div>
</td>

<td class="listContentTd" type="String"> </td>


<td class="listContentTd" type="String" ><div align="center">

</td>
<td class="listContentTd" type="String" >
<div align="center"></div></td>
<td class="listContentTd" type="String" >
<div align="center"></div>
</td>
<td class="listContentTd" type="String" >表单总计</td>
<td class="listContentTd" type="String" ><%


out.print(c);%></td>
<td class="listContentTd" type="String" ><%


out.print(d);%></td>
</tr>
</table>


<div align="right">
第<%=intPage%>页 共<%=intPageCount%>页<% int c_page=0; if (intPage > 1) { c_page=intPage-1; %>
<a href=<%="?page="+c_page+"&lsh="+lsh+"&bm="+bm+"&bxr="+bxr+"&date1="+date1+"&date2="+date2+"&dq="+dq+"&fgs="+fgs+""%>> 上一页</a><%}%>
<%if (intPage < intPageCount) { c_page=intPage+1; %>
<a href=<%="?page="+c_page+"&lsh="+lsh+"&bm="+bm+"&bxr="+bxr+"&date1="+date1+"&date2="+date2+"&dq="+dq+"&fgs="+fgs+""%>>下一页 </a><%}%></div></div><%


}
}
catch(SQLException se){
out.println("数据库连接失败!");}
finally
{
try{//关闭顺序 rs,s,con
if(rs!=null)rs.close();
if(s!=null) s.close();
if(conn!=null) conn.close();
}catch(SQLException sqle){sqle.printStackTrace();}
}


%>

<script language=javascript>
function check(){
re = new RegExp("^[0-9][0-9]*$");
if (!lzForm.test.value.match(re)){
alert("必须输入数字");
return false;
}
}
</script>

</body>
</html>
回复
youjianbo_han_87 2010-09-21
看不懂。。。。。。
回复
zn85600301 2010-09-21
你把问题描述清楚点 这样贴 别人怎么看
回复
andesen 2010-09-21
汗,不用一来就发这么多代码吧。
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-09-21 10:27
社区公告
暂无公告