📄 indexof_all.php
字号:
<?
require_once("../include/admin_or_user.php");
require_once('../include/connection1.php');
require_once('../include/sqlfuns.php');
require_once('delete.php');
require_once('../include/classes.php');
$deptno=3;
?>
<?
$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;
}
if(isset($_POST['s1']))
{
$selectsql="select * from dept_3 ";
if($_POST['name']!="")
sqladd("and","name","like",GetSQLValueString("%".$_POST['name']."%", "text"));
if(doubleval($_POST['mount'])!="")
sqladd("and","mount","=",GetSQLValueString($_POST['mount'], "duble"));
if(doubleval($_POST['prise'])!="")
sqladd("and","prise","=",GetSQLValueString($_POST['prise'], "duble"));
if(doubleval($_POST['total_prise'])!="")
sqladd("and","total_prise","=",GetSQLValueString($_POST['total_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 id desc";
$rs=odbc_exec($conn,$selectsql);
}
if(isset($_POST['s2']))
{
$selectsql = sprintf("select * from dept_3 order by id desc");
$rs=odbc_exec($conn,$selectsql);
}
if(isset($_POST['delete']))
{
$p=new author("","admin",$deptno);
$p->check();
delete("dept_3",$_POST['select']);
}
if(isset($_POST['modefiy']))
{
$rs1=modefiy("dept_3",$_POST['select']);
}
if(isset($_POST['ss1']))
{
for($j=1;$j<=$_POST['total'];$j++)
{
$sql = sprintf("update dept_3 set name=%s,mount=%s,prise=%s,other_prise=%s,total_prise=%s,descript=%s where id=%s",
GetSQLValueString($_POST['name'.$j], "text"),
GetSQLValueString($_POST['mount'.$j], "double"),
GetSQLValueString($_POST['prise'.$j], "double"),
GetSQLValueString($_POST['other_prise'.$j], "double"),
GetSQLValueString(doubleval($_POST['prise'.$j])*
doubleval($_POST['mount'.$j])+doubleval($_POST['other_prise'.$j]), "double"),
GetSQLValueString($_POST['descript'.$j], "text"),
GetSQLValueString($_POST['id'.$j], "int"));
//echo $sql;
odbc_exec($conn,$sql);
}
}
?>
<script>
function comfire()
{
return window.confirm('确认删除');
}
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>
<!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>
<body>
<table width="100%" border="1">
<tr>
<td><? include("collectdept_top.php"); ?></td>
</tr>
<tr>
<td>
<form action="" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1" >
<table width="100%" border="0">
<tr>
<td width="29%"><span class="STYLE3">日期:
<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="day">
<option value="" >请选择</option>
<? $i=1;
while($i<=31)
{ echo "<option value='".$i."'>".$i."日</option>";
$i++;
}
?>
</select>
</label>
</span></td>
<td width="15%"><span class="STYLE3">名称:
<input name="name" type="text" id="name" size="10" maxlength="20" />
</span></td>
<td width="12%"><span class="STYLE3">数量:
<input name="mount" type="text" id="mount" size="6" maxlength="6" />
</span></td>
<td width="10%"><span class="STYLE3">单价:</span><span class="redclore">¥</span><span class="STYLE3">
<input name="prise" type="text" id="prise" size="3" />
</span></td>
<td width="13%"><span class="STYLE3">总费用:<span class="redclore">¥</span>
<input name="total_prise" type="text" id="total_prise" size="3" />
</span></td>
<td width="23%"><span class="STYLE3" align="right">
<input name="s22" type="reset" id="s22" value="重置" />
<input name="s1" type="submit" id="s1" value="查询" />
<input name="s2" type="submit" id="s2" onClick="" value="查询所有"/>
</span></td>
</tr>
</table>
</form>
<?
if(!isset($_POST['modefiy'])) {
if(isset($_POST['s1'])||isset($_POST['s2']))
{ ?>
<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="14%"><div align="center">名称</div></td>
<td width="5%"><div align="center">数量</div></td>
<td width="7%"><div align="center">单价</div></td>
<td width="8%"><div align="center">其它费用</div></td>
<td width="8%"><div align="center">总费用</div></td>
<td width="19%"><div align="center">时间</div></td>
<td width="34%"> 说明</td>
</tr>
<?
$total=0;
while(odbc_fetch_row($rs)) {
$total++;
?>
<tr>
<td>
<div align="center">
<label>
<input name="select[]" type="checkbox" id="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,'mount');?></td>
<td> <span class="redclore">¥</span><? echo odbc_result($rs,'prise');?></td>
<td> <span class="redclore">¥</span><? echo odbc_result($rs,'other_prise');?></td>
<td> <span class="redclore">¥</span><? echo odbc_result($rs,'total_prise');?></td>
<td> <? echo odbc_result($rs,'time');?></td>
<td> <? echo odbc_result($rs,'descript');?></td>
</tr>
<? }
?>
<tr>
<td colspan="8">
<?
if($total==0)
{ echo " 无记录";
}
?>
<label>
<p>
<input name="modefiy" type="submit" id="modefiy" value="修改" />
<input name="delete" type="submit" id="delete" value="删除" onclick='return comfire() ' />
</label>
</p>
<input name='selectid' type='hidden' value='0' />
</td>
</tr>
</table>
</form>
<? }
}
if(isset($_POST['modefiy'])) { ?>
<form action="" method="post" enctype="application/x-www-form-urlencoded" name="modey">
<table width="100%" border="1" align="center">
<tr>
<td width="11%">名称</td>
<td width="5%">数量</td>
<td width="10%">单价</td>
<td width="13%">其它费用</td>
<td width="64%">备注</td>
</tr>
<?
$total=0;
while(odbc_fetch_row($rs1)) {
$total++;
?>
<tr>
<td><label>
<input name="name<? echo $total;?>" type="text" id="name<? echo $total;?>" size="13" maxlength="30" value="<? echo odbc_result($rs1,'name');?>" />
</label></td>
<td><label>
<input name="mount<? echo $total;?>" type="text" id="mount<? echo $total;?>" size="6" maxlength="10" value="<? echo odbc_result($rs1,'mount');?>"/>
</label></td>
<td><span class="redclore">¥</span>
<label>
<input name="prise<? echo $total;?>" type="text" id="prise<? echo $total;?>" size="6" maxlength="10" value="<? echo odbc_result($rs1,'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="ss1" type="submit" id="ss1" 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 + -