<?php
	session_start();
	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期
	
	require_once("db/db.php");	
	require_once("common/common.php");
				
	$strRoomNo=trim($_REQUEST["rmid"]);
	$intDoTypeID=$_REQUEST["doid"];
	
	$strSelUserNo=trim($_SESSION['usernofw']);
	$strUserName=trim($_SESSION['usernamefw']);
	$strChainNo=trim($_SESSION["ChainNofw"]);
	
	$strRetID="0";
	
	if($intDoTypeID==1)
	{
		//房间清扫OK
		
		/*'状态:0空房,1预订房,2在住房,3钟点房,4自用房,5退客房,6维修房,7锁房
			操作类型:0系统自动,1清扫,2更改房态
		*/
		$sql=sprintf("EXECUTE TR_SetRoomStateOk '%s','%s','%s','%s',1",$strRoomNo,$strUserName,$strUserName,$strChainNo);
		$result = querySql($sql);
		//freeResult($result);
		
		$strRetID="1";	//成功
	}
	else if($intDoTypeID==4)
	{
		//房间查房结束
		//$sql=sprintf("EXECUTE TRS_SetRoomCancelOK '%s','%s','%s',0",$strChainNo,$strRoomNo,$strUserName);
		/*2025-11-07
		$sql=sprintf("Update TR_Room_Inform Set CheckOk=0 Where ListNo In(SELECT a.ListNo FROM TR_Room_Inform a,TR_Room_Type b 
						Where a.TypeListNo=b.ListNo And b.Chain_No='%s' And a.Room_No='%s')",$strChainNo,$strRoomNo);
		$result = querySql($sql);
		*/
		$sql = sprintf("EXECUTE TRS_WebAllocateRoomToUser '%s','%s','%s','%s',1",$strChainNo,$strRoomNo,$strSelUserNo,$strUserName);
		executeSql($sql);
		
		
		$strRetID="1";	//成功
	}
	closeDb();
	echo $strRetID;

?>


