<?php
	session_start();
	include "../inc/chec.php";
	include "../conn/conn.php";
	include "../inc/func.php";
//0 下班 1 上班 2 加班签到 3 加班签退 4 病假 5 事假
?>
<link href="../css/style.css" rel="stylesheet" />
<script src="../js/client_js.js"></script>
<script type="text/javascript" src="../lhgcore.js"></script>
<script type="text/javascript" src="../lhgdialog.js"></script>
<script type="text/javascript">
function dlgopen1()
{
	J.dialog.get({ id: 'test1', title: '时间设置', page: 'kqgl/set_time.php' , width: '580' , height: '180'});
}
	</script>
<table width="765" border="1" cellpadding="0" cellspacing="0" class="big_td">
	<tr>
		<td height="33" background="../images/list.jpg" id="list">考勤管理</td>
	</tr>
</table>
<table width="765" border="1" cellpadding="0" cellspacing="0" bgcolor="#DEEBEF">
	<tr>
		<td height="25" colspan="8" align="center" valign="middle">
		<input type="button" id="a" value="设置时间" onclick="dlgopen1()"/>
		&nbsp;&nbsp;
		<a href="del_note_chk.php" onclick="return del_mess();">清空记录</A>
		</td>
	</tr>
	<tr>
		<td width="75" height="20" align="center" valign="middle">日期</td>
		<td width="75" height="20" align="center" valign="middle">时间</td>
  		<td width="75" height="20" align="center" valign="middle">职员姓名</td>
		<td width="75" align="center" valign="middle">上班签到</td>
		<td width="75" align="center" valign="middle">下班签退</td>
		<td width="75" align="center" valign="middle">加班签到</td>
		<td width="75" align="center" valign="middle">加班签退</td>
		<td width="75" align="center" valign="middle">病事假</td>
		
	</tr>
<?php
if(!isset($keyword))
{
	$sqlstr = "select * from tb_register order by id";
	$result = mysql_query($sqlstr,$conn);
}
while($rows = mysql_fetch_array($result)){
?>

<?php		
	}
?>
<?php
$met=$_GET['u_id'];
$spendor=($met=='srlist')?2:1;
$page=isset($_GET['page'])?(int)($_GET['page']):1;
$num=10;
$total=mysql_num_rows(mysql_query("SELECT * FROM  tb_register order by id desc"));
                    $url = 'manage_note.php';
                    if ($total <= 0)
                        exit('还没有你的记录，快去记录吧');
//页码计算
$pagenum=ceil($total/$num);
$page=min($pagenum,$page);//获得首页
$prepg=$page-1;//上一页
$nextpg=($page==$pagenum?0:$page+1);//下一页
$offset=($page-1)*$num;
//开始分页导航条代码：
$pagenav="<div class=num>显示第 <B>".($total?($offset+1):0)."</B>-<B>".min($offset+10,$total)."</B> 条记录，共 $total 条记录 ";
$pagenav.=" <a href='$url?u_id=$met&page=1'>首页</a> ";
if($prepg) $pagenav.=" <a href='$url?u_id=$met&page=$prepg'>前页</a> "; else $pagenav.=" 前页 ";
if($nextpg) $pagenav.=" <a href='$url?u_id=$met&page=$nextpg'>后页</a> "; else $pagenav.=" 后页 ";
$pagenav.=" <a href='$url?u_id=$met&page=$pagenum'>尾页</a> ";
//下拉跳转列表，循环列出所有页码：
$pagenav.="　到第 <select name='topage' size='1' onchange='window.location=\"$url?u_id=$met&page=\"+this.value'>\n";
for($i=1;$i<=$pagenum;$i++){
if($i==$page) $pagenav.="<option value='$i' selected>$i</option>\n";
else $pagenav.="<option value='$i'>$i</option>\n";
}
$pagenav.="</select> 页，共 $pagenum 页</div>";
//假如传入的页数参数大于总页数，则显示错误信息
If($page>$pagenum){
       echo "Error : 不能找到页 ".$page;
       Exit;
}
$info="SELECT * from tb_register order by id desc limit $offset,$num";
$result3=mysql_query($info,$conn);
$j=0;
while($list=mysql_fetch_array($result3)){
$j++;
$list['r_name']=read_field($conn,"tb_users","u_name",$list[p_id]);
if($list[r_type] == 1)
					$list['r_shangban']=($list[r_state] == 0)?"正点上班":"迟到"; 
				else
					$list['r_shangban']= "-";
if($list[r_type] == 0)
					$list['r_xiaban']=($list[r_state] == 0)?"早退":"正点下班"; 
				else
					$list['r_xiaban']= "-";
if($list[r_type] == 2)
					$list['r_jiaban']= ($list[r_state] == 0)?"正点加班":"晚点加班";
				else
					$list['r_jiaban']="-";
if($list[r_type] == 3)
					$list['r_xiatuiban']= ($list[r_state] == 0)?"早退":"正点下班";
				else
					$list['r_xiatuiban']="-";
if(($list[r_type]) == 4 or ($list[r_type] ==5))
					$list['r_jiaqi']=($list[r_state] == 0)?"病假":"事假";
				else
					$list['r_jiaqi']="-";
echo '<tr><td height="25" align="center" valign="middle">'.$list['r_date'].'</td><td height="25" align="center" valign="middle">'.$list['r_time'].'</td><td height="25" align="center" valign="middle">'.$list['r_name'].'</td><td  height="25" align="center" valign="middle">'.$list['r_shangban'].'</td><td height="25" align="center" valign="middle">'.$list['r_xiaban'].'</td><td height="25" align="center" valign="middle">'.$list['r_jiaban'].'</td><td height="25" align="center" valign="middle">'.$list['r_xiatuiban'].'</td><td height="25" align="center" valign="middle">'.$list['r_jiaqi'].'</td></tr>';}
echo '</table>';
echo $pagenav;//输出分页导航
ob_end_flush();
?>
</table>