注册 登录
编程论坛 ASP技术论坛

关于下拉框选择和缴费提醒功能不能两用的问题,ASP老手请进

天蝎风 发布于 2010-11-25 14:18, 890 次点击
这是一个业主交费提醒页面,首先贴出页面代码:
程序代码:
<%if request.Cookies("shiwei_username")="" then%>
<script language="javascript">top.location.href="../index.asp"</script>
<%
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->

<html>
<head>
<title><%=gongsi%>-水费缴费提醒</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>body {background-color:#FFFFFF;}</style>
<script>
function CheckAll(form) {
  
for (var i=0;i<form.elements.length;i++) {
   
var e = form.elements[i];
   
if (e.name != 'chkall') e.checked = form.chkall.checked;
  }
}
</script>
</HEAD>

<BODY>
<%if fla40="0" and request.Cookies("shiwei_id")<>"1" then%>
<br><center><img src="../images/note.gif" align="absmiddle">&nbsp;<font color="#FF0000">你不具备此权限,请与管理员联系!</font></center>
<%
  response.end
end if

%>
<%
if request("hid")="ok" then
  conn.execute(
"update yezhu set wenhou=#"&date()&"# where id="&request("id"))
end if
'取得搜索关键字
nowkeyword=request("keyword")
nowxiaoqu
=request("xiaoqu")
%>
<table width="100%" border="0" cellpadding="0" cellspacing="2" align="center">
  <form name="form2">
    <tr><td width="1%" height="30"></td>
      <td width="99%" align="left">
        <%
    sql
="select * from xiaoqu order by id"
   
set rs_xiaoqu=conn.execute(sql)
   
%>
    &nbsp;请选择小区:
    <select name="xiaoqu" onChange="form2.submit()">
        <option value="">所有小区</option>
        <%do while rs_xiaoqu.eof=false%>
        <option value="<%=rs_xiaoqu("id")%>"<%if trim(cstr(rs_xiaoqu("id")))=nowxiaoqu then%>selected="selected"<%end if%>><%=rs_xiaoqu("xiaoqu")%></option>
        <%
    rs_xiaoqu.movenext
   
loop
   
%>
        </select>
        <%
    sql
="select * from yezhu order by id"
   
set rs=conn.execute(sql)
   
%>
     </td>
    </tr></form></table>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr><td><img src="../images/r_1.gif" alt="" /></td>
  <td width="100%" background="../images/r_0.gif">
    <table cellpadding="0" cellspacing="0" width="100%">
      <tr><td>&nbsp;查看/取消提醒</td>
        </tr>
      </table>
    </td>
  <td><img src="../images/r_2.gif" alt="" /></td>
</tr>
  <tr>
    <td></td>
      <td>
        <form name="form1" >
      <table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
    <tr align="center"><td height="30" class="category">所在小区</td>
  <td class="category">楼宇单元</td>
<td class="category">房号</td>
  <td class="category">业主姓名</td>
    <td class="category">联系电话</td>
      <td class="category">到期时间</td>
    <%if fla41="1" or request.Cookies("shiwei_id")="1" then%><td width="8%" class="category">前台</td><%end if%>
  <%if fla42="1" or request.Cookies("shiwei_id")="1" then%><td width="5%" class="category">操作</td><%end if%>
</tr>
  <%

  sql
="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&") and (day(shui)>="&day(date())&" and day(shui)<="&day  (date()+5)&") and year(wenhou)<>"&year(date())&")"
  
if nowxiaoqu="" then
    sql
="select * from yezhu order by xiaoqu,id"
  
else
    sql
="select * from yezhu where xiaoqu="&nowxiaoqu&" order by id"
  
end if
  
set rs=conn.execute(sql)
  
do while rs.eof=false
  
%>
  <tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''" onDblClick="javascript:var win=window.open('../yezhu/yezhu_show.asp?id=<%=rs("id")%>','业主详细信息','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes'); win.focus()">
    <td align="center" height="25"><%set rs_xiaoqu=conn.execute("select * from xiaoqu where id="&rs("xiaoqu"))%><%if rs_xiaoqu.eof then%>&nbsp;<%else%><%=rs_xiaoqu("xiaoqu")%><%end if%></td>
    <td align="center"><%set rs_louyu=conn.execute("select * from louyu where id="&rs("louyu"))%><%if rs_louyu.eof then%>&nbsp;<%else%><%=rs_louyu("louyu")%><%end if%></td>
<td align="center"><%=rs("fanghao")%></td>
  <td align="center"><%=rs("username")%></td>
    <td align="center"><%=rs("tel")%></td>
      <td align="center">
        <%if rs("shui")-date()<0 then%>
      <font color="#ff0000"><b><%=rs("shui")%>已经到期</b></font>
        <%elseif rs("shui")-date()<5 then%>
          <font color="#009900"><b><%=rs("shui")%>就快到期</b></font>
            <%else%><%=rs("shui")%><%end if%></td>
      <%if fla41="1" or request.Cookies("shiwei_id")="1" then%>
    <td align="center"><input type=button value='现在收费' onClick=window.open("/1/produit/produit_sell.asp") class="button"></td><%end if%>
  <%if fla42="1" or request.Cookies("shiwei_id")="1" then%>
<td align="center"><input type=button value='已经缴费,取消提醒' onclick=window.location.href='?hid=ok&id=<%=rs("id")%>' class="button"></td><%end if%>
  </tr>
  <%
  nowbaojing1
=nowbaojing1&"ok"
  rs.movenext
  
loop
  
%>
  <tr><td colspan="8" height="30" class="category">
     <table cellpadding=0 cellspacing=0 width="100%">
      <tr><td align="left" style="color:#FF0000;">双击每行可查看业主详细资料</td>
    <%if nowbaojing1="" then%><td align=right onMouseOver="this.className='highlight'" onMouseOut="this.className=''"  style="color:#ff0000">目前没有缴费提醒</td><%end if%>
</tr></table></td></tr>
</table></form></td>
<td></td></tr>
<tr><td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table></body></html>
14 回复
#2
gupiao1752010-11-26 00:51
时间太晚了。明天帮你看看!
#3
jansonwang2010-11-26 08:58
先仔细看看吧 学习中

[ 本帖最后由 jansonwang 于 2010-11-26 09:01 编辑 ]
#4
jansonwang2010-11-26 09:06
1、        <%
    sql="select * from yezhu order by id"
    set rs=conn.execute(sql)
    %>
这段干什么用噢?
2、请LZ问题再描述清楚一点。
3、LZ这代码是从某进销存源码拿来的吧?呵呵。要吃透人家的思路才能更好地为我所用吧。我看你的代码时乱糟糟。
#5
天蝎风2010-11-26 10:26
这段代码已经没用了,忘记去掉。
我先把页面效果图发给出来,如果太小的话请点击图片查看大图。
只有本站会员才能查看附件,请 登录

楼上说的没错,这个是拿进销存软件来改的,以上图片是一个业主缴费提醒页面。

[ 本帖最后由 天蝎风 于 2010-11-26 10:28 编辑 ]
#6
天蝎风2010-11-26 10:33
现在问题是下拉框选择小区可以用,但是提醒功能不可用,并没有只显示准备到期的或已经到期的业主,而是显示全部,右边的取消提醒也失效。如果把SQL语句调换一下位置,反过来提醒能用,下拉框选择又失效:
程序代码:
  <%
  sql
="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&") and (day(shui)>="&day(date())&" and day(shui)<="&day  (date()+5)&") and year(wenhou)<>"&year(date())&")"
  
if nowxiaoqu="" then
    sql
="select * from yezhu order by xiaoqu,id"
  
else
    sql
="select * from yezhu where xiaoqu="&nowxiaoqu&" order by id"
  
end if
  
set rs=conn.execute(sql)
  
do while rs.eof=false
  
%>

 
#7
jansonwang2010-11-26 10:45
哎呀哥们,终于看清你是什么意思了,呵呵!
看我写的对不对噢
 <%
  sql="select * from yezhu where ((month(shui)>="&month(date())&" and month(shui)<="&month(date()+5)&") and (day(shui)>="&day(date())&" and day(shui)<="&day  (date()+5)&") and year(wenhou)<>"&year(date())&")"
  if nowxiaoqu="" then
    sql=sql&" order by id"
  else
    sql=sql&" and xiaoqu="&nowxiaoqu&" order by id"
  end if
  set rs=conn.execute(sql)
  do while rs.eof=false
  %>

 
#8
天蝎风2010-11-26 10:51
只有本站会员才能查看附件,请 登录
不显示到期提醒的业主了
#9
jansonwang2010-11-26 10:54
response.write sql
看一下打印出来的sql信息,然后粘到数据库查询器中执行一下,有记录没?
#10
jansonwang2010-11-26 10:56
要么是sql语句条件错了,要么是数据库中无满足条件的记录。
#11
jansonwang2010-11-26 11:06
加我Q47722744交流啊
#12
天蝎风2010-11-26 11:07
这是个独立页面,没有数据输入的,只有输出。
#13
jansonwang2010-11-26 13:17
谢谢LZ的15分!
#14
jansonwang2010-11-26 13:18
程序代码:
    <%
    sql
="select * from yezhu where month(shui)<="&month(date())&" and day(shui)<="&day(date()+5)&" and month(wenhou)<"&month(date())
     
if nowxiaoqu="" then
        sql
=sql&" order by id"
     
else
        sql
=sql&" and xiaoqu="&nowxiaoqu&" order by id"
   
end if
   
set rs_yezhu=conn.execute(sql)
#15
jansonwang2010-11-29 14:57
其实吧,这个用datediff更简单了。datediff(dd,date(),shui)<=5
1