<?php
	session_start();
	require_once("db/db.php");	
	require_once("common/common.php");
	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期
	//判断是否登录系统		
	if($_SESSION['main_wx_userlogined']!="1" | $_SESSION['main_wx_userno']=="")
	{
		//没有登录开始启动登录
		header('location:..\loginwx.php?rset=0');
		exit;
	}
	
	//echo $datday1."**".$datday2;;
	//echo $datday1."+++".$datday2."**".$strtemp1;
?>
<!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">
		<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">	   
			<tr>
				<td height="35" width="100%" align="center">
					<span style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">在住宾客表</span>
				</td>
			</tr>			
		</table>
	</header>
	
	<article data-role="none">
		
		<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFF">
			
			<?php				
						$chainno=$_SESSION["ChainNo"];
						$OrderList=0;
						
						$RoomNo="";
						$RoomType="";
						$RoomPrice=0;
						
						$ManName="";
						$CustomType="";
						$CheckIn="";
						$CheckOut="";
						$intSitedDay=0;
						$SitedType="";
						
						$SumAllCount=0;	//总出租数
						$SumMFCount=0;	//免费房数
						$SumZDCount=0;	//钟点房数
						$SumRoomPrice=0;
						
						$intSitedLong=0;
						$intSitedTime=0;
						$intSitedFree=0;
						
						//开始去房间状态数量
						$sql=sprintf("SELECT a.Room_No,a.Room_Type,a.RoomPrice,a.Man_Name,b.Custom_Type,Convert(varchar(16),a.SelectRoomTime,120)AS CheckIn,Convert(varchar(16),a.Cancel_Date,120)AS CheckOut
								,a.Sited_Days,a.Sited_TimeFlag,a.Sited_FreeFlag,a.Sited_LongFlag FROM TR_Order_Room_List a,TR_Order_Inform b WHERE a.Order_No=b.Order_No 
								AND (b.Order_State=0 OR b.Order_State=1) AND a.Room_BillState=2 AND b.Chain_No='%s'",$chainno);
						$result = querySql($sql);		
						while($row = fetch_array($result))
						{
							//得到每一条的记录信息	
							$OrderList=$OrderList+1;
							
							$RoomNo=$row['Room_No'];
							$RoomType=$row['Room_Type'];
							$RoomPrice=$row['RoomPrice'];
							
							$ManName=$row['Man_Name'];
							$CustomType=$row['Custom_Type'];
							$CheckIn=$row['CheckIn'];
							$CheckOut=$row['CheckOut'];
							$intSitedDay=$row['Sited_Days'];
												
							$intSitedLong=$row['Sited_LongFlag'];
							$intSitedTime=$row['Sited_TimeFlag'];
							$intSitedFree=$row['Sited_FreeFlag'];

							$SumRoomPrice=$SumRoomPrice + $RoomPrice;
							$SumAllCount=$SumAllCount+1;	//总出租数
							
							$SitedType="日租";
							if($intSitedLong>0)
								$SitedType="长包";
							
							if($intSitedTime>0)	
							{
								$SitedType="钟点";
								$SumZDCount=$SumZDCount +1;	//钟点房数
							}
							elseif($intSitedFree>0)	
							{
								$SitedType="免费";
								$SumMFCount=$SumMFCount +1;	//免费房数
							}
							//以下开始显示数据							
					?>
			<tr>
				<td height="1" width="5" ></td>
				<td height="1">
					<div data-role="none" class="STYLEM2" style="border-left: 1px solid #F6F2F2;border-right: 1px solid #F6F2F2;">
						<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F4EC">
							<tr>
								<td width="100" align="left">
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">&nbsp;<?php echo $OrderList;?>、<?php echo $RoomNo;?></span>
								</td>
								<td width="100" align="left">
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">房价: <?php echo number_format($RoomPrice);?></span>
								</td>
								<td align="left">
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">房型: <?php echo $RoomType;?></span>
								</td>
							</tr>
						</table>
					</div>
					
					<div data-role="none" class="STYLEM35" style="border-left: 1px solid #F6F2F2;border-right: 1px solid #F6F2F2;">
						<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="25" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">&nbsp;姓名: <?php echo $ManName;?></span></td>
								<td height="25" width="75"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">天数: <?php echo $intSitedDay;?></span></td>
								<td height="25" width="135" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">入住: <?php echo $CheckIn;?></span></td>
							</tr>
							<tr>
								<td height="25" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">&nbsp;客源: <?php echo $CustomType;?></span></td>
								<td height="25" width="75"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">模式: <?php echo $SitedType;?></span></td>
								<td height="25" width="135" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">预离: <?php echo $CheckOut;?></span></td>
							</tr>
							
							<tr bgcolor="#F6F2F2"><td height="1" colspan="3" align="center"></tr>
						</table>
					</div>
					
					<div data-role="none" class="STYLEM2" >
						<table width="100%" height="6" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
							<tr><td height="6" ></td></tr>
						</table>
					</div>
				<td height="1" width="5" ></td>
			</tr>
			<?php
				}
				//释放数据库
				freeResult($result);
				closeDb();
			?>
		</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 bgcolor="#f1e3e3"><td height="1" align="center" colspan="4"></tr>
			
			<tr height="30" valign="top" bgcolor="#F3F4EC">
				<td height="30" width="100%" colspan="4">
					<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="10" align="left"></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">在住:<?php echo $SumAllCount;?></span></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">免费:<?php echo $SumMFCount;?></span></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">钟点:<?php echo $SumZDCount;?></span></td>
							<td align="right"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">房价合计:<?php echo $SumRoomPrice;?></span></td>
							<td width="10" align="left"></td>
						</tr>
					</table>
				</td>
				
			</tr>
			<tr height="42" valign="top">
				<td width="25%">
					<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="25%">					
					<a class="ui-btn ui-icon-bars 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="25%">
					<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>
				
				<td width="25%">					
					<a class="ui-btn ui-icon-bullets ui-btn-icon-top" target="_parent" href="#reportsitedC" 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>


<section data-role="page" id="reportsitedB">		
	<header data-role="header" data-position="fixed" data-tap-toggle="false">
		<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">	   
			<tr>
				<td height="35" width="100%" align="center">
					<span style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">今日到店宾客表</span>
				</td>
			</tr>			
		</table>
	</header>
	
	<article data-role="none">
			
		<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFF">
			
			<?php				
				$chainno=$_SESSION["ChainNo"];
				$OrderList=0;
				
				$RoomNo="";
				$RoomType="";
				$RoomPrice=0;
				
				$ManName="";
				$CustomType="";
				$CheckIn="";
				$CheckOut="";
				$intSitedDay=0;
				$SitedType="";
				
				$SumAllCount=0;	//总出租数
				$SumMFCount=0;	//免费房数
				$SumZDCount=0;	//钟点房数
				$SumRoomPrice=0;
				
				$intSitedLong=0;
				$intSitedTime=0;
				$intSitedFree=0;
				
				//开始去房间状态数量
				$sql=sprintf("SELECT a.Room_No,a.Room_Type,a.RoomPrice,a.Man_Name,b.Custom_Type,Convert(varchar(16),a.SelectRoomTime,120)AS CheckIn,Convert(varchar(16),a.Cancel_Date,120)AS CheckOut
						,a.Sited_Days,a.Sited_TimeFlag,a.Sited_FreeFlag,a.Sited_LongFlag FROM TR_Order_Room_List a,TR_Order_Inform b WHERE a.Order_No=b.Order_No 
						AND (b.Order_State=0 OR b.Order_State=1 OR b.Order_State=3) AND (a.Room_BillState=2 OR a.Room_BillState=3) 
						AND a.SelectRoomTime>convert(varchar(10),GETDATE(),120) AND b.Chain_No='%s'",$chainno);
				$result = querySql($sql);		
				while($row = fetch_array($result))
				{
					//得到每一条的记录信息	
					$OrderList=$OrderList+1;
					
					$RoomNo=$row['Room_No'];
					$RoomType=$row['Room_Type'];
					$RoomPrice=$row['RoomPrice'];
					
					$ManName=$row['Man_Name'];
					$CustomType=$row['Custom_Type'];
					$CheckIn=$row['CheckIn'];
					$CheckOut=$row['CheckOut'];
					$intSitedDay=$row['Sited_Days'];
										
					$intSitedLong=$row['Sited_LongFlag'];
					$intSitedTime=$row['Sited_TimeFlag'];
					$intSitedFree=$row['Sited_FreeFlag'];

					$SumRoomPrice=$SumRoomPrice + $RoomPrice;
					$SumAllCount=$SumAllCount+1;	//总出租数
					
					$SitedType="日租";
					if($intSitedLong>0)
						$SitedType="长包";
					
					if($intSitedTime>0)	
					{
						$SitedType="钟点";
						$SumZDCount=$SumZDCount +1;	//钟点房数
					}
					elseif($intSitedFree>0)	
					{
						$SitedType="免费";
						$SumMFCount=$SumMFCount +1;	//免费房数
					}
					//以下开始显示数据							
			?>
			
			<tr>
				<td height="1" width="5" ></td>
				<td height="1">
					<div data-role="none" class="STYLEM2" style="border-left: 1px solid #F6F2F2;border-right: 1px solid #F6F2F2;">
						<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" bgcolor="#F5F2E6">
							<tr>
								<td width="100" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">&nbsp;<?php echo $OrderList;?>、<?php echo $RoomNo;?></span></td>
								<td width="100" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">房价: <?php echo number_format($RoomPrice);?></span></td>
								<td align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">房型: <?php echo $RoomType;?></span></td>
							</tr>
						</table>
					</div>
					<div data-role="none" class="STYLEM35" style="border-left: 1px solid #F6F2F2;border-right: 1px solid #F6F2F2;">
						<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="25" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">&nbsp;姓名: <?php echo $ManName;?></span></td>
								<td height="25" width="75"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">天数: <?php echo $intSitedDay;?></span></td>
								<td height="25" width="135" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">入住: <?php echo $CheckIn;?></span></td>
							</tr>
							<tr>
								<td height="25" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">&nbsp;客源: <?php echo $CustomType;?></span></td>
								<td height="25" width="75"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">模式: <?php echo $SitedType;?></span></td>
								<td height="25" width="135" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">预离: <?php echo $CheckOut;?></span></td>
							</tr>
							
							<tr bgcolor="#F6F2F2"><td height="1" colspan="3" align="center"></tr>
						</table>
					</div>
					
					<div data-role="none" class="STYLEM2" >
						<table width="100%" height="6" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
							<tr><td height="6" ></td></tr>
						</table>
					</div>
				<td height="1" width="5" ></td>
			</tr>
			
			<?php
				}
				$SumAllCount=$SumAllCount - $SumMFCount - $SumZDCount;
				//释放数据库
				freeResult($result);
				closeDb();
			?>
		</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 bgcolor="#f1e3e3"><td height="1" align="center" colspan="4"></tr>
			
			<tr height="30" valign="top" bgcolor="#F3F4EC">
				<td height="30" width="100%" colspan="4">
					<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="10" align="left"></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">日租:<?php echo $SumAllCount;?></span></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">免费:<?php echo $SumMFCount;?></span></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">钟点:<?php echo $SumZDCount;?></span></td>
							<td align="left"></td>
						</tr>
					</table>
				</td>
				
			</tr>
			<tr height="42" valign="top">
				<td width="25%">
					<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="25%">					
					<a class="ui-btn ui-icon-bars ui-btn-icon-top" target="_parent" href="#reportsitedA" 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>
				<td width="25%">
					<a class="ui-btn ui-icon-bullets 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="25%">					
					<a class="ui-btn ui-icon-bullets ui-btn-icon-top" target="_parent" href="#reportsitedC" 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>


<section data-role="page" id="reportsitedC">		
	<header data-role="header" data-position="fixed" data-tap-toggle="false">
		<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">	   
			<tr>
				<td height="35" width="100%" align="center">
					<span style="color:#000 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">今日离店宾客表</span>
				</td>
			</tr>			
		</table>
	</header>
	
	<article data-role="none">
	
		<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFF">		
			
			<?php				
				$chainno=$_SESSION["ChainNo"];
				$OrderList=0;
				
				$RoomNo="";
				$RoomType="";
				$RoomPrice=0;
				
				$ManName="";
				$CustomType="";
				$CheckIn="";
				$CheckOut="";
				$intSitedDay=0;
				$SitedType="";
				
				$SumAllCount=0;	//总出租数
				$SumMFCount=0;	//免费房数
				$SumZDCount=0;	//钟点房数
				$SumRoomPrice=0;
				
				$intSitedLong=0;
				$intSitedTime=0;
				$intSitedFree=0;
				
				//开始去房间状态数量
				$sql=sprintf("SELECT a.Room_No,a.Room_Type,a.RoomPrice,a.Man_Name,b.Custom_Type,Convert(varchar(16),a.SelectRoomTime,120)AS CheckIn,Convert(varchar(16),a.Cancel_Date,120)AS CheckOut
						,a.Sited_Days,a.Sited_TimeFlag,a.Sited_FreeFlag,a.Sited_LongFlag FROM TR_Order_Room_List a,TR_Order_Inform b WHERE a.Order_No=b.Order_No 
						AND (b.Order_State=0 OR b.Order_State=1 OR b.Order_State=3) AND a.Room_BillState=3 AND b.Chain_No='%s'
						AND a.Cancel_Date>convert(varchar(10),GETDATE(),120) AND a.Cancel_Date<DATEADD(DAY,1,convert(varchar(10),GETDATE(),120))",$chainno);
				$result = querySql($sql);		
				while($row = fetch_array($result))
				{
					//得到每一条的记录信息	
					$OrderList=$OrderList+1;
					
					$RoomNo=$row['Room_No'];
					$RoomType=$row['Room_Type'];
					$RoomPrice=$row['RoomPrice'];
					
					$ManName=$row['Man_Name'];
					$CustomType=$row['Custom_Type'];
					$CheckIn=$row['CheckIn'];
					$CheckOut=$row['CheckOut'];
					$intSitedDay=$row['Sited_Days'];
										
					$intSitedLong=$row['Sited_LongFlag'];
					$intSitedTime=$row['Sited_TimeFlag'];
					$intSitedFree=$row['Sited_FreeFlag'];

					$SumRoomPrice=$SumRoomPrice + $RoomPrice;
					$SumAllCount=$SumAllCount+1;	//总出租数
					
					$SitedType="日租";
					if($intSitedLong>0)
						$SitedType="长包";
					
					if($intSitedTime>0)	
					{
						$SitedType="钟点";
						$SumZDCount=$SumZDCount +1;	//钟点房数
					}
					elseif($intSitedFree>0)	
					{
						$SitedType="免费";
						$SumMFCount=$SumMFCount +1;	//免费房数
					}
					//以下开始显示数据							
			?>
			
			<tr>
				<td height="1" width="5" ></td>
				<td height="1">
					
					<div data-role="none" class="STYLEM2" style="border-left: 1px solid #F6F2F2;border-right: 1px solid #F6F2F2;">
						<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" bgcolor="#F5F2E6">
							<tr>
								<td width="100" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">&nbsp;<?php echo $OrderList;?>、<?php echo $RoomNo;?></span></td>
								<td width="100" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">房价: <?php echo number_format($RoomPrice);?></span></td>
								<td align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:13px;text-shadow:none;">房型: <?php echo $RoomType;?></span></td>
							</tr>
						</table>
					</div>
					<div data-role="none" class="STYLEM35" style="border-left: 1px solid #F6F2F2;border-right: 1px solid #F6F2F2;">
						<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="25" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">&nbsp;姓名: <?php echo $ManName;?></span></td>
								<td height="25" width="75"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">天数: <?php echo $intSitedDay;?></span></td>
								<td height="25" width="135" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">入住: <?php echo $CheckIn;?></span></td>
							</tr>
							<tr>
								<td height="25" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">&nbsp;客源: <?php echo $CustomType;?></span></td>
								<td height="25" width="75"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">模式: <?php echo $SitedType;?></span></td>
								<td height="25" width="135" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">预离: <?php echo $CheckOut;?></span></td>
							</tr>
							
							<tr bgcolor="#F6F2F2"><td height="1" colspan="3" align="center"></tr>
						</table>
					</div>
					
					<div data-role="none" class="STYLEM2" >
						<table width="100%" height="6" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
							<tr><td height="6" ></td></tr>
						</table>
					</div>
				<td height="1" width="5" ></td>
			</tr>
			
			<?php
				}
				$SumAllCount=$SumAllCount - $SumMFCount - $SumZDCount;
				//释放数据库
				freeResult($result);
				closeDb();
			?>
		</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 bgcolor="#f1e3e3"><td height="1" align="center" colspan="4"></tr>
			
			<tr height="30" valign="top" bgcolor="#F3F4EC">
				<td height="30" width="100%" colspan="4">
					<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="10" align="left"></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">日租:<?php echo $SumAllCount;?></span></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">免费:<?php echo $SumMFCount;?></span></td>
							<td width="70" align="left"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;">钟点:<?php echo $SumZDCount;?></span></td>
							<td align="left"></td>
						</tr>
					</table>
				</td>
				
			</tr>
			<tr height="42" valign="top">
				<td width="25%">
					<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="25%">					
					<a class="ui-btn ui-icon-bars ui-btn-icon-top" target="_parent" href="#reportsitedA" 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>
				<td width="25%">
					<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>
				
				<td width="25%">					
					<a class="ui-btn ui-icon-bullets 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>
			</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>
