📄 search.php
字号:
<?php
function checkbox( $duty_time, $id )
{
$val = $duty_time.";".$id;
echo "<input name=\"box\" type=\"checkbox\" id=\"box\" value=\"".$val."\">";
}
function edit( $id )
{
echo "<input type=\"checkbox\" name=\"allbox\" onClick=\"check_all();\">全选 <input type=\"button\" class=\"BigButton\" name=\"delete_box\" title=\"删除\" value=\"删除\" onClick=\"delete_box(".$id.");\"> <input type=\"button\" class=\"BigButton\" name=\"delete_all\" value=\"全部删除\" title=\"删除所有搜索结果\" onClick=\"delete_all(".$id.");\">";
}
function button_backs( $type )
{
echo "<br><center><a href=\"index.php?type=2\"><img border=\"0\" src=\"/images/button/return.gif\" title=\"返回\"></a></center>";
}
include_once( "inc/auth.php" );
include_once( "inc/check_type.php" );
include_once( "inc/utility_all.php" );
include_once( "inc/function_page_01.php" );
header( "Cache-Control:private" );
echo "\t\r\n<html>\r\n<head>\r\n<title></title>\r\n<meta http-equiv=\"content-type\" content=\"text/html; charset=gb2312\">\r\n";
if ( !$_REQUEST['cur_page'] )
{
$cur_page = 1;
}
else
{
$cur_page = $_REQUEST['cur_page'];
}
echo "<s";
echo "cript language=\"javascript\">\r\n\tfunction delete_out(user_id,out_type,start_time,end_time,submit_time)\r\n\t{\r\n\t\tmsg\t= \"确认要删除所有记录么?\";\r\n\t\tif(window.confirm(msg))\r\n\t\t{\r\n\t\t\turl\t= \"do.php?division=1&user_id=\"+ user_id+\"&out_type=\"+out_type+\"&start_time=\"+start_time+\"&end_time=\"+end_time+\"&submit_time=\"+submit_time+\"&id=";
echo $_REQUEST['id'];
echo "&cur_page=";
echo $cur_page;
echo "&number_type=";
echo $_REQUEST['number_type'];
echo "&date_start=";
echo $_REQUEST['date_start'];
echo "&date_end=";
echo $_REQUEST['date_end'];
echo "&time_start=";
echo $_REQUEST['time_start'];
echo "&time_end=";
echo $_REQUEST['time_end'];
echo "&keywords=";
echo $_REQUEST['keywords'];
echo "&TO_ID=";
echo $_REQUEST['TO_ID'];
echo "&city=";
echo $_REQUEST['city'];
echo "\";\r\n\t\t\twindow.location\t= url;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction deletes(edits)\r\n\t{\r\n\t\tmsg\t= \"确认要删除所有记录么?\";\r\n\t\tif(window.confirm(msg))\r\n\t\t{\r\n\t\t\turl\t= \"do.php?id_str=\"+ edits +\"&id=";
echo $_REQUEST['id'];
echo "&cur_page=";
echo $cur_page;
echo "&number_type=";
echo $_REQUEST['number_type'];
echo "&date_start=";
echo $_REQUEST['date_start'];
echo "&date_end=";
echo $_REQUEST['date_end'];
echo "&time_start=";
echo $_REQUEST['time_start'];
echo "&time_end=";
echo $_REQUEST['time_end'];
echo "&keywords=";
echo $_REQUEST['keywords'];
echo "&TO_ID=";
echo $_REQUEST['TO_ID'];
echo "&city=";
echo $_REQUEST['city'];
echo "\";\r\n\t\t\twindow.location\t= url;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction delete_box(id)\r\n\t{\r\n\t\tdelete_str\t= \"\";\r\n\t\tfor(i=0; i<document.all(\"box\").length; i++)\r\n\t\t{\r\n\t\t\tel\t= document.all(\"box\").item(i);\r\n\t\t\tif(el.checked)\r\n\t\t\t{ \r\n\t\t\t\tval\t= el.value;\r\n\t\t\t\tdelete_str += val + \",\";\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(i == 0)\r\n\t\t{\r\n\t\t\tel\t= document.all(\"box\");\r\n\t\t\tif(el.checked)\r\n\t\t\t{ \r\n\t\t\t\tval\t= el.value;\r\n\t\t\t\tdelete_str += val + \",\";\r\n";
echo "\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tif(delete_str == \"\")\r\n\t\t{\r\n\t\t\talert(\"请至少选择其中一条记录!\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tmsg='确认要删除所选记录么?';\r\n\t\tif(window.confirm(msg))\r\n\t\t{\r\n\t\t\turl\t= \"do.php?division=2&id_str=\"+ delete_str +\"&id=\"+id+\"&cur_page=";
echo $cur_page;
echo "&number_type=";
echo $_REQUEST['number_type'];
echo "&date_start=";
echo $_REQUEST['date_start'];
echo "&date_end=";
echo $_REQUEST['date_end'];
echo "&time_start=";
echo $_REQUEST['time_start'];
echo "&time_end=";
echo $_REQUEST['time_end'];
echo "&keywords=";
echo $_REQUEST['keywords'];
echo "&TO_ID=";
echo $_REQUEST['TO_ID'];
echo "&city=";
echo $_REQUEST['city'];
echo "\";\r\n\t\t\twindow.location\t= url;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction check_all()\r\n\t{\r\n\t\tfor(i=0; i<document.all(\"box\").length; i++)\r\n\t\t{\r\n\t\t\tif(document.all(\"allbox\").checked)\r\n\t\t\t\tdocument.all(\"box\").item(i).checked=true;\r\n\t\t\telse\r\n\t\t\t\tdocument.all(\"box\").item(i).checked=false;\r\n\t\t}\r\n\t\t\r\n\t\tif(i == 0)\r\n\t\t{\r\n\t\t\tif(document.all(\"allbox\").checked)\r\n\t\t\t\tdocument.all(\"box\").checked=true;\r\n\t\t\telse\r\n\t\t\t\tdocument.all(\"box\"";
echo ").checked=false;\r\n\t\t}\r\n\t}\r\n</script>\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\">\r\n";
if ( $_REQUEST['date_start'] != "" )
{
$time_ok = is_date( $_REQUEST['date_start'] );
if ( !$time_ok )
{
message( "错误", "起始日期格式不对,应形如 1999-1-2" );
button_back( );
exit( );
}
}
if ( $_REQUEST['date_end'] != "" )
{
$time_ok = is_date( $_REQUEST['date_end'] );
if ( !$time_ok )
{
message( "错误", "起始日期格式不对,应形如 1999-1-2" );
button_back( );
exit( );
}
}
if ( $_REQUEST['date_start'] != "" && $_REQUEST['date_end'] != "" && compare_date( $_REQUEST['date_start'], $_REQUEST['date_end'] ) == 1 )
{
message( "错误", "查询的起始日期不能晚于截止日期" );
button_back( );
exit( );
}
if ( $_REQUEST['id'] == 1 )
{
if ( $_REQUEST['number_type'] != "all" )
{
$query = "select * from ATTEND_CONFIG where DUTY_TYPE=".$_REQUEST['number_type'];
$cursor = exequery( $connection, $query );
if ( $row = mysql_fetch_array( $cursor ) )
{
$duty_name = $row['DUTY_NAME'];
}
}
else
{
$duty_name = "所有班次记录";
}
}
switch ( $_REQUEST['id'] )
{
case 1 :
$title = $duty_name." - ";
break;
case 2 :
$title = "外出登记 - ";
break;
case 3 :
$title = "请假登记 - ";
break;
case 4 :
$title = "出差登记 - ";
}
echo "<table border=\"0\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\">\r\n <tr class=\"tablehead1\">\r\n <td><img src=\"/images/menu/attendance.gif\" align=\"absmiddle\">";
echo $title;
echo "查询结果</td>\r\n </tr>\r\n <tr class=\"tablehead2\">\r\n <td><a href=\"#\" onClick=\"location='./';\"><img src=\"/images/button/search.gif\" title=\"模糊查询\" border=\"0\"></a>\r\n <a href=\"#\" onClick=\"location='./';\"><img src=\"/images/button/return.gif\" title=\"返回\" border=\"0\"></a> </td>\r\n </tr>\r\n</table>\r\n<br>\r\n";
if ( $_REQUEST['id'] == 1 )
{
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" class=\"small\">\r\n <tr class=\"TableHeader\">\r\n <td width=\"10%\">日期</td>\r\n <td width=\"8%\">员工</td>\r\n <td width=\"9%\">班次类型</td>\r\n <td width=\"7%\">第1次登记</td>\r\n <td width=\"7%\">第2次登记</td>\r\n <td width=\"7%\">第3次登记</td>\r\n <td width=\"7%\">第4次登记</td>\r\n <td width=\"7%\">第5次登记</td>\r\n <td width=\"7%\">第6次登记</td>\r\n <td w";
echo "idth=\"5%\">操作</td>\r\n </tr>\r\n";
$query = "select USER_ID, REGISTER_TIME, STATE, REGISTER_TYPE from ATTEND_DUTY ";
if ( $_REQUEST['date_start'] != NULL )
{
$where_str .= "where to_days(date_format(REGISTER_TIME,'%Y-%m-%d')) >= to_days('".$_REQUEST['date_start']."') ";
}
if ( $_REQUEST['date_end'] != NULL )
{
if ( $where_str != "" )
{
$where_str .= "and to_days(date_format(REGISTER_TIME,'%Y-%m-%d')) <= to_days('".$_REQUEST['date_end']."') ";
}
else
{
$where_str .= "where to_days(date_format(REGISTER_TIME,'%Y-%m-%d')) <= to_days('".$_REQUEST['date_end']."') ";
}
}
if ( $_REQUEST['number_type'] != all )
{
if ( $where_str == "" )
{
$where_str .= "where REGISTER_TYPE=".$_REQUEST['number_type']." ";
}
else
{
$where_str .= "and REGISTER_TYPE=".$_REQUEST['number_type']." ";
}
}
$query .= $where_str;
$query .= "order by REGISTER_TIME desc";
$sql = page( $query, 10 );
$cursor = exequery( $connection, $sql );
$number_count = 0;
$taf = exequery( $connection, $sql );
if ( !( $row = mysql_fetch_array( $taf ) ) )
{
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n <tr>\r\n <td align=\"center\">";
message( "提示", "没有符合条件的记录!" );
exit( );
echo "</td>\r\n </tr>\r\n</table>\r\n";
}
while ( $row = mysql_fetch_array( $cursor ) )
{
++$number_count;
$user_id = $row['USER_ID'];
$register_time = $row['REGISTER_TIME'];
$register_type = $row['REGISTER_TYPE'];
$register_time1 = explode( " ", $register_time );
if ( $number_count % 2 == 1 )
{
$TableLine = "TableLine1";
}
else
{
$TableLine = "TableLine2";
}
$query1 = "select USER_NAME, DUTY_TYPE from user where USER_ID='".$user_id."'";
$cursor1 = exequery( $connection, $query1 );
while ( $row1 = mysql_fetch_array( $cursor1 ) )
{
$user_name = $row1[0];
echo " <tr class=\"";
echo $TableLine;
echo "\">\r\n <td>";
checkbox( $register_time, $user_id );
echo $register_time1[0];
echo "</td>\r\n <td>";
echo $user_name;
echo "</td>\r\n <td>";
echo $duty_name;
echo "</td>\r\n";
$k = 1;
for ( ; $k <= 6; ++$k )
{
$query2 = "select DATE_FORMAT(REGISTER_TIME,'%H:%i:%s') from attend_duty where REGISTER_TYPE=".$k." and USER_ID='".$user_id."' and REGISTER_TIME='".$register_time."'";
$cursor2 = exequery( $connection, $query2 );
if ( $row2 = mysql_fetch_array( $cursor2 ) )
{
$register_time2 = $row2[0];
echo "<td>".$register_time2."</td>";
}
else
{
echo "<td> </td>";
}
}
$edits = $register_time.";".$user_id;
echo " <td><a href=\"#\" onClick=\"javascript:deletes('";
echo $edits;
echo "');\">删除</a></td>\r\n </tr>\r\n";
}
}
echo "</table>\r\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\">\r\n <tr>\r\n <td class=\"TableLine2\">";
edit( $_REQUEST['id'] );
echo "</td>\r\n </tr>\r\n <tr>\r\n <td align=\"right\" class=\"TableLine1\">";
disp( "id=1&date_start=".$_REQUEST['date_start']."&date_end=".$_REQUEST['date_end']."&number_type=".$_REQUEST['number_type']."" );
echo "</td>\r\n </tr>\r\n</table>\r\n";
}
if ( $_REQUEST['id'] == 2 )
{
if ( $_REQUEST['time_start'] != "" && $_REQUEST['time_end'] != "" && 0 <= compare_time( $_REQUEST['time_start'], $_REQUEST['time_end'] ) )
{
message( "错误", "请假开始时间不能晚于请假结束时间" );
button_backs( $_REQUEST['id'] );
exit( );
}
$query = "select * from ATTEND_OUT ";
if ( $_REQUEST['keywords'] != "" && $where_str == "" )
{
$where_str .= "where OUT_TYPE like '%".$_REQUEST['keywords']."%' ";
}
if ( $_REQUEST['time_start'] != "" )
{
if ( $where_str != "" )
{
$where_str .= "and time_to_sec(OUT_TIME1) >= time_to_sec('".$_REQUEST['time_start']."') ";
}
else
{
$where_str .= "where time_to_sec(OUT_TIME1) >= time_to_sec('".$_REQUEST['time_start']."') ";
}
}
if ( $_REQUEST['time_end'] != "" )
{
if ( $where_str != "" )
{
$where_str .= "and time_to_sec(OUT_TIME2) <= time_to_sec('".$_REQUEST['time_end']."') ";
}
else
{
$where_str .= "where time_to_sec(OUT_TIME2) <= time_to_sec('".$_REQUEST['time_end']."') ";
}
}
if ( $_REQUEST['TO_ID'] != "" )
{
$to_id = ",".$_REQUEST['TO_ID'];
$to_id_str = str_replace( ",", "','", $to_id );
$to_id_str = substr( $to_id_str, 2 );
$to_id_str = substr( $to_id_str, 0, strlen( $to_id_str ) - 2 );
if ( $where_str != "" )
{
$where_str .= "and USER_ID IN (".$to_id_str.")";
}
else
{
$where_str .= "where USER_ID IN (".$to_id_str.")";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -