我不知道下面有没有错误,请各位高手检查检查一下,拜托了!!!!!!!!!!!!!!!
<%@ Language=VBScript %>
<% if Session("Access") <> True then Response.Redirect "http://jbcserver/jbcmis/" %>
<%
select case Request.Form("button")
case "无帐单"
Response.Redirect "Null.asp?Year=" & Request.Form("year") & "&Month=" & Request.Form("month")
case "无长话"
Response.Redirect "Noidd.asp?Year=" & Request.Form("year") & "&Month=" & Request.Form("month")
case "上月未付"
Response.Redirect "Notpay.asp?Year=" & Request.Form("year") & "&Month=" & Request.Form("month")
case "无市话"
Response.Redirect "Notcity.asp?Year=" & Request.Form("year") & "&Month=" & Request.Form("month")
end select
%>
<% 'if Request.Form("button")="空帐单" then Response.Redirect "Null.asp?Year=" & Request.Form("year") & "&Month=" & Request.Form("month") %>
<% 'if Request.Form("button")="上月未付" then Response.Redirect "Notpay.asp?Year=" & Request.Form("year") & "&Month=" & Request.Form("month") %>
<% public function check(byval temptelephone)
dim sqlcheck
set Record1 = Server.CreateObject("ADODB.Recordset")
sqlcheck = "select * from telfee where datepart(year,enddate)=" & Recyear &" and datepart(month,enddate) = " &Recmonth &" and telephone= '" &temptelephone & "'"
record1.open sqlcheck,Connection,1
if record1.RecordCount > 0 then
check = 1
else
check = 0
end if
'if temptelephone = "64867979" then
' Response.Write sqlcheck
' Response.write check
'end if
record1.Close
end function
%>
电话清单管理系统
<%
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open "Immigration","sa","3934"
Set Record = Server.CreateObject("ADODB.Recordset")
RecYear=Cint(Request.Form("Year"))
select case Request.Form("all1")
case "city"
sqlselect="select * from telfee where datepart(year,enddate)=" & Recyear
case "s"
sqlselect="select * from telfee where datepart(year,enddate)=" & Recyear & " and sf<>0"
case "net"
sqlselect="select * from telfee where datepart(year,enddate)=" & Recyear & " and nf<> 0"
end select
if Request.Form("month") <> "" then
Recmonth=Cint(Request.Form("month"))
sqlselect=sqlselect & " and datepart(month,enddate)=" & Recmonth
end if
if Trim(Request.Form("Telephone"))<>"" then
sqlselect=sqlselect & " and telephone= '" & Trim(Request.Form("Telephone")) & "'"
end if
if Trim(Request.Form("Company"))<>"" then
sqlselect=sqlselect & " and company like '%" & Trim(Request.Form("Company")) & "%'"
end if
if Trim(Request.Form("RoomNo"))<>"" then
sqlselect=sqlselect & " and roomno like '%" & Trim(Request.Form("RoomNo")) & "%'"
end if
sqlselect=sqlselect & " and idd+ddd+other<> 0"
sqlselect1=sqlselect & " and payway='自付'" & " order by roomno"
sqlselect2=sqlselect & " and payway='代付'" & " order by roomno"
response.write sqlselect
Record.Open sqlselect1,Connection,1
if not record.EOF then
iddTotal=0
dddTotal=0
otherTotal=0
AllTotal=0
'Response.Write sqlseleect
%>
<%
Response.Write Recyear & "年" & RecMonth & "月"
if Trim(Request.Form("Company"))<>"" then
Response.Write Record.fields("company") & "的"
end if
if Trim(Request.Form("RoomNo"))<>"" then
Response.Write Record.fields("roomno") & "房间的"
end if
if Trim(Request.Form("Telephone"))<>"" then
Response.Write "电话号码" & Record.fields("telephone") & "的"
end if
Response.Write "自付费用情况(共" & Record.RecordCount & "条记录)"
%>
<% if Trim(Request.Form("Telephone")) = "" then %>
电话号码 |
<% end if %>
<% if Trim(Request.Form("Company")) = "" then %>
公司名 |
<% end if %>
<% if Trim(Request.Form("RoomNo")) = "" then %>
房号 |
<% end if %>
开始日 |
结束日 |
<% select case Request("all1")%>
<% case "city" %>
IDD |
市话费 |
其它 |
共计 |
OK |
<% case "s"%>
声讯费 |
<% case "net"%>
网络用户签收 |
<% end select%>
方式 |
付款日期 |
签收人 |
---|
<% do while not Record.eof %>
<%
select case Request.Form("all1")
case "city"
iddTotal=iddTotal+Record.fields("idd")
dddTotal=dddTotal+Record.fields("ddd")
otherTotal=otherTotal+Record.fields("other")
'sf = sf + Record.Fields("sf")
'nf = nf + record.Fields("nf")
AllTotal=iddTotal+dddTotal+otherTotal'+sf+nf
case "s"
iddTotal=iddTotal+Record.fields("sf")
AllTotal=iddTotal
case "net"
iddTotal=iddTotal+Record.fields("nf")
AllTotal=iddTotal
end select
%>
<% if Trim(Request.Form("Telephone")) = "" then %>
<%=Record.fields("telephone")%> |
<% end if %>
<% if Trim(Request.Form("Company")) = "" then %>
<% if Trim(Record.fields("company"))="" then Response.Write " " else Response.Write Record.fields("company") end if %>
|
<% end if %>
<% if Trim(Request.Form("RoomNo")) = "" then %>
<% if trim(Record.fields("roomno")) = "" then Response.Write " " else Response.Write Record.fields("roomno") end if %>
|
<% end if %>
<%=Record.fields("begindate")%> |
<%=Record.fields("enddate")%> |
<%select case Request.Form("all1")%>
<% case "city" %>
<%=Record.fields("idd")%> |
<%=Record.fields("ddd")%> |
<%=Record.fields("other")%> |
<%=Record.fields("idd")+Record.fields("ddd")+Record.fields("other")%> |
<%=Record.fields("lastmonth")%> |
<%case "s" %>
<%=Record.fields("sf")%> |
<%case "net"%>
<%=Record.fields("nf")%> |
<%end select %>
<%=Record.fields("payway")%> |
<%=Record.fields("paydate")%> |
|
<%
Record.movenext
Loop
Record.Close
%>
合计 |
<%
if Trim(Request.Form("Telephone")) = "" then
Response.Write " | "
end if
if Trim(Request.Form("Company")) = "" then
Response.Write " | "
end if
if Trim(Request.Form("RoomNo")) = "" then
Response.Write " | "
end if
%>
|
<%select case Request.Form("all1")%>
<%case "city"%>
<%=iddTotal%> |
<%=dddTotal%> |
<%=otherTotal%> |
<%=AllTotal%> |
<%case "s"%>
<%=iddTotal%> |
<%case "net"%>
<%=iddTotal%> |
<%end select%>
|
|
|
<% end if %>
<%
if record.eof then Record.Close
Record.Open sqlselect2,Connection,1
if not record.EOF then
Response.Write Recyear & "年" & RecMonth & "月"
if Trim(Request.Form("Company"))<>"" then
Response.Write Record.fields("company") & "的"
end if
if Trim(Request.Form("RoomNo"))<>"" then
Response.Write Record.fields("roomno") & "房间的"
end if
if Trim(Request.Form("Telephone"))<>"" then
Response.Write "电话号码" & Record.fields("telephone") & "的"
end if
Response.Write "代付费用情况(共" & Record.RecordCount & "条记录)"
iddTotal=0
dddTotal=0
otherTotal=0
AllTotal=0
%>
<% if Trim(Request.Form("Telephone")) = "" then %>
电话号码 |
<% end if %>
<% if Trim(Request.Form("Company")) = "" then %>
公司名 |
<% end if %>
<% if Trim(Request.Form("RoomNo")) = "" then %>
房号 |
<% end if %>
开始日 |
结束日 |
<%select case Request.Form("all1")%>
<%case "city"%>
IDD |
市话费 |
其它 |
共计 |
OK |
<%case "s"%>
声讯费 |
<%case "net"%>
网络用户签收 |
<%end select%>
方式 |
付款日期 |
签收人 |
---|
<% do while not Record.eof %>
<%
select case Request.Form("all1")
case "city"
iddTotal=iddTotal+Record.fields("idd")
dddTotal=dddTotal+Record.fields("ddd")
otherTotal=otherTotal+Record.fields("other")
AllTotal=iddTotal+dddTotal+otherTotal
case "s"
iddTotal=iddTotal+Record.fields("sf")
AllTotal=iddTotal
case "net"
iddTotal=iddTotal+Record.fields("nf")
AllTotal=iddTotal
end select
%>
<% if Trim(Request.Form("Telephone")) = "" then %>
<%=Record.fields("telephone")%> |
<% end if %>
<% if Trim(Request.Form("Company")) = "" then %>
<% if Trim(Record.fields("company"))="" then Response.Write " " else Response.Write Record.fields("company") end if %>
|
<% end if %>
<% if Trim(Request.Form("RoomNo")) = "" then %>
<% if trim(Record.fields("roomno")) = "" then Response.Write " " else Response.Write Record.fields("roomno") end if %>
|
<% end if %>
<%=Record.fields("begindate")%> |
<%=Record.fields("enddate")%> |
<%select case Request.Form("all1")%>
<%case "city"%>
<%=Record.fields("idd")%> |
<%=Record.fields("ddd")%> |
<%=Record.fields("other")%> |
<%=Record.fields("idd")+Record.fields("ddd")+Record.fields("other")%> |
<%=trim(Record.fields("lastmonth"))%> |
<%case "s"%>
<%=Record.fields("sf")%> |
<%case "net"%>
<%=Record.fields("nf")%> |
<%end select%>
<%=Record.fields("payway")%> |
<%=Record.fields("paydate")%> |
|
<%
Record.movenext
Loop
Record.Close
%>
合计 |
<%
if Trim(Request.Form("Telephone")) = "" then
Response.Write " | "
end if
if Trim(Request.Form("Company")) = "" then
Response.Write " | "
end if
if Trim(Request.Form("RoomNo")) = "" then
Response.Write " | "
end if
%>
  |
<%select case Request.Form("all1")%>
<%case "city"%>
<%=iddTotal%> |
<%=dddTotal%> |
<%=otherTotal%> |
<%=iddTotal+dddtotal+othertotal%> |
<%case "s"%>
<%=iddTotal%> |
<%case "net"%>
<%=iddTotal%> |
<%end select%>
|
|
|
<% end if
if Record.State =1 then Record.Close
if Trim(Request.Form("Telephone")) = "" and Trim(Request.Form("Company")) = "" and Trim(Request.Form("RoomNo")) = "" then
sqlselect="select telephone.电话号码,telephone.使用单位,telephone.房号,telfee.begindate,telfee.idd,telfee.ddd,telfee.other,telfee.enddate,telfee.payway,telfee.paydate,telfee.lastmonth from telfee,telephone where datepart(year,telfee.enddate)=" & RecYear & " and (telephone.电话号码 *= telfee.telephone)"
if Request.Form("month") <> "" then
Recmonth=Cint(Request.Form("month"))
sqlselect=sqlselect & " and datepart(month,telfee.enddate)=" & Recmonth
end if
sqlselect=sqlselect & " order by telephone.房号"
Response.Write sqlselect
Record.Open sqlselect,Connection,1
%>
电话号码 |
公司名 |
房号 |
---|
|
<%mm =0 %>
<% do while not Record.eof %>
<%if check(Record.fields("电话号码")) = 0 then %>
<%=Record.fields("电话号码")%> |
<% if Trim(Record.fields("使用单位"))="" then Response.Write " " else Response.Write Record.fields("使用单位") end if %> |
<% if Trim(Record.fields("房号"))="" then Response.Write " " else Response.Write Record.fields("房号") end if %> |
|
<%
mm = mm +1
end if
Record.movenext
Loop
Record.Close
%>
没有电话费的公司(共<%=mm%>条记录)
<%
end if
Set Record=Nothing
Connection.Close
Set Connection=Nothing
set record1 = Nothing
%>