charge.php
来自「SetCursor CWnd LoadCursor DestroyWindow 」· PHP 代码 · 共 248 行
PHP
248 行
<?
header("Pragma: no-cache");
require_once('include/connection.php');
include('include/admin_or_user.php');
require_once('include/sqlfuns.php');
require_once('include/monthdays.php');
?>
<?
if(isset($_POST['s1']))
{
$insertsql = sprintf("INSERT INTO charge (room_number,room_prise,dieing_prise ,other_prise,total_prise,days) VALUES(%s, %s, %s,%s, %s,%s)",
GetSQLValueString($_POST['room_number'], "text"),
GetSQLValueString($_POST['room_prise'], "double"),
GetSQLValueString($_POST['dieing_prise'], "double"),
GetSQLValueString($_POST['other_prise'], "double"),
GetSQLValueString($_POST['other_prise']+$_POST['room_prise']+$_POST['dieing_prise'], "double"),
GetSQLValueString($_POST['days'], "double"));
odbc_exec($conn,$insertsql);
$sql="delete from coustom where room_number=".GetSQLValueString($_POST['room_number'], "text");
odbc_exec($conn,$sql);
$sql="select id from book where room_number like '%".$_POST['room_number']."%'";
$rs1=odbc_exec($conn,$sql);
if(odbc_fetch_row($rs1,"1"))
$sql="update room set room_state=0 where room_number='".$_POST['room_number']."'";
else
$sql="update room set room_state=-1 where room_number='".$_POST['room_number']."'";
odbc_exec($conn,$sql);
echo "<script>alert('操作成功');location='roomined.php';</script>";
exit;
}
function coutday($m,$d,$h,$m1,$d1,$h1)
{ $total=0;
if($m==$m1)
{ $total=$d1-$d-1;
if($h<12)
$total+=1;
else
$total+=0.5;
if($h1<17)
$total+=0.5;
else
$total+=1;
return $total;
}
else
if($m<$m1)
{
for($i=$m;$i<=$m1;$i++)
{ if($i==$m)
$total+=(monthday($i)-$d);
else
if($i==$m1)
$total+=($d1-1);
else
$total+=monthday($i);
}
if($h<12)
$total+=1;
else
$total+=0.5;
if($h1<12)
$total+=0.5;
else
$total+=1;
return $total;
}
else
{
for($i=$m;$i<=12;$i++)
if($i==$m)
$total+=(monthday($i)-$d);
else
$total+=monthday($i);
for($i=1;$i<=$m1;$i++)
if($i==$m1)
$total+=($d1-1);
else
$total+=monthday($i);
if($h<12)
$total+=1;
else
$total+=0.5;
if($h1<12)
$total+=0.5;
else
$total+=1;
return $total;
}
}
?>
<? $charge_room=base64_decode($_GET['room_number']);
$m=date("m");
$d=date("d");
$h=date("H");
$sql="select * from coustom where room_number='".$charge_room."'";
$rs=odbc_exec($conn,$sql);
$in_time=odbc_result($rs,'in_time');
$m1=substr($in_time,5,2)*1;
$d1=substr($in_time,8,2)*1;
$h1=substr($in_time,11,2)*1;
$day=coutday($m1,$d1,$h1,$m,$d,$h);
$slprise="select room.room_person*roomlevel.room_prise as prise from room,roomlevel where room.room_level=roomlevel.room_level and room_number='".$charge_room."'";
$rs1=odbc_exec($conn,$slprise);
?>
<!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}
-->
</style>
</head>
<body>
<span class="greenclore">客人结帐</span>
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="1">
<tr>
<td width="15%">客人称谓:</td>
<td width="85%"> <? echo odbc_result($rs,'name');?></td>
</tr>
<tr>
<td>房 间 号:</td>
<td> <? echo odbc_result($rs,'room_number');?></td>
</tr>
<tr>
<td>入住时间:</td>
<td> <? echo odbc_result($rs,'in_time');?></td>
</tr>
<tr>
<td>入住天数:</td>
<td> <? echo $day;?>天</td>
</tr>
<tr>
<td>入住人数:</td>
<td> <? echo odbc_result($rs,'person');?>人</td>
</tr>
<tr>
<td>房间费用:</td>
<td><label>
<span class="STYLE1">¥</span>
<input name="room_prise" type="text" id="room_prise" value="<? echo $p1=(odbc_result($rs1,'prise')*$day);?>" onkeyup="charge()" />
</label></td>
</tr>
<tr>
<td>饮食消费:</td>
<td><label><span class="STYLE1">¥</span>
<input name="dieing_prise" type="text" id="dieing_prise" value="<? echo $p2=odbc_result($rs,'dieing_prise');?>" onkeyup="charge()"/>
<a href="die_other_prise.php?room_number=<? echo base64_encode(odbc_result($rs,'room_number'));?>" target="_blank">详细信息</a> </label></td>
</tr>
<tr>
<td>其他费用:</td>
<td><label><span class="STYLE1">¥</span>
<input name="other_prise" type="text" id="other_prise" value="<? echo $p3=odbc_result($rs,'other_prise');?>" onkeyup="charge()" />
<a href="other_prise.php?room_number=<? echo base64_encode(odbc_result($rs,'room_number'));?>" target="_blank">详细信息</a></label></td>
</tr>
<tr>
<td>已付定金:</td>
<td><span class="STYLE1">¥</span><? echo $p4=odbc_result($rs,'paiedmoney');?></td>
</tr>
<? $left=$p4-$p1-$p2-$p3;
if($left>=0) { ?>
<tr>
<td><span id="text1">找 零:</span></td>
<td><span class="STYLE1">¥</span><span id="div1"><? echo $left;?></span></td>
</tr>
<? } else {?>
<tr>
<td><span id="text1">客人还需付费用:</span></td>
<td><span class="STYLE1">¥</span><span id="div1"><? echo $left*(-1);?></span></td>
</tr>
<? }
echo "<script>
var paiedmoney=".$p4.";
var otherprise=".$p3.";
var dieingprise=".$p2.";
var roomprise=".$p1.";
var left=".$left.";
function charge()
{
var temp;
temp=paiedmoney-document.all.room_prise.value-document.all.dieing_prise.value-
document.all.other_prise.value;
if(temp<0)
{document.all.text1.innerHTML='客人还需付费用:';
temp=temp*(-1);
}
else
document.all.text1.innerHTML='找 零:';
document.all.div1.innerHTML=temp;
}
function charge1()
{
if(left>=0)
{
document.all.text1.innerHTML='找 零:';
document.all.div1.innerHTML=left;
}
else
{
document.all.text1.innerHTML='客人还需付费用:';
temp=left*(-1);
document.all.div1.innerHTML=temp;
}
}
</script>
";
?>
</table>
<p align="center">
<label>
<input name="days" type="hidden" id="days" value="<? echo $day;?>" />
<input name="room_number" type="hidden" id="room_number" value="<? echo odbc_result($rs,'room_number');?>"/>
<input name="s1" type="submit" id="s1" value="确定" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" onclick="charge1()"/>
</label>
</p>
<p align="center"><a href="roomined.php" onclick="window.history.back()">返回</a></p>
</form>
<p><a href="#" onclick="fun()"></a></p>
<script src="copyright.inc">
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?