<?php
	session_start();
	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"); 
?>
<!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>
		//禁止页面上下滑动,整个页面都不能滑动了
		document.addEventListener('touchmove', function(e) {
			e.preventDefault();
		});
</script>
	
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">

<section data-role="page" id="roomorder">			
	<article data-role="none">
		<?php				
				require_once("db/db.php");	
				require_once("common/common.php");
	
				$chainno=$_SESSION["ChainNofw"];
				$roomno=$_REQUEST["rmid"];
				$strroomstate="空净房";
				
				$intClearFlag=0;	//清扫完成
				$intBarCode=0;		//扫描入账
				$intScoreFlag=0;	//商品入账
				$intSetOkRoom=0;	//查房结束
				$intCheckOkFlag=0;	//查房检测
				$intCanClearRoom=0;
				
				$intCanCheckRoom=0;		//启用查房检测功能
				
				$sql=sprintf("Select Item_Value From TR_Config WHERE Chain_No='%s' And Item_Name='手机房务管理启用清扫检查房'",$chainno);
				$result = querySql($sql);		
				if($row = fetch_array($result))
				{
					$intCanCheckRoom=$row['Item_Value'];	
				}
				//释放数据库
				freeResult($result);
				
				
				//是否允许设置维修房
				$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
				$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
				$intQuanXianWeiXiuOk=0;
				
				$strSelNowUserNo=trim($_SESSION["main_wx_userno"]);
				
				$sql=sprintf("SELECT Use_Flag FROM Sys_Group_Quanxian a,User_QuanXian b WHERE a.Group_No=b.Group_No And b.Use_No='%s' And Modul_Name='men_bar407'",$strSelNowUserNo);
				$result = querySql($sql);		
				if($row = fetch_array($result))
				{
					if($row['Use_Flag']>0)
					{
						$intSetRoomWeiXiuFlag=1;	//有设置维修房的权限
					}
				}
				//释放数据库
				freeResult($result);
				
				
				$sql=sprintf("SELECT Use_Flag FROM Sys_Group_Quanxian a,User_QuanXian b WHERE a.Group_No=b.Group_No And b.Use_No='%s' And Modul_Name='men_bar408'",$strSelNowUserNo);
				$result = querySql($sql);		
				if($row = fetch_array($result))
				{
					if($row['Use_Flag']>0)
					{
						$intQuanXianWeiXiuOk=1;	//有设置维修房管理的权限
					}
				}
				//释放数据库
				freeResult($result);
				
				
				
				
						
				
				
				
				
				
				
				//1.开始去房间状态数量
				$datWeiXiuEndDay='2030-01-01';
				$sql=sprintf("SELECT a.Room_State,a.Dirty_Flag,a.Fault_Flag,a.CheckOk,convert(varchar(10),GetDate(),120)AS HotelNowDay 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,$roomno);
				$result = querySql($sql);		
				if($row = fetch_array($result))
				{
					$inttemp1=$row['Room_State'];		
					$intDirty=$row['Dirty_Flag'];
					$intFault=$row['Fault_Flag'];
					$intCheckOkFlag=$row['CheckOk'];
					$datWeiXiuEndDay=$row['HotelNowDay'];
					
					//生成状态颜色
					switch($inttemp1)
					{
						case 0:
							$strroomstate="空净房";
							
							//$intSetRoomWeiXiuFlag=1;	//是否有设置维修房的权限
							$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							break;
						case 5:
							$strroomstate="退客房";
							$intClearFlag=1;	//清扫完成
							
							//$intSetRoomWeiXiuFlag=1;	//是否有设置维修房的权限
							$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							break;
						case 6:
							$strroomstate="维修房";
							
							//$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
							if($intQuanXianWeiXiuOk>0)
							{
								$intSetRoomWeiXiuOk=1;		//是否允许设置维修OK
							}
							
							break;
						case 1:
							$strroomstate="预订房";
							
							$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
							$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							break;
						case 2:
							if($intDirty==1)
							{
								$strroomstate="住脏房";
								$intClearFlag=1;	//清扫完成
							}
							else
							{
								$strroomstate="住客房";
							}
							$intBarCode=1;		//扫描入账
							$intScoreFlag=1;	//商品入账
							$intSetOkRoom=1;	//查房结束
							
							$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
							$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							break;
						case 3:
							$strroomstate="钟点房";
							$intBarCode=1;		//扫描入账
							$intScoreFlag=1;	//商品入账
							$intSetOkRoom=1;	//查房结束
							
							$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
							$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							break;
						default:
							if($inttemp1==5)
							{
								$strroomstate="免费房";
								$intBarCode=1;		//扫描入账
								$intScoreFlag=1;	//商品入账
								$intSetOkRoom=1;	//查房结束
								$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
								$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							}
							if($inttemp1==7)
							{
								$strroomstate="锁房";
								
								$intSetRoomWeiXiuFlag=0;	//是否有设置维修房的权限
								$intSetRoomWeiXiuOk=0;		//是否允许设置维修OK
							}
							else
								$strroomstate="其他";
							break;
					}
					
					if($intDirty==1)
					{
						$intClearFlag=1;	//清扫完成
					}
				}
				//释放数据库
				freeResult($result);
								
				$RoomOldState=$strroomstate;	//房间当前状态

				//2.获取住房信息
				$strBListNo="0";
				$strOrderNo="";
				$sql=sprintf("SELECT a.ListNo,a.Order_No FROM TR_Order_Room_List a,TR_Order_Inform b WHERE a.Order_No=b.Order_No And b.Chain_No='%s' And b.Order_State<2 And a.Room_BillState=2 And a.Room_No='%s'",$chainno,$roomno);
				$result = querySql($sql);		
				if($row = fetch_array($result))
				{
					$strBListNo=$row['ListNo'];		
					$strOrderNo=$row['Order_No'];
				}
				//释放数据库
				freeResult($result);
				
				//3.如果是维修房
				$lngWXListNo=0;
				$strOldWeiXiuText="";
				$sql=sprintf("SELECT ListNo,Remarks,convert(varchar(10),EndTime,120)AS HotelNowDay FROM TR_Room_Fault_List WHERE Chain_No='%s' And Room_No='%s' And BillState=0",$chainno,$roomno);
				$result = querySql($sql);
				if($row = fetch_array($result))
				{
					$lngWXListNo=$row['ListNo'];
					$strOldWeiXiuText=$row['Remarks'];
					$datWeiXiuEndDay=$row['HotelNowDay'];
				}
				freeResult($result);
		
		
				
				closeDb();	//关闭数据库
				
				if($_SESSION["main_canclearroomflag"]=="1")
				{
					$intCanClearRoom=1;
				}
		?>
		<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
			<tr bgcolor="#E7E7E7">
				<td height="6" width="15"></td>
				<td height="6" align="left"></td>
				<td height="6" width="15"></td>
			</tr>
				
			<tr bgcolor="#E7E7E7">
				<td height="35" width="15"></td>
				<td height="35" align="left">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td height="30" width="55%">
								<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;text-shadow:none;">房号：<?php echo $roomno;?></span>
							</td>
							<td height="30" width="45%" align="right">
								<span style="color: #000000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif;font-size:18px;text-shadow:none;">状态：<?php echo $strroomstate;?></span>
							</td>
						</tr>
					</table>
				</td>
				<td height="35" width="15"></td>
			</tr>
			
			<tr  bgcolor="#E7E7E7"><td height="2" colspan="3"></td></tr>
			
			<tr><td height="1" colspan="3" align="left" bgcolor="#F2E2E2"></td></tr>
			
			<tr>
				<td height="260" width="15"></td>
				<td height="260" align="center" valign="top">
					<div style="position:relative;width:250px;height:250px;margin:0 auto;margin-top:10px;">
						<img src="images/cfbg.png" style="width:100%;height:100%"/>
						<!--清扫完成-->
						<div style="position:absolute;width:70px;height:80px;top:20px;left:30px;">
							<?php if($intClearFlag>0 && $intCanClearRoom>0) {?>
								<img id="SetStateEnable" onclick="SubClick(1)" src="images/qingsao1.png" style="width:100%;height:100%"/>
							<?php } else {?>
								<img id="SetStateEnable" src="images/qingsao0.png" style="width:100%;height:100%"/>
							<?php }?>
						</div>
						<!--扫描入账-->
						<div style="position:absolute;width:65px;height:80px;top:20px;left:150px;">
							<?php if($intBarCode>0) {?>
								<img id="ScaleEnable" onclick="SubClick(2)" src="images/saomiao1.png" style="width:100%;height:100%"/>
							<?php } else {?>
								<img id="ScaleEnable" src="images/saomiao0.png" style="width:100%;height:100%"/>
							<?php }?>
						</div>
						<!--商品入账-->
						<div style="position:absolute;width:70px;height:80px;top:150px;left:30px;">
							<?php if($intScoreFlag>0) {?>
								<img id="ItemListEnable" onclick="SubClick(3)" src="images/shangpin1.png" style="width:100%;height:100%"/>
							<?php } else {?>
								<img id="ItemListEnable" src="images/shangpin0.png" style="width:100%;height:100%"/>
							<?php }?>
						</div>
						<!--查房结束-->
						<div style="position:absolute;width:70px;height:80px;top:150px;left:150px;">
							<?php if($intCheckOkFlag>0) {?>
								<img id="CheckRoomEnable" onclick="SubClick(4)" src="images/cfwc1.png" style="width:100%;height:100%"/>
							<?php } else {?>
								<img id="CheckRoomEnable" src="images/cfwc0.png" style="width:100%;height:100%"/>
							<?php }?>
						</div>
					</div>
				</td>
				<td height="260" width="15"></td>
			</tr>

			<!--
			<tr bgcolor="#fff"><td height="10" colspan="3"></td></tr>
			<tr bgcolor="#E7E7E7"><td height="1" colspan="3"></td></tr>
			<tr bgcolor="#fff"><td height="10" colspan="3"></td></tr>
			-->
			
			<?php if($intCanCheckRoom>0) { ?>
			<tr>
				<td height="25" width="15"></td>
				<td height="25" align="center">
						<div onClick="CheckRoomFinish('<?php echo $roomno;?>')" style="border-radius:5px;width:80%; height:38px; background-color:#3C2778;">
                           	<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>
				<td height="25" width="15"></td>
			</tr>
			<tr><td height="30" colspan="3"></td></tr>
			<?php } else { ?>
			<tr><td height="10" colspan="3"></td></tr>
			<?php } ?>
			
			
			<tr bgcolor="#fff"><td height="10" colspan="3"></td></tr>
			
			
			
			<tr>
				<td height="25" width="15"></td>
				<td height="25" align="center">
					<table width="250" height="100%" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="10" height="100%" align="center"></td>
							<td width="115" height="100%" align="center">
								<?php if($intSetRoomWeiXiuFlag>0) { ?>
								
									<div id="butWeiXiuSet1" style="width:100px; height:70px; background-color:#fff;">
										<a data-transition="none" href="#ShowGroupListSel" data-rel="popup" data-position-to="window" style="width:100%;height:100%;margin:0px auto 0px auto;color:#66666;text-shadow:none;text-decoration:none;">
									
											<div style="width:100%;height:60px;">
												<img id="wximage1" src="images/wxflog.png" style="width:80px;height:56px;opacity: 1;"/>
											</div>
											<div style="width:100%;height:30px;">
												<span style="color:#fb7b14 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">设置维修房</span> 
											</div>
										</a>
									</div>
									
									
								
								<!--启动选择班级的窗体-->
								<div data-role="popup" id="ShowGroupListSel" data-corners="false">
									<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a>
									<table width="310" height="400" border="0" cellpadding="0" cellspacing="0" bgcolor="#fff">
										<tr><td height ="5" colspan="3" align="center"></td></tr>
										<tr><td height ="35" colspan="3" align="center"><span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;user-select:none;">设置维修房</span></td></tr>
										<tr><td height ="1" colspan="3" align="center" bgcolor="#F2E2E2"></td></tr>
										<tr><td height ="10" colspan="3" align="center"></td></tr>
										<!--55-->
										
										<tr>
											<td height ="20" width="15"></td>
											<td height ="20" valign="bottom">
												<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">维修结束日期：</span>
											</td>
											<td height ="20" width="20"></td>
										</tr>
										
										<tr>
											<td height ="35" width="15"></td>
											<td height ="35" valign="top">
												<input type="date" id="dtp1" name="dtp1"  value="<?php echo $datWeiXiuEndDay;?>"  data-mini="true" />
											</td>
											<td height ="35" width="20"></td>
										</tr>
										
										<tr>
											<td height ="20" width="15"></td>
											<td height ="20" valign="bottom">
												<span style="color: #000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">维修原因：</span>
											</td>
											<td height ="20" width="20"></td>
										</tr>
										
										<tr>
											<td height ="50" width="15"></td>
											<td height ="50" valign="top">
												<input name="txtItem1" id="txtItem1" type="text" data-mini="true" value="<?php echo $strOldWeiXiuText;?>">
											</td>
											<td height ="50" width="20"></td>
										</tr>
										
										<tr><td height ="15" colspan="3" align="center"></td></tr>
										
										<tr>
											<td height ="65" width="15"></td>
											<td height ="65" valign="top">
												<table height="20" width="100%" border="0" cellpadding="4" cellspacing="4" >
													<tr>
														<td height="30" width="10%" align="center" valign="middle"></td>
														<td onClick="bmtSaveWeiXiuClick('<?php echo $roomno;?>');"  height="30" width="60%" align="center" valign="middle" style="border:1px solid #F3EDED; border-radius:5px;background-color:#1fb402;">
															<span style="color: #fff;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:16px;text-shadow:none;">提交</span>
														</td>
														<td height="30" width="10%" align="center" valign="middle"></td>
													</tr>
												</table>
											</td>
											<td height ="65" width="20"></td>
										</tr>
																				
										<tr><td height ="125" colspan="3" align="center"></td></tr>
									</table>
								</div>
								<!--结束   启动选择班级的窗体 结束-->
							</td>
									
									
									
									
									
									
									
									
								<?php } else {?>
									<div style="width:100px; height:70px; background-color:#fff;">
										<div style="width:100%;height:60px;">
											<img id="wximage1" src="images/wxflog.png" style="width:80px;height:56px;opacity: 0.2;"/>
										</div>
										<div style="width:100%;height:30px;">
											<span style="color:#c6bbbb ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">设置维修房</span> 
										</div>
									</div>
								<?php } ?>
                            </td>

							<td width="125" height="100%" align="center">
								<?php if($intSetRoomWeiXiuOk>0) { ?>
									<div id="butWeiXiuSet2" onClick="SetRoomWeiXiuOK('<?php echo $roomno;?>');" style="width:90px; height:70px; background-color:#fff;">
										<div style="width:100%;height:60px;">
											<img id="wximage1" src="images/wxflogok.png" style="width:80px;height:56px;opacity: 1;"/>
										</div>
										<div style="width:100%;height:30px;">
											<span style="color:#fb7b14 ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">维修完成</span> 
										</div>
									</div>
								<?php } else {?>
									<div style="width:90px; height:70px; background-color:#fff;">
										<div style="width:100%;height:60px;">
											<img id="wximage1" src="images/wxflogok.png" style="width:80px;height:56px;opacity: 0.2;"/>
										</div>
										<div style="width:100%;height:30px;">
											<span style="color:#c6bbbb ;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:15px;text-shadow:none;">维修完成</span> 
										</div>
									</div>
								<?php } ?>
								
                            </td>
						</tr>
					</table>
						
				</td>
				<td height="25" width="15"></td>
			</tr>
			
			
			<tr bgcolor="#fff"><td height="20" colspan="3"></td></tr>
			<tr bgcolor="#E7E7E7"><td height="1" colspan="3"></td></tr>
			<tr bgcolor="#fff"><td height="20" colspan="3"></td></tr>
			
			
			
			<tr>
				<td height="25" width="15"></td>
				<td height="25" align="center">
						<div onClick="window.location = 'index.php';" style="border-radius:5px;width:80%; height:38px; background-color:#D7AA28;">
                           	<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>
				<td height="25" width="15"></td>
			</tr>
			<tr bgcolor="#fff"><td height="10" colspan="3"></td></tr>
		</table>
		
	</article>
	
	<script type="text/javascript">
		
		var intSetStateEnable;
		var intScaleEnable;
		var intItemListEnable;
		var intCheckRoomEnable;
		
		intSetStateEnable=0;
		intScaleEnable=0;
		intItemListEnable=0;
		intCheckRoomEnable=0;
		
		function SubClick(subid)
		{		
				
			var strret;
			var strRoomNo;
			var strOldState;
			
			strRoomNo="<?php echo $roomno;?>";
			//strOldState"<?php echo $RoomOldState;?>";
			
			if(subid==1)	//清扫完成
			{	
				if(intSetStateEnable==1)
				{
					return;	//已经成功执行过清扫，不允许再提交
				}
				
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: "clearroom.php?doid=1&rmid=" + strRoomNo,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:1, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
										
				//alert(strret);
				if(strret==1)
				{
					intSetStateEnable=1;
					var img = document.getElementById('SetStateEnable');
					img.src="images/qingsao0.png";
					alert("打扫房间成功!");
					window.location="index.php";
				}
				else
				{
					alert("打扫房间失败!");
				}
										
			}
			else if(subid==2)
			{
				var urlroom='barcodescore.php?rmid=' + strRoomNo;
				window.location.href=urlroom;
			}
			else if(subid==3)
			{
				var urlroom='itemlist.php?rmid=' + strRoomNo;
				window.location.href=urlroom;
			}
			else if(subid==4)	//清扫完成
			{
				if(intCheckRoomEnable==1)
				{
					return;	//已经成功执行过查房完成，不允许再提交
				}
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: "clearroom.php?doid=4&rmid=" + strRoomNo,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:4, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
									
				//alert(strret);
				if(strret==1)
				{
					intCheckRoomEnable=1;
					var img = document.getElementById('CheckRoomEnable');
					img.src="images/cfwc0.png";
					alert("提交查房完成成功!");
					window.location="index.php";
				}
				else
				{
					alert("提交查房完成失败!");
				}
			}
			
		};
	
		//查房完成 
		function CheckRoomFinish(strRoomNo)
		{
			//开始保存项目到购物车中
				var strret;
				//用ajax的“同步方式”调用一般处理程序
				$.ajax({
					url: "saveroomoklist.php?selromid=" + strRoomNo ,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:1, rmid: "strRoomNo" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});

				//alert(strret);
				if(strret==1)
				{
					//关闭弹出窗口
					//var $myd = $("#ShowRoomInput" + myboxid);
					//$myd.popup('close');
					window.location="index.php";
				}
		
		};
		
		//设置维修房完成失败
		function bmtSaveWeiXiuClick(strRoomNo)
		{
			var strday1 = $("#dtp1").val();
			if(strday1=="")
			{	
				$("#dtp1").focus();
				return;
			}
			
			var strNewText = $("#txtItem1").val();
			
			if(strNewText.length<1)
			{
				alert("请输入维修原因！");
				$("#txtItem1").focus();
				return;
			}
			
			//1.提交消息
			var strurl="roomweixiuset.php?doid=1&rmid=" + strRoomNo + "&wxendday=" + strday1 + "&wxtext=" + strNewText;
			
			var strret="";
			
			$.ajax({
					url: strurl,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:1, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
										
				//alert(strret);
				if(strret==1)
				{
					intSetStateEnable=1;
					//var img = document.getElementById('butWeiXiuSet1');
					//img.src="images/qingsao0.png";
					//id="butWeiXiuSet1"
					//alert("设置维修房成功!");
					window.location="index.php";
				}
				else
				{
					alert("设置维修房失败!");
				}
		};
		
		//维修OK
		function SetRoomWeiXiuOK(strRoomNo)
		{
			//alert(strRoomNo);
			
			//用ajax的“同步方式”调用一般处理程序
			$.ajax({
					url: "roomweixiuset.php?doid=2&rmid=" + strRoomNo,
					async: false,//改为同步方式
					type: "POST",
					//data: {doid:1, rmid: "<?php echo $roomno;?>" },
					success: function (RetData) 
					{
						strret = RetData;
					}
				});
										
				//alert(strret);
				if(strret==1)
				{
					intSetStateEnable=1;
					//var img = document.getElementById('SetStateEnable');
					//img.src="images/qingsao0.png";
					//alert("设置维修房完成成功!");
					window.location="index.php";
				}
				else
				{
					alert("设置维修房完成失败!");
				}
				
		}
		
		</script>
	
</section>

</body>
</html>
