<?php
	session_start();
	include "wechat.class.php";
	include 'errCode.php';
	require_once("../Wx.Config.php");
			
	$opt = array(
		'appsecret'=>WxMainConfig::APPSECRET,//填写高级调用功能的密钥
		'appid'=>WxMainConfig::APPID	//填写高级调用功能的appid
	);
	$we = new Wechat($opt);
	$auth = $we->checkAuth();
	//var_dump($auth);
	$js_ticket = $we->getJsTicket();
	if (!$js_ticket) {
		echo "获取js_ticket失败！<br>";
		echo '错误码：'.$we->errCode;
		echo ' 错误原因：'.ErrCode::getErrText($we->errCode);
		//echo "dddddddddddddddd";
		exit;
	}
	//$url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];		//注意这里如果最初调用页面的是 http这里就不要加s否则就要加s
	$url = WxMainConfig::ServerHttpPathB.$_SERVER['REQUEST_URI'];
	
	$js_sign = $we->getJsSign($url);
	//var_dump($js_sign);
	//exit();

?>
<!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>
	
	<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>
	
	
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.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>
	//禁止页面上下滑动,整个页面都不能滑动了
	document.addEventListener('touchmove', function(e) {
		e.preventDefault();
	});
</script>


	
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<?php 
		require_once("db/db.php");	
		require_once("common/common.php");
	
		$chainno=$_SESSION["ChainNo"];
		
		//如果是重新加载显示数据
		$strSelChainNo=trim($_REQUEST["chid"]);
		$strCFListNo=trim($_REQUEST["cflistno"]);
		$strCFBListNo=trim($_REQUEST["cfblistno"]);
		$strDoTID=trim($_REQUEST["dotid"]);
		
		if(strlen($strSelChainNo)>0 && $strDoTID=='8')
		{
			$chainno=$strSelChainNo;
			$_SESSION["ChainNo"]=$chainno;
		}
		
		$intShowInform=0;
		if($strDoTID=='8' && strlen($strCFListNo)>1 && strlen($strCFBListNo)>0)
		{
			//开始加载数据
			$intShowInform=1;
			
			$strSelRoomNo='';
			$strSelRoomType='';
			$strSelOrderNo='';
			$strSelCheckIn='';
			$strSelCheckOut='';
			$strSelManNames='';
			$strSelBManNum='';
			$strSelMealDay='';
			
			$sql=sprintf("SELECT a.Order_No,a.Room_No,a.Room_Type,b.Custom_Type,a.Room_BedCount,a.Man_Count,a.Man_Name,a.Man_NameA,a.Man_NameB,
						convert(varchar(16),a.SelectRoomTime,120)AS CheckInTime,convert(varchar(16),a.Cancel_Date,120)AS CheckOutTime,a.ListNo,a.Breakfast,
						convert(varchar(10),GetDate(),120)AS Now_Date FROM TR_Order_Room_List a,TR_Order_Inform b WHERE a.Order_No=b.Order_No AND a.ListNo=%s
						AND (b.Order_State=0 OR b.Order_State=1) AND a.Room_BillState=2",$strCFBListNo);
			$result = querySql($sql);		
			if($row = fetch_array($result))
			{
				$strSelRoomNo=$row['Room_No'];	
				$strSelRoomType=$row['Room_Type'];
				$strSelOrderNo=$row['Order_No'];
				$strSelCheckIn=$row['CheckInTime'];
				$strSelCheckOut=$row['CheckOutTime'];
				
				$strSelMealDay=$row['Now_Date'];
				
				$strSelMan1=trim($row['Man_Name']);
				$strSelMan2=trim($row['Man_NameA']);
				$strSelMan3=trim($row['Man_NameB']);
			
				$strSelManNames	=$strSelMan1;
				if(strlen($strSelMan2)>0)
				{
					$strSelManNames	= $strSelManNames .','.$strSelMan2;
				}
				if(strlen($strSelMan3)>0)
				{
					$strSelManNames	= $strSelManNames .','.$strSelMan3;
				}
				
				$intSelBreakfast=$row['Breakfast'];
				$strSelBManNum=$intSelBreakfast .' 份';
			}
			freeResult($result);		
		}
		
?>
<!--选择楼层的部分代码---------------------------->
<section data-role="page" id="pageItemList">
	<header data-role="header" data-position="fixed" data-tap-toggle="false">
		<table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td height="40" width="45" align="right">
					<a href="../indexm.php?rset=0" data-role="button" data-icon="home" data-iconpos="notext" rel="external"></a>
				</td>
				<td height="40" align="center">早餐扫码核验</td>
				<td height="40" width="40" ></td>
			</tr>
		</table>
	</header>
	
	<article data-role="content">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" >
			<tr><td height="1" colspan="3"></td></tr>
			<tr>
				<td height="26" width="10"></td>
				<td height="26" align="center">
					<div id="SubDiv1" style="width:98%;height:100%;text-align:center;padding-top:0px;border:0px solid #fff;">
						<span style="color: #000;font-size:14px;text-shadow:none;">正在加载扫码设备。。。</span>
					</div>
				</td>
				<td height="26" width="10"></td>
			</tr>
			<tr><td height="5" colspan="3"></td></tr>
			<tr>
				<td height="50" width="10"></td>
				<td height="50" align="center">
					<!--扫描入账-->
					<div id="ScaleEnable" onclick="SubClick()" style="width:120px;height:45px;border-radius:8px;top:0px;left:0px;background-color:#D7AA28;">
						<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td width="50" height="100%" align="right">
									<img src="images/scanbar1.png" style="width:20px;height:18px;margin-top:3px;"/>
								</td>
								<td width="8" height="100%" align="right"></td>
								<td height="100%" align="left">
									<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;">扫码</span> 
								</td>
							</tr>
						</table>
						
					</div>
					
				</td>
				<td height="50" width="10"></td>
			</tr>
			
			<tr><td height="15" colspan="3"></td></tr>
			<tr><td height="1" colspan="3" bgcolor="#F2E2E2"></td></tr>
			<tr><td height="1" colspan="3"></td></tr>
			
			<tr>
				<td height="30" colspan="2" align="left">
					<span style="color: #000;font-size:16px;text-shadow:none;">当前宾客资料</span>
				</td>
				<td height="30" width="10"></td>
			</tr>
			
			
			<tr>
				<td height="25" width="10"></td>
				<td height="25" align="left">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv1" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #0606fe;font-size:16px;text-shadow:none;">房号：<?php echo $strSelRoomNo;?></span>
								</div>
							</td>
							<td id="ButSub01" height="30" width="80" rowspan="3" align="center" valign="middle">
								<?php if($intShowInform==1) {?>
								<div id="btmCheckSave" onclick="SubSaveClick()" align="center" style="width:70px;height:70px;border-radius:35px;background-color:#3595f5;">
									<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td width="100%" height="50%" align="center" valign="bottom">
												<span style="color:#fff ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:14px;text-shadow:none;">就餐</span> 
											</td>
										</tr>
										<tr>
											<td width="100%" height="50%" align="center" valign="top">
												<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 } ?>
							</td>
						</tr>
			
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv4" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #0606fe;font-size:16px;text-shadow:none;">早餐：<?php echo $strSelBManNum;?></span>
								</div>
							</td>
							
						</tr>
						
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv3" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #585858;font-size:16px;text-shadow:none;">姓名：<?php echo $strSelManNames;?></span>
								</div>
							</td>
							
						</tr>
						
					</table>
					
				</td>
				<td height="25" width="10"></td>
			</tr>
			
			<tr>
				<td height="25" width="10"></td>
				<td height="25" align="left">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
						
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv2" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #585858;font-size:16px;text-shadow:none;">房型：<?php echo $strSelRoomType;?></span>
								</div>
							</td>
						</tr>
						
						
						
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv5" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #585858;font-size:16px;text-shadow:none;">入住：<?php echo $strSelCheckIn;?></span>
								</div>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv6" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #585858;font-size:16px;text-shadow:none;">预离：<?php echo $strSelCheckOut;?></span>
								</div>
							</td>
						</tr>
						
						<tr>
							<td height="30" width="5" align="right"></td>
							<td height="30" align="left">
								<div id="LabelDiv7" style="width:100%;height:100%;text-align:left;padding-top:0px;border:0px solid #fff;">
								<span style="color: #585858;font-size:16px;text-shadow:none;">单号：<?php echo $strSelOrderNo;?></span>
								</div>
							</td>
						</tr>
					</table>
					
				</td>
				<td height="25" width="10"></td>
			</tr>
			
			<tr><td height="10" colspan="3"></td></tr>
			<tr><td height="1" colspan="3" bgcolor="#F4F2EE"></td></tr>
			
			
			<!--
			<tr><td height="1" colspan="3"></td></tr>
			
			<tr>
				<td height="30" colspan="2" align="left">
					<span style="color: #000;font-size:16px;text-shadow:none;">本日早餐已消费记录</span>
				</td>
				<td height="30" width="10"></td>
			</tr>
			-->
			
			<tr>
				<td id="TabSub1" height="30" colspan="3" align="left">
					<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
						<tr  bgcolor="#F4F2EE">
							<td height="30" width="40" align="center">
								<span style="color: #000;font-size:14px;text-shadow:none;">序号</span>
							</td>
							<td height="30" width="80" align="center">
								<span style="color: #000;font-size:14px;text-shadow:none;">房号</span>
							</td>
							<td height="30" align="left">
								<span style="color: #000;font-size:14px;text-shadow:none;">核验时间</span>
								
								
							</td>
							<td height="30" width="50" align="center">
								<span style="color: #000;font-size:14px;text-shadow:none;">状态</span>
							</td>
						</tr>
						
						
						<?php 
							if($strDoTID=='8' && strlen($strCFListNo)>1 && strlen($strCFBListNo)>0)
							{
								if(strlen($strSelMealDay)>5)
								{
									$intRowID=1;
									$strUsedTime='';
									$intUsedFlag=0;
									$strRoomNo='';
									$strUsedState='';
									$strColorSub='000';
									
									$sql = sprintf("SELECT ListNo,TradeTime,Room_No,Meal_Date,PrintTimes,UserName,UsedFlag,convert(varchar(16),UsedTime,120)AS UsedTime FROM TR_Room_BreakFast_List 
											WHERE BListNo=%s And Meal_Date>='%s' And Meal_Date<='%s 23:59' ORDER BY UsedTime ASC",$strCFBListNo,$strSelMealDay,$strSelMealDay);
										
									$result = querySql($sql);
					
									while($row = fetch_array($result))
									{
										$strUsedTime=$row['UsedTime'];
										$intUsedFlag=$row['UsedFlag'];
										$strRoomNo=$row['Room_No'];
										
										if($intUsedFlag>0)
										{
											$strUsedState='已使用';
											$strColorSub='918686';
										}
										else
										{
											$strUsedState='未用';
											$strUsedTime='';
											$strColorSub='000';
										}
						?>
						<tr>
							<td height="30" width="40" align="center">
								<span style="color: #<?php echo $strColorSub;?>;font-size:14px;text-shadow:none;"><?php echo $intRowID; ?></span>
							</td>
							<td height="30" width="80" align="center">
								<span style="color: #<?php echo $strColorSub;?>;font-size:14px;text-shadow:none;"><?php echo $strRoomNo; ?></span>
							</td>
							<td height="30" align="left">
								<span style="color: #<?php echo $strColorSub;?>;font-size:14px;text-shadow:none;"><?php echo $strUsedTime; ?></span>
								
								
							</td>
							<td height="30" width="50" align="center">
								<span style="color: #<?php echo $strColorSub;?>;font-size:14px;text-shadow:none;"><?php echo $strUsedState; ?></span>
							</td>
						</tr>
						
						<tr bgcolor="#F4F2EE"><td height="1" colspan="4"></tr>
						
						<?php
								
										$intRowID = $intRowID + 1;
									} 
									
									freeResult($result);	//释放数据库
								}
								closeDb();				//关闭数据库
							}
							
							
						?>
					</table>
				</td>
			</tr>
			
			
			
			
			
			
			
			
			
			
			
			
			
			
		</table>

	</article>
	
</section>


<script type="text/javascript">
	var intHadLinkFlag=0;
	var strSelBarCode;
	var strGetItemNo;
	var strGetItemName;
	strSelBarCode="";
	strGetItemNo="";
	strGetItemName="";
	
	//alert('<?php echo $url;?>');
	wx.config({
			debug: false,
			appId: '<?php echo $js_sign['appid']; ?>', // 必填，公众号的唯一标识
			timestamp: <?php echo $js_sign['timestamp']; ?>, // 必填，生成签名的时间戳，切记时间戳是整数型，别加引号
			nonceStr: '<?php echo $js_sign['noncestr']; ?>', // 必填，生成签名的随机串
			signature: '<?php echo $js_sign['signature']; ?>', // 必填，签名，见附录1
			jsApiList: [
				'checkJsApi',
				'onMenuShareTimeline',
				'onMenuShareAppMessage',
				'onMenuShareQQ',
				'onMenuShareWeibo',
				'hideMenuItems',
				'showMenuItems',
				'hideAllNonBaseMenuItem',
				'showAllNonBaseMenuItem',
				'translateVoice',
				'startRecord',
				'stopRecord',
				'onRecordEnd',
				'playVoice',
				'pauseVoice',
				'stopVoice',
				'uploadVoice',
				'downloadVoice',
				'chooseImage',
				'previewImage',
				'uploadImage',
				'downloadImage',
				'getNetworkType',
				'openLocation',
				'getLocation',
				'hideOptionMenu',
				'showOptionMenu',
				'closeWindow',
				'scanQRCode',
				'chooseWXPay',
				'openProductSpecificView',
				'addCard',
				'chooseCard',
				'openCard'
			  ]
	});
	
	wx.ready(
		function () {
			// 在这里调用 API
			//alert(1);
			wx.checkJsApi(
			{
				jsApiList: ['scanQRCode'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
				success: function(res) 
				{
					// 以键值对的形式返回，可用的api值true，不可用为false
					// 如：{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
					//alert(JSON.stringify(res)); //如果调用成功显示消息
					SetBarAPIState(1);
					
					var doidtype='<?php echo $intShowInform;?>';
					if(doidtype=='1')
					{
						SetBarAPIState(9);	
						intHadLinkFlag=1;
					}
					else
					{
						scaleCodePage();	//自动启动扫码
						intHadLinkFlag=1;
					}
				},
				fail: function (res)
				{
					SetBarAPIState(0);
				}
			});
		}		
	);
			
	
	
		function scaleCodePage()
		{			
			wx.scanQRCode(
			{
				needResult: 1,
				scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
				desc: 'scanQRCode desc',
				success: function (res) 
				{
					//alert(JSON.stringify(res));
					//alert(res.resultStr);
					//localStorage["wx"] = res.resultStr;
					if(res.resultStr=="")
					{
						SetBarAPIState(3);	//扫码失败
					}
					else
					{
						//显示扫码信息
						//alert(res.resultStr);
						strSelBarCode=res.resultStr;
						strSelBarCode=strSelBarCode.replace("EAN_13,","");
						//alert(strSelBarCode);
						SetBarAPIState(2);	//扫码成功
					}
				},
				cancel: function (res) 
				{
					//alert(JSON.stringify(res));
					SetBarAPIState(4);	//取消
				},
				fail: function (res) 
				{
					//alert(JSON.stringify(res));
					SetBarAPIState(3);	//扫码失败
				}
			});
		}
		
		function SubClick()
		{
			if(intHadLinkFlag>0)
			{
				ClearDataInform();
				scaleCodePage();
			}
		};
		
		function ClearDataInform()
		{
			$("#LabelDiv1").html('<span style="color: #0606fe;font-size:16px;text-shadow:none;">房号：</span>');
			$("#LabelDiv2").html('<span style="color: #585858;font-size:16px;text-shadow:none;">房型：</span>');
			$("#LabelDiv3").html('<span style="color: #585858;font-size:16px;text-shadow:none;">姓名：</span>');
			$("#LabelDiv4").html('<span style="color: #0606fe;font-size:16px;text-shadow:none;">早餐：</span>');
			$("#LabelDiv5").html('<span style="color: #585858;font-size:16px;text-shadow:none;">入住：</span>');
			$("#LabelDiv6").html('<span style="color: #585858;font-size:16px;text-shadow:none;">预离：</span>');
			$("#LabelDiv7").html('<span style="color: #585858;font-size:16px;text-shadow:none;">单号：</span>');
			
			$("#TabSub1").html('');
			
			$("#ButSub01").html('');
			
		};
		
		function SetButtomEnabled()
		{
			
		
			$("#ButSub01").html('<span style="color:#ef0a0a ;font: 12px/1.5 微软雅黑,tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;">已核验</span>');
			
		};
		
		function SubSaveClick()
		{
			var strCFListNo='<?php echo $strCFListNo;?>';	//早餐记录流水号
			
			//开始将扫码记录该城已核验
			$.ajax({
					url: "breakfastok.php?cflistno=" + strCFListNo,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:4, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						var strret = RetData;
						
						//alert(strret);
						
						//'BEG:'.$strRetID;	//1=OK,0=无效,2=已经使用过,3=不是当天的,4=房间不是在住状态
						var strBegin=strret.substr(0,4);
												
						if(strBegin=='BEG:')
						{
							var intErrID=strret.substr(4,1);

							if(intErrID=='1')
							{
								//2.重新打开该页面
								SetButtomEnabled();
							}
							else
							{
								alert("提交数据失败!");
							}
						}
						else
						{
							alert("提交数据错误!");
						}
					}
				});
		};
	
		
		function SetBarAPIState(intState)
		{
			if(intState==0)
			{
				//加载失败
				$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">加载扫码接口失败！！</span>');
				ClearDataInform();
			}
			else if(intState==1)
			{
				//加载成功
				$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">正在加载扫码设备。。。</span>');
			}
			else if(intState==9)
			{
				//加载成功
				$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">准备就绪。。。</span>');
			}
			else if(intState==2)
			{
				//扫码成功
				$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">扫码成功！</span>');
				
				//$("#SubDivX1").html('<span style="color: #000;font-size:12px;text-shadow:none;">信息码：' + strSelBarCode + '</span>');
				ClearDataInform();
				
				//获取该条码的项目 BRF:00000143582059
				// '1.得到有效数据  BRF:00000139MM1485
                //Dim strCFListNo As String = main_ParamList.StringToLong(Mid(strTemp, 5, 8)).ToString()
                //Dim lngCFBListNo As Long = main_ParamList.StringToLong(Mid(strTemp, 15))
				
				
				var strCFListNo=strSelBarCode.substr(4,8);	//早餐记录流水号
				var strCFBListNo=strSelBarCode.substr(14);	//住房流水号
				
				//var strmsg=strSelBarCode + '*' + strCFListNo + '*' + strCFBListNo;
				//alert(strmsg);
				
				var intClearSub=0;
				//1.先判断二维码的有效性
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: "judgebarcode.php?chid=<?php echo $chainno;?>&cflistno=" + strCFListNo + "&cfblistno=" + strCFBListNo,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:4, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						var strret = RetData;
						
						//alert(strret);
						
						//'BEG:'.$strRetID;	//1=OK,0=无效,2=已经使用过,3=不是当天的,4=房间不是在住状态
						var strBegin=strret.substr(0,4);
												
						if(strBegin=='BEG:')
						{
							var intErrID=strret.substr(4,1);

							if(intErrID=='1')
							{
								//2.重新打开该页面
								var urlshow='ebfmain.php?dotid=8&chid=<?php echo $chainno;?>&cflistno=' + strCFListNo + '&cfblistno=' + strCFBListNo;
								window.location.href=urlshow;
							}
							else if(intErrID=='2')
							{
								var strUsedTime=strret.substr(5);
								$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">该早餐记录 已经使用过! </br>使用时间：' + strUsedTime + '</span>');
							}
							else if(intErrID=='3')
							{
								$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">该早餐记录 不是当天的!</span>');
							}
							else if(intErrID=='4')
							{
								$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">该早餐记录 房间非在住状态!</span>');
							}
							else
							{
								$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">二维码无效!</span>');
							}
						}
						else
						{
							$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">获取扫码信息错误！</span>');
						}
					}
				});
								
				
			}
			else if(intState==3)
			{
				//扫码失败
				$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">扫码失败！</span>');
				ClearDataInform();
			}
			else if(intState==4)
			{
				//扫码失败
				$("#SubDiv1").html('<span style="color: #000;font-size:15px;text-shadow:none;">扫码用户取消！</span>');
				ClearDataInform();
			}
		};
		
	</script>
	
	<script type="text/javascript">
		//var intNowCount;
		//intNowCount=1;
		
		function gbClick(id,itmid)
		{
			var intSelCount;			
			var oTextbox1=document.getElementById("RowTXT");
			intSelCount=oTextbox1.value;
			//alert(oTextbox1.value);
			//return;
			if(id==1)
			{
				//增加商品数量 
				intSelCount++;
				if(intSelCount>99){
					intSelCount = 1;
				}
				$("#shuDiv").html('<span style="color: #000;font-size:24px;text-shadow:none;">' + intSelCount +'</span>');
				oTextbox1.value=intSelCount;
			}
			else if(id==2)
			{
				//减少商品数量
				intSelCount--;
				if(intSelCount<=0){
					intSelCount = 1;
				}
				$("#shuDiv").html('<span style="color: #000;font-size:24px;text-shadow:none;">' + intSelCount +'</span>');
				oTextbox1.value=intSelCount;
			}
			else if(id==3)
			{
				//保存入账
				if(strGetItemNo.length<1)
				{
					return;
				}
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: "saveitemtoroom.php?rmid=<?php echo $roomno;?>" + "&itmno=" + strGetItemNo + "&selnum=" + intSelCount,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:4, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
									
				if(strret==1)
				{
					var urlroom='roominform.php?rmid=<?php echo $roomno;?>';
					window.location.href=urlroom;
					//alert("商品入账成功!");
				}
				else
				{
					alert("商品入账失败!");
				}
			}
		}
		
	</script>
</body>
</html>
