<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p22")
'''''''''''''''''''''''''''''''''''''''''''''''
dim currentpage,totalpage,totalnum,recpage,urls,listtitle,act
recpage=20
dim lp_id,lpareaid,infotypeid,title
act=request.querystring("act")
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
if(request.QueryString("lp_id")<>"") then
	lp_id=Clng(request.QueryString("lp_id"))
else
	lp_id=0
end if
urls="lp_id="&lp_id
%>
<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;
}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?lp_id<%=lp_id%>&";
	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>
<script language="JavaScript" src="../js/PublicJS.js"></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>
<%
if(act="add") then
%>
<form action="?act=doadd&lp_id=<%=lp_id%>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="22" colspan="2" bgcolor="#F5F5F5"><div align="center">添加楼盘历史价格</div></td>
  </tr>
  <tr>
    <td width="36%" height="22" bgcolor="#FFFFFF"><div align="right">日期：</div></td>
    <td width="64%" bgcolor="#FFFFFF"><div align="left">
      <input name="f_date" type="text" id="f_date" value="<%=date%>">
      <input name="date1" type="button" id="sdaf" onClick="OpenWindowAndSetValue('Inc/SelectDate.asp',280,120,window,document.forms[0].f_date);document.forms[0].f_date.focus();" value="选择日期">
</div></td>
  </tr>
  <tr>
    <td height="22" bgcolor="#FFFFFF"><div align="right">价格：</div></td>
    <td bgcolor="#FFFFFF"><div align="left">
      <textarea name="f_price" cols="55" rows="3" id="f_price"></textarea>
    </div></td>
  </tr>
  <tr>
    <td height="22" bgcolor="#FFFFFF"><div align="right">价格描述：</div></td>
    <td height="22" bgcolor="#FFFFFF"><input name="f_desc" type="text" id="f_desc" size="55"></td>
  </tr>
  <tr>
    <td height="22" colspan="2" bgcolor="#FFFFFF"><div align="center">
      <input type="submit" name="Submit" value="提 交">&nbsp;&nbsp;
      <input type="reset" name="Submit3" value="重 写">
    </div></td>
    </tr>
</table>
</form>
<%
elseif(act="doadd") then
	dim f_price,f_date,f_desc
	f_price=request.form("f_price")
	f_date=request.form("f_date")
	f_desc=request.form("f_desc")
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_lp_hisprice",conn,3,3
	rs.addnew
	rs("f_date")=f_date
	rs("f_price")=f_price
	rs("f_desc")=f_desc
	rs("lp_id")=lp_id
	rs.update
	rs.close
	set rs=nothing
	response.write("<p align=""center"">成功添加楼盘历史价格!<a href=""?lp_id="&lp_id&""">返回管理</a>&nbsp;<a href=""javascript:history.back();"">继续添加</a></p>")
elseif(act="mod") then	
	id=Clng(request.querystring("id"))
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_lp_hisprice where id="&id,conn,3,1
	if not rs.eof then
%>
<form action="?act=domod&id=<%=id%>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="22" colspan="2" bgcolor="#F5F5F5"><div align="center">修改楼盘历史价格</div></td>
  </tr>
  <tr>
    <td width="36%" height="22" bgcolor="#FFFFFF"><div align="right">日期：</div></td>
    <td width="64%" bgcolor="#FFFFFF"><div align="left">
      <input name="f_date" type="text" id="f_date" value="<%=rs("f_date")%>">
      <input name="date1" type="button" id="sdaf" onClick="OpenWindowAndSetValue('Inc/SelectDate.asp',280,120,window,document.forms[0].f_date);document.forms[0].f_date.focus();" value="选择日期">
</div></td>
  </tr>
  <tr>
    <td height="22" bgcolor="#FFFFFF"><div align="right">价格：</div></td>
    <td bgcolor="#FFFFFF"><div align="left">
      <textarea name="f_price" cols="55" rows="3" id="f_price"><%=rs("f_price")%></textarea>
    </div></td>
  </tr>
  <tr>
    <td height="22" bgcolor="#FFFFFF"><div align="right">价格描述：</div></td>
    <td height="22" bgcolor="#FFFFFF"><input name="f_desc" type="text" id="f_desc" value="<%=rs("f_desc")%>" size="55"></td>
  </tr>
  <tr>
    <td height="22" colspan="2" bgcolor="#FFFFFF"><div align="center">
      <input type="submit" name="Submit" value="提 交">&nbsp;&nbsp;
      <input type="reset" name="Submit3" value="重 写">
    </div></td>
    </tr>
</table>
</form>
<%
	end if
	rs.close
	set rs=nothing
elseif(act="domod") then
	id=Clng(request.querystring("id"))
	f_price=request.form("f_price")
	f_date=request.form("f_date")
	f_desc=request.form("f_desc")
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_lp_hisprice where id="&id,conn,3,3
	rs("f_date")=f_date
	rs("f_price")=f_price
	rs("f_desc")=f_desc
	rs.update
	rs.close
	set rs=nothing
	response.write("<p align=""center"">成功修改楼盘历史价格!<a href=""javascript:history.go(-2);"">返回管理</a>&nbsp;<a href=""javascript:history.go(-2);"">继续修改</a></p>")
elseif(act="do") then
	dim obj,objArr,flags,do_type
	do_type=request.form("do_type")
	if not isempty(request.Form("obj")) then
		obj=request.Form("obj")
	else
		response.Write("请选择需要操作的记录")
		response.Write("<a href=""#"" onClick=""javascript:history.back();"">返回</a>")
		response.End()
	end if
	objArr=split(obj,",")
		for i=0 to ubound(objArr)	
			if(do_type="del") then
				conn.execute("delete from t_lp_hisprice where id="&objArr(i))
			end if				
		next
	
	response.Write("批量执行成功！")		
	response.Redirect(request.ServerVariables("HTTP_REFERER"))
else
%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="22" bgcolor="#FFFFFF"><div align="center"><a href="?act=add&lp_id=<%=lp_id%>"><strong>添加楼盘历史价格</strong></a></div></td>
  </tr>
</table>
<form action="?act=do" method="post" name="mem" style="margin:0px; padding:0px;">
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
      <tr>
        <td width="6%" bgcolor="#F5F5F5" class="style1"><div align="center" class="style4"></div></td>
        <td width="39%" height="22" bgcolor="#F5F5F5"><div align="center"><strong>价格</strong></div></td>
        <td width="30%" bgcolor="#F5F5F5"><div align="center">价格描述</div></td>
        <td width="14%" bgcolor="#F5F5F5"><div align="center"><strong>日期</strong></div></td>
        <td width="11%" bgcolor="#F5F5F5" class="style4"><div align="center" class="style4"><strong>修改</strong></div></td>
    </tr>
	  <%
		dim csql,qsql
		csql="select count(*) AS co from t_lp_hisprice where 1=1"
		if(lp_id>0) then
			csql=csql&" and lp_id="&lp_id
		end if		
		qsql="select top "&recpage&" id,f_date,f_price,f_desc from t_lp_hisprice where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_lp_hisprice where 1=1"
		if(lp_id>0) then
			qsql=qsql&" and lp_id="&lp_id
		end if
		
		qsql=qsql&" order by id desc) as t)"
		if(lp_id>0) then
			qsql=qsql&" and lp_id="&lp_id
		end if		
		qsql=qsql&" order by id desc "			
		''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	  allrec=conn.execute(csql)(0)
	  totalpage=Cint((allrec-1+recpage)/recpage)
	  set rs=server.createobject("adodb.recordset")
		rs.open qsql,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="#FFFFFF"><div align="center">
          <input type="checkbox" name="obj" value="<%=listArr(0,j)%>" />
        </div></td>
        <td height="20" bgcolor="#FFFFFF"><div align="left"><%=listArr(2,j)%></div></td>
        <td bgcolor="#FFFFFF"><div align="center"><%=listArr(3,j)%></div></td>
        <td bgcolor="#FFFFFF"><div align="center"><%=listArr(1,j)%></div></td>
        <td bgcolor="#FFFFFF"><div align="center"><a href="?act=mod&id=<%=listArr(0,i)%>">修改</a></div></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>	
  </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>
<%
end if
%>
</body>
</html>
<%
call connclose()
%>
