<?php
	$acl=$_SESSION["acl"];
	if (strlen($acl)<1 || !strpos($acl,"<0018>")) {	//没有权限
		ob_clean();
		header("Location: accesserror.html");
		exit;
	}
?>


<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>换房记录查询</title>
</head>

<body background="bkg.bmp">

<p align="center"><font size="5"><b>换房记录查询</b></font></p>
<hr color="#999966">


<p align="center">
<?php
	$strYear=trim($_REQUEST["year"]);
	$strMonth=trim($_REQUEST["month"]);
	if ($strYear=="" || $strMonth=="") {
		$strYear=date("Y");
		$strMonth=date("m");
	}
	if (strlen($strMonth)==1) {
		$strMonth="0".$strMonth;
	}
	$db=mysql_pconnect(get_cfg_var("SIPSERVER"),get_cfg_var("SIPUSER"),get_cfg_var("SIPPWD"));
	mysql_select_db(get_cfg_var("SIPDB"),$db);
	$rs = mysql_query( "select operator,opertime,action from operation where action like '更换房间号%' and opertime like '".$strYear."-".$strMonth."-%'",$db );
	if ($row = mysql_fetch_array($rs)) {
		$n=1;
		echo("<table border='1' bordercolor='#808080' cellspacing='0' cellpadding='0'>");
		echo("<tr><td>序号</td><td>换房时间</td><td>操作员</td><td>换房记录</td></tr>");
		while ($row) {
			echo("<tr>");
			echo("<td>".strval($n)."</td>");
			echo("<td>".$row["opertime"]."</td>");
			echo("<td>".$row["operator"]."</td>");
			echo("<td>".$row["action"]."</td>");
			echo("</tr>");
			$row = mysql_fetch_array($rs);
			$n=$n+1;
		}
		echo("</table><br>");
	} else {
		echo("查询时间范围内没有换房记录！");
	}
	mysql_free_result($rs);
	mysql_close($db);
?>
</p>


<hr>
<p align="center">SIP酒店上网计费管理系统</p>
<p align="center">作者：<b>深圳市飞沃软件有限公司</b></p>

</body>

</html>
