<?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 http-equiv="Content-Type" content="text/html; 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">
	
	<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");	//只加载一次
		
	$strroomtypeid = $_REQUEST['romtype'];				//入住房型ID
	$strrmcount = $_SESSION["main_order_temp_rmcount"];		//$_REQUEST['rmcount'];
	$strrmprice = $_SESSION["main_order_temp_rmprice"];		//$_REQUEST['rmprice'];
	$strrmname = $_SESSION["main_order_temp_manname"];		//$_REQUEST['rmname'];
	$strrmtelno = $_SESSION["main_order_temp_mantelno"];	//$_REQUEST['rmtelno'];
	$strrmkptime = $_SESSION["main_order_temp_rmkptime"];	//$_REQUEST['rmkptime'];
	$strrmtxt = $_SESSION["main_order_temp_mantext"];		//$_REQUEST['rmtxt'];
	
	$strselchainno = $_SESSION["main_order_chainno"];
	
	$strDayTemp1 = $_SESSION["main_order_checkinday"];		//入住日期
	$strDayTemp2 = $_SESSION["main_order_checkoutday"];		//入住日期
	$strDays = $_SESSION["main_order_siteddays"];			//天数
	
	$strDayTemp1 = trim($strDayTemp1);
	$strDayTemp2 = trim($strDayTemp2);
	$strweekday1 = '';
	$strweekday2 = '';
	
	//查询可用房数和房价
	$sql=sprintf("SELECT b.Room_Type,b.RoomPriceS,b.VIPPrice,b.RoomCount,DATEPART(weekday,'%s')AS weekday1,DATEPART(weekday,'%s') AS weekday2 FROM TR_Room_Type a,dbo.TRF_RoomTypeFreeCountVIP('%s','%s','%s','%s') b 
					WHERE a.Chain_No='%s'AND a.Room_Type=b.Room_Type and b.RoomCount>0 AND a.ListNo=%s",$strDayTemp1,$strDayTemp2,
					$strselchainno,$_SESSION["main_vipnosk"],$strDayTemp1,$strDayTemp2,$strselchainno,$strroomtypeid);
		
	//2.得到房型名称,入住日期的星期
	//$sql=sprintf("SELECT Room_Type,DATEPART(weekday,'%s')AS weekday1,DATEPART(weekday,'%s') AS weekday2 FROM TR_Room_Type WHERE ListNo=%s;",$strDayTemp1,$strDayTemp2,$strroomtypeid);
	
	$result = querySql($sql);
	$row = fetch_array($result);
	$strroomtype = trim($row['Room_Type']);
	$intweekday1 = $row['weekday1'];
	$intweekday2 = $row['weekday2'];
	
	//$fltroomprice=$row['RoomPriceS'];
	//$fltvipprice=$row['VIPPrice'];
	$intfreecount=$row['RoomCount'];
	
	//释放数据库
	freeResult($result);
		
	//if($fltvipprice==0)
	//	$fltvipprice=$fltroomprice;
	
	$fltroomprice=strval($strrmprice);
	
	//$fltroomprice=$fltvipprice;	//有效房价
	$fltsiteddays=strval($strDays);			//有效天数
	$introomcount=strval($strrmcount);
	if($introomcount==0)
		$introomcount=1;
	$fltallval= $fltroomprice * $fltsiteddays * $introomcount;	//单据金额
		
	//------------------------------------//
	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="星期六";
	
	//3.获取友情提醒信息
	$strrembertext1="";
	$strrembertext2="";

	$sql=sprintf("SELECT Notice,RemindText FROM TR_MobileParam;");
	$result = querySql($sql);
	if($row = fetch_array($result))
	{
		$strrembertext1 = $row['Notice'];
		$strrembertext2 = $row['RemindText'];
	}
	$strrembertext1=trim($strrembertext1);
	$strrembertext2=trim($strrembertext2);
	//释放数据库
	freeResult($result);	
	//关闭数据库
	closeDb();		
?>


<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<!--第一个页面的内容实现---------------------------->
<section data-role="page" id="order1page1">
	
	<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">
			
			<?php if(strlen($strrembertext1)>0) {?>
				<tr>
					<td height="4" width="15"></td>
					<td height="4" align="left"></td>
					<td height="4" width="15"></td>
				</tr>
			
				<tr>
					<td height="20" width="15"></td>
					<td height="20" align="left">
						<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:12px;"><?php echo $strrembertext1;?></span>
					</td>
					<td height="20" 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>
			<?php } ?>
			<tr>
				<td height="6" width="15"></td>
				<td height="6" align="left"></td>
				<td height="6" width="15"></td>
			</tr>
			
			<tr>
				<td height="25" width="15"></td>
				<td height="25" align="left">
					<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $_SESSION["main_order_chainname"];?></span>
				</td>
				<td height="25" width="15"></td>
			</tr>
			
			<tr>
				<td height="15" width="15"></td>
				<td height="15" align="left">
					<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:14px;"><?php echo $_SESSION["main_order_chainaddress"];?></span>
				</td>
				<td height="15" 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="5" width="15"></td>
				<td height="15" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">入住</span>
							</td>
							<td height="30">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strDayTemp1;?></span>
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">&nbsp;&nbsp;<?php echo $strweekday1;?></span>
							</td>
							<td height="30" width="70" rowspan="2">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $strDays;?>晚</span>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">离店</span>
							</td>
							<td height="30">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strDayTemp2;?></span>
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">&nbsp;&nbsp;<?php echo $strweekday2;?></span>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">保留</span>
							</td>
							<td height="30">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strrmkptime;?></span>
							</td>
							<td height="30" width="70"></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="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">房型</span>
							</td>
							<td height="30">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strroomtype;?></span>
							</td>
							<td height="30" width="70">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo $strrmcount.'间';?></span>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">房价</span>
							</td>
							<td height="30" 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="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="40" width="15"></td>
				<td height="40" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">姓名</span>
							</td>
							<td height="30">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strrmname;?></span>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">手机</span>
							</td>
							<td height="30" colspan="2">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strrmtelno;?></span>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="50">
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">要求</span>
							</td>
							<td height="30" colspan="2">
								<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;"><?php echo $strrmtxt;?></span>
							</td>
						</tr>
						
					</table>
				</td>
				<td height="40" 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>
			
			<!--================================-->
			<?php if(strlen($strrembertext2)>0) { ?>
				<tr>
					<td height="5" width="15"></td>
					<td height="5" align="left"></td>
					<td height="5" width="15"></td>
				</tr>
				
				<tr>
					<td height="15" width="15"></td>
					<td height="15" align="left">
						<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:12px;">温馨提示:</span>
					</td>
					<td height="15" width="15"></td>
				</tr>
				
				<tr>
					<td height="15" width="15"></td>
					<td height="15" align="left">
						<span style="color: #999999;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:12px;"><?php echo $strrembertext2;?></span>
					</td>
					<td height="15" width="15"></td>
				</tr>
				
				<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>
			<?php } ?>
			
			
			<tr>
				<td height="20" width="15"></td>
				<td height="20" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="40" width="50%">
								<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:15px;">订单金额:</span>
								<span style="color: #808000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;"><?php echo "  ￥".number_format($fltallval);?></span>
							</td>
							<td height="40" width="50%">
								<span style="color: #666666;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;">
									
								</span>
							</td>
						</tr>
					</table>
				</td>
				<td height="20" 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="20" width="15"></td>
				<td height="20" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="47%">
								<a href="ordernew.php?romtype=<?php echo $strroomtypeid;?>" data-transition="slide" style="color:#A6A600;" target="_blank" data-role="button">上一步</a>
							</td>
							<td width="6%"></td>
							<td width="47%">
								<a class="ui-btn ui-corner-all" style="color:#A6A600;" target="_blank" href="ordersave.php?romtype=<?php echo $strroomtypeid;?>&rmcount=<?php echo $strrmcount;?>&rmprice=<?php echo $strrmprice;?>&rmname=<?php echo $strrmname;?>&rmtelno=<?php echo $strrmtelno;?>&rmkptime=<?php echo $strrmkptime;?>&rmtxt=<?php echo $strrmtxt;?>">提交订单</a>
							</td>
						</tr>
					</table>	
				</td>
				<td height="20" width="15"></td>
			</tr>
			
			<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>