<?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;
	}
	
	
	$strRoomNo=trim($_REQUEST["romid"]);
	$chainno=$_SESSION["ChainNo"];
	
	
	//获取默认退房时间
	$strDefCancelTime='12:00';
	$sql=sprintf("SELECT Item_Value from TR_Config WHERE Item_Name='入住时默认退房时间' And Chain_No='%s'",$chainno);
	$result = querySql($sql);		
	if($row = fetch_array($result))
	{
		//得到每一条的记录信息
		$strDefCancelTime=$row['Item_Value'];
		if(strlen($strDefCancelTime)>5)
		{
			//2010-01-01 14:00
			$strDefCancelTime=substr($strDefCancelTime,11);
		}
	}
	//释放数据库
	freeResult($result);
	
	//得到住房结算时间
	$intNowHour1=0;
	$intNowHour2=0;
	$strHotelStartTime='06:00';
	$sql=sprintf("SELECT Item_Value from TR_Config WHERE Item_Name='凌晨房住房结算时间' And Chain_No='%s'",$chainno);
	$result = querySql($sql);		
	if($row = fetch_array($result))
	{
		//得到每一条的记录信息
		$strHotelStartTime=$row['Item_Value'];
		if(strlen($strHotelStartTime)>5)
		{
			//2010-01-01 14:00
			$intNowHour1=substr($strHotelStartTime,11,2);	//得到当前小时
			$strHotelStartTime=substr($strHotelStartTime,11);
		}
	}
	//释放数据库
	freeResult($result);
	
	
	$strRoomType='';
	$fltRoomPriceMS=0;
	$fltRoomPrice=0;
	$strCheckInDay='2020-01-01 12:00';
	$strCheckOutDay='2020-01-01 12:00';
	
	
	//开始去房间状态数量
	$sql=sprintf("SELECT b.Room_Type,b.Room_Price,b.Room_PriceS,CONVERT(varchar(16),Getdate(),20)AS SerDay  FROM TR_Room_Inform a,TR_Room_Type b 
				WHERE a.TypeListNo=b.ListNo AND b.Chain_No='%s' AND a.Room_No='%s'",$chainno,$strRoomNo);

	$result = querySql($sql);		
	if($row = fetch_array($result))
	{
		//得到每一条的记录信息
		$strRoomType=$row['Room_Type'];
		$fltRoomPriceMS=$row['Room_Price'];
		$fltRoomPrice=$row['Room_PriceS'];
		$strCheckInDay=$row['SerDay'];
		
		$intNowHour2=substr($strCheckInDay,11,2);	//得到当前小时
		$strCheckOutDay=substr($strCheckInDay,0,10);
	}
	
	$fltRoomPrice=$fltRoomPrice+0;
	$fltRoomPriceMS=$fltRoomPriceMS+0;
	
	//释放数据库
	freeResult($result);
	
	//生成默认退房时间的日期，还没有增加1天的预离日期
	$intIsMorningFlag=0;
	$strCheckOutDay=$strCheckOutDay.' 12:00';
	if($intNowHour2<$intNowHour1)
	{
		//如果当前时间小于住房结算时间，按凌晨房方式计算天数
		$intIsMorningFlag=1;
	}
?>

<!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="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>-->
	
	<!--<link rel="stylesheet" href="css/mycss.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>-->
	

	<style>
	  header {
		position: fixed;
		top: 0;
		width: 100%;
		background-color: #f8f9fa;
		z-index: 1000;
	  }
	  footer {
		position: fixed;
		bottom: 0;
		width: 100%;
		background-color: #f8f9fa;
		z-index: 1000;
	  }
	  body {
		padding-top: 50px; /* 根据header的高度调整 */
		padding-bottom: 50px; /* 根据footer的高度调整 */
	  }
	  
	  input::placeholder {
			color: #c8c8c8; /* 设置占位符文本颜色为灰色 */
		}
	</style>

</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();
		}
		
		//设置日期空间显示样式为yyyy-MM-dd HH:mm
		function formatDateTimeLocal(dateTimeLocal) 
		{
			const date = new Date(dateTimeLocal);
			let year = date.getFullYear();
			let month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero based.
			let day = date.getDate().toString().padStart(2, '0');
			let hours = date.getHours().toString().padStart(2, '0');
			let minutes = date.getMinutes().toString().padStart(2, '0');
			return `${year}-${month}-${day} ${hours}:${minutes}`;
		}

		document.getElementById('datetime').addEventListener('change', function() 
		{
			const formattedDate = formatDateTimeLocal(this.value);
			document.getElementById('formattedDate').textContent = formattedDate;
		});

</script>

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

<section data-role="page" id="pagepayfor1" 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;"><?php echo $strRoomNo.'-'.$strRoomType;?></span>
               	</td>
				
				<td height="45" width="60" align="left" valign="middle"></td>
				
				<td height="45" width="15" valign="middle"></td>
		  	</tr>
			<tr bgcolor="<?php echo WxMainConfig::colHeadBkColor;?>">
				<td colspan="4" height="15">
					<div style="background:#fff;width:100%;height:18px;padding-top:0px;margin-top:0px; border-radius: 15px 15px 0px 0px;">

					</div>
				</td>
		  	</tr>
		</table>
		
	</header>
		
	<article data-role="none" >
		<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
			
			<tr><td height="6" colspan="5"></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;font-weight: bold;">住客信息</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">姓名：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext1" name="mytext1" value='' type="text" placeholder="宾客姓名" data-mini="true" autocomplete="off" style="border: none;width:95%;height:28px;"/>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">性别：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">
						<select id="mycombo1" name="mycombo1" data-mini="true" style="color: #000; background-color:#fff; border: none; width:95%;height:28px;">
							<option value="先生">先生&nbsp;</option>
							<option value="女士">女士&nbsp;</option>
						</select>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">电话：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext2" name="mytext2" value='' type="tel" placeholder="手机号码" data-mini="true" autocomplete="off" style="border: none;width:95%;height:28px;"/>
						
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">证件：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">
						<select id="mycombo2" name="mycombo2" data-mini="true" style="color: #000; background-color:#fff; border: none; width:95%;height:28px;">
							<option value="身份证">身份证&nbsp;</option>
							<?php
								$strItemName='';
								$sql=sprintf("SELECT Item_Name,OrderNo FROM TR_Basic_Item WHERE (Chain_No='%s' OR Chain_No='') 
											AND Item_Type='证件类型' AND Item_Name<>'身份证' ORDER BY Item_Type ASC,OrderNo ASC,Item_Name ASC",$chainno);
								$result = querySql($sql);
										
								while($row = fetch_array($result))
								{
									$strItemName = $row['Item_Name']; 
							?>
							<option value="<?php echo $strItemName;?>"><?php echo $strItemName;?>&nbsp;</option>
							<?php 
								}
								//释放数据库
								freeResult($result);
								closeDb();
							?>
						</select>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">证号：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext3" name="mytext3" value='' type="tel" placeholder="证件号码" data-mini="true" autocomplete="off" style="border: none;width:95%;height:28px;"/>
						
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">说明：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext4" name="mytext4" value='' type="text" placeholder="备注说明" data-mini="true"  autocomplete="off"  style="border: none;width:95%;height:28px;"/>
						
					</span>
				</td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr><td height="15" colspan="5"></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" colspan="3" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;font-weight: bold;">入住信息</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			
			
			
			
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">天数：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="38" width="45" align="right">
								<div id="SubCode" onClick="gbClick(2)" style="width:45px;height:36px;text-align:center;line-height:36px;background-color:#E7E7E7;margin-left:0px;border-radius:5px;">
									<span style="color: #000;font-size:20px;text-shadow:none;">←</span>
								</div>
							</td>
							<td height="38" width="50" align="center">
								<div style="width:45px;height:29px;text-align:center;padding-top:4px;border:1px solid #F3F3F3;">
									<span id="labDaysVal" style="color: #000;font-size:18px;text-shadow:none;"><?php echo $intSitedDays;?></span>
								</div>
							</td>
							<td height="38" width="45" align="right">
								<div id="AddCode" onClick="gbClick(1)" style="width:45px;height:36px;text-align:center;line-height:36px;background-color:#E7E7E7;margin-right:10px;border-radius:5px;">
									<span style="color: #000;font-size:20px;text-shadow:none;">→</span>
								</div>
							</td>
							<td height="38" align="right" valign="middle">
								<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">钟点房</span><input type="checkbox" id="chkTimeFlag" name="chkTimeFlag" value="0" >
							</td>
						</tr>
					</table>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">抵店：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #626262;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;"><?php echo $strCheckInDay;?></span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">预离：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span id="labDateTime1" style="color: #626262;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;"><?php echo $strCheckOutDay;?></span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">房价：</span>
				</td>
				<td height="35" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext5" name="mytext5" value='<?php echo $fltRoomPrice;?>' type="number" placeholder="实际销售价" data-mini="true"  autocomplete="off"  style="border: none;width:92%;height:28px;"/>
						
					</span>
				</td>
				<td height="35" width="115" align="right">
					<span style="color: #626262;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">门市价:￥<?php echo $fltRoomPriceMS;?></span>
				</td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">客源：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">
						<select id="mycombo4" name="mycombo4" data-mini="true" style="color: #000; background-color:#fff; border: none; width:95%;height:28px;">
							<option value="散客">散客&nbsp;</option>
							<?php
								$strItemName='';
								$sql=sprintf("SELECT Item_Name,OrderNo FROM TR_Basic_Item WHERE (Chain_No='%s' OR Chain_No='') 
											AND Item_Type='客源类型' And Item_Name<>'散客' ORDER BY Item_Type ASC,OrderNo ASC,Item_Name ASC",$chainno);
								$result = querySql($sql);
										
								while($row = fetch_array($result))
								{
									$strItemName = $row['Item_Name']; 
							?>
							<option value="<?php echo $strItemName;?>"><?php echo $strItemName;?>&nbsp;</option>
							<?php 
								}
								//释放数据库
								freeResult($result);
								closeDb();
							?>
						</select>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			
			<tr><td height="15" colspan="5"></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" colspan="3" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;font-weight: bold;">收款信息</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">方式：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #570057;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:16px;">
						<select id="mycombo3" name="mycombo3" data-mini="true" style="color: #000; background-color:#fff; border: none; width:95%;height:28px;">
							<option value=" "> &nbsp;</option>
							<?php
								$strItemName='';
								$sql=sprintf("SELECT Item_Name,OrderNo FROM TR_Basic_Item WHERE (Chain_No='%s' OR Chain_No='') 
											AND (Item_Type='付款方式' AND Item_Name<>'会员卡' AND Item_Name<>'挂账' AND Item_Name<>'扫码支付') ORDER BY Item_Type ASC,OrderNo ASC,Item_Name ASC",$chainno);
								$result = querySql($sql);
										
								while($row = fetch_array($result))
								{
									$strItemName = $row['Item_Name']; 
							?>
							<option value="<?php echo $strItemName;?>"><?php echo $strItemName;?>&nbsp;</option>
							<?php 
								}
								//释放数据库
								freeResult($result);
								closeDb();
							?>
						</select>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">金额：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext6" name="mytext6" value='' type="number" placeholder="收款金额" data-mini="true" autocomplete="off" style="border: none;width:95%;height:28px;"/>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			<tr>
				<td height="35" width="30" ></td>
				<td height="35" width="60" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">说明：</span>
				</td>
				<td height="35" colspan="2" align="left">
					<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;">
						<input id="mytext7" name="mytext7" value='' type="text" placeholder="收款备注说明" data-mini="true" autocomplete="off" style="border: none;width:95%;height:28px;"/>
					</span>
				</td>
				<td height="35" width="30" ></td>
			</tr>
			
			<tr><td height="1" width="30" ></td><td height="1" colspan="3" bgcolor="#F3F3F3"></td><td height="1" width="30" ></td></tr>
			
			
			
			
			
			
			<tr><td height="30" colspan="5"></td></tr>
			
			
			<tr>
				<td height="35"  width="30" ></td>
				<td height="35" colspan="3" align="center">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="35" width="5%"></td>

  
							<td height="35" width="90%"><!--background-color:#D7AA28;-->
								<div onClick="bmtSaveRoomCheckIn(1)" style="border-radius:5px;width:96%; height:38px;  background-image:linear-gradient(45deg, #5762f7 70%, #24d7ff 100%),linear-gradient(225deg, #5762f7 70%, #24d7ff 100%);background-blend-mode: screen;">
									<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
										<tr><td width="100%" height="100%" align="center">
											<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">保存入住登记</span>
										</td></tr>
									</table>
								</div>
							</td>
						</tr>
					</table>
				</td>
				
				<td height="35" width="30" ></td>
			</tr>
			
			
			<tr><td height="2" colspan="5"></td></tr>
			
			
		</table>
				
	</article>
		
	
	<script type="text/javascript">
		
		//页面加载后，显示默认预离时间
		var intIsMorningFlag=<?php echo $intIsMorningFlag;?>;
		
		//计算新的日期
		var strNewTime='<?php echo $strCheckOutDay;?>';
		strNewTime=addDayAndFormat(strNewTime,1);
		RefDayText(1,strNewTime);//首次显示
		
		function addDayAndFormat(dateString,intDays) 
		{
			// 解析字符串为日期对象
			const date = new Date(dateString);
    
			// 添加一天
			if(intIsMorningFlag>0)
			{
				//如果是凌晨时间
				intDays=intDays-1;
			}
			date.setDate(date.getDate() + intDays);
    
			// 格式化日期为 yyyy-MM-dd HH:mm
			const year = date.getFullYear();
			const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的
			const day = String(date.getDate()).padStart(2, '0');
			const hours = String(date.getHours()).padStart(2, '0');
			const minutes = String(date.getMinutes()).padStart(2, '0');
    
			return `${year}-${month}-${day} ${hours}:${minutes}`;
		};

		//刷新新的日期数据
		function RefDayText(intDay,strCheckOut)
		{
			var labSpan1=document.getElementById("labDaysVal");	//显示天数的标签
			var labDateTime1=document.getElementById("labDateTime1");
			labSpan1.textContent=intDay;
			labDateTime1.textContent=strCheckOut;
		};
		
		function gbClick(id)
		{
			var intIsTimeFlag=0;
			var checkbox = document.getElementById('chkTimeFlag');
			if (checkbox.checked) 
			{
				intIsTimeFlag=1;
			}
			if(intIsTimeFlag>0)
			{
				//钟点房不执行加减
				return;
			}
			
			var intSelCount;
			var labSpan1=document.getElementById("labDaysVal");	//显示天数的标签
			intSelCount=labSpan1.textContent;
			//alert(oTextbox1.value);
			//return;
			if(id==1)
			{
				//增加 
				intSelCount++;
				if(intSelCount>99){
					intSelCount = 1;
				}
				
				//计算新的日期
				var strNewTime='<?php echo $strCheckOutDay;?>';
				strNewTime=addDayAndFormat(strNewTime,intSelCount);
				
				RefDayText(intSelCount,strNewTime);
				//得到新的预离日期
				//var labDateTime1=document.getElementById("labDateTime1");
				//labDateTime1.textContent=strNewTime;
				
				//显示当前天数
				//labSpan1.textContent=intSelCount;
			}
			else if(id==2)
			{
				//减少商品数量
				intSelCount--;
				if(intSelCount<=0){
					intSelCount = 1;
				}
				
				//计算新的日期
				var strNewTime='<?php echo $strCheckOutDay;?>';
				strNewTime=addDayAndFormat(strNewTime,intSelCount);
				
				RefDayText(intSelCount,strNewTime);
				
				//得到新的预离日期
				//var labDateTime1=document.getElementById("labDateTime1");
				//labDateTime1.textContent=strNewTime;
				
				//显示当前天数
				//labSpan1.textContent=intSelCount;
			}
		};
		
			
		function bmtReturnPage()
		{	
			window.location.href='repRoomView.php';
		};
		
		//1入住登记，2预订登记
		function bmtSaveRoomCheckIn(intDoID)
		{
			var strchainno='<?php echo $chainno;?>';
			var strroomno='<?php echo $strRoomNo;?>';
			var strManName=$("#mytext1").val();
			var strTelNo=$("#mytext2").val();
			var strCardNo=$("#mytext3").val();
			var strRemarks=$("#mytext4").val();
			var strRoomPrice=$("#mytext5").val();
			
			var labSpan1=document.getElementById("labDaysVal");	//显示天数的标签
			var intDay =labSpan1.textContent;
			var labDateTime1=document.getElementById("labDateTime1");
			var strCheckOut=labDateTime1.textContent;
			
			var intIsTimeFlag=0;
			var checkbox = document.getElementById('chkTimeFlag');
			if (checkbox.checked) 
			{
				intIsTimeFlag=1;
			}
			
			var strSex=$("#mycombo1").val();
			var strCardType=$("#mycombo2").val();
			var intSex=2;
			if(strSex=='女士')
			{
				intSex=1;	//1女，2男
			}
			var strCustomType=$("#mycombo4").val();
			var strPayType=$("#mycombo3").val();
			var strPayValue=$("#mytext6").val();
			var strPayText=$("#mytext7").val();
			
			strManName=strManName.trim();
			strPayType=strPayType.trim();
			
			if(strPayValue<0)
			{
				alert("收款金额不能小于零！");
				document.getElementById("mytext6").focus();
				return;
			}
			
			if(strManName.length<1)
			{
				alert("请输入宾客姓名！");
				document.getElementById("mytext1").focus();
				return;
			}
			
			if(strPayType.length<1 && strPayValue>0)
			{
				alert("请选择收款方式！");
				document.getElementById("mycombo3").focus();
				return;
			}
			if(strPayType.length>0 && strPayValue==0)
			{
				alert("请输入收款金额！");
				document.getElementById("mytext6").focus();
				return;
			}
			
			//alert(strCardType);
			//return;
			
			//将数据封包成JSON
			const jsondata = {
				rmdoid: 1,			//1入住登记，2预订登记
				chainno: strchainno,
				roomno: strroomno,
				roomprice: strRoomPrice,
				checkdays: intDay,
				checkout: strCheckOut,
				manname: strManName,
				mansex: intSex,		//--1女，2男
				telno: strTelNo,
				cardtype: strCardType,
				cardno: strCardNo,
				remarks: strRemarks,
				paytype: strPayType,
				payvalue: strPayValue,
				payText: strPayText,
				customtype: strCustomType,
				istimeroom: intIsTimeFlag
				};
			
			//开始提交PHP页面执行数据库操作流程
			var strurl="rmroomcheckinsave.php";
			var strret="";
			//用ajax的“同步方式”调用一般处理程序
			$.ajax({
					url: strurl ,
					async: false,//改为同步方式
					type: "POST",
					data: jsondata,
					success: function (RetData) 
					{
						strret = RetData;
					}
			});
				
			if(strret.length>2)
			{
				var strSubHead =strret.substr(0,3);
			
				if(strSubHead=="*1*")
				{
					//得到新的数量值
					strurl="repRoomView.php";
					window.location=strurl;
				}
				else if(strSubHead=="*0*")
				{
					alert("房号不存在或非空净房！");
				}
				else
				{
					alert("提交入住登记失败！");
				}
			}
			
		};

		
		 	
	</script>
		
		
</section>

</body>
</html>
