问题之一:和值永远为空,什么也没有。
问题之二:小写转大写永远是贰佰贰拾贰亿贰仟贰佰贰拾贰万贰仟贰佰贰拾贰元(也就是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'"> <%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'"> <%=rs("zhuozhe_name")%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> <%=rs("client_adr")%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> <%=rs("client_file")%></td>
<td height="18" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> <%=rs("fashong_fangshi")%></td>
<td height="18" align="right" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> <%=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'"> 合 计</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'"> 大 写: <%=rs("Money")%></td>
<td width="8%" height="18" align="right" class="but" onMouseDown="this.className='tddown'" onMouseUp="this.className='but'" onMouseOut="this.className='but'"> <%=num%></td>
<%end if %>
</tr>
<%end if%>
共 <%=total%> 条,当前第 <%=page%>/<%=Maxpages%>页,每页 <%=MyPageSize%> 条
……
以下是页码的显示(没问题)