level 5
无敌VS超人
楼主
做了缴款表,发现随着天数增多,查询速度越来越慢,麻烦帮忙修改
<!--#include file=dbconn.asp -->
<%
bbrq1=Request("sbbrq")
bbrq2=Request("ebbrq")
d=date()
rq=bbrq2-bbrq1+1
%>
<%
if bbrq1<>"" then
bbrqs=bbrq1
else
if month(d)<10 then
bbrqs=year(d)&"0"&month(d)&"01"
else
bbrqs=year(d)&month(d)&"01"
end if
end if
%>
<%
if bbrq2<>"" then
bbrqe=bbrq2
else
if month(d)<10 then
if day(d)<10 then
bbrqe=year(d)&"0"&month(d)&"0"&day(d)
else
bbrqe=year(d)&"0"&month(d)&day(d)
end if
else
bbrqe=year(d)&month(d)&day(d)
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/private.css" rel="stylesheet" type="text/css" />
<LINK href=site.css rel=stylesheet>
<title>差异说明生成系统</title>
<link href="css.css" type=text/css rel=stylesheet>
<script language="javascript" >
<!--
function check(frm)
{
var abbrq=frm.sbbrq.value
var bbbrq=frm.ebbrq.value
if (frm.xgs.value=="")
{
alert ("请选择所属县/市");
frm.xgs.focus();
return false;
}
if (abbrq=="")
{
alert ("请选择开始日期……");
frm.sbbrq.focus();
return false;
}
if (bbbrq=="")
{
alert ("请选择结束日期……");
frm.ebbrq.focus();
return false;
}
return true;
}
--></script>
<script language='javascript' src='images/private.js'></SCRIPT>
<script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<style>
<!--
body {
font-family: "宋体";
font-size: 12pt
}
.STYLE5 {
color: #FF0000
}
.STYLE6 {
font-size: 36mm
}
-->
</style>
</head>
<body topmargin="0">
<br>
<span class="STYLE6"></span>
<form name="form1" method="post" action="" onSubmit="return check(this);">
<table width="100%" border="0" align="center" cellpadding="0" cel
lsp
acing="0" bordercolor="<%=border%>">
<tr>
<td><div align="center">请选择所属县/市:
<select name="xgs" id="xgs">
<option value="">请选择……</option>
<option value="滨海">滨海</option>
<option value="盐都邮政">盐都邮政</option>
</select>
请选择开始日期:
<input name="sbbrq" type="text" class="Wdate" id="d244" onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyyMMdd'})" value="<%=bbrqs%>"/>
请选择结束日期:
<input name="ebbrq" type="text" class="Wdate" id="d244" onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyyMMdd'})" value="<%=bbrqe%>"/>
<input type=submit name="submit" value="查 询" style="width:70px; height:19px;" >
</div></td>
</tr>
</table>
</form>
<br>
<%
if Request("xgs")="" then
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="<%=border%>">
<tr>
<td><div align="center" class="STYLE5">请选择你让你所属的县/市和报表的账期!<%=day(date())%></div></td>
</tr>
</table>
<%
else
xgs1=Request("xgs")
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="<%=border%>">
<tr>
<td>农行缴款单<span class="STYLE5">(当前所属县/市为:<%=xgs1%>,账期为:<%=bbrq1%>到<%=bbrq2%>)</span></td>
</tr>
</table>
<% a=666+rq*222
%>
<table width='<%=a%>' border="1" align=center cellpadding="0" cellspacing="0" bordercolor="<%=border%>" id="outStudent" style="border-collapse: collapse">
<tr align="center" height=20>
<td width="74" rowspan="2">县市</td>
<td width="222" rowspan="2">营业厅名称</td>
<td width="74" rowspan="2">营业厅编码</td>
<td width="74" rowspan="2">上月累计未缴</td>
<% for i=bbrq1 to bbrq2 Step 1
ii=mid(i,7,2)
%>
<td colspan="3"><%=ii%>号</td>
<%next%>
</tr>
<tr align="center" height=20>
<% for i=bbrq1 to bbrq2 Step 1 %>
<td width="74">当日应缴</td>
<td width="74">当日缴款</td>
<td width="74">累计未缴</td>
<%next%>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from yyt where yhxx='农行' and xgs='"&xgs1&"'"
rs.open sql,conn,1,3
%>
<% do while Not rs.EOF %>
<tr align="center" height=20>
<td width="74"><%= rs("xgs") %></td>
<td width="222"><%= rs("yyt") %></td>
<td width="74"><%= rs("yytid") %></td>
<%
if mid(bbrq1,4,2)=01 then
wkrq2=mid(bbrq1,1,6)-89
else
wkrq2=mid(bbrq1,1,6)-1
end if
set rs0=server.createobject("adodb.recordset")
sql0 = "select * from wk where yyt='"&rs("yyt") &"'and yhxx='农行' and wkrq="&wkrq2
rs0.open sql0,conn,1,3
wkje=0
%>
<%if rs0.bof and rs0.eof then
kwje=0
else
wkje= rs0("wkje")
end if%>
<td width="74"><%=wkje%></td>
<%'wkje=wkje%>
<%rs0.close
set rs0=nothing
%>
<% for i=bbrq1 to bbrq2 Step 1 %>
<%
set rs1=server.createobject("adodb.recordset")
sql1 = "select * from yjhj where yyt='"&rs("yyt") &"'and bbrq="&i
rs1.open sql1,conn,1,3
%>
<%
set rs2=server.createobject("adodb.recordset")
sql2 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&i&" GROUP BY yyt"
rs2.open sql2,conn,1,3
%>
<% yjhj=0
if rs1.bof and rs1.eof then
yjhj=0
else
yjhj=rs1("yjhj")
end if
%>
<td width="74"><%=yjhj%></td>
<% sjhj=0
if rs2.bof and rs2.eof then
sjhj=0
else
sjhj=rs2("sjhj")
end if
%>
<td width="74"><%=sjhj%></td>
<%
if mid(i,7,2)=01 then
ljwj=FormatNumber(wkje+yjhj-sjhj,2,-1,0,0)
else
ljwj=FormatNumber(ljwj+yjhj-sjhj,2,-1,0,0)
end if
%>
<td width="74"><%=ljwj%></td>
<%
rs2.close
set rs2=nothing
%>
<%
rs1.close
set rs1=nothing
%>
<%next%>
</tr>
<%
rs.MoveNext
loop
rs.close
set rs=nothing
%>
</table>
<p align=center>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="<%=border%>">
<tr>
<td>邮政缴款单<span class="STYLE5">(当前所属县/市为: <%=xgs1%>,账期为:<%=bbrq1%>到<%=bbrq2%>)</span></td>
</tr>
</table>
<% a=666+rq*222
%>
<table width='<%=a%>' border="1" align=center cellpadding="0" cellspacing="0" bordercolor="<%=border%>" id="outStudent" style="border-collapse: collapse">
<tr align="center" height=20>
<td width="74" rowspan="2">县市</td>
<td width="222" rowspan="2">营业厅名称</td>
<td width="74" rowspan="2">营业厅编码</td>
<td width="74" rowspan="2">上月累计未缴</td>
<% for i=bbrq1 to bbrq2 Step 1
ii=mid(i,7,2)
%>
<td colspan="3"><%=ii%>号</td>
<%next%>
</tr>
<tr align="center" height=20>
<% for i=bbrq1 to bbrq2 Step 1 %>
<td width="74">当日应缴</td>
<td width="74">当日缴款</td>
<td width="74">累计未缴</td>
<%next%>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from yyt where yhxx='邮政' and xgs='"&xgs1&"'"
rs.open sql,conn,1,3
%>
<% do while Not rs.EOF %>
<tr align="center" height=20>
<td width="74"><%= rs("xgs") %></td>
<td width="222"><%= rs("yyt") %></td>
<td width="74"><%= rs("yytid") %></td>
<%
if mid(bbrq1,4,2)=01 then
wkrq2=mid(bbrq1,1,6)-89
else
wkrq2=mid(bbrq1,1,6)-1
end if
set rs0=server.createobject("adodb.recordset")
sql0 = "select * from wk where yyt='"&rs("yyt") &"'and yhxx='邮政' and wkrq="&wkrq2
rs0.open sql0,conn,1,3
wkje=0
%>
<%if rs0.bof and rs0.eof then
kwje=0
else
wkje= rs0("wkje")
end if%>
<td width="74"><%=wkje%></td>
<%'wkje=wkje%>
<%rs0.close
set rs0=nothing
%>
<% for i=bbrq1 to bbrq2 Step 1 %>
<%
set rs1=server.createobject("adodb.recordset")
sql1 = "select * from yjhj where yyt='"&rs("yyt") &"'and bbrq="&i
rs1.open sql1,conn,1,3
%>
<%
set rs2=server.createobject("adodb.recordset")
sql2 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&i&" GROUP BY yyt"
rs2.open sql2,conn,1,3
%>
<% yjhj=0
if rs1.bof and rs1.eof then
yjhj=0
else
yjhj=rs1("yjhj")
end if
%>
<td width="74"><%=yjhj%></td>
<%
if mid(i,7,2)=01 then
b=mid(i,1,6)
if mid(b,5,2)=01 then
bb=b-89
else
bb=b-1
end if
aa=mid(bb,5,2)
cc=mid(bb,1,4)
set rs3=server.createobject("adodb.recordset")
select case aa
case 01
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "02"
if (cc mod 4)=0 then
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"29 GROUP BY yyt"
else
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"28 GROUP BY yyt"
end if
case "03"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "04"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "05"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "06"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "07"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "08"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "09"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "10"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "11"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "12"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
end select
rs3.open sql3,conn,1,3
sjhj=0
if rs2.bof and rs2.eof then
sjhj=0
else
sjhj=rs2("sjhj")
end if
sjhj1=0
if rs3.bof and rs3.eof then
sjhj1=0
else
sjhj1=rs3("sjhj")
end if
sjhj2=sjhj+sjhj1
%><td width="74"><%=sjhj2%></td>
<%rs3.close
set rs3=nothing
else
sjhj=0
if rs2.bof and rs2.eof then
sjhj=0
else
sjhj=rs2("sjhj")
end if
%><td width="74"><%=sjhj%></td>
<%
end if
%>
<%
if mid(i,7,2)=01 then
ljwj=FormatNumber(wkje+yjhj-sjhj2,2,-1,0,0)
else
ljwj=FormatNumber(ljwj+yjhj-sjhj,2,-1,0,0)
end if
%>
<td width="74"><%=ljwj%></td>
<%
rs2.close
set rs2=nothing
%>
<%
rs1.close
set rs1=nothing
%>
<%next%>
</tr>
<%
rs.MoveNext
loop
rs.close
set rs=nothing
%>
</table>
<%end if%>
</body>
</html>
2016年06月22日 13点06分
1
<!--#include file=dbconn.asp -->
<%
bbrq1=Request("sbbrq")
bbrq2=Request("ebbrq")
d=date()
rq=bbrq2-bbrq1+1
%>
<%
if bbrq1<>"" then
bbrqs=bbrq1
else
if month(d)<10 then
bbrqs=year(d)&"0"&month(d)&"01"
else
bbrqs=year(d)&month(d)&"01"
end if
end if
%>
<%
if bbrq2<>"" then
bbrqe=bbrq2
else
if month(d)<10 then
if day(d)<10 then
bbrqe=year(d)&"0"&month(d)&"0"&day(d)
else
bbrqe=year(d)&"0"&month(d)&day(d)
end if
else
bbrqe=year(d)&month(d)&day(d)
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/private.css" rel="stylesheet" type="text/css" />
<LINK href=site.css rel=stylesheet>
<title>差异说明生成系统</title>
<link href="css.css" type=text/css rel=stylesheet>
<script language="javascript" >
<!--
function check(frm)
{
var abbrq=frm.sbbrq.value
var bbbrq=frm.ebbrq.value
if (frm.xgs.value=="")
{
alert ("请选择所属县/市");
frm.xgs.focus();
return false;
}
if (abbrq=="")
{
alert ("请选择开始日期……");
frm.sbbrq.focus();
return false;
}
if (bbbrq=="")
{
alert ("请选择结束日期……");
frm.ebbrq.focus();
return false;
}
return true;
}
--></script>
<script language='javascript' src='images/private.js'></SCRIPT>
<script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<style>
<!--
body {
font-family: "宋体";
font-size: 12pt
}
.STYLE5 {
color: #FF0000
}
.STYLE6 {
font-size: 36mm
}
-->
</style>
</head>
<body topmargin="0">
<br>
<span class="STYLE6"></span>
<form name="form1" method="post" action="" onSubmit="return check(this);">
<table width="100%" border="0" align="center" cellpadding="0" cel
lsp
acing="0" bordercolor="<%=border%>">
<tr>
<td><div align="center">请选择所属县/市:
<select name="xgs" id="xgs">
<option value="">请选择……</option>
<option value="滨海">滨海</option>
<option value="盐都邮政">盐都邮政</option>
</select>
请选择开始日期:
<input name="sbbrq" type="text" class="Wdate" id="d244" onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyyMMdd'})" value="<%=bbrqs%>"/>
请选择结束日期:
<input name="ebbrq" type="text" class="Wdate" id="d244" onFocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyyMMdd'})" value="<%=bbrqe%>"/>
<input type=submit name="submit" value="查 询" style="width:70px; height:19px;" >
</div></td>
</tr>
</table>
</form>
<br>
<%
if Request("xgs")="" then
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="<%=border%>">
<tr>
<td><div align="center" class="STYLE5">请选择你让你所属的县/市和报表的账期!<%=day(date())%></div></td>
</tr>
</table>
<%
else
xgs1=Request("xgs")
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="<%=border%>">
<tr>
<td>农行缴款单<span class="STYLE5">(当前所属县/市为:<%=xgs1%>,账期为:<%=bbrq1%>到<%=bbrq2%>)</span></td>
</tr>
</table>
<% a=666+rq*222
%>
<table width='<%=a%>' border="1" align=center cellpadding="0" cellspacing="0" bordercolor="<%=border%>" id="outStudent" style="border-collapse: collapse">
<tr align="center" height=20>
<td width="74" rowspan="2">县市</td>
<td width="222" rowspan="2">营业厅名称</td>
<td width="74" rowspan="2">营业厅编码</td>
<td width="74" rowspan="2">上月累计未缴</td>
<% for i=bbrq1 to bbrq2 Step 1
ii=mid(i,7,2)
%>
<td colspan="3"><%=ii%>号</td>
<%next%>
</tr>
<tr align="center" height=20>
<% for i=bbrq1 to bbrq2 Step 1 %>
<td width="74">当日应缴</td>
<td width="74">当日缴款</td>
<td width="74">累计未缴</td>
<%next%>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from yyt where yhxx='农行' and xgs='"&xgs1&"'"
rs.open sql,conn,1,3
%>
<% do while Not rs.EOF %>
<tr align="center" height=20>
<td width="74"><%= rs("xgs") %></td>
<td width="222"><%= rs("yyt") %></td>
<td width="74"><%= rs("yytid") %></td>
<%
if mid(bbrq1,4,2)=01 then
wkrq2=mid(bbrq1,1,6)-89
else
wkrq2=mid(bbrq1,1,6)-1
end if
set rs0=server.createobject("adodb.recordset")
sql0 = "select * from wk where yyt='"&rs("yyt") &"'and yhxx='农行' and wkrq="&wkrq2
rs0.open sql0,conn,1,3
wkje=0
%>
<%if rs0.bof and rs0.eof then
kwje=0
else
wkje= rs0("wkje")
end if%>
<td width="74"><%=wkje%></td>
<%'wkje=wkje%>
<%rs0.close
set rs0=nothing
%>
<% for i=bbrq1 to bbrq2 Step 1 %>
<%
set rs1=server.createobject("adodb.recordset")
sql1 = "select * from yjhj where yyt='"&rs("yyt") &"'and bbrq="&i
rs1.open sql1,conn,1,3
%>
<%
set rs2=server.createobject("adodb.recordset")
sql2 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&i&" GROUP BY yyt"
rs2.open sql2,conn,1,3
%>
<% yjhj=0
if rs1.bof and rs1.eof then
yjhj=0
else
yjhj=rs1("yjhj")
end if
%>
<td width="74"><%=yjhj%></td>
<% sjhj=0
if rs2.bof and rs2.eof then
sjhj=0
else
sjhj=rs2("sjhj")
end if
%>
<td width="74"><%=sjhj%></td>
<%
if mid(i,7,2)=01 then
ljwj=FormatNumber(wkje+yjhj-sjhj,2,-1,0,0)
else
ljwj=FormatNumber(ljwj+yjhj-sjhj,2,-1,0,0)
end if
%>
<td width="74"><%=ljwj%></td>
<%
rs2.close
set rs2=nothing
%>
<%
rs1.close
set rs1=nothing
%>
<%next%>
</tr>
<%
rs.MoveNext
loop
rs.close
set rs=nothing
%>
</table>
<p align=center>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="<%=border%>">
<tr>
<td>邮政缴款单<span class="STYLE5">(当前所属县/市为: <%=xgs1%>,账期为:<%=bbrq1%>到<%=bbrq2%>)</span></td>
</tr>
</table>
<% a=666+rq*222
%>
<table width='<%=a%>' border="1" align=center cellpadding="0" cellspacing="0" bordercolor="<%=border%>" id="outStudent" style="border-collapse: collapse">
<tr align="center" height=20>
<td width="74" rowspan="2">县市</td>
<td width="222" rowspan="2">营业厅名称</td>
<td width="74" rowspan="2">营业厅编码</td>
<td width="74" rowspan="2">上月累计未缴</td>
<% for i=bbrq1 to bbrq2 Step 1
ii=mid(i,7,2)
%>
<td colspan="3"><%=ii%>号</td>
<%next%>
</tr>
<tr align="center" height=20>
<% for i=bbrq1 to bbrq2 Step 1 %>
<td width="74">当日应缴</td>
<td width="74">当日缴款</td>
<td width="74">累计未缴</td>
<%next%>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from yyt where yhxx='邮政' and xgs='"&xgs1&"'"
rs.open sql,conn,1,3
%>
<% do while Not rs.EOF %>
<tr align="center" height=20>
<td width="74"><%= rs("xgs") %></td>
<td width="222"><%= rs("yyt") %></td>
<td width="74"><%= rs("yytid") %></td>
<%
if mid(bbrq1,4,2)=01 then
wkrq2=mid(bbrq1,1,6)-89
else
wkrq2=mid(bbrq1,1,6)-1
end if
set rs0=server.createobject("adodb.recordset")
sql0 = "select * from wk where yyt='"&rs("yyt") &"'and yhxx='邮政' and wkrq="&wkrq2
rs0.open sql0,conn,1,3
wkje=0
%>
<%if rs0.bof and rs0.eof then
kwje=0
else
wkje= rs0("wkje")
end if%>
<td width="74"><%=wkje%></td>
<%'wkje=wkje%>
<%rs0.close
set rs0=nothing
%>
<% for i=bbrq1 to bbrq2 Step 1 %>
<%
set rs1=server.createobject("adodb.recordset")
sql1 = "select * from yjhj where yyt='"&rs("yyt") &"'and bbrq="&i
rs1.open sql1,conn,1,3
%>
<%
set rs2=server.createobject("adodb.recordset")
sql2 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&i&" GROUP BY yyt"
rs2.open sql2,conn,1,3
%>
<% yjhj=0
if rs1.bof and rs1.eof then
yjhj=0
else
yjhj=rs1("yjhj")
end if
%>
<td width="74"><%=yjhj%></td>
<%
if mid(i,7,2)=01 then
b=mid(i,1,6)
if mid(b,5,2)=01 then
bb=b-89
else
bb=b-1
end if
aa=mid(bb,5,2)
cc=mid(bb,1,4)
set rs3=server.createobject("adodb.recordset")
select case aa
case 01
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "02"
if (cc mod 4)=0 then
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"29 GROUP BY yyt"
else
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"28 GROUP BY yyt"
end if
case "03"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "04"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "05"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "06"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "07"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "08"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "09"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "10"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
case "11"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"30 GROUP BY yyt"
case "12"
sql3 = "select yyt, Sum(je) AS sjhj from sj where yyt='"&rs("yyt") &"'and jyrq="&bb&"31 GROUP BY yyt"
end select
rs3.open sql3,conn,1,3
sjhj=0
if rs2.bof and rs2.eof then
sjhj=0
else
sjhj=rs2("sjhj")
end if
sjhj1=0
if rs3.bof and rs3.eof then
sjhj1=0
else
sjhj1=rs3("sjhj")
end if
sjhj2=sjhj+sjhj1
%><td width="74"><%=sjhj2%></td>
<%rs3.close
set rs3=nothing
else
sjhj=0
if rs2.bof and rs2.eof then
sjhj=0
else
sjhj=rs2("sjhj")
end if
%><td width="74"><%=sjhj%></td>
<%
end if
%>
<%
if mid(i,7,2)=01 then
ljwj=FormatNumber(wkje+yjhj-sjhj2,2,-1,0,0)
else
ljwj=FormatNumber(ljwj+yjhj-sjhj,2,-1,0,0)
end if
%>
<td width="74"><%=ljwj%></td>
<%
rs2.close
set rs2=nothing
%>
<%
rs1.close
set rs1=nothing
%>
<%next%>
</tr>
<%
rs.MoveNext
loop
rs.close
set rs=nothing
%>
</table>
<%end if%>
</body>
</html>