标题:关于分页显示后的求和、小写转大写问题!!
只看楼主
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
 问题点数:0 回复次数:22 
关于分页显示后的求和、小写转大写问题!!

问题之一:和值永远为空,什么也没有。
问题之二:小写转大写永远是贰佰贰拾贰亿贰仟贰佰贰拾贰万贰仟贰佰贰拾贰元(也就是22222222222)

代码如下:
<TD height="25" align="center">列表标题</TD>
<td width="12%" height="25" align="center" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">内容</td>
……
<%
uptime=cstr(trim(request("uptime")))
uptime1=cstr(trim(request("uptime1")))
PageShowSize = 10 '每页显示多少个页
MyPageSize = 20 '每页显示多少条
If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
Page=1
Else
Page=Int(Abs(Request("page")))
End if

set rs=server.CreateObject("ADODB.RecordSet")
if Request("user_zhuozhe_name")="" and Request("user_dangwei_file")="" and Request("user_fashong_fangshi")="" then
rs.Source="select * from client where kfsj between #"&uptime&"# and #"&uptime1&"# order by id desc"
else
if Request("user_fashong_fangshi")="" then
if Request("user_dangwei_file")="" then
rs.Source="select * from client where zhuozhe_name like '%"&Request("user_zhuozhe_name")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
else
rs.Source="select * from client where client_adr like '%"&Request("user_dangwei_file")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
else
rs.Source="select * from client where fashong_fangshi like '%"&request("user_fashong_fangshi")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
end if
rs.Open rs.Source,conn,1,1

if not rs.EOF then
rs.PageSize = MyPageSize
MaxPages = rs.PageCount
rs.absolutepage = Page
total = rs.RecordCount
for i=1 to rs.PageSize
if not rs.EOF then
%>

<tr>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"><input name="selBigClass" type="checkbox" id="selBigClass" value="<%=rs("ID")%>"><a href="invoice_search03.Asp?id=<%=rs("ID")%>&action=edit"><%=rs("kfsj")%></a></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%for j=1 to 3-len(rs("kfbm_person"))%>0<%next%><%=rs("kfbm_person")%></a></td>
<td height="18" align="left" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("zhuozhe_name")%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("client_adr")%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("client_file")%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("fashong_fangshi")%></td>
<td height="18" align="right" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=rs("freight")%></td>
</TR>
<%
rs.MoveNext
end if
next
%>

<% if rs.eof Then
’//以下这一段是按上面的查询条件进行求和
set rs=server.CreateObject("ADODB.RecordSet")
if Request("user_zhuozhe_name")="" and Request("user_dangwei_file")="" and Request("user_fashong_fangshi")="" then
rs.Source="select sum(freight) as num from client where kfsj between #"&uptime&"# and #"&uptime1&"# order by id desc"
else
if Request("user_fashong_fangshi")="" then
if Request("user_dangwei_file")="" then
rs.Source="select sum(freight) as num from client where zhuozhe_name like '%"&Request("user_zhuozhe_name")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
else
rs.Source="select sum(freight) as num from client where client_adr like '%"&Request("user_dangwei_file")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
else
rs.Source="select sum(freight) as num from client where fashong_fangshi like '%"&request("user_fashong_fangshi")&"%' and (kfsj between #"&uptime&"# and #"&uptime1&"#) order by id desc"
end if
end if
rs.Open rs.Source,conn,1,1
’//以下是小写转大写
thenumber=num
call Money(22222222222)
function Money(thenumber)
dim n,String1,String2,length
dim one(),onestr()
String1="零壹贰叁肆伍陆柒捌玖"
String2="万仟佰拾亿仟佰拾万仟佰拾元"
length=len(thenumber)
redim one(length-1)
redim onestr(length-1)
for n=0 to length-1
one(n)=mid(thenumber,n+1,1)
one(n)=mid(string1,one(n)+1,1)
onestr(n)=mid(string2,14-length+n,1)
one(n)=one(n)&onestr(n)
next
Money=replace(join(one)," ","")
Money=replace(Money,"零元","元")
Money=replace(Money,"零万","万")
Money=replace(Money,"零亿","亿")
Money=replace(Money,"零仟","零")
Money=replace(Money,"零佰","零")
Money=replace(Money,"零拾","零")
do while not instr(Money,"零零")=0
Money=replace(Money,"零零","零")
loop
end function
%>
’//以下是显示合计值
<tr>
<td width="12%" height="22" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;&nbsp;&nbsp;&nbsp;合&nbsp;&nbsp;&nbsp;计</a></td>
<td width="7%" height="18" align="left" class="but" colspan="5" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;&nbsp;大&nbsp;写:&nbsp;<%=rs("Money")%></td>
<td width="8%" height="18" align="right" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'">&nbsp;<%=num%></td>
<%end if %>
</tr>

<%end if%>
&nbsp;共 <%=total%> 条,当前第 <%=page%>/<%=Maxpages%>页,每页 <%=MyPageSize%> 条

……
以下是页码的显示(没问题)

搜索更多相关主题的帖子: quot 小写 uptime cstr className 
2007-10-05 12:53
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
得分:0 
2007-10-05 13:08
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
得分:0 
2007-10-05 13:25
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 

楼主是想在最后一页来求和吗?

2007-10-05 14:03
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
得分:0 
终于等到你了
2007-10-05 14:34
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
得分:0 
最后一页,最后一行,
2007-10-05 14:35
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
得分:0 
几经思考,发现首先是NUM没得东西出来;然后就是CALL这里有问题。但就是不知道问题该怎么解决。
2007-10-05 14:38
greatyollow
Rank: 1
等 级:新手上路
帖 子:74
专家分:0
注 册:2007-10-4
得分:0 
2007-10-05 14:50
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
得分:0 
call Money(22222222222)
改成
<%num=rs("num")%>
call Money(num)
试试
后面的function不要改动
合计用<%=rs("num")%>表示
2007-10-05 15:07
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 

个人的思路利用rs.PageCount判断是否为最后一页,然后用SQL语句完成求和。

2007-10-05 15:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-175215-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.237323 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved