query.asp

来自「投资管理系统, asp+ mssql server」· ASP 代码 · 共 397 行 · 第 1/2 页

ASP
397
字号
<%
response.expires=-1
dim ThisKey
ThisKey = "d"
typet=trim(request("typet"))
if typet="" or typet="0" then
	typet=1
end if
%>
<!--#include file="inc/permission.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/SearAtt.asp"-->
<!--#include file="inc/DeleaveData.asp"-->
<%
Dim Att,SearAtt
AllID=""
AllID1=""
Att=Session("FGDept")
Department=Session("Department")
Unit=Session("Unit")
ReadAtt=Session("ReadAtt")
TMoney1=""
TMoney2=""
if trim(request("sbumit"))<>"All" then
	Attribute=int(request("Attribute"))
	Attribute2=request("Attribute2")
	if Attribute2="" then
		Attribute2=0
	else
		Attribute2=int(Attribute2)
	end if
	SearchText=request("SearchText")
	TMoney1=trim(request("TMoney1"))
	if TMoney1="" then
		TMoney1="0"
		TMoney11=""
	else
		TMoney11=TMoney1
	end if
	TMoney2=trim(request("TMoney2"))
	if TMoney2="" then
		TMoney2="0"
		TMoney22=""
	else
		TMoney22=TMoney2
	end if
else
	Attribute=0
	Attribute2=0
	SearchText=""
end if
if TMoney11="0" and TMoney22="0" then
	TMoney11=""
	TMoney22=""
end if
set rs=server.createobject("adodb.recordset")
set rsy=server.createobject("adodb.recordset")

Attribute3="("&Attribute&":"&Attribute2&")"

'选取包含有用户可浏览特殊属性的项目
if ReadAtt<>"" then
	Sqlstr="select * from tblBase where (State="&int(typet)&" and Unit="&Unit&") and ("&DeleaveData(ReadAtt)&") order by InputTime Desc"
	rs.open Sqlstr,conn,1,1
	if not rs.eof then
		T=0
		do while not rs.eof
			T=T+1
			if T=1 then
				AllID1="'"&rs("ID")&"'"
			else
				AllID1=AllID1&",'"&rs("ID")&"'"
			end if
			rs.movenext
		loop
	end if
	rs.close
end if
'结束
Sqlstr="select * from tblBase where State="&int(typet)&" and Unit="&Unit
if Department<>0 then	'如果不是领导
	Sqlstr=Sqlstr&" and Department="&Department
end if					'结束
if Attribute2<>0 then
	Sqlstr=Sqlstr&" and Attribute like '%"&Attribute3&"%'"
end if
if TMoney1<>"0" or TMoney2<>"0" then
	Sqlstr=Sqlstr&" and Money>="&TMoney1&" and Money<="&TMoney2
end if
Sqlstr=Sqlstr&" and Name like '%"&SearchText&"%' order by InputTime Desc"
rs.open Sqlstr,conn,1,1
'×××××××××××××××××××××××××
if Department=0 then
	if not rs.eof then
		S=0
		do while not rs.eof
			SearAtt="("&rs("Department")&")"
			if SearchAtt="True" then
				S=S+1
				if S=1 then
					AllID="'"&rs("ID")&"'"
				else
					AllID=AllID&",'"&rs("ID")&"'"
				end if
			end if
			rs.movenext
		loop
	end if
	rs.close
else
	if not rs.eof then
		S=0
		do while not rs.eof
			S=S+1
			if S=1 then
				AllID="'"&rs("ID")&"'"
			else
				AllID=AllID&",'"&rs("ID")&"'"
			end if
			rs.movenext
		loop
	end if
	rs.close
end if
'×××××××××××××××××××××××××××
if AllID1&AllID<>"" then
	Sqlstr="select * from tblBase where ID in ("&CompData(AllID1,AllID)&") order by InputTime Desc"
else
	Sqlstr="select * from tblBase where ID=-1"
end if
'response.write AllID1
'response.end
rs.open Sqlstr,conn,1,1
if not rs.eof then
	'**********************
	TotalMoney=0
	do while not rs.eof
		TotalMoney=TotalMoney+rs("Money")
		rs.movenext
	loop
	rs.movefirst
	'**********************
	rs.pagesize=20
	pagesize=rs.pagesize
	pagecount=rs.pagecount
	absolutepage=trim(request("absolutepage"))
	if absolutepage=empty then
		absolutepage=1
	else
		rs.absolutepage=absolutepage
	end if
	total=rs.recordcount
end if

num=cint(absolutepage-1)*pagesize
%>
<HTML>
<HEAD>
<TITLE>投资项目管理查询系统</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK rel=stylesheet href="css/main.css" type="text/css">
</HEAD>
<BODY bgColor=#CC9933 leftMargin=0 topMargin=0>
<TABLE cellPadding=0 width=773 align=center bgColor=#FFCC66 border=0 bordercolor="#FFFFFF">
  <TR>
      <TD 
    style="BORDER-RIGHT: #996600 1px solid; BORDER-TOP: #996600 1px solid; BORDER-LEFT: #996600 1px solid; BORDER-BOTTOM: #996600 1px solid" 
    vAlign=top align=center width="100%">        
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 align=center>
        <form name=searchform method=post action="query.asp">
          <TR align="center" valign="middle"> 
            <TD 
          style="BORDER-BOTTOM: #996600 1px solid" colspan="3" align=center><img src="images/topmore.jpg" width="773" height="80"></TD>
          </TR>
          <TR bgcolor="#996600"> 
            <TD style="BORDER-BOTTOM: #996600 1px solid" 
          align=right valign="middle" height="10" bgcolor="#996600" colspan="3">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr valign="middle" align="center"> 
                  <td width=116 style="border-right:1 solid #FFCC33;border-bottom:1 solid #FFCC33;cursor:hand;color:'#ffffff'" onclick="javascript:location.href='Query.asp?typet=1&Attribute=<%=Attribute%>&Attribute2=<%=Attribute2%>&TMoney1=<%=TMoney1%>&TMoney2=<%=TMoney2%>&SearchText=<%=SearchText%>'" <%if typet="1" or typet="" then%>bgcolor="#FFCC33"<%else%>onmouseover="javascript:this.bgColor='#FFCC33'" onmouseout="javascript:this.bgColor='#996600';"<%end if%>><b>前期</b></td>
                  <td width=116 style="border-right:1 solid #FFCC33;border-bottom:1 solid #FFCC33;cursor:hand;color:'#ffffff'" onclick="javascript:location.href='Query.asp?typet=2&Attribute=<%=Attribute%>&Attribute2=<%=Attribute2%>&TMoney1=<%=TMoney1%>&TMoney2=<%=TMoney2%>&SearchText=<%=SearchText%>'" <%if typet="2" then%>bgcolor="#FFCC33"<%else%>onmouseover="javascript:this.bgColor='#FFCC33'" onmouseout="javascript:this.bgColor='#996600';"<%end if%>><b>争取开工</b></td>
                  <td width=116 style="border-right:1 solid #FFCC33;border-bottom:1 solid #FFCC33;cursor:hand;color:'#ffffff'" onclick="javascript:location.href='Query.asp?typet=3&Attribute=<%=Attribute%>&Attribute2=<%=Attribute2%>&TMoney1=<%=TMoney1%>&TMoney2=<%=TMoney2%>&SearchText=<%=SearchText%>'" <%if typet="3" then%>bgcolor="#FFCC33"<%else%>onmouseover="javascript:this.bgColor='#FFCC33'" onmouseout="javascript:this.bgColor='#996600';"<%end if%>><b>在建</b></td>
                  <td width=116 style="border-right:1 solid #FFCC33;border-bottom:1 solid #FFCC33;cursor:hand;color:'#ffffff'" onclick="javascript:location.href='Query.asp?typet=4&Attribute=<%=Attribute%>&Attribute2=<%=Attribute2%>&TMoney1=<%=TMoney1%>&TMoney2=<%=TMoney2%>&SearchText=<%=SearchText%>'" <%if typet="4" then%>bgcolor="#FFCC33"<%else%>onmouseover="javascript:this.bgColor='#FFCC33'" onmouseout="javascript:this.bgColor='#996600';"<%end if%>><b>竣工</b></td>
                  <td width=116 style="border-right:1 solid #FFCC33;border-bottom:1 solid #FFCC33;cursor:hand;color:'#ffffff'" onclick="javascript:location.href='Query.asp?typet=5&Attribute=<%=Attribute%>&Attribute2=<%=Attribute2%>&TMoney1=<%=TMoney1%>&TMoney2=<%=TMoney2%>&SearchText=<%=SearchText%>'" <%if typet="5" then%>bgcolor="#FFCC33"<%else%>onmouseover="javascript:this.bgColor='#FFCC33'" onmouseout="javascript:this.bgColor='#996600';"<%end if%>><b>停缓建</b></td>
                  <td width=120 style="border-bottom:1 solid #FFCC33;cursor:hand;color:'#ffffff'" onclick="javascript:location.href='Query.asp?typet=6&Attribute=<%=Attribute%>&Attribute2=<%=Attribute2%>&TMoney1=<%=TMoney1%>&TMoney2=<%=TMoney2%>&SearchText=<%=SearchText%>'" <%if typet="6" then%>bgcolor="#FFCC33"<%else%>onmouseover="javascript:this.bgColor='#FFCC33'" onmouseout="javascript:this.bgColor='#996600';"<%end if%>><b>撤消立项</b></td>
                </tr>
              </table>
            </TD>
          </tr>
          <tr bgcolor="#996600"> 
            <TD style="BORDER-BOTTOM: #996600 1px solid;border-top:1 solid #ffffff" align=left valign="top" height="10" colspan=2>&nbsp;&nbsp;<font color=white>查询条件:</font><select name="Attribute" onchange="javascript:ShowClass2(this[this.selectedIndex].value);"><%for i=0 to ubound(arrClass1,2)
			if arrClass1(0,i)=Attribute then%>
			<option value="<%=arrClass1(0,i)%>" selected><%=arrClass1(1,i)%>
			<%else%>
			<option value="<%=arrClass1(0,i)%>"><%=arrClass1(1,i)%>		
			<%end if
		next%></select>
	  	 <select id=Class2 name="Attribute2">
		 <option value=""></option>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?