<?php
	session_start();
	include "../inc/chec.php";
	include "../conn/conn.php";
	include "../inc/func.php";
?>
<link href="../css/style.css" rel="stylesheet" />
<script src="../js/client_js.js"></script>
<SCRIPT language=javascript src="../dedeajax2.js"></SCRIPT>
<SCRIPT language=javascript src="../js/fy.js"></SCRIPT>
<SCRIPT language=javascript src="../js/ckkq.js"></SCRIPT>
<table width="765" border="0" cellpadding="0" cellspacing="0" class="big_td">
	<tr>
		<td width="356" height="33" background="../images/list.jpg" id="list">
		<?php echo read_field($conn,"tb_list","f_name",$_GET[u_id]); ?>		</td>
	    <td width="403" background="../images/list.jpg" id="list"><a onclick=AlertMsg('打卡登记','<?php echo $_GET[u_id]; ?>')  href='javascript:';>
		  点击打卡
		</a></td>
	</tr>
</table>
<table width="765" border="0" cellpadding="0" cellspacing="0" bgcolor="#DEEBEF">
<form method="post" action="#">
	  <tr>
	<tr>
		<td width="100" height="20" align="center" valign="middle">日期</td>
		<td width="100" height="20" align="center" valign="middle">登记时间</td>
		<td width="100" align="center" valign="middle">登记类型</td>
		<td width="100" align="center" valign="middle">登记状态</td>
		<td  align="center" valign="middle">备注</td>
	</tr>
<?php
	$sqlstr = "select id,r_date,r_time,r_type,r_state,r_remark from tb_register where r_id = ".$_GET[u_id]." and p_id = ".$_SESSION[id]." order by id desc";
	$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 where r_id = ".$_GET[u_id]."  order by id desc"));
                    $url = 'work_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 id,r_date,r_time,r_type,r_state,r_remark from tb_register where r_id = ".$_GET[u_id]." and p_id = ".$_SESSION[id]." order by id desc limit $offset,$num";
$result3=mysql_query($info,$conn);
$j=0;
while($list=mysql_fetch_array($result3)){
$j++;
switch($list[r_type]){
				case 0:
					$list['r_type']=下班;
					$list['r_state']=($list[r_state] == 0)?"早退":"正点下班"; 
					break;
				case 1:
					$list['r_type']=上班;
					$list['r_state']=($list[r_state] == 0)?"正点上班":"迟到";
					break;
				case 2:
					$list['r_type']=加班签到;
					$list['r_state']= ($list[r_state] == 0)?"正点加班":"晚点加班";
					break;
				case 3:
					$list['r_type']=加班签退;
					$list['r_state']=($list[r_state] == 0)?"早退":"正点下班";
					break;
				case 4:
					$list['r_type']=病假;
					$list['r_state']=($list[r_state] == 0)?"病假":"事假";
					break;
				case 5:
					$list['r_type']=事假;
					$list['r_state']=事假;
					break;
			}
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_type'].'</td><td  height="25" align="center" valign="middle">'.$list['r_state'].'</td><td height="25" align="center" valign="middle">'.$list['r_remark'].'</td></tr>';}
echo '</table>';
echo $pagenav;//输出分页导航
ob_end_flush();
?>
</form>



</table>
