<?php
	session_start();
	require_once("db/db.php");	
	require_once("common/common.php");
	require_once("..\Wx.Config.php");
	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期
	//判断是否登录系统		
	if($_SESSION['main_wx_userlogined']!="1" | $_SESSION['main_wx_userno']=="")
	{
		//没有登录开始启动登录
		header('location:..\loginwx.php?rset=0');
		exit;
	}
	
	$strRevChainNo=$_REQUEST["chainno"];
	if(strlen($strRevChainNo)>0)
	{
		$sql=sprintf("SELECT Chain_No,Chain_Name FROM Chain_Infor WHERE Chain_No='%s'",$strRevChainNo);				
		$result = querySql($sql);		
		if($row = fetch_array($result))
		{
			$strNewChainNo= $row['Chain_No'];
			$strNewChainName= $row['Chain_Name'];
		}
		freeResult($result);
		
		$_SESSION["ChainNo"]=$strNewChainNo;
		$_SESSION["ChainName"]=$strNewChainName;
			
	}
	
	$chainno=$_SESSION["ChainNo"];
	
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="gb2312">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=0">
	<meta name="apple-touch-fullscreen" content="1">
	
	<Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)"> 
	<Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)">
	
	<title><?php echo $_SESSION['ChainName']?></title>
	
	<link rel="stylesheet" href="css/mycss.css"> 
	
	<link rel="stylesheet" href="jsp4/jquery.mobile-1.4.3.min.css">
	<script src="jsp4/jquery.js"></script>
	<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>
</head>

<script>	
		//隐藏维信右上角菜单
		function onBridgeReady(){
			WeixinJSBridge.call('hideOptionMenu');
		}

		if (typeof WeixinJSBridge == "undefined")
		{
			if( document.addEventListener )
			{
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
			}
			else if (document.attachEvent)
			{
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		}
		else
		{
			onBridgeReady();
		}
</script>
	
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">

<section data-role="page" id="reportsitedA">		
	
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
        <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
		   	<tr>
				<td height="45" width="30" align="center"></td>
				<td height="45" align="center" valign="middle">
	                <span id="MsgTxt" style="color:<?php echo WxMainConfig::colHeadTextColor;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;">自助选房</span>
               	</td>
				<td height="45" width="30" valign="middle"></td>
		  	</tr>
		</table>
	</header>
		
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
			<tr>
				<td height="4" width="15"></td>
				<td height="4" align="left"></td>
				<td height="4" width="15"></td>
			</tr>
			
            <?php
            	
				$strselroomno='';
				$strrlistno='0';
				$introomstate=0;
				$introwindex=0;
				$strroomstate='';
				$intfloor=0;
				
				
				
				
				$sql=sprintf("SELECT a.ListNo,a.Room_No,a.Room_State,a.Room_Floor FROM TR_Room_Inform a,TR_Room_Type b
								WHERE a.TypeListNo=b.ListNo And b.Chain_No='%s'",$chainno);

				$result = querySql($sql);
											
				while($row = fetch_array($result))
				{
					$strselroomno=$row['Room_No'];
					$strrlistno=$row['ListNo'];
					$introomstate=$row['Room_State'];
					$intfloor=$row['Room_Floor'];
			
					$introwindex = $introwindex + 1;
					
					$strroomstate='';
					//状态:0空房,1预订房,2在住房,3钟点房,4自用房,5退客房,6维修房,7锁房
					switch($introomstate)
					{
					  case 1:
					  	$strroomstate='当前状态：预订排房';
					    break;
					  case 2:
					  	$strroomstate='当前状态：客人在住';
						break;
					  case 3:
					  	$strroomstate='当前状态：钟点房在住';
						break;
					  case 4:
					  	$strroomstate='当前状态：内部用房';
						break;
					  case 6:
					  	$strroomstate='当前状态：客房维修中';
						break;
					  case 7:
					  	$strroomstate='当前状态：临时保留';
						break;
					}

					
			?>
			
            <tr>
				<td height="50" width="15"></td>
				<td height="50" align="left">
                	
                    <!---显示房间信息列表--> 
                    <div id="cmdroomsuit" onClick="myroomclick(<?php echo $introwindex;?>);" >
                        <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td height="49" width="90"> 
                                    <span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;"><?php echo $strselroomno;?></span> 
           							<input id="check<?php echo $introwindex;?>" name="check<?php echo $introwindex;?>" value="0" type="hidden" />
           							<input id="roomno<?php echo $introwindex;?>" name="roomno<?php echo $introwindex;?>" value="<?php echo $strselroomno;?>" type="hidden" />
           							<input id="selpos<?php echo $introwindex;?>" name="selpos<?php echo $introwindex;?>" value="0" type="hidden" />
                                    
                                </td>
                                <td height="49"> 
									<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                    	<tr><td width="100%" height="12%"></td></tr>
                                    	<tr><td width="100%" height="35%">
                                        	<span style="color: #D7C4C4;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;">所属楼层：<?php echo $intfloor;?>层</span>
                                         	</td></tr>
                                    	<tr><td width="100%" height="38%">
                                        	<span style="color: #D7C4C4;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;"><?php echo $strroomstate;?></span> 
                                            </td></tr>
                                       	<tr><td width="100%" height="15%"></td></tr>
                                    </table>
                                </td>
                                
                            </tr>
                            
                            <tr>
                                <td height="1" colspan="2" bgcolor="#F2E2E2"></td>
                            </tr>
                        </table>
                    </div>
                </td>
				<td height="50" width="15"></td>
			</tr>
            
            <?php 
				}
				
				//释放数据库
				freeResult($result);	
				//关闭数据库
				closeDb();	
			?>
			
			<tr><td height="10" colspan="3" bgcolor="#fff"></td></tr>
		</table>
			
	</article>
	
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px solid #F2E2E2;border-bottom:0px solid #F2E2E2;border-left:1px solid #F2E2E2;border-right:1px solid #F2E2E2;">
		<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
			
			
			
			
			<tr height="42" valign="top">
				<td width="33%">
					<a class="ui-btn ui-icon-home ui-btn-icon-top" target="_parent" href="..\indexm.php?rset=0" style="width:93%;height:10px;margin:0px auto 0px auto;">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">主页</span>
					</a>
				</td>
				
				<td width="33%">					
					<a class="ui-btn ui-icon-grid ui-btn-icon-top" target="_parent" href="#" style="width:93%;height:10px;margin:0px auto 0px auto;text-shadow:none;color:#666666;background-color:#F3F4EC;">
					<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">已分房</span>
					</a>
				</td>
				<td width="34%">
					<a class="ui-btn ui-icon-bullets ui-btn-icon-top" target="_parent" href="#reportsitedB" style="width:93%;height:10px;margin:0px auto 0px auto;text-shadow:none;">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">未分房</span>
					</a>
				</td>
			</tr>
		</table>		
	</footer>
	
	<script tyle="text/javascript"> 
		//处理点击事件进入相应的页面
		function gbClick(id)
		{ 
			switch (id)
			{
				case -1:	//返回
					parent.window.location.href='index.php';
					//window.location.href="repRoomView.php?roomstate=*";
					break;
				case 0:	//刷新
					//parent.window.location.href='index.php';
					window.location.href="repdaysited.php?datday1=" + $dp.$('dtp1').value;
					break;
			}
		}
			
	</script> 
</section>


</body>
</html>
