新微赢技术网

标题: 关于分页显示后的求和、小写转大写问题!! [打印本页]

作者: 秋燕子_児    时间: 2010-1-8 07:23
标题: 关于分页显示后的求和、小写转大写问题!!
问题之一:和值永远为空,什么也没有。
问题之二:小写转大写永远是贰佰贰拾贰亿贰仟贰佰贰拾贰万贰仟贰佰贰拾贰元(也就是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%> 条

……
以下是页码的显示(没问题)
作者: 黒設會    时间: 2010-1-8 07:23
call Money(22222222222)
改成
<%num=rs("num")%>
call Money(num)
试试
后面的function不要改动
合计用<%=rs("num")%>表示
作者: 蓳隯Д麞帥    时间: 2010-1-8 07:23

作者: 风化雪夜    时间: 2010-1-8 07:23
最后一页,最后一行,
作者: 木子    时间: 2010-1-8 07:23
个人的思路利用rs.PageCount判断是否为最后一页,然后用SQL语句完成求和。
作者: ㊣旗舰卍    时间: 2010-1-8 07:23
楼主是想在最后一页来求和吗?
作者: 爱琴海    时间: 2010-1-8 07:24
几经思考,发现首先是NUM没得东西出来;然后就是CALL这里有问题。但就是不知道问题该怎么解决。
作者: 冰feng£落叶    时间: 2010-1-8 07:24

作者: 无形的天空    时间: 2010-1-8 07:24

作者: $星辰    时间: 2010-1-8 07:24
终于等到你了
作者: tony仔    时间: 2010-2-11 09:05
呵呵 大家好奇嘛 来观看下~~~~




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2