<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../esf/inc/function.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p23")
'''''''''''''''''''''''''''''''''''''''''''''''
dim currentpage,totalpage,totalnum,recpage,urls,listtitle
recpage=20
dim ischeck,areaid,infotypeid,roomtypeid,floorlevelid,housetype,pubby
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
if(request.QueryString("ischeck")<>"") then
	ischeck=Clng(request.QueryString("ischeck"))
else
	ischeck=0
end if
if(request.QueryString("pubby")<>"") then
	pubby=Clng(request.QueryString("pubby"))
else
	pubby=0
end if
if(request.QueryString("housetype")<>"") then
	housetype=Clng(request.QueryString("housetype"))
else
	housetype=0
end if
if(request.QueryString("areaid")<>"") then
	areaid=Clng(request.QueryString("areaid"))
	listtitle=listtitle&"-"&getAreaTitle(areaid)
else
	areaid=0
end if
if(request.QueryString("infotypeid")<>"") then
	infotypeid=Clng(request.QueryString("infotypeid"))
	listtitle=listtitle&"-"&getInfoTypeTitle(infotypeid)
else
	infotypeid=0
end if
if(request.QueryString("roomtypeid")<>"") then
	roomtypeid=Clng(request.QueryString("roomtypeid"))
	listtitle=listtitle&"-"&getRoomTypeTitle(roomtypeid)
else
	roomtypeid=0
end if
if(request.QueryString("floorlevelid")<>"") then
	floorlevelid=Clng(request.QueryString("floorlevelid"))
	listtitle=listtitle&"-"&getFloorLevelTitle(floorlevelid)
else
	floorlevelid=0
end if
urls="ischeck="&ischeck&"&areaid="&areaid&"&infotypeid="&infotypeid&"&roomtypeid="&roomtypeid&"&floorlevelid="&floorlevelid&"&housetype="&housetype&"&pubby="&pubby
%>
<html>
<head>
<title>二手房信息管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
form{ margin:0px;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?<%=urls%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}</script>
<script language="JavaScript" type="text/JavaScript">

function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.style4 {color: #000000}
-->
</style>
</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="22" bgcolor="#FF9900"><div align="center"><span class="style1">◆ 二手房信息管理 ◆</span></div></td>
  </tr>
</table>
<form action="?" method="get">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="54%" height="22" align="center">
	<select name="ischeck">
     	<option value="-1">审核状态</option>
      <option value="1" <%if(ischeck=1) then response.write("selected=""selected""") end if%>>已审核..</option>   
	 		<option value="0" <%if(ischeck=0) then response.write("selected=""selected""") end if%>>未审核..</option>
    </select>
    <select name="pubby">
     	<option value="-1">中介/个人</option>
      <option value="1" <%if(pubby=1) then response.write("selected=""selected""") end if%>>中介</option>   
	 		<option value="0" <%if(pubby=0) then response.write("selected=""selected""") end if%>>个人</option>
    </select>
	按地区：
            <select name="areaid">
              <option value="0">地区</option>
              <%=getAreaSelect(areaid)%>
            </select>
按类别：
            <select name="infotypeid">
              <option value="0">信息类别</option>
              <%=getInfoTypeSelect(infotypeid)%>
            </select>
按户型：
            <select name="roomtypeid">
              <option value="0">户型</option>
              <%=getRoomTypeSelect(roomtypeid)%>
            </select>
按楼层：
            <select name="floorlevelid">
              <option value="0">楼层</option>
              <%=getFloorLevelSelect(floorlevelid)%>
            </select>
            <input type="submit" name="button" id="button" value="搜索"></td>
  </tr>
</table>
</form>
<form action="house_do.asp" method="post" name="mem" style="margin:0px; padding:0px;">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
      <tr>
        <td width="7%" bgcolor="#F5F5F5" class="style1"><div align="center" class="style4">ID</div></td>
        <td width="8%" height="22" bgcolor="#F5F5F5"><div align="center"><strong>城市</strong></div></td>
        <td width="10%" bgcolor="#F5F5F5"><div align="center"><strong>类别</strong></div></td>
        <td width="28%" bgcolor="#F5F5F5"><div align="center"><strong>地址</strong></div></td>
        <td width="13%" bgcolor="#F5F5F5"><div align="center"><strong>日期</strong></div></td>
        <td width="10%" align="center" bgcolor="#F5F5F5"><strong>类型</strong></td>
        <td width="11%" align="center" bgcolor="#F5F5F5"><strong>审核</strong></td>
        <td width="13%" align="center" bgcolor="#F5F5F5"><strong>操作</strong></td>
    </tr>
	  <%
	  sql="select count(*) from t_2house,t_2infotype,t_2roomtype,t_house_area WHERE t_2house.InfoTypeId=t_2infotype.id and t_2house.AreaId=t_house_area.id and t_2house.RoomTypeId=t_2roomtype.id"
		if(ischeck>=0) then
			sql=sql&" and t_2house.IsCheck="&ischeck
		end if
		'条件判断
		if(infotypeid>0) then
			sql=sql&" and t_2house.InfoTypeId="&infotypeid
		end if
		if(areaid>0) then
			sql=sql&" and t_2house.AreaId="&areaid
		end if
		if(floorlevelid>0) then
			sql=sql&" and t_2house.FloorLevelId="&floorlevelid
		end if
		if(roomtypeid>0) then
			sql=sql&" and t_2house.RoomTypeId="&roomtypeid
		end if
		if(housetype>0) then
			sql=sql&" and t_2house.HouseType="&housetype
		end if
		if(pubby>=0) then
		 sql=sql&" and PubBy="&pubby
		end if
		set rs=server.CreateObject("adodb.recordset")
		rs.open sql,conn,3,1
		if not rs.eof then
			allrec=rs(0)
		else
			allrec=0
		end if
		rs.close
		set rs=nothing
	  totalpage=Cint((allrec-1+recpage)/recpage)
	  sql="select top "&recpage&" id,Address,Moditime,Price,InfoTypeTitle,RoomTypeTitle,AreaTitle,PriceUnit,PubBy,Acreage,IsCheck from t_2house WHERE (id <=(SELECT MIN(id) FROM (SELECT TOP "&((currentpage-1)*recpage+1)&" id  FROM t_2house where 1=1"
		if(ischeck>=0) then
			sql=sql&" and IsCheck="&ischeck
		end if
		if(pubby>=0) then
		 sql=sql&" and PubBy="&pubby
		end if
		'条件判断
		if(infotypeid>0) then
			sql=sql&" and InfoTypeId="&infotypeid
		end if
		if(areaid>0) then
			sql=sql&" and AreaId="&areaid
		end if
		if(floorlevelid>0) then
			sql=sql&" and FloorLevelId="&floorlevelid
		end if
		if(roomtypeid>0) then
			sql=sql&" and RoomTypeId="&roomtypeid
		end if
		if(housetype>0) then
			sql=sql&" and HouseType="&housetype
		end if
		sql=sql&" ORDER BY id DESC) AS t))"
		if(ischeck>=0) then
			sql=sql&" and IsCheck="&ischeck
		end if
		if(pubby>=0) then
		 sql=sql&" and PubBy="&pubby
		end if
		'条件判断
		if(infotypeid>0) then
			sql=sql&" and InfoTypeId="&infotypeid
		end if
		if(areaid>0) then
			sql=sql&" and AreaId="&areaid
		end if
		if(floorlevelid>0) then
			sql=sql&" and FloorLevelId="&floorlevelid
		end if
		if(roomtypeid>0) then
			sql=sql&" and RoomTypeId="&roomtypeid
		end if
		if(housetype>0) then
			sql=sql&" and HouseType="&housetype
		end if
		sql=sql&" ORDER BY id DESC"
		'response.write(sql)
		set rs=server.CreateObject("adodb.recordset")
		rs.open sql,conn,3,1
		if not rs.eof then
			listArr=rs.getrows()
		end if
		rs.close
		set rs=nothing
	  if(isarray(listArr)) then
	  	for j=0 to ubound(listArr,2)
	  %>
      <tr>
        <td bgcolor="#F7F7F7"><div align="center">
          <input type="checkbox" name="obj" value="<%=listArr(0,j)%>" />
        </div></td>
        <td height="20" bgcolor="#F7F7F7"><div align="center"><a href="../esf/show.asp?id=<%=listArr(0,j)%>" target="_blank"><%=listArr(6,j)%></a></div></td>
        <td bgcolor="#F7F7F7"><div align="center"><a href="../esf/show.asp?id=<%=listArr(0,j)%>" target="_blank"><%=listArr(4,j)%></a></div></td>
        <td bgcolor="#F7F7F7"><a href="../esf/show.asp?id=<%=listArr(0,j)%>" target="_blank"><%=listArr(1,j)%></a></td>
        <td bgcolor="#F7F7F7"><div align="center"><%=listArr(2,j)%></div></td>
        <td align="center" bgcolor="#F7F7F7">
        <%
				if(listArr(8,j)=0) then
				response.Write("<font color=""red"">个人</font>")
				elseif(listArr(8,j)=1) then
				response.Write("中介")
				else
				response.Write("经济人")
				end if
				%></td>
        <td align="center" bgcolor="#F7F7F7">
        <%
				if(listArr(10,j)=0) then
				response.Write("&times;")
				else
				response.Write("<font color=""red"">&radic;</font>")
				end if
				%>
        </td>
        <td align="center" bgcolor="#F7F7F7"><a href="house_edit.asp?id=<%=listArr(0,j)%>">编辑</a> <a href="dele.asp?id=<%=listArr(0,j)%>&table=t_2house" onClick="return ConfirmDel()">删除</a></td>
      </tr>
	  <%
	    next
	  else
	  	response.Write("<tr><td colspan=""5"">暂时没有记录</td></tr>")
	  end if
	  set carr=nothing
	  %>
    </table>

<div align="center">
  <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
  &nbsp;
  <select name="do_type" id="do_type">
    <option value="del">批量删除</option>
	<option value="check">批量审核</option>
	<option value="uncheck">取消审核</option>	
  <option value="rem">批量推荐</option>
	<option value="unrem">取消推荐</option>	
  </select>
  &nbsp;
  <input class=Button type="submit" name="Submit2" value="执行所选 的操作" onClick="return confirm('您确定执行该操作吗?')">
</div>
</form>
<div align="center">
  <form name="form1" method="post" action="" style="margin:0 0 0 0">
    <%n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?"&urls&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?"&urls&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
    <input type="hidden" name="hid" value="<%=totalpage%>">
    &nbsp;&nbsp;跳至
    <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
    页
    <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
  </form>
</div>
<script type="text/javascript">
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name =='obj')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
