<?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;
	}
	header("Content-type: text/html; charset=gb2312"); 
	
	
	$chainno=$_SESSION["ChainNo"];
	$roomno=$_REQUEST["rmid"];
				
			$strorderno="";
			$strcustomtype="";
			$strmanname="";
			$strordervipno="";
			$strordercustomno="";
			$strcheckintime="";
			$strselectroomtime="";
			$strcanceldate="";
			$strblistno="0";
			$strvipname="";
			$strcustomname="";
			$strroomtype="";
				
			$strManTelNo='';
			$strManQuDao='';
			$strManSex='';
			$strCheckType='日租';
			$strRoomPrice=0;
				
			$intTimeFlag=0;
			$intFreeFlag=0;
			$intOrderState=0;
				
				//开始去房间状态数量
			$sql=sprintf("SELECT a.Order_No,b.ListNo,b.Man_Name,a.Custom_Type,a.Vip_SubNo,a.Custom_No,Convert(varchar(16),a.CheckInTime,120)As CheckInT,
								Convert(varchar(16),b.SelectRoomTime,120)As SelectRoomT,Convert(varchar(16),b.Cancel_Date,120)As CancelRoomT,b.Room_Type,
								b.Man_TelNo,b.RoomPrice,b.Sited_TimeFlag,b.Sited_FreeFlag,b.Man_Sex,a.Custom_Source,a.Order_State
								FROM TR_Order_Inform a,TR_Order_Room_List b WHERE a.Order_No=b.Order_No And a.Chain_No='%s' 
								And a.Order_State<2 And b.Room_BillState=2 And b.Room_No='%s'",$chainno,$roomno);

			$result = querySql($sql);		
			if($row = fetch_array($result))
			{
				$intOrderState=$row['Order_State'];
				$strblistno=$row['ListNo'];		
				$strorderno=$row['Order_No'];
				$strmanname=$row['Man_Name'];
				$strcustomtype=$row['Custom_Type'];
				$strordervipno=trim($row['Vip_SubNo']);
				$strordercustomno=trim($row['Custom_No']);
				$strcheckintime=$row['CheckInT'];
				$strselectroomtime=$row['SelectRoomT'];
				$strcanceldate=$row['CancelRoomT'];
				$strroomtype=$row['Room_Type'];
				//以下开始显示数据
				$strManTelNo=$row['Man_TelNo'];
				$strManQuDao=$row['Custom_Source'];
				$strManSex=$row['Man_Sex'];
				$intTimeFlag=$row['Sited_TimeFlag'];
				$intFreeFlag=$row['Sited_FreeFlag'];
				$strRoomPrice=$row['RoomPrice'];
				$strRoomPrice=$strRoomPrice+0;
				
				if($intTimeFlag>0)
				{
					$strCheckType='钟点房';
				}
				else if($intFreeFlag>0)
				{
					$strCheckType='免费房';
				}
				else
				{
					$strCheckType='日租 ￥'.$strRoomPrice.'/晚';
				}
			}
			//释放数据库
			freeResult($result);
				
			//判断是否有会员和协议客户
			if(strlen($strordervipno)>0)
			{
				$sql=sprintf("SELECT Sub_Name FROM VIP_Item WHERE Sub_No='%s'",$strordervipno);
				$result = querySql($sql);
				if($row = fetch_array($result))
				{
					$strvipname=$row['Sub_Name'];
					$strordervipno=$strordervipno."|".$strvipname;
				}
				freeResult($result);
			}
			if(strlen($strordercustomno)>0)
			{
				$sql=sprintf("SELECT CustomName FROM TR_Custom_Inform WHERE Chain_No='%s' And CustomNo='%s'",$chainno,$strordercustomno);
				$result = querySql($sql);
				if($row = fetch_array($result))
				{
					$strcustomname=$row['CustomName'];
					$strordercustomno=$strordercustomno."|".$strcustomname;
				}
				freeResult($result);
			}
				//
			$fltSumValue=0;
			$fltSumPayFor=0;
			$fltShouldPay=0;
				
			$sql=sprintf("SELECT SUM(Item_Value)AS SumValue,SUM(PayFor_Value)AS SumPay FROM TR_Consume_List WHERE Order_No='%s'",$strorderno);
			$result = querySql($sql);
			if($row = fetch_array($result))
			{
				$fltSumValue=$row['SumValue'];
				$fltSumPayFor=$row['SumPay'];
			}
			freeResult($result);
			
			$fltSumValue=$fltSumValue+0;
			$fltSumPayFor=$fltSumPayFor+0;
				
			$fltShouldPay=$fltSumValue-$fltSumPayFor;
				//closeDb();
				
		
	//判断是否有换房，退房，恢复入住的权限
	$intCanReCheckInHours=WxMainConfig::intCanReCheckInHours;
	
	$intCanChangeRoomFlag=0;	//是否有在住编辑权限 
	$intCanCancelRoomFlag=0;	//是否有账务处理
	$intCanReBackRoomFlag=0;	//是否允许恢复入住临时
	
	$userno=$_SESSION['userno']; 
	$sql=sprintf("SELECT RoomFlag,Use_Flag FROM(
			Select 1 AS RoomFlag,a.Use_Flag,b.Use_Name From Sys_Group_Quanxian a,User_QuanXian b Where a.Group_No=b.Group_No And b.Use_No='%s' And a.Modul_Name='men_bar338'
			UNION Select 2 AS RoomFlag,a.Use_Flag,b.Use_Name From Sys_Group_Quanxian a,User_QuanXian b Where a.Group_No=b.Group_No And b.Use_No='%s' And a.Modul_Name='men_bar384'
			UNION Select 3 AS RoomFlag,a.Use_Flag,b.Use_Name From Sys_Group_Quanxian a,User_QuanXian b Where a.Group_No=b.Group_No And b.Use_No='%s' And a.Modul_Name='men_bar341'			
			) t Order By t.RoomFlag ASC",$userno,$userno,$userno);

	$result = querySql($sql);
	while($row = fetch_array($result))
	{
		$intRowTemp = $row['RoomFlag'];
		$intRowValue = $row['Use_Flag'];
		
		switch ($intRowTemp)
		{
			case 1:
				$intCanChangeRoomFlag=$intRowValue;
				break;
			case 2:
				$intCanCancelRoomFlag=$intRowValue;
				break;
			case 3:
				$intCanReBackRoomFlag=$intRowValue;
				break;
		}
	}
	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>客房云点通</title>
	
	<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>

<script type="text/javascript">
	var lngNowSelBListNo;
	var lngNowMsgTypeID=0;
	var strNowRoomNo='';
	function bmtReturnPage()
	{	
		window.location.href='repRoomView.php';
	};
	
	//保存账目
	function bmtSaveRoomItem()
	{
		window.location.href='rmroomorderitem.php?blistno=<?php echo $strblistno;?>';
	};
	
</script>

	
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">

<section data-role="page" id="roomorder" style="background-color:#fff;">
	
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;bkc">
        <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" >
		   	<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td height="45" width="50" align="center" valign="middle">
					<div onClick="bmtReturnPage()" style="width:40;height:45px; ">
						<img src="images\back.png" width="12" height="21" border="0" style="margin-top:12px;">
					</div>
				</td>
				
				<td height="45" align="center" valign="middle">
	                <span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;font-weight: bold;">宾客帐单</span>
               	</td>
				
				<td height="45" width="100" align="left" valign="middle">
					<?php if($intOrderState<2) { //预订0,入住1,取消2,完成3?>
						<?php if($intCanCancelRoomFlag>0) { ?>
						<div onClick="bmtSaveRoomItem();" style="border:1px solid #fff; border-radius:14px;width:86px; height:28px; background-color:<?php echo WxMainConfig::colHeadBkColor;?>;">
							<table width="100%" height="22" border="0" cellpadding="0" cellspacing="0">
								<td height="100%" width="20" align="right" valign="middle">
									<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;font-weight: bold;">+</span>
								</td>
								<td height="100%" align="left" valign="middle">
									<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">添加账目</span>
								</td>
							</table>
						</div>
						<?php } else {?>
						<div style="border:1px solid #c3cbcc; border-radius:14px;width:86px; height:28px; background-color:<?php echo WxMainConfig::colHeadBkColor;?>;">
							<table width="100%" height="22" border="0" cellpadding="0" cellspacing="0">
								<td height="100%" width="20" align="right" valign="middle">
									<span style="color:#c3cbcc ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;font-weight: bold;">+</span>
								</td>
								<td height="100%" align="left" valign="middle">
									<span style="color:#c3cbcc ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">添加账目</span>
								</td>
							</table>
						</div>
						<?php } ?>
					
					<?php } ?>
				</td>
				
		  	</tr>
			<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td colspan="3" height="15">
					<div style="background:#fff;width:100%;height:18px;padding-top:0px;margin-top:0px; border-radius: 15px 15px 0px 0px;">
						<table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="35" width="15"></td>
								<td height="35" >
									<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;text-shadow:none;">单号：<?php echo $strorderno;?></span>
								</td>
								<td height="35" width="120" align="right">
									<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;text-shadow:none;">客源：<?php echo $strcustomtype;?></span>
								</td>
								<td height="35" width="15"></td>
							</tr>
						</table>
					</div>
				</td>
		  	</tr>
			
			<tr bgcolor="#fff"><td height="15" colspan="3"></td></tr>
			<tr bgcolor="#f0f0f0"><td height="1" colspan="3"></td></tr>
			
		</table>
	</header>
	
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
			
			<tr><td height="4"  colspan="3"></td></tr>

			<tr>
				<td height="25" width="10"></td>
				<td height="25" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="25" width="55%">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">宾客：<?php echo $strmanname;?></span>
							</td>
							<td height="25" width="45%" align="left">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">房号：</span>
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;text-shadow:none;"><?php echo $roomno;?></span>
							</td>
						</tr>
						<tr>
							<td height="25" width="55%">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">登记：<?php echo $strcheckintime;?></span>
							</td>
							<td height="25" width="45%" align="left">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">房型：<?php echo $strroomtype;?></span>
							</td>
						</tr>
						<tr>
							<td height="25" width="55%">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">入住：<?php echo $strselectroomtime;?></span>
							</td>
							<td height="25" width="45%" align="left">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">预离：<?php echo $strcanceldate;?></span>
							</td>
						</tr>
						<tr>
							<td height="25" width="55%">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">电话：<?php echo $strManTelNo;?></span>
							</td>
							<td height="25" width="45%" align="left">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">渠道：<?php echo $strManQuDao;?></span>
							</td>
						</tr>
						<tr>
							<td height="25" width="55%">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">方式：<?php echo $strCheckType;?></span>
							</td>
							<td height="25" width="45%" align="left">
								<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">性别：<?php echo $strManSex;?></span>
							</td>
						</tr>
												
						<?php 
							if(strlen($strordervipno)>0)
							{
						?>
							<tr>
								<td height="25" colspan="2">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">会员：<?php echo $strordervipno;?></span>
								</td>
							</tr>
						<?php
							}						
						?>
						
						<?php 
							if(strlen($strordercustomno)>0)
							{
						?>
							<tr>
								<td height="25" colspan="2">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">协议：<?php echo $strordercustomno;?></span>
								</td>
							</tr>
						<?php
							}						
						?>
						
						<tr><td height="3" colspan="2" align="left" ></td></tr>
						<tr><td height="1" colspan="2" align="left" bgcolor="#fbf1f1"></td></tr>
						<tr><td height="3" colspan="2" align="left" ></td></tr>
						
						<tr><td height="25" colspan="2" align="left" >
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td height="25" width="30%" align="left">
										<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">消费：<?php echo $fltSumValue;?></span>
									</td>
									<td height="25" align="center">
										<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">已付款：<?php echo $fltSumPayFor;?></span>
									</td>
									<td height="25" width="30%" align="right">
										<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">
										<?php if($fltShouldPay>0)
											{
												echo "应付：￥".$fltShouldPay;
											}else {
												echo "应退：￥".abs($fltShouldPay);
											}
										?>
										</span>
									</td>
								</tr>
							</table>
						</td></tr>
					</table>
				</td>
				<td height="25" width="10"></td>
			</tr>
			
			<tr><td height="8" colspan="3"></td></tr>
			
			
			<tr>
				<td height="25" align="left" colspan="3">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr bgcolor="#f0f0f0">
							<td height="30" width="10"></td>
							<td height="30" width="120">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">付款项目</span>
							</td>
							<td height="30" align="left">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">付款方式</span>
							</td>
							<td height="30" width="100" align="right">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">付款金额</span>
							</td>
							<td height="30" width="10"></td>
						</tr>
						
						<?php 
							//得到付款明晰信息
							$strItemName="";
							$strPayForType="";
							$fltItemValue=0;
							$fltSumValue=0;
							
							$sql=sprintf("SELECT Item_Name,PayFor_Type,Sum(PayFor_Value)AS SumPayFor FROM TR_Consume_List WHERE Order_No='%s' And PayFor_Value<>0
											GROUP BY Item_Name,PayFor_Type Order By Item_Name ASC,PayFor_Type ASC",$strorderno);

							$result = querySql($sql);		
							while($row = fetch_array($result))
							{	
								$strItemName=$row['Item_Name'];							
								$strPayForType=$row['PayFor_Type'];
								$fltItemValue=$row['SumPayFor'];
								$fltItemValue=$fltItemValue+0;
								$fltSumValue=$fltSumValue + $fltItemValue;
								
								//以下开始显示数据							
						?>
							<tr>
								<td height="30" width="10"></td>
								<td height="20" width="120">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strItemName;?></span>
								</td>
								<td height="20" align="left">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strPayForType;?></span>
								</td>
								<td height="20" width="100" align="right">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $fltItemValue;?></span>
								</td>
								<td height="30" width="10"></td>
							</tr>
						<?php
							}
							//释放数据库
							freeResult($result);
						?>
												
						<tr>
							<td height="1" width="10"></td>
							<td height="1" colspan="3"  bgcolor="#fbf1f1"></td>
							<td height="1" width="10"></td>
						</tr>
						<tr>
							<td height="30" width="10"></td>
							<td height="20" width="120">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">Σ付款合计</span>
							</td>
							<td height="20" align="left">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"></span>
							</td>
							<td height="20" width="100" align="right">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">￥<?php echo $fltSumValue;?></span>
							</td>
							<td height="30" width="10"></td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr><td height="4" colspan="3"></td></tr>
						
			<tr>
				<td height="25" align="left" colspan="3">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr bgcolor="#f0f0f0">
							<td height="30" width="10"></td>
							<td height="30" width="120">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">消费项目</span>
							</td>
							<td height="30" align="left">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">项目类型</span>
							</td>
							<td height="30" width="100" align="right">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">项目金额</span>
							</td>
							<td height="30" width="10"></td>
						</tr>
						
						<?php 
							//得到付款明晰信息
							$strItemName="";
							$strPayForType="";
							$fltItemValue=0;
							$fltSumValue=0;
							
							$sql=sprintf("SELECT Item_Type,Item_Name,Sum(Item_Value)AS SumPayFor FROM TR_Consume_List WHERE Order_No='%s' And Item_Value<>0
											GROUP BY Item_Type,Item_Name Order By Item_Type ASC,Item_Name ASC",$strorderno);

							$result = querySql($sql);		
							while($row = fetch_array($result))
							{	
								$strItemName=$row['Item_Name'];							
								$strPayForType=$row['Item_Type'];
								$fltItemValue=$row['SumPayFor'];
								$fltItemValue=$fltItemValue+0;
								$fltSumValue=$fltSumValue + $fltItemValue;
								
								//以下开始显示数据							
						?>
							<tr>
								<td height="30" width="10"></td>
								<td height="20" width="120">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strItemName;?></span>
								</td>
								<td height="20" align="left">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strPayForType;?></span>
								</td>
								<td height="20" width="100" align="right">
									<span style="color: #5e5e5e;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $fltItemValue;?></span>
								</td>
								<td height="30" width="10"></td>
							</tr>
						<?php
							}
							//释放数据库
							freeResult($result);
						?>
						
						<tr>
							<td height="1" width="10"></td>
							<td height="1" colspan="3"  bgcolor="#fbf1f1"></td>
							<td height="1" width="10"></td>
						</tr>
						<tr>
							<td height="30" width="10"></td>
							<td height="20" width="120">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">Σ费用合计</span>
							</td>
							<td height="20" align="left">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"></span>
							</td>
							<td height="20" width="100" align="right">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;">￥<?php echo $fltSumValue;?></span>
							</td>
							<td height="30" width="10"></td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr><td height="5" colspan="3"></td></tr>
			
			<tr><td height="1" colspan="3" bgcolor="#f0f0f0"></td></tr>
			
		</table>
		
	</article>
	
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px solid #F3EDED;border-bottom:0px solid #F6F5F2;border-left:0px solid #F6F5F2;border-right:0px solid #fff;">
			<table width="100%" height="52" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
				<tr height="100%" valign="middle" align="center">
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='rmroomcheckinedit.php?romid=<?php echo $roomno;?>';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:23px;height:24px;">
								<img src="images\p3_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:4px;">宾客资料</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;">
						<div style="width:100%;height:100%;padding-top:6px;">
							<div style="width:22px;height:24px;">
								<img src="images\p0_b.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:3px;">宾客帐单</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='#roomlist';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:22px;height:24px;">
								<img src="images\p1_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:3px;">关联房</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='#dubtlist';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:23px;height:24px;">
								<img src="images\p2_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:2px;">账目明细</span>
						</div>
					</td>
				</tr>
			</table>	
	</footer>
</section>



<section data-role="page" id="roomlist" style="background-color:#fff;">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;bkc">
        <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" >
		   	<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td height="45" width="50" align="center" valign="middle">
					<div onClick="bmtReturnPage()" style="width:40;height:45px; ">
						<img src="images\back.png" width="12" height="21" border="0" style="margin-top:12px;">
					</div>
				</td>
				
				<td height="45" align="center" valign="middle">
	                <span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;font-weight: bold;">同行关联房</span>
               	</td>
				
				<td height="45" width="50" align="left" valign="middle"></td>
				
		  	</tr>
			
			<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td colspan="3" height="15">
						<?php
							$intCheckInCount=0;
							$intCheckOutCount=0;
							
							$sql=sprintf("SELECT SUM(InCount)AS InCount,SUM(OutCount)AS OutCount FROM(
								SELECT COUNT(ListNo)AS InCount,0 AS OutCount FROM TR_Order_Room_List WHERE Order_No='%s' And Room_BillState=2
								UNION SELECT 0 AS InCount,COUNT(ListNo)AS OutCount FROM TR_Order_Room_List WHERE Order_No='%s' And Room_BillState=3)t",$strorderno,$strorderno);
							
							$result = querySql($sql);		
							$row = fetch_array($result);
							
							$intCheckInCount=$row['InCount'];
							$intCheckOutCount=$row['OutCount'];
							freeResult($result);
						?>
						<table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="35" width="15"></td>
								<td height="35" >
									<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:15px;text-shadow:none;font-weight: bold;">Σ同行关联房</span>
								</td>
								<td height="35" width="150" align="right">
									<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:15px;text-shadow:none;font-weight: bold;">在住 <?php echo $intCheckInCount;?> 间，已退 <?php echo $intCheckOutCount;?> 间</span>
								</td>
								<td height="35" width="20"></td>
							</tr>
						</table>
				</td>
		  	</tr>
			
			<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td colspan="3" height="15">
					<div style="background:#fff;width:100%;height:18px;padding-top:0px;margin-top:0px; border-radius: 15px 15px 0px 0px;">
						<table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td height="30" width="10"></td>
								<td height="30" width="55">
									<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">房号</span>
								</td>
								<td height="30" align="left">
									<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">姓名</span>
								</td>
								<td height="30" width="50" align="left">
									<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">房价</span>
								</td>
								<td height="30" width="40" align="left">
									<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">方式</span>
								</td>
								<td height="30" width="40" align="center">
									<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">天数</span>
								</td>
								<td height="30" width="40" align="right">
									<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">状态</span>
								</td>
								<td height="30" width="10"></td>
							</tr>
						</table>
					</div>
				</td>
		  	</tr>
			
						
			<tr bgcolor="#fff"><td height="10" colspan="3"></td></tr>
			<tr bgcolor="#f0f0f0"><td height="1" colspan="3"></td></tr>
			
			
			
		</table>
	</header>
	
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
						
			<tr>
				<td height="25" align="left" colspan="3">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr><td height="4" colspan="8"></td></tr>
						<?php 
							//得到付款明晰信息
							$strSelManName="";
							$strselroomno="";
							$strselroomtype="";
							$fltselroomprice=0;
							$strselecttime="";
							$strcanceltime="";
							$intTemp=0;
							$strTemp="";
							$strSelRemarks="";
							$intSelDays=0;
							$strBillState="";
							$strRoomBorrowTemp='';
							$lngHadCancelHours=0;
							$strBListNo=0;
							
							$sql=sprintf("SELECT ListNo,Room_No,Man_Name,Room_Type,RoomPrice,Convert(varchar(16),SelectRoomTime,120)As SelectRoomT,
											Convert(varchar(16),Cancel_Date,120)As CancelRoomT,Sited_Days,Sited_LongFlag,Sited_TimeFlag,RoomBorrowTemp,
											DATEDIFF(HOUR,Cancel_Date,GetDate()) AS HadCancelHours,Sited_FreeFlag,Remarks,Room_BillState 
											FROM TR_Order_Room_List WHERE Order_No='%s' And (Room_BillState=2 OR Room_BillState=3)",$strorderno);
							$result = querySql($sql);		
							while($row = fetch_array($result))
							{	
								$strSelManName=$row['Man_Name'];
								$strBListNo=$row['ListNo'];
								$strselroomno=$row['Room_No'];
								$strselroomtype=$row['Room_Type'];
								$fltselroomprice=$row['RoomPrice'];
								$strselecttime=$row['SelectRoomT'];
								$strcanceltime=$row['CancelRoomT'];
								$strSelRemarks=trim($row['Remarks']);
								$intSelDays=$row['Sited_Days'];
								$lngHadCancelHours=$row['HadCancelHours'];
								
								$fltselroomprice=$fltselroomprice+0;
								$strRoomBorrowTemp=trim($row['RoomBorrowTemp']);
								
								$strTemp="日租";
								$intTemp=$row['Sited_LongFlag'];
								if($intTemp>0)
								{
									$strTemp="长包";
								}
								$intTemp=$row['Sited_TimeFlag'];
								if($intTemp>0)
								{
									$strTemp="钟点";
								}
								$intTemp=$row['Sited_FreeFlag'];
								if($intTemp>0)
								{
									$strTemp="免费";
								}
								$strBillState="在住";
								$intTemp=$row['Room_BillState'];
								//0预排,1预订,2入住,3退房,4取消
								if($intTemp==3)
								{
									$strBillState="退房";
								}
								//以下开始显示数据	
								if($strBillState=="退房")
								{
									$colTextColr='#aaaaaa';
									$colTextColr1='#999999';
								}
								else
								{
									$colTextColr='#5e5e5e';
									$colTextColr1='#000';
								}
								
						?>
							<tr>
								<td height="20" width="10"></td>
								<td height="20" width="55">
									<span style="color: <?php echo $colTextColr1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;font-weight: bold;"><?php echo $strselroomno;?></span>
								</td>
								<td height="20" align="left">
									<span style="color: <?php echo $colTextColr1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strSelManName;?></span>
								</td>
								<td height="20" width="50" align="left">
									<span style="color: <?php echo $colTextColr1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $fltselroomprice;?></span>
								</td>
								<td height="20" width="40" align="left">
									<span style="color: <?php echo $colTextColr1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strTemp;?></span>
								</td>
								<td height="20" width="40" align="center">
									<span style="color: <?php echo $colTextColr1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $intSelDays;?></span>
								</td>
								<td height="20" width="40" align="right">
									<span style="color: <?php echo $colTextColr1;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo $strBillState;?></span>
								</td>
								<td height="20" width="10"></td>
							</tr>
							
							<tr>
								<td height="20" width="10"></td>
								<td height="20" colspan="6">
									<span style="color: <?php echo $colTextColr;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo "房型：".$strselroomtype;?></span>
								</td>
								<td height="20" width="10"></td>
							</tr>
							
							
							<!--显示入住时间和天数-->
							<tr>
								<td height="20" width="10"></td>
								<td height="20" colspan="2">
									<span style="color: <?php echo $colTextColr;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo "抵店：".$strselecttime;?></span>
								</td>
								<td height="20" colspan="4" rowspan="2" align="center">
									<?php if($strBillState=="退房") 
									{ 
										if($intCanReBackRoomFlag>0) 
										{
											//手机上操作恢复入住仅支持10小时内退房的
											if($lngHadCancelHours<=$intCanReCheckInHours)
											{
									?>
									<div onClick="bntShowMsg(1,<?php echo $strBListNo;?>,'<?php echo $strselroomno;?>','');" style="width:80px;height:28px;border-radius:4px;top:0px;left:0px;background:linear-gradient(225deg, #379ffb 45%, #24d7ff 100%);">
										<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:14px;text-shadow:none;">恢复入住</span> 
												</td>
											</tr>
										</table>
									</div>
									<?php 
											}
										}
									}  
									else 
									{
									?>
									<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td height="20" width="50%" align="center">
												<?php if($intCanChangeRoomFlag>0) { ?>
												<div onclick="SubClick_RoomChange('<?php echo $strBListNo;?>')" style="width:70px;height:28px;border-radius:4px;top:0px;left:0px; background:linear-gradient(135deg, #56c81c 45%, #c7e6b8 100%);">
												<?php } else {?>
												<div style="width:70px;height:28px;border-radius:4px;top:0px;left:0px; background-color:#ffd9e5;">
												<?php } ?>
													<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:14px;text-shadow:none;">换房</span> 
															</td>
														</tr>
													</table>
												</div>
											</td>
											
											<td height="20" width="50%" align="center">
												<?php if($intCanCancelRoomFlag>0) { //if($intCanCancelRoomFlag>0 and $blnCanAddScoreFlag>0) ?>
												<div onClick="bntShowMsg(2,<?php echo $strBListNo;?>,'<?php echo $strselroomno;?>','<?php echo $strRoomBorrowTemp;?>');" style="width:70px;height:28px;border-radius:4px;top:0px;left:0px;background:linear-gradient(225deg, #379ffb 45%, #24d7ff 100%);">
												<?php } else {?>
												<div style="width:70px;height:28px;border-radius:4px;top:0px;left:0px;background-color:#ffd9e5;">
												<?php } ?>
													<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:14px;text-shadow:none;">退房</span> 
															</td>
														</tr>
													</table>
												</div>
											</td>
										</tr>
									</table>
									<?php } ?>
								</td>
								<td height="20" width="10"></td>
							</tr>
							<tr>
								<td height="20" width="10"></td>
								<td height="20" colspan="2">
									<span style="color: <?php echo $colTextColr;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo "预离：".$strcanceltime;?></span>
								</td>
								<td height="20" width="10"></td>
							</tr>
							
							<?php if(strlen($strSelRemarks)>1)
								{
							?>
								<tr>
									<td height="20" width="10"></td>
									<td height="20" colspan="6">
										<span style="color: <?php echo $colTextColr;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo "备注：".$strSelRemarks;?></span>
									</td>
									<td height="20" width="10"></td>
								</tr>
							<?php } ?>
							
							<?php if(strlen($strRoomBorrowTemp)>1)
								{
							?>
								<tr>
									<td height="20" width="10"></td>
									<td height="20" colspan="6">
										<span style="color: <?php echo $colTextColr;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;text-shadow:none;"><?php echo "提醒：".$strRoomBorrowTemp;?></span>
									</td>
									<td height="20" width="10"></td>
								</tr>
							<?php } ?>
							
							<tr><td height="5" colspan="8"></td></tr>
							<tr><td height="1" colspan="8"  bgcolor="#f0f0f0"></td></tr>
							<tr><td height="5" colspan="8"></td></tr>
						<?php
							}
							//释放数据库
							freeResult($result);
						?>
						
						
						
					</table>
				</td>
			</tr>
			
			<tr><td height="5" width="5" colspan="3"></td></tr>
			
		</table>
		
		
	</article>
	
	
	<script type="text/javascript">
		//换房
		function SubClick_RoomChange(strBListNo)
		{
			window.location.href='rmroomchange.php?blistno=' + strBListNo;
		};
	
	
		//探出消息框
		function bntShowMsg(intMsgID,lngBListNo,strRoomNo,strRemarks)
		{
			lngNowSelBListNo=lngBListNo;
			lngNowMsgTypeID=intMsgID;
			strNowRoomNo=strRoomNo;
			
			var labSpan1=document.getElementById("labMsgText");
			var labSpan2=document.getElementById("labMsgTitle");
			var labSpan3=document.getElementById("labButtonText");
			var labSpan4=document.getElementById("labMsgText2");
			
			if(intMsgID==1)
			{
				labSpan1.textContent= "确定要将 " + strRoomNo + " 恢复为入住状态吗？";
				labSpan2.textContent= "恢复入住";
				labSpan3.textContent= "确定恢复入住"
				labSpan4.textContent="";
				document.getElementById("divMsgRemarkItem").style.height = "2px"; // 设置固定高度
			}
			else if(intMsgID==2)
			{
				labSpan1.textContent= "确定要将 " + strRoomNo + " 退房吗？";
				labSpan2.textContent= "退房提示";
				labSpan3.textContent= "确定退房";
				if(strRemarks.length>2)
				{
					document.getElementById("divMsgRemarkItem").style.height = "130px"; // 设置固定高度
					labSpan4.textContent= "提醒：" + strRemarks;
				}
				else
				{
					labSpan4.textContent="";
					document.getElementById("divMsgRemarkItem").style.height = "2px"; // 设置固定高度
				}
				
				
			}
			$('#openModalBtn').click();
			
		};
		
		function bntMsgClickOK()
		{
			if(lngNowMsgTypeID==1)
			{
				bntSetRoomCheckIn();
			}
			else if(lngNowMsgTypeID==2)
			{
				SubClick_RoomCancel();
			}
		}
		
		//退房
		function SubClick_RoomCancel()
		{
			var strCancelRoomNo=strNowRoomNo;
			var strDefRoomNo='<?php echo $roomno;?>';
			//将数据封包成JSON
			const jsondata = {
					chainno: '<?php echo $chainno;?>',
					rblistno: lngNowSelBListNo
					};

			//用ajax的“同步方式”调用一般处理程序
			var strret='';
			$.ajax({
					url: "rmroomcheckoutsave.php",
					async: false,//改为同步方式
					type: "POST",
					data: jsondata,
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
			
			//alert(strret);
				
			if(strret.length>2)
			{
				var strSubHead =strret.substr(0,3);
			
				if(strSubHead=="*1*")
				{
					//关闭界面
					$('#closeModalBtn').click();
					//成功
					if(strCancelRoomNo==strDefRoomNo)
					{	//当前房间退房了,返回房态图界面
						window.location.href='repRoomView.php';
					}
					else
					{
						location.reload();
					}
					//window.location.href='rmroomorder.php?rmid=<?php echo $roomno;?>#roomlist';
				}
				else if(strSubHead=="*2*")
				{
					alert("客房不是在住状态，不能退房！");
				}
				/*
				else if(strSubHead=="*3*")
				{
					alert("目标房间已被占用，不能恢复入住！");
				}
				else if(strSubHead=="*4*")
				{
					alert("房间有预排房信息，不能恢复入住！");
				} 
				*/
				else
				{
					alert("提交退房操作失败!");
				}
			}
			
			
			
			//alert("");
			//window.location.href='repRoomView.php';
			$('#closeModalBtn').click();
		};
		
		//将房间恢复入住
		function bntSetRoomCheckIn()
		{	
			//将数据封包成JSON
			const jsondata = {
					chainno: '<?php echo $chainno;?>',
					rblistno: lngNowSelBListNo
					};

			//用ajax的“同步方式”调用一般处理程序
			var strret='';
			$.ajax({
					url: "rmroomrecheckinsave.php",
					async: false,//改为同步方式
					type: "POST",
					data: jsondata,
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
			
			//alert(strret);
				
			if(strret.length>2)
			{
				var strSubHead =strret.substr(0,3);
			
				if(strSubHead=="*1*")
				{
					//关闭界面
					$('#closeModalBtn').click();
					//成功
					location.reload();
					//window.location.href='repRoomView.php';
					//window.location.href='rmroomorder.php?rmid=<?php echo $roomno;?>#roomlist';
				}
				else if(strSubHead=="*2*")
				{
					alert("客房未退房或单据已结账，不能恢复入住！");
				}
				else if(strSubHead=="*3*")
				{
					alert("目标房间已被占用，不能恢复入住！");
				}
				else if(strSubHead=="*4*")
				{
					alert("房间有预排房信息，不能恢复入住！");
				} 
				else
				{
					alert("保存换房操作失败!");
				}
			}

		};
		
	</script>


	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px solid #F3EDED;border-bottom:0px solid #F6F5F2;border-left:0px solid #F6F5F2;border-right:0px solid #fff;">
			<table width="100%" height="52" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
				<tr height="100%" valign="middle" align="center">
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='rmroomcheckinedit.php?romid=<?php echo $roomno;?>';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:23px;height:24px;">
								<img src="images\p3_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:4px;">宾客资料</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;">
						<div onClick="window.location='#roomorder';"  style="width:100%;height:100%;padding-top:6px;">
							<div style="width:22px;height:24px;">
								<img src="images\p0_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:3px;">宾客帐单</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div style="width:100%;height:100%;padding-top:6px;">
							<div style="width:22px;height:24px;">
								<img src="images\p1_b.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:3px;">关联房</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='#dubtlist';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:23px;height:24px;">
								<img src="images\p2_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:2px;">账目明细</span>
						</div>
					</td>
				</tr>
			</table>	
	</footer>
	
</section>





<section data-role="page" id="dubtlist" style="background-color:#fff;">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;bkc">
        <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" >
		   	<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td height="45" width="50" align="center" valign="middle">
					<div onClick="bmtReturnPage()" style="width:40;height:45px; ">
						<img src="images\back.png" width="12" height="21" border="0" style="margin-top:12px;">
					</div>
				</td>
				
				<td height="45" align="center" valign="middle">
	                <span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;font-weight: bold;">账目明晰</span>
               	</td>
				
				<td height="45" width="50" align="left" valign="middle"></td>
				
		  	</tr>
			
			<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td height="30" colspan="3">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr >
								<td height="35" width="15"></td>
								<td height="35">
									<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:15px;text-shadow:none;font-weight: bold;">Σ合计</span>
								</td>
								<td height="35" width="120" align="left">
									<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:15px;text-shadow:none;font-weight: bold;">消费：<?php echo $fltSumValue;?></span>
								</td>
								<td height="35" width="120" align="right">
									<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:15px;text-shadow:none;font-weight: bold;">付款：<?php echo $fltSumPayFor;?></span>
								</td>
								<td height="35" width="20" align="right"></td>
							</tr>
						</table>
				</td>
			</tr>
			
			<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td colspan="3" height="15">
					<div style="background:#fff;width:100%;height:18px;padding-top:0px;margin-top:0px; border-radius: 15px 15px 0px 0px;">
						<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="30" width="10"></td>
							<td height="30" width="60">
								<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">房号</span>
							</td>
							<td height="30" align="left">
								<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">账目名称</span>
							</td>
							<td height="30" width="70" align="right">
								<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">费用金额</span>
							</td>
							<td height="30" width="70" align="right">
								<span style="color: #B69021;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;;text-shadow:none;font-weight: bold;">付款金额</span>
							</td>
							<td height="30" width="10"></td>
						</tr>
					</table>
					</div>
				</td>
		  	</tr>
			
			<tr bgcolor="#fff"><td height="10" colspan="3"></td></tr>
			<tr bgcolor="#f0f0f0"><td height="1" colspan="3"></td></tr>
			
		</table>
	</header>
	
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
						
			<tr>
				<td height="25" align="left" colspan="3">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						
						<tr><td height="2" colspan="6"></td></tr>
						<?php 
							//得到付款明晰信息
							$strOLDRoomNo='';
							$strSelRoomNo="";
							$strSelTradeTime="";
							$strSelItemName="";
							$fltItemValue=0;
							$fltPayForVal=0;
							$strPayForType="";
							$strSelRemarks="";
							
							$fltItemSubValue=0;
							$fltPayForSubVal=0;
							
							$sql=sprintf("SELECT Room_No,Convert(varchar(16),TradeTime,120)As TradeTime,Item_Name,Item_Value,PayFor_Value,PayFor_Type,Remarks FROM TR_Consume_List
										WHERE Order_No='%s' Order By Room_No ASC,TradeTime DESC",$strorderno);
							
							$result = querySql($sql);		
							while($row = fetch_array($result))
							{	
								$strSelRoomNo=$row['Room_No'];
								$strSelTradeTime=$row['TradeTime'];
								$strSelItemName=$row['Item_Name'];
								$fltItemValue=$row['Item_Value'];
								$fltPayForVal=$row['PayFor_Value'];
								$strPayForType=$row['PayFor_Type'];
								$strSelRemarks=$row['Remarks'];
								
								$fltItemValue=$fltItemValue+0;
								$fltPayForVal=$fltPayForVal+0;
								
								//以下开始显示数据
								
								if(strlen($strOLDRoomNo)<1)
								{
									$strOLDRoomNo=$strSelRoomNo;
								}
								
								if($strSelRoomNo<>$strOLDRoomNo)
								{
									//如果房号不一样了，则显示上一个房号的统计
						?>
						<tr bgcolor="#f0f0f0">
							<td height="35" width="10"></td>
							<td height="35" width="60">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;text-shadow:none;font-weight: bold;"><?php echo $strOLDRoomNo;?></span>
							</td>
							<td height="35" align="left">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;text-shadow:none;font-weight: bold;">小计</span>
							</td>
							<td height="35" width="70" align="right">
								<?php if($fltItemSubValue==0) {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"></span>
								<?php } else {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;text-shadow:none;font-weight: bold;"><?php echo $fltItemSubValue;?></span>
								<?php } ?>
							</td>
							<td height="35" width="70" align="right">
								<?php if($fltPayForSubVal==0) {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"></span>
								<?php } else {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;text-shadow:none;font-weight: bold;"><?php echo $fltPayForSubVal;?></span>
								<?php } ?>
							</td>
							<td height="35" width="10"></td>
						</tr>
						
						
						<?php 
									$strOLDRoomNo=$strSelRoomNo;
									$fltItemSubValue=0;
									$fltPayForSubVal=0;
								}
								
								$fltItemSubValue=$fltItemSubValue + $fltItemValue;
								$fltPayForSubVal=$fltPayForSubVal + $fltPayForVal;
						?>
						<!--显示数据信息-->
						<tr>
							<td height="25" width="10"></td>
							<td height="25" width="60">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"><?php echo $strSelRoomNo;?></span>
							</td>
							<td height="25" align="left">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"><?php echo $strSelItemName;?></span>
							</td>
							<td height="25" width="70" align="right">
								<?php if($fltItemValue==0) {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"></span>
								<?php } else {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"><?php echo $fltItemValue;?></span>
								<?php } ?>
							</td>
							<td height="25" width="70" align="right">
								<?php if($fltPayForVal==0) {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"></span>
								<?php } else {?>
									<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;"><?php echo $fltPayForVal;?></span>
								<?php } ?>
							</td>
							<td height="25" width="10"></td>
						</tr>
						<!--显示入住时间和天数-->
						<tr>
							<td height="20" width="10"></td>
							<td height="20" colspan="4">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td height="20" width="180" align="left">
											<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;">
												<?php echo "入帐：".$strSelTradeTime;?>
											</span>
										</td>
										<td height="20" align="left">
											<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;">
												<?php if($fltPayForVal==0) 
												{ 
													echo "";
												}
												else
												{
													echo "付款方式：".$strPayForType;
												}
												?>												
											</span>
										</td>
									</tr>
								</table>
								
							</td>
							<td height="20" width="10"></td>
						</tr>
						
						<tr>
							<td height="28" width="10"></td>
							<td height="28" colspan="4">
								<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:13px;">
									<?php echo "备注：".$strSelRemarks;?>
								</span>								
							</td>
							<td height="28" width="10"></td>
						</tr>
						
						
						
						<tr>
							<td height="1" width="10"></td>
							<td height="1" colspan="4"  bgcolor="#f0f0f0"></td>
							<td height="1" width="10"></td>
						</tr>
						
						
						<?php
							}
							//释放数据库
							freeResult($result);
						?>
						
					</table>
				</td>
			</tr>
			
			<tr>
				<td height="5" width="10"></td>
				<td height="5" align="left"></td>
				<td height="5" width="10"></td>
			</tr>
			
			<tr><td height="5" width="5" colspan="3"></td></tr>
			
		</table>
		
		<?php closeDb(); ?>
	</article>
	
	<footer data-role="footer" data-position="fixed" data-tap-toggle="false" style="border-top:0px solid #F3EDED;border-bottom:0px solid #F6F5F2;border-left:0px solid #F6F5F2;border-right:0px solid #fff;">
			<table width="100%" height="52" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
				<tr height="100%" valign="middle" align="center">
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='rmroomcheckinedit.php?romid=<?php echo $roomno;?>';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:23px;height:24px;">
								<img src="images\p3_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:4px;">宾客资料</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;">
						<div onClick="window.location='#roomorder';"  style="width:100%;height:100%;padding-top:6px;">
							<div style="width:22px;height:24px;">
								<img src="images\p0_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:3px;">宾客帐单</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div onClick="window.location='#roomlist';" style="width:100%;height:100%;padding-top:6px;">
							<div style="width:22px;height:24px;">
								<img src="images\p1_a.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:3px;">关联房</span>
						</div>
					</td>
					<td width="25%" style="border-top:1px solid #F3EDED;border-left:0px solid #F6F5F2;">
						<div  style="width:100%;height:100%;padding-top:6px;">
							<div style="width:23px;height:24px;">
								<img src="images\p2_b.png" width="24" height="26" border="0">
							</div>
							<span style="color:#6a6a6a;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:12px;text-shadow:none;padding-left:2px;">账目明细</span>
						</div>
					</td>
				</tr>
			</table>	
	</footer>
</section>


<link rel="stylesheet" href="css/mycss.css">
<script src="jsp4/myform.js"></script>
<!-- 弹出窗体结构 -->
		<div id="openModalBtn" style="width:0px;height:0px;">
		<div id="modalOverlay" class="modal-overlay">
			<div id="modalContent" class="modal-content">
				<div class="modal-header">
					<span id="labMsgTitle" style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;font-weight: bold;">恢复入住</span>
					<div style="width:30;height=20;">
					<button id="closeModalBtn" class="close-btn" style="border-radius:15px;"><i class="fas fa-times">X</i></button>
					</div>
				</div>
				<div class="modal-body">
					
					<div style="height:50px;width:100%; padding-top:18px;">
						<span id="labMsgText" style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;font-weight: bold;">确定要将该房间恢复为入住状态吗？</span>
					</div>
					
					<div id="divMsgRemarkItem" style="height:2px;width:100%;border-bottom: 1px solid #deecfb; padding-top:18px;">
						<span id="labMsgText2" style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;"></span>
					</div>
					
				<div class="modal-footer" style="background-color:#fff">
					<button class="btn-secondary" id="exportBtn" onClick="$('#closeModalBtn').click();">
						<span id="labMsgText" style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">&nbsp;&nbsp;&nbsp;取消&nbsp;&nbsp;&nbsp;</span>
					</button>
					<button class="btn-primary" onClick="bntMsgClickOK();">
						<span id="labButtonText" style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">确定恢复入住</span>
					</button>
				</div>
				
			</div>
		</div>

</body>
</html>
