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

📄 custombookin.php

📁 SetCursor CWnd LoadCursor DestroyWindow CDialog GetClientRect C Button GetStockObject CFont GetWindo
💻 PHP
字号:
<? 
 require_once('include/connection.php'); 
 include('include/admin_or_user.php');
 require_once('include/sqlfuns.php');

if(isset($_POST['s4']))
{ $room_number=$_POST['book_room'];
  $roomarray=explode("  ",$room_number);
 
  $total=$_POST['paiedmoney'];
  $totalperson=$_POST['person'];
  $i=0;
   while(isset($roomarray[$i])&&$roomarray[$i]!='')
    {
       $selectsql=sprintf("select distinct  room.room_person,roomlevel.room_prise from room,roomlevel where room.room_level=roomlevel.room_level and room_number=%s",
		     GetSQLValueString($roomarray[$i], "text"));
			 
		     $selectprise=odbc_exec($conn,$selectsql);
			 $rp=odbc_result($selectprise,'room_person')*odbc_result($selectprise,'room_prise')*$_POST['indays'];
			 $inperson=odbc_result($selectprise,'room_person');
			 $totalperson=$totalperson-$inperson;
			 if($totalperson<0)
			 $inperson=($inperson+$totalperson)*1;
			 if($inperson<0)
			 $inperson=0;
			 $total=$total-$rp;
			  if($total<0)
			  $rp=$rp+$total;
	 		  $insertsql = sprintf("INSERT INTO coustom(room_number,name,paiedmoney,in_time,days,person) VALUES(%s,%s,%s,%s,%s,%s)",
                       GetSQLValueString($roomarray[$i], "text"),
                       GetSQLValueString($_POST['name'], "text"),
					   GetSQLValueString($rp, "int"),
					   GetSQLValueString($_POST['in_time'], "text"),
					   GetSQLValueString($_POST['indays'], "int"),
					   GetSQLValueString($inperson, "int"));
					 
			odbc_exec($conn,$insertsql);
			$insertsql = sprintf("INSERT INTO coustombak(room_number,name,paiedmoney,in_time,days,person) VALUES(%s,%s,%s,%s,%s,%s)",
                       GetSQLValueString($roomarray[$i], "text"),
                       GetSQLValueString($_POST['name'], "text"),
					   GetSQLValueString($rp, "int"),
					   GetSQLValueString($_POST['in_time'], "text"),
					   GetSQLValueString($_POST['indays'], "int"),
					   GetSQLValueString($inperson, "int"));
					 
			odbc_exec($conn,$insertsql);
			$updateroomsql = sprintf("update room set room_state=1 where room_number=%s",  
                      GetSQLValueString($roomarray[$i], "text"));
			odbc_exec($conn,$updateroomsql);
			$i++;
			}
			
			if($total>0)
			{ $j=0;
			   $state=1;
			   while($state)
              { if(isset($roomarray[$j]))  
			     { $updatesql = sprintf("update coustom set paiedmoney=paiedmoney+%s where room_number=%s",  
                       GetSQLValueString($total, "int"),
					   GetSQLValueString($roomarray[$j], "text"));
					   odbc_exec($conn,$updatesql);
					  $state=0;
					  
					  }
					  $j++;
				 }
				}

$delsql="delete from book where id=".$_POST['id'];
odbc_exec($conn,$delsql);
odbc_close($conn);


}

echo '
<style type="text/css">
<!--
.p1 {
	color: #FF0000;
	font-size: 24px;
}
-->
</style>';
echo "<p align='center' class='p1'>操作成功</p>";
exit;				
 ?>


⌨️ 快捷键说明

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