Beispiel #1
0
        trigger_error('entry: cannot insert timestamp into info record. ' . mysql_error(), E_USER_WARNING);
    }
    # Uncomment next to display success message. The entry status display also shows last punch-in/out.
    #$msg .= "<span color=\"$h_color\">$h_inout</span> time entry recorded.\n";
    // Fall through to re-enter next punch-in/out time.
}
////////////////////////////////////////
// Display the entry form.
$PAGE_TITLE = "My Time Entry - {$title}";
if ($entry_display_timecard == 'yes') {
    // Summarize employee hours for the current week.
    list($today_hours, $week_hours, $overtime_hours) = current_week_hours($empfullname);
    if ($timecard_display_hours_minutes == 'yes') {
        $today_hours = hrs_min($today_hours) . " hrs:min";
        $week_hours = hrs_min($week_hours) . " hrs:min";
        $overtime_hours = hrs_min($overtime_hours) . " hrs:min";
    } else {
        $today_hours = sprintf("%01.02f hrs", $today_hours);
        $week_hours = sprintf("%01.02f hrs", $week_hours);
        $overtime_hours = sprintf("%01.02f hrs", $overtime_hours);
    }
    $overtime_line = $overtime_hours > 0 ? "\n<tr><th>Overtime:</th><td>{$overtime_hours}</td></tr>\n" : '';
    $current_week_summary = <<<End_Of_HTML

<div class="hours-summary">
<table>
<tr><th>Today:</th><td>{$today_hours}</td></tr>
<tr><th>This Week:</th><td>{$week_hours}</td></tr>{$overtime_line}
<tr><td colspan="2"><a href="timecard.php?emp={$u_empfullname}" target="_blank">Timecard</a></td></tr>
</table>
</div>
    function print_footer($tc)
    {
        global $timecard_display_running_total, $timecard_hours_include_overtime;
        global $timecard_display_hours_minutes, $overtime_week_limit;
        // Set flag to print paragraph of totals if they're not already obvious.
        $print_totals = $timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" ? true : false;
        $h_total_hours = sprintf("%01.02f", $tc->week_hours + $tc->overtime_hours);
        $h_totals = $print_totals ? "\n<p>Total for week: " . hrs_min($tc->week_hours + $tc->overtime_hours) . " ({$h_total_hours} hours)</p>" : '';
        $h_ovt_total_hours = sprintf("%01.02f", $tc->overtime_hours);
        $h_overtime_totals = $print_totals && $tc->overtime_hours > 0 ? "\n<p>Total overtime: " . hrs_min($tc->overtime_hours) . " ({$h_ovt_total_hours} hours)</p>" : '';
        $h_day_total_hours = sprintf("%01.02f", $tc->today_hours);
        $h_today_hours = $tc->today_hours !== null ? "<p>Total today: " . hrs_min($tc->today_hours) . " ({$h_day_total_hours} hours)</p>" : '';
        if ($timecard_display_running_total != "yes") {
            // Print row of totals
            $total_hours = $timecard_hours_include_overtime == "yes" ? $tc->week_hours + $tc->overtime_hours : $tc->week_hours;
            $h_hours = $timecard_display_hours_minutes == "yes" ? hrs_min($total_hours) : $h_total_hours;
            $overtime_col = $overtime_week_limit > 0 ? "\n    <td align=\"right\" class=\"ovt\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->overtime_hours) : $h_ovt_total_hours) . "</td>" : '';
            $total_col = $timecard_display_running_total == "yes" ? "\n    <td align=\"right\" class=\"total\">" . ($timecard_display_hours_minutes == "yes" ? hrs_min($tc->week_hours + $tc->overtime_hours) : $h_total_hours) . "</td>" : '';
            print <<<End_Of_HTML
  <tr class="total_row">
    <td align="left"></td>
    <td align="right"></td>
    <td align="right"></td>
    <td align="right" class="hrs">{$h_hours}</td>{$overtime_col}{$total_col}
    <td align="left" class="notes"></td>
  </tr>
End_Of_HTML;
        }
        print <<<End_Of_HTML
  </tbody>
</table>
End_Of_HTML;
        if ($timecard_display_running_total == "yes" || $timecard_hours_include_overtime != "yes" || $h_today_hours) {
            // Add totals text if totals are not already displayed or if summing the hours column is confusing.
            print <<<End_Of_HTML

<div class="totals">
{$h_today_hours}{$h_totals}{$h_overtime_totals}
</div>

End_Of_HTML;
        }
    }
require_once 'config.inc.php';
require_once 'lib.common.php';
// Configuration variables.
global $timefmt, $datefmt, $timecard_display_hours_minutes;
// Get status
list($in_or_out, $color, $inout, $timestamp, $notes) = get_employee_status($empfullname);
// Compute hours
$punch_time = local_timestamp($timestamp);
$hours = compute_hours($punch_time, local_timestamp());
$h_color = htmlentities($color);
$h_inout = htmlentities($inout);
$h_time = date($timefmt, $punch_time);
$h_date = date($datefmt, $punch_time);
if ($in_or_out == 1) {
    if ($timecard_display_hours_minutes == "yes") {
        $h_hours = hrs_min($hours);
    } else {
        $h_hours = sprintf("%01.02f", $hours);
    }
} else {
    $h_hours = '';
}
$h_notes = htmlentities($notes);
?>
<table class="misc_items timecard_list" border="0" cellpadding="2" cellspacing="0" style="margin:0 auto;">
    <thead>
    <tr>
        <th align="left">In/Out</th>
        <th align="center">Time</th>
        <th align="center">Date</th>
        <th align="center" class="hrs" title="Regular work hours.">Hrs</th>