📄 total_hours.php
字号:
$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]."' and ".$db_prefix."employees.empfullname <> 'admin' 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]); $x_info_date[] = date($datefmt, $info_timestamp[$y]); $info_date[] = date('n/j/y', $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; $row_color = $color2; // Initial row color if (empty($y)) { $yy = 0; $date_formatted = date('l, ', $info_timestamp[$y]); } else { $yy = $y - 1; $date_formatted = date('l, ', $info_timestamp[$y]); } echo " <tr bgcolor=\"$row_color\" align=\"left\"><td style=\"color:#000000;border-style:solid;border-color:#888888; border-width:1px 0px 0px 0px;\" nowrap>$date_formatted$x_info_date[$y]</td>\n"; if ($hours < 10) { echo " <td nowrap style='color:#000000;padding-left:31px;border-style:solid;border-color:#888888; border-width:1px 0px 0px 0px;'>$hours</td></tr>\n"; } else { echo " <td nowrap style='color:#000000;padding-left:25px;border-style:solid;border-color:#888888; border-width:1px 0px 0px 0px;'>$hours</td></tr>\n"; } $row_color = ($row_color == $color1) ? $color2 : $color1; $row_count++; if ($tmp_show_details == "1") { echo " <tr><td width=100% colspan=2>\n"; echo "<table width=100% align=center class=misc_items border=0 cellpadding=0 cellspacing=0>\n"; for ($z=$tmp_z;$z<=$punch_cnt;$z++) { $time_formatted = date($timefmt, $info_timestamp[$z]); echo " <tr bgcolor=\"$row_color\" align=\"left\">\n"; echo " <td align=left width=13% nowrap style=\"color:$punchlist_color[$z];\">$info_inout[$z]</td>\n"; echo " <td nowrap align=right width=10% style='padding-right:25px;'>$time_formatted</td>\n"; if (@$tmp_display_ip == "1") { echo " <td nowrap align=left width=15% style='padding-right:25px; color:$punchlist_color[$z];'>$info_ipaddress[$z]</td>\n"; } echo " <td width=77%>$info_notes[$z]</td></tr>\n"; $row_color = ($row_color == $color1) ? $color2 : $color1; $row_count++; $tmp_z++; } echo "</table></td></tr>\n"; if ($row_count >= "40") { $row_count = "0"; $page_count++; $temp_page_count = $page_count + 1; if (!empty($tmp_paginate)) { echo "<tr style='page-break-before:always;'><td width=100% colspan=2>\n"; echo "<table width=100% align=center class=misc_items border=0 cellpadding=3 cellspacing=0>\n"; echo " <tr><td class=notdisplay_rpt width=80% style='font-size:9px;color:#000000;'>Run on: $rpt_time, $rpt_date (page $temp_page_count)</td> <td class=notdisplay_rpt nowrap style='font-size:9px;color:#000000;'>$rpt_name</td></tr>\n"; echo " <tr><td width=80%></td><td class=notdisplay_rpt nowrap style='font-size:9px;color:#000000;'>Date Range: $from_date - $to_date</td></tr>\n"; echo "</table></td></tr>\n"; if (strtolower($user_or_display) == "display") { echo " <tr><td class=notdisplay_rpt width=100% colspan=2 style=\"font-size:11px;color:#000000;border-style:solid;border-color:#888888; border-width:0px 0px 1px 0px;\"><b>$employees_displayname[$x]</b> (cont'd)</td></tr>\n"; } else { echo " <tr><td class=notdisplay_rpt width=100% colspan=2 style=\"font-size:11px;color:#000000;border-style:solid;border-color:#888888; border-width:0px 0px 1px 0px;\"><b>$employees_empfullname[$x]</b> (cont'd)</td></tr>\n"; } echo " <tr><td width=75% class=notdisplay_rpt nowrap align=left style='color:#27408b;'><b><u>Date</u></b></td>\n"; echo " <td width=25% class=notdisplay_rpt nowrap align=left style='color:#27408b;'><b><u>Hours Worked</u></b></td></tr>\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)) && ($x_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) && ($x_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]); }// if (($info_timestamp[$y] <= $rpt_stamp) && ($x_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';// } 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; $row_color = $color2; // Initial row color if ((empty($y)) || ($y == $info_cnt -1)) { $yy = 0; $date_formatted = date('l, ', $info_timestamp[$y]); } else { $yy = $y - 1; $date_formatted = date('l, ', $info_timestamp[$y-1]); } echo " <tr bgcolor=\"$row_color\" align=\"left\"><td style=\"color:#000000;border-style:solid;border-color:#888888; border-width:1px 0px 0px 0px;\" nowrap>$date_formatted$x_info_date[$y]</td>\n"; if ($hours < 10) { echo " <td nowrap style='color:#000000;padding-left:31px;border-style:solid;border-color:#888888; border-width:1px 0px 0px 0px;'>$hours</td></tr>\n"; } else { echo " <td nowrap style='color:#000000;padding-left:25px;border-style:solid;border-color:#888888; border-width:1px 0px 0px 0px;'>$hours</td></tr>\n"; } $row_color = ($row_color == $color1) ? $color2 : $color1; $row_count++; if ($tmp_show_details == "1") { echo " <tr><td width=100% colspan=2>\n"; echo "<table width=100% align=center class=misc_items border=0 cellpadding=0 cellspacing=0>\n"; for ($z=$tmp_z;$z<=$punch_cnt;$z++) { $time_formatted = date($timefmt, $info_timestamp[$z]); echo " <tr bgcolor=\"$row_color\" align=\"left\">\n"; echo " <td align=left width=13% nowrap style=\"color:$punchlist_color[$z];\">$info_inout[$z]</td>\n"; echo " <td nowrap align=right width=10% style='padding-right:25px;'>$time_formatted</td>\n"; if (@$tmp_display_ip == "1") { echo " <td nowrap align=left width=15% style='padding-right:25px; color:$punchlist_color[$z];'>$info_ipaddress[$z]</td>\n"; } echo " <td width=77%>$info_notes[$z]</td></tr>\n"; $row_color = ($row_color == $color1) ? $color2 : $color1; $row_count++; $tmp_z++; } echo "</table></td></tr>\n"; if ($row_count >= "40") { $row_count = "0"; $page_count++; $temp_page_count = $page_count + 1; if (!empty($tmp_paginate)) { echo "<tr style='page-break-before:always;'><td width=100% colspan=2>\n"; echo "<table width=100% align=center class=misc_items border=0 cellpadding=3 cellspacing=0>\n"; echo " <tr><td class=notdisplay_rpt width=80% style='font-size:9px;color:#000000;'>Run on: $rpt_time, $rpt_date (page $temp_page_count)</td> <td class=notdisplay_rpt nowrap style='font-size:9px;color:#000000;'>$rpt_name</td></tr>\n"; echo " <tr><td width=80%></td><td class=notdisplay_rpt nowrap style='font-size:9px;color:#000000;'>Date Range: $from_date - $to_date</td></tr>\n"; echo "</table></td></tr>\n"; if (strtolower($user_or_display) == "display") { echo " <tr><td class=notdisplay_rpt width=100% colspan=2 style=\"font-size:11px;color:#000000;border-style:solid;border-color:#888888; border-width:0px 0px 1px 0px;\"><b>$employees_displayname[$x]</b> (cont'd)</td></tr>\n"; } else { echo " <tr><td class=notdisplay_rpt width=100% colspan=2 style=\"font-size:11px;color:#000000;border-style:solid;border-color:#888888; border-width:0px 0px 1px 0px;\"><b>$employees_empfullname[$x]</b> (cont'd)</td></tr>\n"; } echo " <tr><td width=75% class=notdisplay_rpt nowrap align=left style='color:#27408b;'><b><u>Date</u></b></td>\n"; echo " <td width=25% class=notdisplay_rpt nowrap align=left style='color:#27408b;'><b><u>Hours Worked</u></b></td></tr>\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -