📄 indexof_all.php
字号:
<?
require_once("../include/admin_or_user.php");
require_once('../include/connection1.php');
require_once('../include/sqlfuns.php');
require_once('../dept_3/delete.php');
require_once('../include/classes.php');
$deptno=2;
?>
<?
$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.=" and ".$file_name." ".$sqlkey." ".$value;
$state=1;
}
if(isset($_POST['ss1']))
{
$selectsql="select dept_2.*,coustom.name from dept_2,coustom where (dept_2.room_number=coustom.room_number) ";
if($_POST['name']!="")
sqladd("and","name","like",GetSQLValueString("%".$_POST['name']."%", "text"));
if($_POST['room_number']!="")
sqladd("and","dept_2.room_number","like",GetSQLValueString("%".str_replace("#", "_",$_POST['room_number'])."%","text"));
if(doubleval($_POST['dieing_prise'])!="")
{
sqladd("and","dept_2.dieing_prise","=",GetSQLValueString($_POST['dieing_prise'], "duble"));
sqladd("or","dept_2.other_prise","=",GetSQLValueString($_POST['dieing_prise'], "duble"));
}
$tempsql="";
if($_POST['year']!="")
$tempsql=$_POST['year'];
if($_POST['month']!="")
$tempsql.="-".$_POST['month'];
if($_POST['day']!="")
$tempsql.="-".$_POST['day'];
if($tempsql!="")
sqladd("and","time","like",GetSQLValueString("%".$tempsql."%", "text"));
$selectsql.=" order by dept_2.id desc";
$rs=odbc_exec($conn,$selectsql);
}
if(isset($_POST['delete']))
{
$p=new author("","admin",$deptno);
$p->check();
delete("dept_2",$_POST['select']);
}
if(isset($_POST['modefiy']))
{
$rs1=modefiy("dept_2",$_POST['select']);
}
if(isset($_POST['modefiy2']))
{
for($j=1;$j<=$_POST['total'];$j++)
{
$sql = sprintf("update dept_2 set room_number=%s,dieing_prise=%s,other_prise=%s,descript=%s where id=%s",
GetSQLValueString($_POST['room_number'.$j], "text"),
GetSQLValueString($_POST['dieing_prise'.$j], "double"),
GetSQLValueString($_POST['other_prise'.$j], "double"),
GetSQLValueString($_POST['descript'.$j], "text"),
GetSQLValueString($_POST['id'.$j], "int"));
//echo $sql;
odbc_exec($conn,$sql);
}
}
if(isset($_POST['selectall']))
{
$selectsql = sprintf("select dept_2.*,coustom.name from dept_2,coustom where (dept_2.room_number=coustom.room_number) order by dept_2.id desc ");
$rs=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" />
</head>
<script>
function funk(a)
{
if(a.checked)
document.form2.selectid.value=parseInt(document.form2.selectid.value)+1;
else
document.form2.selectid.value=parseInt(document.form2.selectid.value)-1;
}
function sub()
{ if(document.form2.selectid.value==0)
{
alert("请选择");
return false;
}
else
return true;
}
</script>
<body>
<table width="100%" border="1">
<tr>
<td><? include("dieingdept_top.php"); ?></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0">
<tr>
<td width="29%">
<div align="center">
<span class="STYLE3">日期:
</span>
<label>
<select name="year" id="year">
<option value="">请选择</option>
<?
$year=date(Y);
echo "<option value='$year'>$year</option>";
$year-=1;
echo "<option value='$year'>$year</option>";
?>
</select>
</label>
<select name="month" id="month">
<option value="">请选择</option>
<?
$m=1;
while($m<=12)
{
echo "<option value='$m'>$m".'月'."</option>";
$m++;
}
?>
</select>
<label>
<select name="day" id="select2">
<option value="">请选择</option>
<? $i=1;
while($i<=31)
{ echo "<option value='".$i."'>".$i."日</option>";
$i++;
}
?>
</select>
</label>
</div>
</td>
<td width="17%"><div align="center"><span class="STYLE3">客人称谓:
<input name="name" type="text" id="name" size="10" maxlength="20" />
</span></div></td>
<td width="15%"><div align="center"><span class="STYLE3">房间号:
<input name="room_number" type="text" id="room_number" size="8" maxlength="20" />
</span></div></td>
<td width="10%"><div align="center"><span class="STYLE3">费用:<span class="redclore">¥</span>
<input name="dieing_prise" type="text" id="dieing_prise" size="3" />
</span></div></td>
<td width="29%"><div align="center"><span class="STYLE3">
<input name="s22" type="reset" id="s22" value="重置" />
<input name="ss1" type="submit" id="ss1" value="查询" />
<input name="selectall" type="submit" id="selectall" onclick="" value="查询所有"/>
</span></div></td>
</tr>
</table>
<p> </p>
</form>
<?
if(!isset($_POST['modefiy'])) {
if(isset($_POST['ss1'])||isset($_POST['selectall']))
{ ?>
<form id="form2" name="form2" method="post" action="" onsubmit="return sub()">
<table width="100%" border="1">
<tr>
<td width="5%"><div align="center">操作</div></td>
<td width="8%"><div align="center"><span class="STYLE3">客人称谓</span></div></td>
<td width="8%"><div align="center"><span class="STYLE3">房间号</span></div></td>
<td width="9%"><div align="center">饮食费用</div></td>
<td width="9%"><div align="center">其它费用</div></td>
<td width="17%"><div align="center">时间</div></td>
<td> 备注</td>
</tr>
<? if(odbc_fetch_row($rs)) {
$totalprise1=$totalprise2=0;
do{
$totalprise1+=odbc_result($rs,'dieing_prise');
$totalprise2+=odbc_result($rs,'other_prise');
?>
<tr>
<td>
<div align="center">
<label>
<input type="checkbox" name="select[]" value="<? echo odbc_result($rs,'id');?>" onclick="funk(this)"/>
</label>
</div> </td>
<td> <? echo odbc_result($rs,'name');?></td>
<td> <? echo odbc_result($rs,'room_number');?></td>
<td> <span class="redclore">¥</span><? echo odbc_result($rs,'dieing_prise');?></td>
<td> <span class="redclore">¥</span><? echo odbc_result($rs,'other_prise');?></td>
<td> <? echo odbc_result($rs,'time');?></td>
<td> <? echo odbc_result($rs,'descript');?></td>
</tr>
<? }while(odbc_fetch_row($rs));
echo '
<tr>
<td colspan="3" align="center">共:</td>
<td> <span class="redclore">¥</span>'.$totalprise1.'</td>
<td> <span class="redclore">¥</span>'.$totalprise2.'</td>
<td colspan="2"> </td>
</tr>
<tr>';
}else
echo "
<tr><td colspan='7'>
无记录
</td>
</tr>";
?>
<tr>
<td colspan="8"><label>
<p>
<input name="modefiy" type="submit" id="modefiy" value="修改" />
<? if($p->isadmin()) echo '
<input name="delete" type="submit" id="delete" value="删除" />';?>
</label>
<input name="selectid" type="hidden" value="0" /></p></td>
</tr>
</table>
</form>
<? }
}
else
{
?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" name="modey">
<table width="100%" border="1" align="center">
<tr>
<td width="9%">房间号</td>
<td width="9%">饮食费用</td>
<td width="9%">其它费用</td>
<td width="64%">备注</td>
</tr>
<?
$total=0;
while(odbc_fetch_row($rs1)) {
$total++;
?>
<tr>
<td><label>
<input name="room_number<? echo $total;?>" type="text" id="name<? echo $total;?>" size="10" maxlength="30" value="<? echo odbc_result($rs1,'room_number');?>" />
</label></td>
<td><label>
<span class="redclore">¥</span>
<input name="dieing_prise<? echo $total;?>" type="text" id="mount<? echo $total;?>" size="6" maxlength="10" value="<? echo odbc_result($rs1,'dieing_prise');?>"/>
</label></td>
<td><label>
<span class="redclore">¥</span>
<input name="other_prise<? echo $total;?>" type="text" id="other_prise<? echo $total;?>" size="6" maxlength="10" value="<? echo odbc_result($rs1,'other_prise');?>"/>
</label></td>
<td><label>
<input name="descript<? echo $total;?>" type="text" id="descript<? echo $total;?>" value="<? echo odbc_result($rs1,'descript');?>" size="63"/>
</label></td>
<input name="id<? echo $total;?>" type="hidden" value="<? echo odbc_result($rs1,'id');?>" />
</tr>
<? }?>
<tr>
<td colspan="5"><label>
<br />
<input name="modefiy2" type="submit" id="modefiy2" value="修改" />
<input type="reset" name="Submit2" value="重置" />
<input name="total" type="hidden" id="total" value="<? echo $total;?>" />
<br />
<div align="center"><a href="indexof_all.php">返回</a></div>
</label></td>
</tr>
</table>
</form>
<? }?>
</td>
</tr>
</table>
<p \>
<script src="../copyright.inc">
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -