📄 get_csv.php
字号:
$query = "select empfullname, displayname from ".$db_prefix."employees WHERE tstamp IS NOT NULL and empfullname = '".$fullname."' order by displayname asc"; $result = mysql_query($query); } elseif (($office_name != "All") && ($group_name == "All") && ($fullname == "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees where office = '".$office_name."' and tstamp IS NOT NULL order by displayname asc"; $result = mysql_query($query); } elseif (($office_name != "All") && ($group_name != "All") && ($fullname == "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees where office = '".$office_name."' and groups = '".$group_name."' and tstamp IS NOT NULL order by displayname asc"; $result = mysql_query($query); } elseif (($office_name != "All") && ($group_name != "All") && ($fullname != "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees where office = '".$office_name."' and groups = '".$group_name."' and empfullname = '".$fullname."' and tstamp IS NOT NULL order by displayname asc"; $result = mysql_query($query); }} else { if (($office_name == "All") && ($group_name == "All") && ($fullname == "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees WHERE tstamp IS NOT NULL order by empfullname asc"; $result = mysql_query($query); } elseif ((empty($office_name)) && (empty($group_name)) && ($fullname == 'All')) { $query = "select empfullname, displayname from ".$db_prefix."employees WHERE tstamp IS NOT NULL order by empfullname asc"; $result = mysql_query($query); } elseif ((empty($office_name)) && (empty($group_name)) && ($fullname != 'All')) { $query = "select empfullname, displayname from ".$db_prefix."employees WHERE tstamp IS NOT NULL and empfullname = '".$fullname."' order by empfullname asc"; $result = mysql_query($query); } elseif (($office_name != "All") && ($group_name == "All") && ($fullname == "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees where office = '".$office_name."' and tstamp IS NOT NULL order by empfullname asc"; $result = mysql_query($query); } elseif (($office_name != "All") && ($group_name != "All") && ($fullname == "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees where office = '".$office_name."' and groups = '".$group_name."' and tstamp IS NOT NULL order by empfullname asc"; $result = mysql_query($query); } elseif (($office_name != "All") && ($group_name != "All") && ($fullname != "All")) { $query = "select empfullname, displayname from ".$db_prefix."employees where office = '".$office_name."' and groups = '".$group_name."' and empfullname = '".$fullname."' and tstamp IS NOT NULL order by empfullname asc"; $result = mysql_query($query); }}while ($row=mysql_fetch_array($result)) { $employees_empfullname[] = stripslashes("".$row['empfullname'].""); $employees_displayname[] = stripslashes("".$row['displayname'].""); $employees_cnt++;}if ($tmp_show_details == "1") { if (!empty($tmp_display_ip)) { $headings = "Name, In/Out, Time, Date, IP Address, Notes, Daily Totals, Employee Totals,\n"; } else { $headings = "Name, In/Out, Time, Date, Notes, Daily Totals, Employee Totals,\n"; }} else { $headings = "Name, Date, Daily Totals, Employee Totals,\n";}$string = "";for ($x=0;$x<$employees_cnt;$x++) { $fullname = stripslashes($fullname); if (($employees_empfullname[$x] == $fullname) || ($fullname == "All")) { $employees_empfullname[$x] = addslashes($employees_empfullname[$x]); $employees_displayname[$x] = addslashes($employees_displayname[$x]); $query = "select ".$db_prefix."info.fullname, ".$db_prefix."info.`inout`, ".$db_prefix."info.timestamp, ".$db_prefix."info.notes, ".$db_prefix."info.ipaddress, ".$db_prefix."punchlist.in_or_out, ".$db_prefix."punchlist.punchitems, ".$db_prefix."punchlist.color from ".$db_prefix."info, ".$db_prefix."punchlist, ".$db_prefix."employees where ".$db_prefix."info.fullname like ('".$employees_empfullname[$x]."') and ".$db_prefix."info.timestamp >= '".$from_timestamp."' and ".$db_prefix."info.timestamp < '".$to_timestamp."' and ".$db_prefix."info.`inout` = ".$db_prefix."punchlist.punchitems and ".$db_prefix."employees.empfullname = '".$employees_empfullname[$x]."' order by ".$db_prefix."info.timestamp asc"; $result = mysql_query($query); while ($row=mysql_fetch_array($result)) { $info_fullname[] = stripslashes("".$row['fullname'].""); $info_inout[] = "".$row['inout'].""; $info_timestamp[] = "".$row['timestamp']."" + $tzo; $info_notes[] = "".$row['notes'].""; $info_ipaddress[] = "".$row['ipaddress'].""; $punchlist_in_or_out[] = "".$row['in_or_out'].""; $punchlist_punchitems[] = "".$row['punchitems'].""; $punchlist_color[] = "".$row['color'].""; $info_cnt++; } $employees_empfullname[$x] = stripslashes($employees_empfullname[$x]); $employees_displayname[$x] = stripslashes($employees_displayname[$x]); for ($y=0;$y<$info_cnt;$y++) { $info_date[] = date($datefmt, $info_timestamp[$y]); $info_start_time[] = strtotime($info_date[$y]); $info_end_time[] = $info_start_time[$y] + 86399; if (isset($tmp_info_date)) { if ($tmp_info_date == $info_date[$y]) { if (empty($punchlist_in_or_out[$y])) { $punch_cnt++; if ($status == "out") { $secs = $secs + ($info_timestamp[$y] - $out_time); } elseif ($status == "in") { $secs = $secs + ($info_timestamp[$y] - $in_time); } $status = "out"; $out_time = $info_timestamp[$y]; if ($y == $info_cnt - 1) { $hours = secsToHours($secs, $tmp_round_time); $total_hours = $total_hours + $hours; $hours = number_format($hours, 2); if ($tmp_show_details == "1") { for ($z=$tmp_z;$z<=$punch_cnt;$z++) { $time_formatted = date($timefmt, $info_timestamp[$z]); if (strtolower($user_or_display) == "display") { if (!empty($tmp_display_ip)) { if ($z == $punch_cnt) { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n"; } } else { if ($z == $punch_cnt) { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n"; } } } else { if (!empty($tmp_display_ip)) { if ($z == $punch_cnt) { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n"; } } else { if ($z == $punch_cnt) { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n"; } } } $tmp_z++; } } else { if (strtolower($user_or_display) == "display") { $string .= "$employees_displayname[$x], $info_date[$y], $hours, ,\n"; } else { $string .= "$employees_empfullname[$x], $info_date[$y], $hours, ,\n"; } } $secs = 0; $punch_cnt = 0; } } else { $punch_cnt++; if ($y == $info_cnt - 1) { if (($info_timestamp[$y] <= $rpt_stamp) && ($rpt_stamp < ($to_timestamp + $tzo)) && ($info_date[$y] == $rpt_date)) { if ($status == "in") { $secs = $secs + ($rpt_stamp - $info_timestamp[$y]) + ($info_timestamp[$y] - $in_time); } elseif ($status == "out") { $secs = $secs + ($rpt_stamp - $info_timestamp[$y]); } $currently_punched_in = '1'; } elseif (($info_timestamp[$y] <= $rpt_stamp) && ($info_date[$y] == $rpt_date)) { if ($status == "in") { $secs = $secs + (($to_timestamp + $tzo) - $info_timestamp[$y]) + ($info_timestamp[$y] - $in_time); } elseif ($status == "out") { $secs = $secs + (($to_timestamp + $tzo) - $info_timestamp[$y]); } $currently_punched_in = '1'; } else { $secs = $secs + (($info_end_time[$y] + 1) - $info_timestamp[$y]); } } else { if ($status == "in") { $secs = $secs + ($info_timestamp[$y] - $in_time); } $in_time = $info_timestamp[$y]; $previous_days_end_time = $info_end_time[$y] + 1; } $status = "in"; if ($y == $info_cnt - 1) { $hours = secsToHours($secs, $tmp_round_time); $total_hours = $total_hours + $hours; $hours = number_format($hours, 2); if ($tmp_show_details == "1") { for ($z=$tmp_z;$z<=$punch_cnt;$z++) { $time_formatted = date($timefmt, $info_timestamp[$z]); if (strtolower($user_or_display) == "display") { if (!empty($tmp_display_ip)) { if ($z == $punch_cnt) { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n"; } } else { if ($z == $punch_cnt) { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_displayname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n"; } } } else { if (!empty($tmp_display_ip)) { if ($z == $punch_cnt) { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_ipaddress[$z], $info_notes[$z], , ,\n"; } } else { if ($z == $punch_cnt) { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], $hours, ,\n"; } else { $string .= "$employees_empfullname[$x], $info_inout[$z], $time_formatted, $info_date[$y], $info_notes[$z], , ,\n"; } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -