<?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"];
	
	//得到当前选择的服务员
	$intSelUserFlag=0;
	$strSelUserNo=trim($_REQUEST["fwuser"]);
	$strSelUserName='';
	if(strlen($strSelUserNo)>0)
	{
		//如果有选择的操作员
		$sql=sprintf("SELECT a.Use_Name,a.Use_No FROM User_QuanXian a,User_Group b WHERE a.Group_No=b.Group_No And a.FWFlag>0 And (b.Chain_No='%s' OR b.Chain_No='<所有>') And a.Use_No='%s'
					UNION Select a.Use_Name,a.Use_No From User_QuanXian a,User_Group b,User_Group_Chain c
					WHERE a.Group_No=b.Group_No AND a.Group_No=c.Group_No And a.FWFlag>0 And b.Chain_No<>'%s' AND c.Chain_No='%s' And a.Use_No='%s'
					ORDER BY a.Use_No ASC",$chainno,$strSelUserNo,$chainno,$chainno,$strSelUserNo);
		$result = querySql($sql);
		if($row = fetch_array($result))
		{
			$strSelUserNo= trim($row['Use_No']);
			$strSelUserName= trim($row['Use_Name']);
			$intSelUserFlag=1;
		}
		freeResult($result);
	}
		
	//根据工号获取到操作员姓名
	if($intSelUserFlag<1)
	{
		//如果没有选择的操作员,就默认第一个服务员
		$sql=sprintf("SELECT a.Use_Name,a.Use_No FROM User_QuanXian a,User_Group b WHERE a.Group_No=b.Group_No And a.FWFlag>0 And (b.Chain_No='%s' OR b.Chain_No='<所有>')
					UNION Select a.Use_Name,a.Use_No From User_QuanXian a,User_Group b,User_Group_Chain c
					WHERE a.Group_No=b.Group_No AND a.Group_No=c.Group_No And a.FWFlag>0 And b.Chain_No<>'%s' AND c.Chain_No='%s'
					ORDER BY a.Use_No ASC",$chainno,$chainno,$chainno);
		$result = querySql($sql);
		if($row = fetch_array($result))
		{
			$strSelUserNo= trim($row['Use_No']);
			$strSelUserName= trim($row['Use_Name']);
			$intSelUserFlag=1;
		}
		freeResult($result);
	}
	
	if($intSelUserFlag<1)
	{
		//没有可选择的操作员
		$strSelUserNo='';
		$strSelUserName='';
	}
	
	
	//获取当前服务员是否是参与分房
	$tradeuserno=trim($_SESSION['main_wx_userno']);
	$intIsUsedAllocateFlag=0;	//是否参与分房，如果是参与分房，就只显示自己名下的房间
	$sql=sprintf("Select FWFlag From User_QuanXian Where Use_No='%s'",$tradeuserno);
	$result = querySql($sql);
	if($row = fetch_array($result))
	{
		if($row['FWFlag']>0)
		{
			$intIsUsedAllocateFlag=1;	//是否参与分房，如果是参与分房，就只显示自己名下的房间
		}
	}
	freeResult($result);	
?>
<!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>
	
<?php
		$colKF="#F0ECDF";	//空房数
		$colZK="#66FF00";	//住客
		$colZD="#CCCC33";	//钟点
		$colZZ="#33FF00";	//住客脏房0099FF
		$colZF="#999999";	//脏房
		$colWX="#FF3737";	//维修
		$colYD="#0099FF";	//预订
		$colAL="#99FFFF";	//所有			
		
		$colKFTxt="#000";	//空房数
		$colZKTxt="#000";	//住客
		$colZDTxt="#000";	//钟点
		$colZZTxt="#000";	//住客脏房0099FF
		$colZFTxt="#000";	//脏房
		$colWXTxt="#000";	//维修
		$colYDTxt="#000";	//预订
		$colALTxt="#000";	//所有	
		
		$colMF='#33FF00';	//免费房
		$colMFTxt='#000';	//免费房
		$colSF='#D7E8F3';	//锁房
		$colSFTxt='#000';	//锁房
		
		//获取数据库中设置的状态颜色**************************************//
		$strSelSubStateName='';
		$strSelSubStateColor='';
		$strSelSubTextColor='';
		$lngSelSubColor=0;
		
		$sql=sprintf("SELECT State_Name,State_Color,TextColor FROM TR_Room_State ");

		$result = querySql($sql);		
		while($row = fetch_array($result))
		{
			$strSelSubStateName= $row['State_Name'];
			//背景色
			$lngSelSubColor= $row['State_Color'];
			$hexadecimalNumber = dechex($lngSelSubColor);
			$strSelSubStateColor="#".substr($hexadecimalNumber, -6);
			//字体颜色
			$lngSelSubColor= $row['TextColor'];
			$hexadecimalNumber = dechex($lngSelSubColor);
			$strSelSubTextColor="#".substr($hexadecimalNumber, -6);
		
			switch($strSelSubStateName)
			{
				case '空房':
					$colKF=$strSelSubStateColor;	//空房
					$colKFTxt=$strSelSubTextColor;	//空房
					break;
				case '在住房':
					$colZK=$strSelSubStateColor;	//住客
					$colZZ=$strSelSubStateColor;	//住客脏房
					
					$colZKTxt=$strSelSubTextColor;	//住客
					$colZZTxt=$strSelSubTextColor;	//住客脏房
					break;
				case '钟点房':
					$colZD=$strSelSubStateColor;	//钟点
					$colZDTxt=$strSelSubTextColor;	//钟点
					break;
				case '退客房':
					$colZF=$strSelSubStateColor;	//脏房
					$colZFTxt=$strSelSubTextColor;	//脏房
					break;
				case '维修房':
					$colWX=$strSelSubStateColor;	//维修
					$colWXTxt=$strSelSubTextColor;	//维修
					break;
				case '预订房':
					$colYD=$strSelSubStateColor;	//预订
					$colYDTxt=$strSelSubTextColor;	//预订
					break;
				case '免费房':
					$colMF=$strSelSubStateColor;	//免费房
					$colMFTxt=$strSelSubTextColor;	//免费房
					break;
				case '锁房':
					$colSF=$strSelSubStateColor;	//锁房
					$colSFTxt=$strSelSubTextColor;	//锁房
					break;					
					
					
			}
		}
		freeResult($result);
?>


<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="50" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
		   	<tr>				
				<td height="45" width="30" align="center">
					<img src="images\listidsub.png" width="17" height="16" border="0" style="margin-top:4px;">
				</td>
				
				<td height="45" width="150" align="left">
					
					<div style="border:1px solid #fff;border-radius:4px;width:140px; height:26px; background-color:#fff;">
						<a data-transition="none" href="#ShowUserListSel" data-rel="popup" data-position-to="window" style="width:100%;height:100%;margin:0px auto 0px auto;color:#66666;text-shadow:none;text-decoration:none;">
							<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
								<tr><td width="100%" height="100%" align="center">
									<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="100%" align="center">
												<span style="color:<?php echo WxMainConfig::colHeadBkColor;?> ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strSelUserName;?></span>
											</td>
											<td width="20" height="100%" align="left">
												<span style="color:<?php echo WxMainConfig::colHeadBkColor;?> ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">▼</span>
											</td>
										</tr>
									</table>
								</td></tr>
							</table>
						</a>
					</div>	
					
					<!--启动选择班级的窗体-->
					<div data-role="popup" id="ShowUserListSel" data-corners="false">
						<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
						<table width="280" height="450" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
							<tr><td height ="5" colspan="3" align="center"></td></tr>
							<tr><td height ="35" colspan="3" align="center"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;user-select:none;">选择服务员</span></td></tr>
							<tr><td height ="1" colspan="3" align="center" bgcolor="#F2E2E2"></td></tr>
							<tr><td height ="4" colspan="3" align="center"></td></tr>
							
							<tr>
								<td height ="400" width="4"></td>
								<td height ="400" valign="top">
									<div style="border:0px solid #fff;width:304px; height:400px; overflow: auto;">
													
										<table width="100%" border="0" cellpadding="0" cellspacing="0">											
											<?php			
												$intRowIndex=0;
												
												$sql=sprintf("SELECT a.Use_Name,a.Use_No FROM User_QuanXian a,User_Group b WHERE a.Group_No=b.Group_No And a.FWFlag>0 And (b.Chain_No='%s' OR b.Chain_No='<所有>')
														UNION Select a.Use_Name,a.Use_No From User_QuanXian a,User_Group b,User_Group_Chain c
														WHERE a.Group_No=b.Group_No AND a.Group_No=c.Group_No And a.FWFlag>0 And b.Chain_No<>'%s' AND c.Chain_No='%s'
														ORDER BY a.Use_No ASC",$chainno,$chainno,$chainno);
												$result = querySql($sql);
												while($row = fetch_array($result))
												{
													$strSubUserNo= trim($row['Use_No']);
													$strSubUserName= trim($row['Use_Name']);
												
													$intRowIndex=$intRowIndex+1;
											?>
											<tr>
												<td height="40" colspan="3" align="center">
													<div onClick="bmtSelItem('<?php echo $strSubUserNo;?>');"  style="border-radius:4px;width:90%; height:40px; background-color:#fff;padding-top:0px;">
														<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
															<tr>
																<td height="40" width="30"  align="center">
																	<span style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;"><?php echo $intRowIndex?>.</span>
																</td>
																<td height="40" align="left">
																	<span style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;"><?php echo $strSubUserName;?></span>
																</td>
																<td height="40" width="80" align="center">
																	<span style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;"><?php echo $strSubUserNo;?></span>
																</td>
															</tr>
														</table>
													</div>
												</td>
											</tr>

											<tr><td height="1" colspan="3" bgcolor="#F2E2E2"></td></tr>
											
											<?php
												}
												//释放数据库
												freeResult($result);
															
												if($intRowIndex<1) 
												{
											?>
												<tr><td height="85" colspan="3"  align="center">
													<span style="color:#c3c3c3 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">~无可分配操作员~</span>
												</td></tr>
											<?php } ?>
										</table>
											

											
									</div>
								</td>
								<td height ="400" width="4"></td>
							</tr>
												
							<tr><td height ="5" colspan="3" align="center"></td></tr>
						</table>
					</div>
					<!--结束   启动选择班级的窗体 结束-->
					
					
				</td>
				
				
				<td height="45" width="40" valign="middle"></td>
				
				<td height="45"  align="left" valign="middle">
					<?php if($intIsUsedAllocateFlag<1) {?>
	                <div onClick="bmtSendRoomToUser();" style="border:1px solid #fff; border-radius:14px;width:96px; height:24px; background-color:<?php echo WxMainConfig::colHeadBkColor;?>; margin-top:2px; padding-top:2px;">
						<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px; text-shadow:none; margin-left:14px;">服务员分房</span>
					</div>
					<?php } ?>
               	</td>
		  	</tr>
		</table>
	</header>
		
	<article data-role="none">
		<table width="100%" border="1" bordercolor="#FFFFFF" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
		
			
			
            <?php
            	
				$strselroomno='';
				$introomstate=0;
				$strroomstate='';
				$strroomtype='';
				$intDirty=0;
				$colRoomBK='#F0ECDF';
				$colRoomTxt='#000';
				//****************************************
				$intRowIndex=0;
				$strRoomNo1='';
				$strRoomNo2='';
				$strRoomNo3='';
				$strRoomNo4='';
				$strRoomNo5='';
				$strRoomState1='';
				$strRoomState2='';
				$strRoomState3='';
				$strRoomState4='';
				$strRoomState5='';
				$strRoomType1='';
				$strRoomType2='';
				$strRoomType3='';
				$strRoomType4='';
				$strRoomType5='';
				
				$colRoomBK1='#F0ECDF';
				$colRoomTxt1='#000';
				
				$colRoomBK2='#F0ECDF';
				$colRoomTxt2='#000';
				
				$colRoomBK3='#F0ECDF';
				$colRoomTxt3='#000';
				
				$colRoomBK4='#F0ECDF';
				$colRoomTxt4='#000';
				
				$colRoomBK5='#F0ECDF';
				$colRoomTxt5='#000';
				
				$isdirtyflag1=0;
				$isdirtyflag2=0;
				$isdirtyflag3=0;
				$isdirtyflag4=0;
				$isdirtyflag5=0;
				
				$lngRoomLD=0;
				$lngRoomLD1=0;
				$lngRoomLD2=0;
				$lngRoomLD3=0;
				$lngRoomLD4=0;
				$lngRoomLD5=0;
				//****************************************
				if(strlen($strSelUserNo)<1)
				{
					$sql=sprintf("SELECT a.ListNo,a.Room_No,a.Room_State,b.Room_Type,a.Dirty_Flag FROM TR_Room_Inform a,TR_Room_Type b
								WHERE a.TypeListNo=b.ListNo And b.Chain_No='%s' And UserNameNow='*+*'",$chainno);
				}
				else
				{
					$sql=sprintf("SELECT a.ListNo,a.Room_No,a.Room_State,b.Room_Type,a.Dirty_Flag FROM TR_Room_Inform a,TR_Room_Type b
								WHERE a.TypeListNo=b.ListNo And b.Chain_No='%s' And UserNameNow='%s' order by a.Room_No ASC",$chainno,$strSelUserNo);
				}
				$result = querySql($sql);

				while($row = fetch_array($result))
				{
					$strselroomno=$row['Room_No'];
					$strroomtype=$row['Room_Type'];
					$introomstate=$row['Room_State'];
			
					$intDirty= $row['Dirty_Flag'];
					$lngRoomLD= $row['ListNo'];
					
					$intRowIndex = $intRowIndex + 1;
					
					$strroomstate='';
									
					//生成状态颜色
					switch($introomstate)
					{
						case 0:
							$colRoomBK=$colKF;	//空房数
							$colRoomTxt=$colKFTxt;
							$strroomstate="空净房";
							break;
						case 5:
							$colRoomBK=$colZF;	//脏房
							$colRoomTxt=$colZFTxt;
							$strroomstate="退客房";
							break;
						case 6:
							$colRoomBK=$colWX;	//维修
							$colRoomTxt=$colWXTxt;
							$strroomstate="维修房";
							break;
						case 1:
							$colRoomBK=$colYD;	//预订
							$colRoomTxt=$colYDTxt;
							$strroomstate="预订房";
							break;
						case 2:
							if($intDirty==1)
							{
								$colRoomBK=$colZZ;	//住客脏房
								$colRoomTxt=$colZZTxt;
								$strroomstate="住脏房";
							}
							else
							{
								$colRoomBK=$colZK;	//住客
								$colRoomTxt=$colZKTxt;
								$strroomstate="住客房";
							}
							break;
						case 3:
							$colRoomBK=$colZD;	//钟点	
							$colRoomTxt=$colZDTxt;
							$strroomstate="钟点房";
							break;
						default:
							$colRoomBK="#D7E8F3";
							$colRoomTxt='#000';
							if($introomstate==5)
							{
								$strroomstate="免费房";
								$colRoomBK=$colMF;
								$colRoomTxt=$colMFTxt;
							}
							if($introomstate==7)
							{
								$strroomstate="锁房";
								$colRoomBK=$colSF;
								$colRoomTxt=$colSFTxt;
							}
							else
							{
								$strroomstate="其他";
							}
							break;
					}
					

					//开始分配到指定房号
					switch($intRowIndex)
					{
						case 1:
							$strRoomNo1 = $strselroomno;
							$strRoomState1 = $strroomstate;
							$strRoomType1 = $strroomtype;
							$colRoomBK1=$colRoomBK;
							$colRoomTxt1=$colRoomTxt;
							$isdirtyflag1=$intDirty;
							$lngRoomLD1=$lngRoomLD;
							break;
						case 2:
							$strRoomNo2 = $strselroomno;
							$strRoomState2 = $strroomstate;
							$strRoomType2 = $strroomtype;
							$colRoomBK2=$colRoomBK;
							$colRoomTxt2=$colRoomTxt;
							$isdirtyflag2=$intDirty;
							$lngRoomLD2=$lngRoomLD;
							break;
						case 3:
							$strRoomNo3 = $strselroomno;
							$strRoomState3 = $strroomstate;
							$strRoomType3 = $strroomtype;
							$colRoomBK3=$colRoomBK;
							$colRoomTxt3=$colRoomTxt;
							$isdirtyflag3=$intDirty;
							$lngRoomLD3=$lngRoomLD;
							break;
						case 4:
							$strRoomNo4 = $strselroomno;
							$strRoomState4 = $strroomstate;
							$strRoomType4 = $strroomtype;
							$colRoomBK4=$colRoomBK;
							$colRoomTxt4=$colRoomTxt;
							$isdirtyflag4=$intDirty;
							$lngRoomLD4=$lngRoomLD;
							break;
						case 5:
							$strRoomNo5 = $strselroomno;
							$strRoomState5 = $strroomstate;
							$strRoomType5 = $strroomtype;
							$colRoomBK5=$colRoomBK;
							$colRoomTxt5=$colRoomTxt;
							$isdirtyflag5=$intDirty;
							$lngRoomLD5=$lngRoomLD;
							break;
							
					}
					
					
					if($intRowIndex>4)
					{
						//如果满足一行了						
						//开始显示数据
			?>
			
			
			<tr height="50" style="border-radius:5px;" >					
				<td onClick="openRoomModal('<?php echo $strRoomNo1;?>','<?php echo $strRoomType1;?>','<?php echo $strRoomState1;?>','<?php echo $lngRoomLD1;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK1;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag1==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div onClick="openRoomModal('<?php echo $strRoomNo1;?>');" style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo1;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType1;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState1;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				
				<td onClick="openRoomModal('<?php echo $strRoomNo2;?>','<?php echo $strRoomType2;?>','<?php echo $strRoomState2;?>','<?php echo $lngRoomLD2;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK2;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag2==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt2;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo2;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt2;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType2;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt2;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState2;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				
				<td onClick="openRoomModal('<?php echo $strRoomNo3;?>','<?php echo $strRoomType3;?>','<?php echo $strRoomState3;?>','<?php echo $lngRoomLD3;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK3;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag3==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt3;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo3;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt3;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType3;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt3;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState3;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				
				<td onClick="openRoomModal('<?php echo $strRoomNo4;?>','<?php echo $strRoomType4;?>','<?php echo $strRoomState4;?>','<?php echo $lngRoomLD4;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK4;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag4==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt4;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo4;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt4;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType4;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt4;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState4;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				
				<td onClick="openRoomModal('<?php echo $strRoomNo5;?>','<?php echo $strRoomType5;?>','<?php echo $strRoomState5;?>','<?php echo $lngRoomLD5;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK5;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag5==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt5;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo5;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt5;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType5;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt5;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState5;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
							
				
			<?php
						//开始清空行缓存
						$intRowIndex=0;
						$strRoomNo1='';
						$strRoomNo2='';
						$strRoomNo3='';
						$strRoomNo4='';
						$strRoomNo5='';
						$strRoomState1='';
						$strRoomState2='';
						$strRoomState3='';
						$strRoomState4='';
						$strRoomState5='';
						$strRoomType1='';
						$strRoomType2='';
						$strRoomType3='';
						$strRoomType4='';
						$strRoomType5='';
					}
					
			?>
			
            
            
            <?php 
				}
				
				//显示剩余的部分
			?>
			
			<tr height="50" style="border-radius:5px;" >
				<?php if (strlen($strRoomNo1)>0) { ?>
				<td onClick="openRoomModal('<?php echo $strRoomNo1;?>','<?php echo $strRoomType1;?>','<?php echo $strRoomState1;?>','<?php echo $lngRoomLD1;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK1;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag1==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo1;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType1;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState1;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				<?php } else {?>
				<td height="30" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" valign="top"> </td>
				<?php } ?>
				
				
				<?php if (strlen($strRoomNo2)>0) { ?>
				<td onClick="openRoomModal('<?php echo $strRoomNo2;?>','<?php echo $strRoomType2;?>','<?php echo $strRoomState2;?>','<?php echo $lngRoomLD2;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK2;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag2==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt2;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo2;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt2;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType2;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt2;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState2;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				<?php } else {?>
				<td height="30" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" valign="top"> </td>
				<?php } ?>
				
				
				<?php if (strlen($strRoomNo3)>0) { ?>
				<td onClick="openRoomModal('<?php echo $strRoomNo3;?>','<?php echo $strRoomType3;?>','<?php echo $strRoomState3;?>','<?php echo $lngRoomLD3;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK3;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag3==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt3;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo3;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt3;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType3;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt3;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState3;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				<?php } else {?>
				<td height="30" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" valign="top"> </td>
				<?php } ?>
				
				
				<?php if (strlen($strRoomNo4)>0) { ?>
				<td onClick="openRoomModal('<?php echo $strRoomNo4;?>','<?php echo $strRoomType4;?>','<?php echo $strRoomState4;?>','<?php echo $lngRoomLD4;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK4;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag4==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt4;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo4;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt4;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType4;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt4;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState4;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				<?php } else {?>
				<td height="30" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" valign="top"> </td>
				<?php } ?>
				
				
				<?php if (strlen($strRoomNo5)>0) { ?>
				<td onClick="openRoomModal('<?php echo $strRoomNo5;?>','<?php echo $strRoomType5;?>','<?php echo $strRoomState5;?>','<?php echo $lngRoomLD5;?>');" height="58" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="<?php echo $colRoomBK5;?>" align="center" valign="top">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%" height="6"> 
								<?php	if($isdirtyflag5==1) {?>
									<div style="width:100%;height:6px;background:<?php echo $colZF;?>;border-radius:0px;border-top-right-radius:5px;border-top-left-radius:5px;"></div>
								<?php } else {?>
									<div style="width:100%;height:6px;"></div>
								<?php } ?> 
							</td>
						</tr>
						
						<tr>
							<td width="100%" align="center" valign="top">
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt5;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;"><?php echo $strRoomNo5;?></span></div>
								<div style="width:100%;height:14px;"><span style="color: <?php echo $colRoomTxt5;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:9px;text-shadow:none;"><?php echo $strRoomType5;?></span> </div>
								<div style="width:100%;height:10px;"><span style="color: <?php echo $colRoomTxt5;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:10px;text-shadow:none;"><?php echo $strRoomState5;?></span> </div>
							</td>
						</tr>
					</table>
				</td>
				<?php } else {?>
				<td height="30" width="17%" style="border-radius:5px;" bordercolor="#FFFFFF" bgcolor="#FFFFFF" align="center" valign="top"> </td>
				<?php } ?>
			</tr>
			
			
				
			<?php
				//释放数据库
				freeResult($result);	
				//关闭数据库
				closeDb();	
			?>
			
			<!--<tr><td height="10" colspan="3" bgcolor="#fff"></td></tr>-->
		</table>
			
			
			
			
		<!-- 模态框 -->
		<div data-role="popup" id="roomModal" data-corners="false">
			<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
			<table width="280" height="256" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
				<tr><td height ="5" colspan="3" align="center"></td></tr>
				<tr><td height ="35" colspan="3" align="center"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;user-select:none;">分房操作</span></td></tr>
				<tr><td height ="1" colspan="3" align="center" bgcolor="#F2E2E2"></td></tr>
				<tr><td height ="20" colspan="3" align="center"></td></tr>
							
				<tr>
					<td height ="35" width="20"></td>
					<td height ="35" valign="top">
						<span id="roomModal_RoomID" style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">房号：</span>
					</td>
					<td height ="35" width="4"></td>
				</tr>
				
				<tr>
					<td height ="35" width="20"></td>
					<td height ="35" valign="top">
						<span id="roomModal_RoomType" style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">房型：</span>
					</td>
					<td height ="35" width="4"></td>
				</tr>
				
				<tr>
					<td height ="35" width="20"></td>
					<td height ="35" valign="top">
						<span id="roomModal_RoomState" style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">状态：</span>
					</td>
					<td height ="35" width="4"></td>
				</tr>
				
				<tr><td height ="20" colspan="3" align="center"></td></tr>
				
				<tr>
					<td height ="45" colspan="3" align="center">
						<div id="roomModal_QXFF" onclick="SubClick_CancelFF()" style="width:170px;height:40px;border-radius:8px;top:0px;left:0px;background-color:#D7AA28;">
							<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td height="100%" align="center">
										<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">撤销分房</span> 
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
				
				<tr><td height ="25" colspan="3" align="center"></td></tr>
			</table>
		</div>
		<!--结束   启动选择班级的窗体 结束-->
					
		
		
		<script tyle="text/javascript"> 
			var lngNowRoomListNo=0;	//当前操作的房间流水号
			
			function SubClick_CancelFF()
			{
				//取消分房
				if(lngNowRoomListNo>0)
				{
					//开始操作撤销
					
					//用ajax的“同步方式”调用一般处理程序
					$.ajax({
						url: "fwroomdelsave.php?rmlistid=" + lngNowRoomListNo,
						async: false,//改为同步方式
						type: "POST",
						//data: {doid:4, rmid: "<?php echo $roomno;?>" },
						success: function (RetData) 
						{
							strret = RetData;
						}
					});
					
					if(strret.length>2)
					{
						var strSubHead =strret.substr(0,3);
				
						if(strSubHead=="*1*")
						{
							//得到新的数量值
							closeRoomModal();
							strurl="fwmain.php?chainno=<?php echo $chainno;?>&fwuser=<?php echo $strSelUserNo;?>";
							window.location=strurl;
						}
					
					}
				}				
			}
			
			// 打开房号模态框
			function openRoomModal(room,roomtype,roomstate,lngRoomLD) 
			{
				lngNowRoomListNo=lngRoomLD;
				
				var intCanDo='<?php echo $intIsUsedAllocateFlag;?>';
				if(intCanDo=='1')
				{
					return;
				}
				//设置房号
				var span1 = document.getElementById('roomModal_RoomID');
				var span2 = document.getElementById('roomModal_RoomType');
				var span3 = document.getElementById('roomModal_RoomState');
				span1.textContent = '房号：' + room;
				span2.textContent = '房型：' + roomtype;
				span3.textContent = '状态：' + roomstate;
				
				$('#roomModal').popup('open');

			}

			// 关闭模态框
			function closeRoomModal() 
			{
				$('#roomModal').popup('close');
			}
		</script> 
			
			
			
	</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="fwunallocated.php" 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>
	
</section>

<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;
			}
		}
		
		//选择新的车次后
		function bmtSelItem(strUserNo)
		{	
			strurl="fwmain.php?chainno=<?php echo $chainno;?>&fwuser=" + strUserNo;
			window.location.href=strurl;
		}
		
		function bmtSendRoomToUser()
		{
			//将当前服务员分配房间
			var strUserNo='<?php echo $strSelUserNo?>';
			if(strUserNo.length<1)
			{
				alert("请先选择要分房的服务员!");
				return;
			}
			strurl="fwallocate.php?chainno=<?php echo $chainno;?>&fwuser=" + strUserNo;
			window.location.href=strurl;
		}
		
	</script> 

</body>
</html>
