//二次续期
userBean.executeQuery(
" select a.aracde,count(distinct b.chdrnum) as jianshu_2,sum(b.instprem) as baofei_2 into b2# "
+ " from newagent a,covrpf b,chdrpf c,hpadpf d "
+ " where a.agntnum = c.agntnum and b.chdrnum = c.chdrnum and c.chdrnum=d.chdrnum "
+ " and b.validflag='1' and b.statcode='IF' and substring(b.crtable,4,1)='P' and b.instprem>0 "
+ " and c.validflag='1' and c.statcode='IF' and b.crtable not like 'H%' and c.cnttype not in ('H01','H02') "
+ " and ((cast(substring(cast(c.occdate as char),1,4) as int)="+(int_year-1)+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+int_month+" and c.billfreq in ('01','02')) "
+ " or (cast(substring(cast(c.occdate as char),1,4) as int)="+ban_year1+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+ban_month1+" and c.billfreq='01')) "
+ " and d.zcllctor=' ' and d.validflag='1' "
+ " group by a.aracde"
);
userBean.executeQuery(
" select a.aracde,count(distinct b.chdrnum) as jianshu_2,sum(b.instprem) as baofei_2 into b2# "
+ " from newagent a,covrpf b,chdrpf c,hpadpf d "
+ " where a.agntnum = c.agntnum and b.chdrnum = c.chdrnum and c.chdrnum=d.chdrnum "
+ " and b.validflag='1' and b.statcode='IF' and substring(b.crtable,4,1)='P' and b.instprem>0 "
+ " and c.validflag='1' and c.statcode='IF' and b.crtable not like 'H%' and c.cnttype not in ('H01','H02') "
+ " and ((cast(substring(cast(c.occdate as char),1,4) as int)="+(int_year-1)+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+int_month+" and c.billfreq in ('01','02')) "
+ " or (cast(substring(cast(c.occdate as char),1,4) as int)="+ban_year1+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+ban_month1+" and c.billfreq='01')) "
+ " and d.zcllctor=' ' and d.validflag='1' "
+ " group by a.aracde"
);
userBean.executeQuery(
" select a.aracde,count(distinct b.chdrnum) as jianshu_3,sum(b.instprem) as baofei_3 into b3# "
+ " from newagent a,covrpf b,chdrpf c,hpadpf d "
+ " where a.agntnum = c.agntnum and b.chdrnum = c.chdrnum and c.chdrnum=d.chdrnum "
+ " and b.validflag='1' and b.statcode='IF' and substring(b.crtable,4,1)='P' and b.instprem>0 "
+ " and c.validflag='1' and c.statcode='IF' and b.crtable not like 'H%' and c.cnttype not in ('H01','H02') "
+ " and ((cast(substring(cast(c.occdate as char),1,4) as int)="+(int_year-2)+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+int_month+" and c.billfreq in ('01','02')) "
+ " or (cast(substring(cast(c.occdate as char),1,4) as int)="+ban_year2+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+ban_month2+" and c.billfreq='01')) "
+ " and d.zcllctor=' ' and d.validflag='1' "
+ " group by a.aracde "
);
//四次续期
userBean.executeQuery(
" select a.aracde,count(distinct b.chdrnum) as jianshu_4,sum(b.instprem) as baofei_4 into b4# "
+ " from newagent a,covrpf b,chdrpf c,hpadpf d "
+ " where a.agntnum = c.agntnum and b.chdrnum = c.chdrnum and c.chdrnum=d.chdrnum "
+ " and b.validflag='1' and b.statcode='IF' and substring(b.crtable,4,1)='P' and b.instprem>0 "
+ " and c.validflag='1' and c.statcode='IF' and b.crtable not like 'H%' and c.cnttype not in ('H01','H02') "
+ " and ((cast(substring(cast(c.occdate as char),1,4) as int)<="+(int_year-3)+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+int_month+" and c.billfreq in ('01','02')) "
+ " or (cast(substring(cast(c.occdate as char),1,4) as int)<="+ban_year3+" "
+ " and cast(substring(cast(c.occdate as char),5,2) as int)="+ban_month3+" and c.billfreq='01') "
+ " or (c.billfreq='12')) "
+ " and d.zcllctor=' ' and d.validflag='1' "
+ " group by a.aracde "
);
------------------------------------------------
//合并
userBean.executeQuery(
"select chu_name2.aracde,chu_name2.chu_name,b1#.jianshu_1,b1#.baofei_1, "
+ " b2#.jianshu_2,b2#.baofei_2,b3#.jianshu_3,b3#.baofei_3,b4#.jianshu_4,b4#.baofei_4 "
+ " into b5# from chu_name2 "
+ " left outer join b1# on b1#.aracde=chu_name2.aracde "
+ " left outer join b2# on b2#.aracde=chu_name2.aracde "
+ " left outer join b3# on b3#.aracde=chu_name2.aracde "
+ " left outer join b4# on b4#.aracde=chu_name2.aracde "
+ " group by chu_name2.aracde,chu_name2.chu_name,b1#.jianshu_1,b1#.baofei_1,b2#.jianshu_2,b2#.baofei_2,b3#.jianshu_3,b3#.baofei_3,b4#.jianshu_4,b4#.baofei_4"
+ " order by chu_name2.aracde "
);
userBean.executeQuery(
"update b5# set jianshu_1=0 where jianshu_1 is null ; "
+ "update b5# set baofei_1=0 where baofei_1 is null ; "
+ "update b5# set jianshu_2=0 where jianshu_2 is null ; "
+ "update b5# set baofei_2=0 where baofei_2 is null ; "
+ "update b5# set jianshu_3=0 where jianshu_3 is null ; "
+ "update b5# set baofei_3=0 where baofei_3 is null ; "
+ "update b5# set jianshu_4=0 where jianshu_4 is null ; "
+ "update b5# set baofei_4=0 where baofei_4 is null ; "
);
/*************************************
userBean.executeQuery(
" select * into b6# from b5#"
);
userBean.executeQuery(
" insert into b5#(aracde,chu_name,jianshu_1,baofei_1,jianshu_2,baofei_2,jianshu_3,baofei_3,jianshu_4,baofei_4 )"
+" select '合计','值',sum(jianshu_1),sum(baofei_1),sum(jianshu_2),"
+" sum(baofei_2),sum(jianshu_3),sum(baofei_3),sum(jianshu_4),sum(baofei_4) from b6#"
);
**************************************/
userBean.executeQuery(
" select * into b6# from b5#"
);
userBean.executeQuery(
" insert into b5#(aracde,chu_name,jianshu_1,baofei_1,jianshu_2,baofei_2,jianshu_3,baofei_3,jianshu_4,baofei_4 )"
+" select '合计','值',sum(jianshu_1),sum(baofei_1),sum(jianshu_2),"
+" sum(baofei_2),sum(jianshu_3),sum(baofei_3),sum(jianshu_4),sum(baofei_4) from b6#"
);
ResultSet rs=userBean.executeQuery("select * from b5# order by aracde");
while(rs.next())
{
total=rs.getString(1).trim(); if (total.equals("合计"))
{
%>
<TR>
<TD bgcolor="#0FC9F0" align=center ><FONT size='2'><%=rs.getString(1)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(2)%></FONT></TD>
<TD align=center><FONT size='2'><%=rs.getString(3)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(4)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(5)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(6)%></FONT></TD>
<TD align=center><FONT size='2'><%=rs.getString(7)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(8)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(9)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(10)%></FONT></TD>
</TR>
<%
}
else
{
%>
<TD align=center ><FONT size='2'><%=rs.getString(1)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(2)%></FONT></TD>
<TD align=center><FONT size='2'><%=rs.getString(3)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(4)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(5)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(6)%></FONT></TD>
<TD align=center><FONT size='2'><%=rs.getString(7)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(8)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(9)%></FONT></TD>
<TD align=center ><FONT size='2'><%=rs.getString(10)%></FONT></TD>
<%
}
userBean.executeQuery("drop table b5#,b1#,b2#,b3#,b4#,b6# ");
}
catch( Exception e)
{
out.println("出现异常错误!");
}finally
{
//rs.close();
//stmt.close();
//conn.close();
}
//if (rs!=null) rs.close();
//if (sqlst!=null) sqlst.close();
//if (con!=null) con.close();
%>
</TABLE>
<table><tr>
<td><input type="button" value="自动生成EXCEL表" onclick="exportExcel(tblData1)"></td></tr></table>
<center><table><tr><td valign=top></CENTER>
</body>
</html>
}
----------------------------------->此处少"}"!!
catch( Exception e)
{
不行啊
为什么我用IF(I(I00)就可以啊?怎么这么奇怪!
你把' 合计 ' 换成“ 双引号
-->if (rs.getString(1).trim().equals("合计"))单引号只能够表示单个字符.
我本来就加的双引号啊
if (rs.getString(1).trim().equals("合计"))这个也试过没有用的
怎么就真的没人会啊
我主要是想在同一个页面里面做两种不同的合计,一个是组的合计,一个是总的合计所以想通过if (rs.getString(1).trim().equals("合计"))来判断,老大门看看你们有什么别的
方法解决这种在同一个页面分别合计的问题
如:
select id,price from table
union
select '合计' as id sum(price) as price from table
这样不是很方便吗?
String type="";
if(!(rs.getString(1).trim().length()==0))
type=rs.getString(1).trim();
if(type.equals("组合计"))
..........
else if(type.equals("合计"))
..............
ced at line 297 which breaks scope '_base_service_scope_'这样的错
,难道就真的没有人可以搞定这个问题!
或者哪位高手有别的方法可以解决这样的问题,请赐教!