⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookin.php

📁 酒店管理系统
💻 PHP
字号:
<? 
 require_once('include/connection.php'); 
 include('include/admin_or_user.php');
 require_once('include/sqlfuns.php');

 ?>
<?
$state=0; 
function sqladd($andor,$file_name,$sqlkey,$value)
     {  global $selectsql;
	    global $state;
	    if($state==1)
		 {$selectsql.=" ".$andor." ".$file_name." ".$sqlkey." ".$value;
		  $state=1;
		  }
		 else
		$selectsql.=" where ".$file_name." ".$sqlkey." ".$value;
		$state=1;
	  }	

$month=date("m");
if(isset($_POST['s1']))
   {
    $selectsql="select * from book  ";
	 if($_POST['name']!="")
	 sqladd("and","name","like",GetSQLValueString("%".$_POST['name']."%", "text"));
	 $tempsql="";
	 if($_POST['bookmonth']!="")
	 $tempsql=$_POST['bookmonth'];
	 if($_POST['bookday']!="")
	 if($_POST['bookday']<10)
	 $tempsql.="-0".$_POST['bookday'];
	 else
	  $tempsql.="-".$_POST['bookday'];
	 if($tempsql!="")
	 sqladd("and","booktime","like",GetSQLValueString("%".$tempsql."%", "text"));
    if($_POST['person']!="")
	 sqladd("and","person","like",GetSQLValueString("%".$_POST['person']."%", "text"));
	 if($_POST['day']!="")
	 sqladd("and","day","like",GetSQLValueString("%".$_POST['day']."%", "text"));
	 if($_POST['phone']!="")
	 sqladd("and","phone","like",GetSQLValueString("%".$_POST['phone']."%", "text"));
	
	$result=odbc_exec($conn,$selectsql);
	}
	
if(isset($_POST['sellectall']))
   {
     $selectsql = sprintf("select * from book order by id");
	$result=odbc_exec($conn,$selectsql);
	}	
			   

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>预定房</title>
<link href="css/hotel.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
body {
	margin-left: 36px;
	margin-right: 36px;
	margin-top: 0px;
}
.STYLE4 {font-size: 12px}
-->
</style>

</head>
<script>
function conform()
{
 if(!window.confirm("确认注销此预订房间?"))
return false;
else return true;
}
</script>

<body>
<? if(!isset($_POST['s1'])&&!isset($_GET['id'])&&!isset($_POST['sellectall']))
  {   ?>
<form id="form1" name="form1" method="post" action=""><table width="900" border="0">
   <div align="left">
  <span class="greenclore">预定房查询</span></div> 
    <tr>
      <td width="200"><span class="STYLE4">预订日期:
          <select name="bookmonth" id="bookmonth">
          
            <option value="">请选择</option>      
            <option value="<? echo $month-1;?>"><? echo ($month-1)."月";?></option>
            <option value="<? echo $month;?>"><? echo ($month*1)."月";?></option>
        </select>
          <label>
          <select name="bookday" id="select2">
            <option value="">请选择</option>
            <? $i=1;
		    while($i<=31)
			{ echo "<option value='".$i."'>".$i."日</option>";
			  $i++;
			}
			
			?>
          </select>
          </label>
      </span></td>
      <td width="139"><span class="STYLE4">客人称谓:
        <input name="name" type="text" id="name" size="10" maxlength="20" />
      </span></td>
	   <td width="120"><span class="STYLE4">电话:
        <input name="phone" type="text" id="phone" size="10" maxlength="20" />
      </span></td>
      <td width="110"><span class="STYLE4">预订天数:
          <input name="day" type="text" id="day" size="3" />
天 </span></td>
      <td width="89"><span class="STYLE4">人数:
          <input name="person" type="text" id="person" size="3" />
      </span></td>
      <td width="180"><div align="right" class="STYLE4">
        <input name="s22" type="reset" id="s22" value="重置" />
	&nbsp;	
	<input name="s1" type="submit" id="s1" value="查询" />
       &nbsp;  
       <input name="sellectall" type="submit" id="sellectall" onclick="" value="查询所有"/>
</div></td>
    </tr>
  </table>
<p>&nbsp; </p>
</form>
<p>
  <? } ?>
</p>
<p>
  <? if(isset($_POST['s1'])||isset($_POST['sellectall']))
   { ?>
</p>

<table width="100%" border="1">
  <tr>
    <td><div align="center">订单号</div></td>
    <td><div align="center">客人称谓</div></td>
	<td><div align="center">联系方式</div></td>
    <td><div align="center">房间号</div></td>
    <td><div align="center">预订日期</div></td>
    <td><div align="center">入住时间</div></td>
    <td><div align="center">预订天数</div></td>
    <td><div align="center">人数</div></td>
	<td><div align="center">操作</div></td>
	<td><div align="center">操作</div></td>
	<td><div align="center">操作</div></td>
  </tr>
  <? $i=0;
   while(odbc_fetch_row($result))
    { $i++; ?>
  <tr>
    <td><div align="center"><? echo odbc_result($result,'id');?></div></td>
    <td><div align="center"><? echo odbc_result($result,'name');?></div></td>
	<td><div align="center">&nbsp;<? echo odbc_result($result,'phone');?></div></td>
    <td>&nbsp;<? echo str_replace("@", "  ",odbc_result($result,'room_number'));?></td>
    <td>&nbsp;&nbsp;<? echo odbc_result($result,'booktime');?></td>
    <td><div align="center"><span class="STYLE1"><? echo odbc_result($result,'longintime');?></span></div></td>
    <td><div align="center"><? echo odbc_result($result,'bookdays');?></div></td>
    <td><div align="center"><? echo odbc_result($result,'person');?></div></td>
	<td><div align="center"><a href="?id=<? echo odbc_result($result,'id');?>&name=<? echo base64_encode(odbc_result($result,'name'));?>&room=<? echo base64_encode(str_replace("@", "  ",odbc_result($result,'room_number')));?>&person=<? echo odbc_result($result,'person');?>&days=<? echo odbc_result($result,'bookdays');?>">登记</a></div></td>
	<td><div align="center"><a href="?id=<? echo odbc_result($result,'id');?>&name=<? echo base64_encode(odbc_result($result,'name'));?>&room=<? echo base64_encode(str_replace("@", "  ",odbc_result($result,'room_number')));?>&person=<? echo odbc_result($result,'person');?>&days=<? echo odbc_result($result,'bookdays');?>&action=modefiy&phone=<? echo odbc_result($result,'phone');?> &in_time=<? echo odbc_result($result,'longintime');?>">修改</a></div></td>
		<td><div align="center"><a href="removebookroom.php?bookid=<? echo odbc_result($result,'id');?> &room=<? echo base64_encode(str_replace("@", "  ",odbc_result($result,'room_number')));?> " onclick="return conform()">注销</a></div></td>
  </tr>
 <? } if($i==0)
   echo "
   <tr>
     <td colspan='11'>
   <p align='center' class='STYLE1'>暂无记录</p>
   </td>
   </tr>";
   ?>
</table>


<p align="center"><a href="#" onclick="window.history.back()">返回</a></p>
<? }?>


<? if(isset($_GET['id'])&&!isset($_GET['action'])) 
  {  
  $roomstr=base64_decode($_GET['room']);
  $roomarray=explode("  ", $roomstr);
  $sql="select room_person,room_prise from room,roomlevel where room.room_level=roomlevel.room_level and ";
  $i=0;
  while(isset($roomarray[$i]))
   { if($roomarray[$i]!="  ")
       if($i==0)
	   $sql.="(room.room_number='".$roomarray[$i]."'";
	   else 
        $sql.=" or room.room_number='".$roomarray[$i]."'";
	 $i++;
    }
	$sql.=")";
  $rs=odbc_exec($conn,$sql);
  $totalprise=0;
  while(odbc_fetch_row($rs))
  {
  $totalprise+=odbc_result($rs,'room_prise')*odbc_result($rs,'room_person');

  }
  echo "<script>
        totalprise=".$totalprise.";";
  echo "function tp(t1)
         {
		
		  var total=0;
		       total=totalprise*t1.value;
			   document.all.paiedmoney.value=total;
		  }";
echo "</script>";		  		
  $totalprise*=$_GET['days'];
 
  
  ?>
<script>
function f1()
{ var bookid,bookroom; 
   bookid=<? echo $_GET['id'];?>;  
   bookroom='<? echo $_GET['room'];?>';
   if(window.confirm("确认注销此预订房间?"))
     window.open('removebookroom.php?bookid='+bookid+'&room='+bookroom,'usermainframe');
}
</script>

  
 <form action="custombookin.php" method="post" name="form2" id="form2" dir="ltr">
  <table width="30%" border="1" align="center" cellpadding="0" cellspacing="1">
  <tr>
    <td>订单号:</td>
    <td><input name="id" type="text" id="id" value="<? echo $_GET['id'];?>" size="5" maxlength="10" readonly="true"/></td>
  </tr>
  <tr>
      <td width="31%">客人称谓:</td>
      <td width="69%"><label>
        <input name="name" type="text" id="name" size="13" maxlength="20" value="<? echo base64_decode($_GET['name']);?>" />
     &nbsp; * </label></td>
    </tr>
    
    <tr>
      <td>入住天数:
        <label></label></td>
      <td><label>
        <input name="indays" type="text" id="indays" size="3" maxlength="6" value="<? echo $_GET['days'];?>"  onchange="tp(this)"/>
      *</label></td>
    </tr>
    <tr>
      <td>人  数:</td>
      <td><label>
        <input name="person" type="text" id="person" size="3" value="<? echo $_GET['person'];?>"/> 
      *</label></td>
    </tr>
    <tr>
      <td>入住房间:</td>
      <td>&nbsp;<? echo base64_decode($_GET['room']);?></td>
    </tr>
    <tr>
      <td>须付定金:</td>
      <td><label>
        <span class="STYLE1">&yen;        </span>
        <input name="paiedmoney" type="text" id="paiedmoney" size="6" maxlength="10" value="<? echo $totalprise;?>"/>
      *</label></td>
    </tr>
  </table>
  <p>
  <div align="center">&nbsp;
  &nbsp;
  <input name="book_room" type="hidden" id="book_room" value="<? echo base64_decode($_GET['room']);?>" />
  <input name="in_time" type="hidden" id="in_time" value="<? echo date("Y-m-d H:i:s")?>" />  
    <input name="s4" type="submit" id="s4" value="登记" />
 &nbsp;
 <input name="remove" type="button" id="remove" value="注销房间"  onclick="f1()"/> 
 <label></label>
  </div>
  </p>
</form>

<p align="center"><a href="bookin.php" onclick="window.history.back()">返回</a></p>
<? }

if(isset($_GET['action'])&&$_GET['action']='modefiy') 
 {
?>


<script>
function fun3()
{ div9.innerHTML="<div align='center'><iframe id='room' src='mbook.php' frameborder='0' scrolling='auto' width='587' height='533'></iframe></div>";
}
</script>




<table width="100%" border="0">
  <tr>
    <td width="23%" valign="top"><form id="form3" name="form3" method="post" action="modefiy_bookroom.php">
  <table width="100%" border="1" align="center" cellpadding="0" cellspacing="1">
  <tr>
      <td width="28%">客人称谓:</td>
      <td width="72%"><label>
        <input name="name" type="text" id="name" size="13" maxlength="20" value="<? echo base64_decode($_GET['name']);?>" />
     &nbsp; * </label></td>
    </tr>
    
    <tr>
      <td>联系方式:</td>
      <td><label>
        <input name="phone" type="text" id="phone" size="13" maxlength="19" value="<? echo $_GET['phone'];?>" />
      </label></td>
    </tr>
    <tr>
      <td>入住时间:</td>
      <td><label>
<select name="selectmonth" id="selectmonth">
<? $m=date("m"); ?>
  <option value="<? echo $m*1;?>"><? echo ($m*1)."月";?></option>
  <option value="<? echo $m+1;?>"><? echo ($m+1)."月";?></option>
</select>      
<select name="selectday" id="selectday">
<? $d=1;
while($d<=31)
{ ?>
 <option value="<? echo $d; ?>" <? if($d==date("d")) echo ' selected="selected"';?>><? echo $d."日";?></option>
 <? $d++;
  }?>
</select>
*</label></td>
    </tr>
    <tr>
      <td>入住天数:
        <label></label></td>
      <td><label>
        <input name="indays" type="text" id="indays" size="3" maxlength="6" value="<? echo $_GET['days'];?>"  onchange="tp(this)"/>
      *</label></td>
    </tr>
    <tr>
      <td>人  数:</td>
      <td><label>
        <input name="person" type="text" id="person" size="3" value="<? echo $_GET['person'];?>"/> 
      *</label></td>
    </tr>
    <tr>
      <td>入住房间:</td>
      <td><label>
        <textarea name="room_number" cols="19" rows="2"><? echo base64_decode($_GET['room']);?></textarea>
      </label>        &nbsp;
      <label>
      <div align="right">
        <input type="button" name="Submit" value="修改房间" onclick="fun3()"/>
      </div>
      </label></td>
    </tr>
  </table> 

    <p>
      <input name="id" type="hidden" id="id" value="<? echo $_GET['id'];?>" />
    </p>
    <table width="100%" border="0" align="left" cellpadding="10">
    
      <tr>
        <td><label>
        <div align="right">
                <input type="submit" name="Submit3" value="提交" />
              </div>
            </label></td><td><label>
            <div align="left">
              <input type="reset" name="Submit4" value="重置" />
              </div>
            </label></td>
      </tr>
	    <tr>
        <td colspan="2"><p align="center"><a href="bookin.php" onclick="window.history.back()">返回</a></p></td>
        </tr>
    </table>
    <p align="center">&nbsp;</p>
  
    </form>
	
</td>
    <td width="41%" valign="top">
 <div id="div9" align="left" >
</div></td>
  </tr>
</table>

<? }
?>
<p \>
<p \>
<p \>
<p \>
<script src="copyright.inc">
</script>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -