<?php
	session_start();
	header("Content-type:text/html;charset=gb2312");
	//判断是否登录系统		
	if($_SESSION["main_viploginedsk"]!="1" |$_SESSION["main_vipnosk"]=="")
	{
		//没有登录开始启动登录
		require_once("logina.php");	
	}
?>
<!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">

	<title>微信订房</title>

	<script src="jsp4/jquery.js"></script>
	<link rel="stylesheet" href="css/mycss.css"> 
	
	<!--<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">-->
	<!--<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>-->
	<script src="jsp5/jquery.mobile-1.4.5.min.js"></script>
	<link rel="stylesheet" href="jsp5/jquery.mobile-1.4.5.min.css">
	<link rel="stylesheet" href="jsp4/jquery.mobile.datepicker.css">
	
	<script src="jsp4/jquery.ui.datepicker.js"></script>
	<script id="mobile-datepicker" src="jsp4/jquery.mobile.datepicker.js"></script>
	
	<script language="JavaScript"> 
		//不允许进行后退
		javascript:window.history.forward(0); 
	</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
	require_once("db/db.php");	
	require_once("common/common.php");
	require_once("../Wx.Config.php");	//只加载一次
	
	$strret=trim($_REQUEST['stext']);
	$strorderno=trim($_REQUEST['tbno']);	//订单号
	$strdoid=trim($_REQUEST['doid']);		//1是历史订单,否则我的订单
		
	$sql=sprintf("SELECT Convert(varchar(10),a.CheckInTime,120)as checkintime,Convert(varchar(10),a.CheckOutTime,120)as checkouttime,
					a.WillTime,b.Room_Type,b.Room_Count,b.RoomPrice,a.Custom_Name,a.Remarks,a.Book_LinkMan,a.CheckDays,Convert(varchar(5),a.WillTime,8)as willtime,
					a.Book_LinkTel,a.RoomNoTemp,a.intBreakfast,a.intBInvoice,c.Chain_Name,c.Chain_Address,c.Chain_Tel,a.Order_State,
					DATEPART(weekday,a.CheckInTime)AS weekday1,DATEPART(weekday,a.CheckOutTime) AS weekday2 FROM TR_Order_Inform a,
					TR_Book_RoomType b,Chain_Infor c WHERE a.Order_No=b.Order_No AND a.Chain_No=c.Chain_No AND a.Order_No='%s';",$strorderno);
					
	$result = querySql($sql);
	$row = fetch_array($result);
	
	$strchainname = trim($row['Chain_Name']);		//分店名称
	$strchainaddress = trim($row['Chain_Address']);	//分店地址
	$strchaintelno = trim($row['Chain_Tel']);		//分店电话
	$strcheckinday = $row['checkintime'];			//入住时间
	$strcheckoutday = $row['checkouttime'];			//离店日期
	$intcheckdays = $row['CheckDays'];				//住房天数
	$strwilltime = $row['willtime'];				//保留时间
	$strroomtype = $row['Room_Type'];				//房型
	$introomcount = $row['Room_Count'];				//订房数
	$fltroomprice = $row['RoomPrice'];				//房价
	$strmanname = $row['Custom_Name'];				//联系人
	$strmantelno = $row['Book_LinkTel'];			//联系电话
	$intweekday1 = $row['weekday1'];
	$intweekday2 = $row['weekday2'];
	$strremarks = $row['Remarks'];
	$intorderstate = $row['Order_State'];		//预订0,入住1,取消2,完成3
	
	$fltallval=$introomcount * $fltroomprice;
	
	//释放数据库
	freeResult($result);	
	//关闭数据库
	closeDb();	
	
	$strweekday1="";
	$strweekday2="";
	//------------------------------------//
	if($intweekday1==1)
		$strweekday1="星期日";
	elseif($intweekday1==2)
		$strweekday1="星期一";
	elseif($intweekday1==3)
		$strweekday1="星期二";
	elseif($intweekday1==4)
		$strweekday1="星期三";
	elseif($intweekday1==5)
		$strweekday1="星期四";
	elseif($intweekday1==6)
		$strweekday1="星期五";
	elseif($intweekday1==7)
		$strweekday1="星期六";
	
	if($intweekday2==1)
		$strweekday2="星期日";
	elseif($intweekday2==2)
		$strweekday2="星期一";
	elseif($intweekday2==3)
		$strweekday2="星期二";
	elseif($intweekday2==4)
		$strweekday2="星期三";
	elseif($intweekday2==5)
		$strweekday2="星期四";
	elseif($intweekday2==6)
		$strweekday2="星期五";
	elseif($intweekday2==7)
		$strweekday2="星期六";
		
	$pstext='';
	if($strret=='1')
		$pstext='订单已确认或取消，不能取消！';
	elseif($strret=='2')
		$pstext='已有账目生成,不能取消';
	elseif($strret=='3')
		$pstext='未知结果';
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="hispage1">
	<header data-role="header" data-position="fixed" data-tap-toggle="false" style="border-top-width:0px;border-bottom-width:0px;">
        <table width="100%" height="45" border="0" cellpadding="0" cellspacing="0" bgcolor="<?php echo WxMainConfig::colHeadBkColorBook;?>">
		   	<tr>
				<td height="45" width="30" align="center"></td>
				<td height="45" align="center" valign="middle">
					<span id="MsgTxt" style="color:<?php echo WxMainConfig::colHeadTextColorBook;?>;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:19px;text-shadow:none;">取消订单确认</span>
               	</td>
				<td height="45" width="30" valign="middle"></td>
		  	</tr>
		</table>
	</header>
		
	<article data-role="none">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
			<tr>
				<td height="4" width="15"></td>
				<td height="4" align="left"></td>
				<td height="4" width="15"></td>
			</tr>
									
			<tr>
				<td height="5" width="15"></td>
				<td height="15" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="35" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">入住</span>
							</td>
							<td height="35">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $strcheckinday;?></span>
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;">&nbsp;&nbsp;<?php echo $strweekday1;?></span>
							</td>
							<td height="35" width="50" rowspan="2">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $intcheckdays;?>晚</span>
							</td>
						</tr>
						
						<tr>
							<td height="35" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">离店</span>
							</td>
							<td height="35">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $strcheckoutday;?></span>
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;">&nbsp;&nbsp;<?php echo $strweekday2;?></span>
							</td>
						</tr>
						
						<tr>
							<td height="35" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">保留</span>
							</td>
							<td height="35">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $strwilltime;?></span>
							</td>
							<td height="35" width="50"></td>
						</tr>	
					</table>
				</td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="1" width="15"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="15" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="35" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">房型</span>
							</td>
							<td height="35">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $strroomtype;?></span>
							</td>
							<td height="35" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;">
									<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo number_format($introomcount).'间';?></span>
								</span>
							</td>
						</tr>
						
						<tr>
							<td height="35" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">房价</span>
							</td>
							<td height="35" colspan="2">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo "  ￥".number_format($fltroomprice);?></span>
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;">&nbsp;&nbsp;&nbsp;每晚房价</span>
							</td>
						</tr>
											
					</table>
				</td>
				<td height="5" width="15"></td>
			</tr>
					
									
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="1" width="15" bgcolor="#F2E2E2"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15" bgcolor="#F2E2E2"></td>
			</tr>
			
			<tr>
				<td height="5" width="15" bgcolor="#66FFFF"></td>
				<td height="5" align="left" bgcolor="#66FFFF"></td>
				<td height="5" width="15" bgcolor="#66FFFF"></td>
			</tr>
			
			<tr>
				<td height="1" width="15" bgcolor="#F2E2E2"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15" bgcolor="#F2E2E2"></td>
			</tr>
			
			<tr>
				<td height="5" width="15"></td>
				<td height="5" align="left"></td>
				<td height="5" width="15"></td>
			</tr>
			
			<tr>
				<td height="30" width="15"></td>
				<td height="30" align="left">
					<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:17px;">确实要取消该订单吗？</span>
				</td>
				<td height="30" width="15"></td>
			</tr>
			
			<?php if(strlen($pstext)>0) {?>
				<tr>
					<td height="5" width="15"></td>
					<td height="5" align="left"></td>
					<td height="5" width="15"></td>
				</tr>
				<tr>
					<td height="30" width="15"></td>
					<td height="30" align="left">
						<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $pstext;?></span>
					</td>
					<td height="30" width="15"></td>
				</tr>
			<?php } ?>
			
			<?php if($intorderstate<1) {?>
				<tr>
					<td height="5" width="15"></td>
					<td height="5" align="left"></td>
					<td height="5" width="15"></td>
				</tr>
			
				<tr>
					<td height="20" width="15"></td>
					<td height="20" align="left">
						<table width="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td width="47%">
									<a class="ui-btn ui-corner-all" href="orderview.php?tbno=<?php echo $strorderno;?>&doid=<?php echo $strdoid;?>" style="color:#A6A600;" target="_blank" data-role="button">返回</a>
								</td>
								<td width="6%"></td>
								<td width="47%">
									<a href="orderqx.php?tbno=<?php echo $strorderno;?>&doid=<?php echo $strdoid;?>" data-transition="slide" style="color:#A6A600;" target="_blank" data-role="button">取消订单</a>
								</td>
							</tr>
						</table>				
					</td>
					<td height="20" width="15"></td>
				</tr>
			<?php } ?>
			<tr>
				<td height="10" width="15"></td>
				<td height="10" align="left"></td>
				<td height="10" width="15"></td>
			</tr>
			
			<tr>
				<td height="1" width="15" bgcolor="#F2E2E2"></td>
				<td height="1" align="left" bgcolor="#F2E2E2"></td>
				<td height="1" width="15" bgcolor="#F2E2E2"></td>
			</tr>
		</table>
			
	</article>
</section>

</body>
	
</html>