📄 index.php
字号:
<?
include_once("inc/auth.php");
?>
<html>
<head>
<title>工资项目</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language="JavaScript">
function CheckForm()
{
if(document.form1.ITEM_NAME.value=="")
{ alert("工资项目名称不能为空!");
return (false);
}
}
function sel_change(input)
{
if(form1.ITEM_TYPE.value=="2")
{
document.all("FORMU").style.display="";
}
else
{
document.all("FORMU").style.display="none";
document.form1.FORMULA.value="";
document.form1.FORMULANAME.value="";
}
}
function LoadWindow2()
{
URL="formula_edit.php";
myleft=(screen.availWidth-650)/2;
window.open(URL,"formul_edit","height=350,width=650,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}
function delete_all()
{
msg='确认要删除全部工资项目吗?';
if(window.confirm(msg))
{
URL="delete_all.php";
window.location=URL;
}
}
function show_formul(ITEM_ID)
{
URL="formula_edit.php?ITEM_ID="+ITEM_ID;
myleft=(screen.availWidth-650)/2;
window.open(URL,"formul_edit","height=350,width=650,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top=150,left="+myleft+",resizable=yes");
}
</script>
</head>
<?
$connection=OpenConnection();
$query = "SELECT count(*) from SAL_ITEM";
$ITEM_COUNT=0;
$cursor= exequery($connection,$query);
if($ROW=mysql_fetch_array($cursor))
$ITEM_COUNT=$ROW[0];
?>
<body class="bodycolor" topmargin="5" <? if($ITEM_COUNT<50) echo"onload='document.form1.ITEM_NAME.focus();'"?>>
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
<tr>
<td class="Big"><img src="/images/notify_new.gif" align="absmiddle"><span class="big3"> 添加工资项目</span>
</td>
</tr>
</table>
<div align="center" class="big1">
<b>
<table border="0" cellspacing="1" width="450" class="small" bgcolor="#000000" cellpadding="3" align="center" >
<form action="add.php" method="post" name="form1" onsubmit="return CheckForm();">
<tr>
<td nowrap class="TableContent">工资项目名称:</td>
<td nowrap class="TableData">
<input type="text" name="ITEM_NAME" class="BigInput" size="30" maxlength="100" <? if($ITEM_COUNT>=50) echo disabled;?>>
<input type="hidden" name="ITEM_ID" value="<?=$ITEM_COUNT+1?>">
</td>
</tr>
<tr>
<td nowrap class="TableContent">项目类型: </td>
<td nowrap class="TableData">
<select name="ITEM_TYPE" class="BigSelect" onchange="sel_change()">
<option value="0">财务录入项</option>
<option value="1">部门上报项</option>
<option value="2">计算项</option>
</select>
</td>
</tr>
<tr id="FORMU" style="display:none">
<td nowrap class="TableContent">计算公式:</td>
<td nowrap class="TableData">
<input type="hidden" name="FORMULA">
<textarea cols=37 name="FORMULANAME" rows="4" class="BigStatic" readonly wrap="yes"></textarea>
<input type="button" value="编辑公式" class="SmallButton" onClick="LoadWindow2()" title="编辑公式" name="button">
</td>
</tr>
<tr align="center" class="TableControl">
<td colspan="2" nowrap>
<input type="submit" value="添加" class="BigButton" title="添加工资项目" <? if($ITEM_COUNT>=50) echo disabled;?> name="button">
</td>
</tr>
</form>
</table>
</b>
</div>
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0" height="3">
<tr>
<td background="/images/dian1.gif" width="100%"></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
<tr>
<td class="Big"><img src="/images/notify_open.gif" align="absmiddle"><span class="big3"> 已定义的工资项目(最多50条)</span>
</td>
</tr>
</table>
<br>
<div align="center">
<?
//============================ 显示已定义工资项目 =======================================
$query = "SELECT * from SAL_ITEM order by ITEM_ID";
$cursor= exequery($connection,$query);
$ITEM_COUNT1=0;
while($ROW=mysql_fetch_array($cursor))
{
$ITEM_COUNT1++;
$ITEM_ID=$ROW["ITEM_ID"];
$ITEM_NAME=$ROW["ITEM_NAME"];
$ISPRINT=$ROW["ISPRINT"];
$ISCOMPUTER=$ROW["ISCOMPUTER"];
$FORMULA=$ROW["FORMULA"];
$FORMULANAME=$ROW["FORMULANAME"];
$ISREPORT=$ROW["ISREPORT"];
if($ISREPORT=="1")
{
$ITEMSET="部门上报项";
}
else
{
if($ISCOMPUTER=="1") $ITEMSET="计算项";else $ITEMSET="财务录入项";
}
if($ITEM_COUNT1==1)
{
?>
<table border="0" cellspacing="1" width="450" class="small" bgcolor="#000000" cellpadding="3">
<?
}
?>
<tr class="TableData">
<td nowrap align="center" width="50"><?=$ITEM_ID?></td>
<td nowrap align="center"><?=$ITEM_NAME?></td>
<td nowrap align="center">
<?=$ITEMSET?>
</td>
<td nowrap align="center">
<a href="edit.php?ITEM_ID=<?=$ITEM_ID?>"> 编辑</a>
<?
if($ITEM_COUNT1==$ITEM_COUNT)
{
?>
<a href="delete.php?ITEM_ID=<?=$ITEM_ID?>"> 删除</a>
<?
}
if($ISCOMPUTER=="1")
{
?>
<a href="javascript:show_formul('<?=$ITEM_ID?>');">公式编辑</a>
<?
}
?>
</td>
</tr>
<?
}
if($ITEM_COUNT>0)
{
?>
<tr class="TableControl">
<td colspan="6" align="center">
<input type="button" value="全部删除" class="SmallButton" onClick="delete_all();">
</td>
</tr>
<thead class="TableHeader">
<td nowrap align="center">编号</td>
<td nowrap align="center">名称</td>
<td nowrap align="center">项目类型</td>
<td nowrap align="center">操作</td>
</thead>
</table>
<?
}
else
Message("","尚未定义");
?>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -