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

📄 index.php

📁 极限网络智能办公系统 Office Automation V3.0官方100%源代码.
💻 PHP
字号:
<?
include_once("inc/auth.php");
include_once("inc/check_type.php");
include_once("inc/utility_all.php");
?>

<html>
<head>
<title>考勤查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language=JavaScript>
window.setTimeout('this.location.reload();',60000);
</script>
</head>

<body class="bodycolor" topmargin="5">

<?
//----------- 合法性校验 ---------
if($SOME_DATE!="")
{
  $TIME_OK=is_date($SOME_DATE);

  if(!$TIME_OK)
  { Message("错误","查询日期格式不对,应形如 1999-1-2");
    Button_Back();
    exit;
  }
}

$query = "SELECT * from USER where USER_ID='$LOGIN_USER_ID'";
$cursor= exequery($connection,$query);
if($ROW=mysql_fetch_array($cursor))
   $POST_PRIV=$ROW["POST_PRIV"];
?>

<div class="Big1" align="center">
<b>
[考勤查询 - <?=format_date($SOME_DATE)?>]
</b>
</div>
<br>

<!------------------------------------- 上下班 ------------------------------->

<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
  <tr>
    <td class="Big"><img src="/images/menu/attendance.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><span class="big3"> 上下班</span>
    </td>
  </tr>
</table>

<div align="center" class="Big1">
<form action="duty.php" name="form1">
<b>
部门:<select name="DEPARTMENT" class="BigSelect">
<?
if($POST_PRIV=="1")
{
?>
          <option value="ALL_DEPT">所有部门</option>
<?
}
    echo my_dept_tree(0,$DEPT_ID,1);
?>
        </select>&nbsp;&nbsp;

排班类型:<select name="DUTY_TYPE" class="BigSelect">
<?
      $query = "SELECT * from ATTEND_CONFIG order by DUTY_TYPE";
      $cursor= exequery($connection,$query);
      while($ROW=mysql_fetch_array($cursor))
      {
         $DUTY_TYPE=$ROW["DUTY_TYPE"];
         $DUTY_NAME=$ROW["DUTY_NAME"];

?>
          <option value="<?=$DUTY_TYPE?>"><?=$DUTY_NAME?></option>
<?
      }
?>
        </select>&nbsp;
        <input type="hidden" name="SOME_DATE" value="<?=$SOME_DATE?>">
        <input type="submit" value="查询" class="BigButton" title="查询指定日期的上下班时间">
</b>
</form>
</div>

<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/menu/attendance.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><span class="big3"> 外出人员</span><br>
    </td>
  </tr>
</table>

<?
 $query = "SELECT * from ATTEND_OUT,USER,DEPARTMENT where DEPARTMENT.DEPT_ID=USER.DEPT_ID and ATTEND_OUT.USER_ID=USER.USER_ID and to_days(SUBMIT_TIME)=to_days('$SOME_DATE') order by DEPT_NO,USER.USER_ID";
 $cursor= exequery($connection,$query);
 $OUT_COUNT=0;
 while($ROW=mysql_fetch_array($cursor))
 {
   $USER_ID=$ROW["USER_ID"];
   $USER_NAME=$ROW["USER_NAME"];
   $OUT_TYPE=$ROW["OUT_TYPE"];
   $SUBMIT_TIME=$ROW["SUBMIT_TIME"];
   $OUT_TIME1=$ROW["OUT_TIME1"];
   $OUT_TIME2=$ROW["OUT_TIME2"];
   $ALLOW=$ROW["ALLOW"];
   $STATUS=$ROW["STATUS"];
   $DEPT_ID=$ROW["DEPT_ID"];
   $LEADER_ID=$ROW["LEADER_ID"];

    $LEADER_NAME="";
    $query = "SELECT * from USER where USER_ID='$LEADER_ID'";
    $cursor1= exequery($connection,$query);
    if($ROW=mysql_fetch_array($cursor1))
       $LEADER_NAME=$ROW["USER_NAME"];

   if(!is_dept_priv($DEPT_ID))
      continue;

   $OUT_COUNT++;

   if($STATUS=="0")
      $STATUS_DESC="外出";
   else if($STATUS=="1")
      $STATUS_DESC="已归来";
   if($ALLOW=='0')
      $STATUS_DESC="待批";
   if($ALLOW=='2')
      $STATUS_DESC="不批准";

   $query1="select * from DEPARTMENT where DEPT_ID=$DEPT_ID";
   $cursor1= exequery($connection,$query1);
   if($ROW=mysql_fetch_array($cursor1))
      $USER_DEPT_NAME=$ROW["DEPT_NAME"];

    if($OUT_COUNT==1)
    {
?>

    <table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">

<?
    }
?>
    <tr class="TableData">
      <td nowrap align="center"><?=$USER_DEPT_NAME?></td>
      <td nowrap align="center"><?=$USER_NAME?></td>
      <td nowrap align="center"><?=$OUT_TYPE?></td>
      <td nowrap align="center"><?=$SUBMIT_TIME?></td>
      <td nowrap align="center"><?=$OUT_TIME1?></td>
      <td nowrap align="center"><?=$OUT_TIME2?></td>
      <td nowrap align="center"><?=$LEADER_NAME?></td>
      <td nowrap align="center"><?=$STATUS_DESC?></td>
    </tr>
<?
 }

 if($OUT_COUNT>0)
 {
?>
    <thead class="TableHeader">
      <td nowrap align="center">部门</td>
      <td nowrap align="center">姓名</td>
      <td nowrap align="center">外出原因</td>
      <td nowrap align="center">申请时间</td>
      <td nowrap align="center">外出时间</td>
      <td nowrap align="center">归来时间</td>
      <td nowrap align="center">审批人员</td>
      <td nowrap align="center">状态</td>
    </thead>
    </table>
<?
 }
 else
    message("","无外出记录");
?>

<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/menu/attendance.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><span class="big3"> 请假人员</span><br>
    </td>
  </tr>
</table>



<?
 $query = "SELECT * from ATTEND_LEAVE,USER,DEPARTMENT where DEPARTMENT.DEPT_ID=USER.DEPT_ID and ATTEND_LEAVE.USER_ID=USER.USER_ID and to_days(LEAVE_DATE1)<=to_days('$SOME_DATE') and to_days(LEAVE_DATE2)>=to_days('$SOME_DATE') and allow in('1','3') order by DEPT_NO,USER.USER_ID";
 $cursor= exequery($connection,$query);
 $LEAVE_COUNT=0;
 while($ROW=mysql_fetch_array($cursor))
 {
   $USER_ID=$ROW["USER_ID"];
   $USER_NAME=$ROW["USER_NAME"];
   $LEAVE_DATE1=$ROW["LEAVE_DATE1"];
   $LEAVE_DATE2=$ROW["LEAVE_DATE2"];
   $LEAVE_TYPE=$ROW["LEAVE_TYPE"];
   $DEPT_ID=$ROW["DEPT_ID"];
   $LEADER_ID=$ROW["LEADER_ID"];
   $STATUS=$ROW["STATUS"];

   $LEADER_NAME="";
   $query = "SELECT * from USER where USER_ID='$LEADER_ID'";
   $cursor1= exequery($connection,$query);
   if($ROW=mysql_fetch_array($cursor1))
      $LEADER_NAME=$ROW["USER_NAME"];

   if($STATUS==1)
      $STATUS="现行";
   else
      $STATUS="已销假";

   if(!is_dept_priv($DEPT_ID))
      continue;

   $LEAVE_COUNT++;

   $query1="select * from DEPARTMENT where DEPT_ID=$DEPT_ID";
   $cursor1= exequery($connection,$query1);
   if($ROW=mysql_fetch_array($cursor1))
      $USER_DEPT_NAME=$ROW["DEPT_NAME"];

    if($LEAVE_COUNT==1)
    {
?>

    <table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">

<?
    }

    if($LEAVE_COUNT%2==1)
       $TableLine="TableLine1";
    else
       $TableLine="TableLine2";
?>
    <tr class="<?=$TableLine?>">
      <td nowrap align="center"><?=$USER_DEPT_NAME?></td>
      <td nowrap align="center"><?=$USER_NAME?></td>
      <td nowrap align="center"><?=$LEAVE_TYPE?></td>
      <td nowrap align="center"><?=$LEADER_NAME?></td>
      <td nowrap align="center"><?=$LEAVE_DATE1?></td>
      <td nowrap align="center"><?=$LEAVE_DATE2?></td>
      <td nowrap align="center"><?=$STATUS?></td>
    </tr>
<?
 }

 if($LEAVE_COUNT>0)
 {
?>
    <thead class="TableHeader">
      <td nowrap align="center">部门</td>
      <td nowrap align="center">姓名</td>
      <td nowrap align="center">请假原因</td>
      <td nowrap align="center">审批人员</td>
      <td nowrap align="center">开始日期</td>
      <td nowrap align="center">结束日期</td>
      <td nowrap align="center">状态</td>
    </thead>
    </table>
<?
 }
 else
    message("","无请假记录");
?>

<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/menu/attendance.gif" WIDTH="22" HEIGHT="20" align="absmiddle"><span class="big3"> 出差人员</span><br>
    </td>
  </tr>
</table>


<?
 $query = "SELECT * from ATTEND_EVECTION,USER,DEPARTMENT where DEPARTMENT.DEPT_ID=USER.DEPT_ID and ATTEND_EVECTION.USER_ID=USER.USER_ID and to_days(EVECTION_DATE1)<=to_days('$SOME_DATE') and to_days(EVECTION_DATE2)>=to_days('$SOME_DATE') order by DEPT_NO,USER.USER_ID";
 $cursor= exequery($connection,$query);
 $EVECTION_COUNT=0;
 while($ROW=mysql_fetch_array($cursor))
 {
   $USER_ID=$ROW["USER_ID"];
   $USER_NAME=$ROW["USER_NAME"];

   $EVECTION_DATE1=$ROW["EVECTION_DATE1"];
   $EVECTION_DATE1=strtok($EVECTION_DATE1," ");

   $EVECTION_DATE2=$ROW["EVECTION_DATE2"];
   $EVECTION_DATE2=strtok($EVECTION_DATE2," ");

   $EVECTION_DEST=$ROW["EVECTION_DEST"];
   $DEPT_ID=$ROW["DEPT_ID"];
   $LEADER_ID=$ROW["LEADER_ID"];

   $LEADER_NAME="";
   $query = "SELECT * from USER where USER_ID='$LEADER_ID'";
   $cursor1= exequery($connection,$query);
   if($ROW=mysql_fetch_array($cursor1))
      $LEADER_NAME=$ROW["USER_NAME"];

   $STATUS=$ROW["STATUS"];

   if($STATUS=="1")
      $STATUS="在外";
   else
      $STATUS="归来";

   if(!is_dept_priv($DEPT_ID))
      continue;

   $EVECTION_COUNT++;

   $query1="select * from DEPARTMENT where DEPT_ID=$DEPT_ID";
   $cursor1= exequery($connection,$query1);
   if($ROW=mysql_fetch_array($cursor1))
      $USER_DEPT_NAME=$ROW["DEPT_NAME"];

    if($EVECTION_COUNT==1)
    {
?>

    <table border="0" cellspacing="1" width="95%" class="small" bgcolor="#000000" cellpadding="3">

<?
    }

    if($EVECTION_COUNT%2==1)
       $TableLine="TableLine1";
    else
       $TableLine="TableLine2";
?>
    <tr class="<?=$TableLine?>">
      <td nowrap align="center"><?=$USER_DEPT_NAME?></td>
      <td nowrap align="center"><?=$USER_NAME?></td>
      <td nowrap align="center"><?=$EVECTION_DEST?></td>
      <td nowrap align="center"><?=$LEADER_NAME?></td>
      <td nowrap align="center"><?=$EVECTION_DATE1?></td>
      <td nowrap align="center"><?=$EVECTION_DATE2?></td>
      <td nowrap align="center"><?=$STATUS?></td>
    </tr>
<?
 }

 if($EVECTION_COUNT>0)
 {
?>
    <thead class="TableHeader">
      <td nowrap align="center">部门</td>
      <td nowrap align="center">姓名</td>
      <td nowrap align="center">出差地点</td>
      <td nowrap align="center">审批人员</td>
      <td nowrap align="center">开始日期</td>
      <td nowrap align="center">结束日期</td>
      <td nowrap align="center">状态</td>
    </thead>
<?
 }
 else
    message("","无出差记录");
?>

</table>

<br>
<div align="center">
  <input type="button"  value="返回" class="BigButton" onClick="location='../';">
</div>

</body>
</html>

⌨️ 快捷键说明

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