[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: timetrack addjobdetail.php,1.18.2.1,1.18.2.2 cha
From: |
Mark A Peters <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: timetrack addjobdetail.php,1.18.2.1,1.18.2.2 changeprofile.php,1.8.2.1,1.8.2.2 hr-profiles.php,1.8.2.1,1.8.2.2 index.php,1.8.2.2,1.8.2.3 timesheets.php,1.16.2.1,1.16.2.2 |
Date: |
Sun, 22 Sep 2002 15:58:05 -0400 |
Update of /cvsroot/phpgroupware/timetrack
In directory subversions:/tmp/cvs-serv22728
Modified Files:
Tag: Version-0_9_14-branch
addjobdetail.php changeprofile.php hr-profiles.php index.php
timesheets.php
Log Message:
GNU Patch #529.
Index: addjobdetail.php
===================================================================
RCS file: /cvsroot/phpgroupware/timetrack/addjobdetail.php,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -C2 -r1.18.2.1 -r1.18.2.2
*** addjobdetail.php 14 Mar 2002 19:26:33 -0000 1.18.2.1
--- addjobdetail.php 22 Sep 2002 19:58:02 -0000 1.18.2.2
***************
*** 226,230 ****
</tr>
<tr>
! <td><?php echo "Billable"; ?></td>
<!-- This could just be a checkbox, default to True for
billable -->
<td><input type="checkbox" name="n_billable" value="True"
CHECKED></td>
--- 226,230 ----
</tr>
<tr>
! <td><?php echo lang('Billable'); ?></td>
<!-- This could just be a checkbox, default to True for
billable -->
<td><input type="checkbox" name="n_billable" value="True"
CHECKED></td>
Index: changeprofile.php
===================================================================
RCS file: /cvsroot/phpgroupware/timetrack/changeprofile.php,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -r1.8.2.1 -r1.8.2.2
*** changeprofile.php 14 Mar 2002 19:26:33 -0000 1.8.2.1
--- changeprofile.php 22 Sep 2002 19:58:02 -0000 1.8.2.2
***************
*** 75,84 ****
<tr>
<td colspan="2"><center><b><?php echo lang("Employee Profile for");
! echo get_fullname($GLOBALS['phpgw_info']["user"]["userid"]);?>
</b></center></td>
<td> </td>
</tr>
<tr>
! <td>Title:</td>
<td><input name="title" value="<?php echo $n_title; ?>"></td>
<td rowspan="2">
--- 75,84 ----
<tr>
<td colspan="2"><center><b><?php echo lang("Employee Profile for");
! echo ' '.get_fullname($GLOBALS['phpgw_info']["user"]["userid"]);?>
</b></center></td>
<td> </td>
</tr>
<tr>
! <td><?php echo lang('Title'); ?>:</td>
<td><input name="title" value="<?php echo $n_title; ?>"></td>
<td rowspan="2">
***************
*** 97,105 ****
<tr>
! <td>Phone number:</td>
<td><input name="phone_number" value="<?php echo $n_phone_number;
?>"></td>
</tr>
<tr>
<td>Mobile number:</td>
<td><input name="mobilephn" value="<?php echo $n_mobilephn; ?>"></td>
--- 97,106 ----
<tr>
! <td><?php echo lang('Work Phone'); ?>:</td>
<td><input name="phone_number" value="<?php echo $n_phone_number;
?>"></td>
</tr>
<tr>
+ <td><?php echo lang('Mobile Phone'); ?>:</td>
<td>Mobile number:</td>
<td><input name="mobilephn" value="<?php echo $n_mobilephn; ?>"></td>
***************
*** 107,111 ****
<tr>
! <td>Pager number:</td>
<td><input name="pager" value="<?php echo $n_pager; ?>"></td>
</tr>
--- 108,112 ----
<tr>
! <td><?php echo lang('Pager'); ?>:</td>
<td><input name="pager" value="<?php echo $n_pager; ?>"></td>
</tr>
Index: hr-profiles.php
===================================================================
RCS file: /cvsroot/phpgroupware/timetrack/hr-profiles.php,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -r1.8.2.1 -r1.8.2.2
*** hr-profiles.php 14 Mar 2002 19:26:33 -0000 1.8.2.1
--- hr-profiles.php 22 Sep 2002 19:58:02 -0000 1.8.2.2
***************
*** 173,177 ****
$tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
echo '<tr><td align="left" bgcolor="' . $tr_color . '" width="50%">'
! . lang("Dated Hired") . ':</td>'
. '<td align="right" width="50%" bgcolor="' . $tr_color . '">'
. $hired . '</td></tr>';
--- 173,177 ----
$tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
echo '<tr><td align="left" bgcolor="' . $tr_color . '" width="50%">'
! . lang("Date Hired") . ':</td>'
. '<td align="right" width="50%" bgcolor="' . $tr_color . '">'
. $hired . '</td></tr>';
Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/timetrack/index.php,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -C2 -r1.8.2.2 -r1.8.2.3
*** index.php 16 Mar 2002 22:40:17 -0000 1.8.2.2
--- index.php 22 Sep 2002 19:58:02 -0000 1.8.2.3
***************
*** 1,165 ****
! <?php
!
! /**************************************************************************\
! * phpgwtimetrack - phpGroupWare addon application *
! * http://phpgwtimetrack.sourceforge.net *
! * Written by Robert Schader <address@hidden> *
! * -------------------------------------------- *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! $GLOBALS['phpgw_info'] = array();
! $GLOBALS['phpgw_info']["flags"]["enable_nextmatchs_class"] = "True";
! $GLOBALS['phpgw_info']["flags"]["currentapp"] = "timetrack";
!
! include("../header.inc.php");
!
! // Add simple test here to check for complete installation of timetrack
! $n_group = "TTrack_Managers";
! if (!$GLOBALS['phpgw']->accounts->exists($n_group))
! {
! echo '<center><br><br><b>Warning: Timetrack has detected that required
post installation<br>'
! . "steps have not been performed yet. Please <a href=\""
! . $GLOBALS['phpgw']->link("/timetrack/admin5.php") .
"\">"
! . lang("Click Here") . "</a> to complete installation.";
! $GLOBALS['phpgw']->common->phpgw_footer();
! $GLOBALS['phpgw']->common->phpgw_exit();
!
! }
!
! // Add test here to check version of phpgwtimetrack
! //$GLOBALS['phpgw']->db->query("SELECT app_version from phpgw_applications
where app_name='timetrack'");
! //$GLOBALS['phpgw']->db->next_record();
! //if($GLOBALS['phpgw']->db->f(0) == "0.1") {
! // We need to upgrade.
! // echo "<center>Your Timetrack tables need to be updated for this
version.<br>";
! // echo "If you are a member of the 'Admin' group, you may <a href=\""
! // . $GLOBALS['phpgw']->link("/timetrack/setup/index.php") . "\">"
! // . lang("Click Here") . "</a> to upgrade";
! // $GLOBALS['phpgw']->common->phpgw_footer();
! // $GLOBALS['phpgw']->common->phpgw_exit();
! //}
!
! if ($submit) {
! //echo "Status is: " . $status;
! //echo " UID is: " . $uid;
! $GLOBALS['phpgw']->db->query("UPDATE phpgw_ttrack_emplyprof SET
inorout='$status' "
! . "WHERE id=$uid");
! }
! ?>
! <center><h3><?php echo lang("Employee In/Out Board"); ?></h3></center>
! <? /* Here I have to do my first query, to check the user's checkin
status */
! $uid = $GLOBALS['phpgw_info']["user"]["account_id"];
! /* Now use the uid to reference the employee_stats.inorout field */
! $GLOBALS['phpgw']->db->query("select inorout from
phpgw_ttrack_emplyprof"
! . " where id= " . $uid);
! $GLOBALS['phpgw']->db->next_record();
! $status = $GLOBALS['phpgw']->db->f("inorout");
! $prefix = lang("you are currently checked");
! switch ($status) {
! case "I":
! $stat_word = lang("In");
! $action = lang("Check Out");
! $suffix = lang("when you leave work");
! $togval = "O";
! break;
! default:
! $stat_word = lang("Out");
! $action = lang("Check In");
! $suffix = lang("while you are at work");
! $togval = "I";
! break;
! }
! // This part will display basically a form with only a submit
! // button with the appropriate text to set in or out status.
! ?>
! <form method="POST" action="<?php echo
$GLOBALS['phpgw']->link("/timetrack/index.php");?>">
! <input type=hidden name=uid value="<?php echo $uid; ?>">
! <input type=hidden name=status value="<?php echo $togval; ?>">
! <center><h4>
! <?php echo $GLOBALS['phpgw_info']["user"]["firstname"] . ", " .
$prefix . " " . $stat_word
! . ", Please "; ?>
! <input type="submit" name="submit" value="<?php echo $action;?>">
! <?php echo " " . $suffix; ?>
! </center></h4>
! </form>
!
! <?php
! $main_locations=2; // All the rest of locations will eventually be treated
as "Other"
!
! // For this to work right, the first thing I need to do is fill an array
with the location names.
! $GLOBALS['phpgw']->db->query("select * from phpgw_ttrack_locations");
! while ($GLOBALS['phpgw']->db->next_record()) {
! $loc_id = $GLOBALS['phpgw']->db->f("location_id");
! $n_location[$loc_id] = $GLOBALS['phpgw']->db->f("location_name");
! }
! $total_locations = $loc_id; // tested, works
!
! $locations_per_row = 3; //should probably be in a config or preference file
later.
! // Inner table width percentages:
! $itable_width = floor(100 / $locations_per_row);
! // Following needed to handle odd number of locations:
! $num_rows = ceil($total_locations / $locations_per_row);
! ?>
! <table border="0" width="100%">
! <?php
! for ($row = 0; $row < $num_rows; $row++)
! {
! echo '<tr valign="top">';
! for ($loc = 1; $loc <= $locations_per_row; $loc++)
! {
! $loc_id = $loc + ($row * $locations_per_row);
! echo '<td width="' . $itable_width . '%">';
! echo '<table border="0" valign="top" width="100%">';
! echo '<tr><th colspan="3" bgcolor="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"]
! . '" align="center">'
! . $n_location[$loc_id] . '</th></tr>';
! // more td's for this location table go here
! // sql query for selecting all users from one location, need
to access both
! // the accounts and profiles tables using a join, order by,
and ?
! $loc_sql = "select id,lid,inorout "
! . "from phpgw_ttrack_emplyprof "
! . "where location_id = " . $loc_id
! . " order by lid";
! // Now do a while loop on the resultset and print a
! // row (name, inorout) for each result
! $GLOBALS['phpgw']->db->query($loc_sql);
! $t = 0;
! while ($GLOBALS['phpgw']->db->next_record()) {
! $id[$t] = $GLOBALS['phpgw']->db->f("id");
! $in_out[$t] = $GLOBALS['phpgw']->db->f("inorout");
! switch($in_out[$t]){
! case "I":
! $inout_word[$t] = lang("In");
! break;
! default:
! $inout_word[$t] = lang("Out");
! break;
! }
! $t++;
! }
! for($i=0; $i<$t; $i++) {
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
!
! echo '<tr>';
! echo ' <td colspan="2" bgcolor="' . $tr_color . '">' .
! get_fullname($id[$i]) . '</td>';
! echo ' <td bgcolor="' . $tr_color . '" align="center">'
! . $inout_word[$i] . '</td>';
! }
! // End it with end td and end table when done:
! echo '</table></td>';
! }
! echo '</tr>';
! }
! echo '</table>';
! ?>
!
! <?php
! $GLOBALS['phpgw']->common->phpgw_footer();
! ?>
--- 1,164 ----
! <?php
!
! /**************************************************************************\
! * phpgwtimetrack - phpGroupWare addon application *
! * http://phpgwtimetrack.sourceforge.net *
! * Written by Robert Schader <address@hidden> *
! * -------------------------------------------- *
! * This program is free software; you can redistribute it and/or modify it *
! * under the terms of the GNU General Public License as published by the *
! * Free Software Foundation; either version 2 of the License, or (at your *
! * option) any later version. *
! \**************************************************************************/
!
! /* $Id$ */
!
! $GLOBALS['phpgw_info'] = array();
! $GLOBALS['phpgw_info']["flags"]["enable_nextmatchs_class"] = "True";
! $GLOBALS['phpgw_info']["flags"]["currentapp"] = "timetrack";
!
! include("../header.inc.php");
!
! // Add simple test here to check for complete installation of timetrack
! $n_group = "TTrack_Managers";
! if (!$GLOBALS['phpgw']->accounts->exists($n_group))
! {
! echo '<center><br><br><b>Warning: Timetrack has detected that required
post installation<br>'
! . "steps have not been performed yet. Please <a href=\""
! . $GLOBALS['phpgw']->link("/timetrack/admin5.php") .
"\">"
! . lang("Click Here") . "</a> to complete installation.";
! $GLOBALS['phpgw']->common->phpgw_footer();
! $GLOBALS['phpgw']->common->phpgw_exit();
!
! }
!
! // Add test here to check version of phpgwtimetrack
! //$GLOBALS['phpgw']->db->query("SELECT app_version from phpgw_applications
where app_name='timetrack'");
! //$GLOBALS['phpgw']->db->next_record();
! //if($GLOBALS['phpgw']->db->f(0) == "0.1") {
! // We need to upgrade.
! // echo "<center>Your Timetrack tables need to be updated for this
version.<br>";
! // echo "If you are a member of the 'Admin' group, you may <a href=\""
! // . $GLOBALS['phpgw']->link("/timetrack/setup/index.php") . "\">"
! // . lang("Click Here") . "</a> to upgrade";
! // $GLOBALS['phpgw']->common->phpgw_footer();
! // $GLOBALS['phpgw']->common->phpgw_exit();
! //}
!
! if ($submit) {
! //echo "Status is: " . $status;
! //echo " UID is: " . $uid;
! $GLOBALS['phpgw']->db->query("UPDATE phpgw_ttrack_emplyprof SET
inorout='$status' "
! . "WHERE id=$uid");
! }
! ?>
! <center><h3><?php echo lang("Employee In/Out Board"); ?></h3></center>
! <? /* Here I have to do my first query, to check the user's checkin
status */
! $uid = $GLOBALS['phpgw_info']["user"]["account_id"];
! /* Now use the uid to reference the employee_stats.inorout field */
! $GLOBALS['phpgw']->db->query("select inorout from
phpgw_ttrack_emplyprof"
! . " where id= " . $uid);
! $GLOBALS['phpgw']->db->next_record();
! $status = $GLOBALS['phpgw']->db->f("inorout");
! $prefix = lang("you are currently checked");
! switch ($status) {
! case "I":
! $stat_word = lang("In");
! $action = lang("Check Out");
! $suffix = lang("when you leave work");
! $togval = "O";
! break;
! default:
! $stat_word = lang("Out");
! $action = lang("Check In");
! $suffix = lang("while you are at work");
! $togval = "I";
! break;
! }
! // This part will display basically a form with only a submit
! // button with the appropriate text to set in or out status.
! ?>
! <form method="POST" action="<?php echo
$GLOBALS['phpgw']->link("/timetrack/index.php");?>">
! <input type=hidden name=uid value="<?php echo $uid; ?>">
! <input type=hidden name=status value="<?php echo $togval; ?>">
! <center><h4>
! <?php echo $GLOBALS['phpgw_info']["user"]["firstname"] . ", " .
$prefix . " " . $stat_word . ', '.lang('Please').' '; ?>
! <input type="submit" name="submit" value="<?php echo $action;?>">
! <?php echo " " . $suffix; ?>
! </center></h4>
! </form>
!
! <?php
! $main_locations=2; // All the rest of locations will eventually be treated
as "Other"
!
! // For this to work right, the first thing I need to do is fill an array
with the location names.
! $GLOBALS['phpgw']->db->query("select * from phpgw_ttrack_locations");
! while ($GLOBALS['phpgw']->db->next_record()) {
! $loc_id = $GLOBALS['phpgw']->db->f("location_id");
! $n_location[$loc_id] = $GLOBALS['phpgw']->db->f("location_name");
! }
! $total_locations = $loc_id; // tested, works
!
! $locations_per_row = 3; //should probably be in a config or preference file
later.
! // Inner table width percentages:
! $itable_width = floor(100 / $locations_per_row);
! // Following needed to handle odd number of locations:
! $num_rows = ceil($total_locations / $locations_per_row);
! ?>
! <table border="0" width="100%">
! <?php
! for ($row = 0; $row < $num_rows; $row++)
! {
! echo '<tr valign="top">';
! for ($loc = 1; $loc <= $locations_per_row; $loc++)
! {
! $loc_id = $loc + ($row * $locations_per_row);
! echo '<td width="' . $itable_width . '%">';
! echo '<table border="0" valign="top" width="100%">';
! echo '<tr><th colspan="3" bgcolor="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"]
! . '" align="center">'
! . $n_location[$loc_id] . '</th></tr>';
! // more td's for this location table go here
! // sql query for selecting all users from one location, need
to access both
! // the accounts and profiles tables using a join, order by,
and ?
! $loc_sql = "select id,lid,inorout "
! . "from phpgw_ttrack_emplyprof "
! . "where location_id = " . $loc_id
! . " order by lid";
! // Now do a while loop on the resultset and print a
! // row (name, inorout) for each result
! $GLOBALS['phpgw']->db->query($loc_sql);
! $t = 0;
! while ($GLOBALS['phpgw']->db->next_record()) {
! $id[$t] = $GLOBALS['phpgw']->db->f("id");
! $in_out[$t] = $GLOBALS['phpgw']->db->f("inorout");
! switch($in_out[$t]){
! case "I":
! $inout_word[$t] = lang("In");
! break;
! default:
! $inout_word[$t] = lang("Out");
! break;
! }
! $t++;
! }
! for($i=0; $i<$t; $i++) {
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
!
! echo '<tr>';
! echo ' <td colspan="2" bgcolor="' . $tr_color . '">' .
! get_fullname($id[$i]) . '</td>';
! echo ' <td bgcolor="' . $tr_color . '" align="center">'
! . $inout_word[$i] . '</td>';
! }
! // End it with end td and end table when done:
! echo '</table></td>';
! }
! echo '</tr>';
! }
! echo '</table>';
! ?>
!
! <?php
! $GLOBALS['phpgw']->common->phpgw_footer();
! ?>
Index: timesheets.php
===================================================================
RCS file: /cvsroot/phpgroupware/timetrack/timesheets.php,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -C2 -r1.16.2.1 -r1.16.2.2
*** timesheets.php 14 Mar 2002 19:26:33 -0000 1.16.2.1
--- timesheets.php 22 Sep 2002 19:58:02 -0000 1.16.2.2
***************
*** 15,208 ****
// Update complete for phpgroupware 0.9.10 - 4/18/2001 (api calls for
accounts and contacts)
! if ($friendly) {
! $GLOBALS['phpgw_info']["flags"]["noheader"] = True;
! }
!
! $GLOBALS['phpgw_info']["flags"]["enable_nextmatchs_class"] = "True";
! $GLOBALS['phpgw_info']["flags"]["currentapp"] = "timetrack";
! include("../header.inc.php");
!
! if ($friendly) {
! $GLOBALS['phpgw_info']["apps"]["timetrack"]["ismanager"] = 0;
! $GLOBALS['phpgw_info']["apps"]["timetrack"]["ispayroll"] = 0;
!
! $userGroups = $GLOBALS['phpgw']->accounts->membership();
! for ($i=0; $i<count($userGroups); $i++)
! {
! $gname = $userGroups[$i]['account_name'];
! if ($gname == "TTrack_Managers")
! {
! $GLOBALS['phpgw_info']["apps"]["timetrack"]["ismanager"] = 1;
! }
! if ($gname == "TTrack_Payroll")
! {
! $GLOBALS['phpgw_info']["apps"]["timetrack"]["ispayroll"] = 1;
! }
! }
! }
! if(!$n_employee) {
! $n_employee = $GLOBALS['phpgw_info']["user"]["account_id"];
! } else {
! // Code here to verify that the user is allowed
! // Next line MAY not work for printer friendly version
! if ( !$GLOBALS['phpgw_info']["apps"]["timetrack"]["ismanager"] ||
!$GLOBALS['phpgw_info']["apps"]["timetrack"]["ispayroll"])
! {
! if($n_employee != $GLOBALS['phpgw_info']["user"]["account_id"])
! {
! //Need to write to a logfile here
! $hack_log = fopen("/tmp/groupware_breakin_log","a");
! if($hack_log)
! {
! $employee_name =
get_fullname($GLOBALS['phpgw_info']["user"]["account_id"]);
! $spyon_name = get_fullname($n_employee);
! $h_tstr = date("F j, Y, g:i a");
! fputs($hack_log, "$h_tstr : Intrusion attempt by $employee_name
against $spyon_name\n");
! fclose($hack_log);
! }
! $n_employee = $GLOBALS['phpgw_info']["user"]["account_id"];
! echo "<h1><center>You are not authorized to view other employee's
Timesheets</center></h1>";
! echo "<h2><center>Your inappropriate behaviour has been
logged!</center></h2>";
! }
! }
! }
! $employee_name = get_fullname($n_employee);
!
! // Initial Goal: We will need "today's date, use that to determine the date
of the beginning
! // of the week, all weeks will start on Monday and end on Sunday. We should
only allow editing
! // for the current week until it is "POSTED" by an admin in payroll which
should occur no
! // later than the following Monday, but we will need some mechanism to
determine when the data
! // for the last week has been processed and lock out any changes to it
after that. So for now
! // we are only going to concern ourselves with entering data for the
current week.
! if (strlen($date) > 0) {
! $thisyear = substr($date, 0, 4);
! $thismonth = substr($date, 4, 2);
! $thisday = substr($date, 6, 2);
! } else {
! if ($day == 0)
! $thisday = date("d");
! else
! $thisday = $day;
! if ($month == 0)
! $thismonth = date("m");
! else
! $thismonth = $month;
! if ($year == 0)
! $thisyear = date("Y");
! else
! $thisyear = $year;
! }
!
! $next = mktime(2, 0, 0, $thismonth, $thisday + 7, $thisyear);
! $nextyear = date("Y", $next);
! $nextmonth = date("m", $next);
! $nextday = date("d", $next);
! $prev = mktime(2, 0, 0, $thismonth, $thisday - 7, $thisyear);
! $prevyear = date("Y", $prev);
! $prevmonth = date("m", $prev);
! $prevday = date("d", $prev);
!
! // We add 2 hours on to the time so that the switch to DST doesn't
! // throw us off. So, all our dates are 2AM for that day.
! $sun = get_sunday_before($thisyear, $thismonth, $thisday) + 7200;
! $sat = $sun + (3600 * 24 * 7);
! // Our work week starts on Monday and ends on Sunday. Try to compensate for
that:
! $mon = $sun + (3600 * 24);
! $endweek = $sun + (3600 * 24 * 7);
! $nextmon = $mon + (3600 * 24 * 7);
! // For sql queries:
! $start_of_week = date("Y-m-d", $sun); //we are checking for dates greater
than this (i.e. Monday)
! $end_of_week = date("Y-m-d", $nextmon); // we are checking for dates less
than this
!
! // Concept for viewing multiple timesheets by Sten During.
! if(!$friendly && $GLOBALS['phpgw_info']["apps"]["timetrack"]["ispayroll"])
! {
! echo'<form method="POST" name="empname" action="' .
$GLOBALS['phpgw']->link("/timetrack/timesheets.php") . '">';
! echo '<b> ' . lang("Choose a timesheet") . '</b><br> ';
!
! echo '<select name="n_employee"
onChange="document.empname.submit.click()">';
! $names = $GLOBALS['phpgw']->accounts->get_list('accounts');
! for ($i=0; $i<count($names); $i++) {
! $n_employee_id = $names[$i]['account_id'];
! $n_empname = $names[$i]['account_firstname'] . " " .
$names[$i]['account_lastname'];
! echo '<option value="' . $n_employee_id . '"';
! if ($n_employee == $n_employee_id) echo " selected";
! echo '>' . $n_empname . '</option>';
! }
! echo '</select>';
! echo '<input type="hidden" name="year" value="' . $thisyear . '">';
! echo '<input type="hidden" name="month" value="' . $thismonth . '">';
! echo '<input type="hidden" name="day" value="' . $thisday . '">';
! echo'<input type="submit" name="submit" value="' . lang("submit") . '">';
! echo'</form>';
! }
!
! if($friendly)
! {
! echo '<table border=0 width="100%">';
! echo '<tr>';
! echo ' <td width="200"><img src="images/timesheet_logo.gif" border=0></td>';
! echo ' <td><center><h2>Timesheet Entries<br>';
! echo '<font size="-1">for ' . $employee_name . '</font></h2></center></td>';
! echo ' <td width="200"> </td>';
! echo '</tr></table>';
! } else {
! echo '<center><h2>Timesheet Entries<br>';
! echo '<font size="-1">for ' . $employee_name . '</font></h2></center>';
! }
?>
! <TABLE BORDER=0 WIDTH=100%>
! <TR>
<?php
! if (! $friendly) {
! echo '<TD ALIGN="left"><A HREF="' .
$GLOBALS['phpgw']->link("/timetrack/timesheets.php")
! .
"?year=$prevyear&month=$prevmonth&day=$prevday&n_employee=$n_employee\"><<</A></TD>";
! }
?>
! <TD ALIGN="middle"><FONT SIZE="+2" COLOR="<?php echo $H2COLOR;?>"><B>
<?php
! // Bumped up $sun to $mon, $sat to $endweek
! if (date("m", $mon) == date("m", $endweek)) {
! echo strftime("%b %d", $mon) . " - " . strftime("%d, %Y", $endweek);
! } else {
! if (date("Y", $mon) == date("Y", $endweek)) {
! echo strftime("%b %d", $mon) . " - " .
! strftime("%b %d, %Y", $endweek);
! } else {
! echo strftime("%b %d, %Y", $mon) . " - " .
! strftime("%b %d, %Y", $endweek);
! }
! }
?>
! </B></FONT>
! <FONT SIZE="+1" COLOR="<?php echo $H2COLOR;?>">
! </FONT>
! </TD>
<?php
! if (! $friendly) {
! echo '<TD ALIGN="right"><A HREF="' .
$GLOBALS['phpgw']->link("/timetrack/timesheets.php")
! .
"?year=$nextyear&month=$nextmonth&day=$nextday&n_employee=$n_employee\">>></A></TD>";
! }
?>
! </TR>
! </TABLE>
! <TABLE WIDTH=100% BORDER=0 bordercolor=FFFFFF cellspacing=2 cellpadding=2>
! <TR>
<?php
! echo '<TH colspan ="2" WIDTH=22% BGCOLOR="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"] . '"><FONT COLOR="#000000">Job
Number</FONT></TH>';
! echo '<TH WIDTH=24% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Comments</FONT></TH>';
! echo '<TH WIDTH=4% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">C</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Mon</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Tue</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Wed</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Thu</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Fri</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Sat</FONT></TH>';
! echo '<TH WIDTH=6% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Sun</FONT></TH>';
! echo '<TH WIDTH=8% BGCOLOR="' . $GLOBALS['phpgw_info']["theme"]["th_bg"] .
'"><FONT COLOR="#000000">Total</FONT></TH>';
! echo '</TR>';
// In order to go any further, if I am going to do anything like the grid on
our manual timesheet, I will
--- 15,255 ----
// Update complete for phpgroupware 0.9.10 - 4/18/2001 (api calls for
accounts and contacts)
! $GLBOALS['phpgw_info']['flags'] = Array(
! 'currentapp' => 'timetrack',
! 'enable_nextmatchs_class' => True
! );
!
! if (@$GLOBALS['_GET']['friendly'] ||
@$GLOBALS['HTTP_GET_VARS']['friendly'])
! {
! $friendly = 1;
! $GLOBALS['phpgw_info']['flags']['noheader'] = True;
! }
!
! include('../header.inc.php');
!
! if($friendly)
! {
! $GLOBALS['phpgw_info']['apps']['timetrack']['ismanager'] = 0;
! $GLOBALS['phpgw_info']['apps']['timetrack']['ispayroll'] = 0;
!
! $userGroups = $GLOBALS['phpgw']->accounts->membership();
! for ($i=0; $i<count($userGroups); $i++)
! {
! $gname = $userGroups[$i]['account_name'];
! if ($gname == 'TTrack_Managers')
! {
!
$GLOBALS['phpgw_info']['apps']['timetrack']['ismanager'] = 1;
! }
! if ($gname == 'TTrack_Payroll')
! {
!
$GLOBALS['phpgw_info']['apps']['timetrack']['ispayroll'] = 1;
! }
! }
! }
! if(!$n_employee)
! {
! $n_employee = $GLOBALS['phpgw_info']['user']['account_id'];
! }
! else
! {
! // Code here to verify that the user is allowed
! // Next line MAY not work for printer friendly version
! if ( !$GLOBALS['phpgw_info']['apps']['timetrack']['ismanager']
|| !$GLOBALS['phpgw_info']['apps']['timetrack']['ispayroll'])
! {
! if($n_employee !=
$GLOBALS['phpgw_info']['user']['account_id'])
! {
! //Need to write to a logfile here
! $hack_log =
fopen($GLOBALS['phpgw_info']['server']['temp_dir'].'/groupware_breakin_log','a');
! if($hack_log)
! {
! $employee_name =
get_fullname($GLOBALS['phpgw_info']['user']['account_id']);
! $spyon_name = get_fullname($n_employee);
! $h_tstr = date('F j, Y, g:i a');
! fputs($hack_log, "$h_tstr : Intrusion
attempt by $employee_name against $spyon_name\n");
! fclose($hack_log);
! }
! $n_employee =
$GLOBALS['phpgw_info']['user']['account_id'];
! echo '<center>'."\n"
! . ' <h1>You are not authorized to view
other employee\'s Timesheets</h1><br>'."\n"
! . ' <h2>Your inappropriate behaviour
has been logged!</h2>'."\n"
! . '</center>'."\n";
! }
! }
! }
! $employee_name = get_fullname($n_employee);
!
! // Initial Goal: We will need "today's date, use that to determine the
date of the beginning
! // of the week, all weeks will start on Monday and end on Sunday. We
should only allow editing
! // for the current week until it is "POSTED" by an admin in payroll
which should occur no
! // later than the following Monday, but we will need some mechanism to
determine when the data
! // for the last week has been processed and lock out any changes to it
after that. So for now
! // we are only going to concern ourselves with entering data for the
current week.
! if (strlen($date) > 0)
! {
! $thisyear = substr($date, 0, 4);
! $thismonth = substr($date, 4, 2);
! $thisday = substr($date, 6, 2);
! }
! else
! {
! if ($day == 0)
! {
! $thisday = date('d');
! }
! else
! {
! $thisday = $day;
! }
! if ($month == 0)
! {
! $thismonth = date('m');
! }
! else
! {
! $thismonth = $month;
! }
! if ($year == 0)
! {
! $thisyear = date('Y');
! }
! else
! {
! $thisyear = $year;
! }
! }
!
! $next = mktime(2, 0, 0, $thismonth, $thisday + 7, $thisyear);
! $nextyear = date('Y', $next);
! $nextmonth = date('m', $next);
! $nextday = date('d', $next);
! $prev = mktime(2, 0, 0, $thismonth, $thisday - 7, $thisyear);
! $prevyear = date('Y', $prev);
! $prevmonth = date('m', $prev);
! $prevday = date('d', $prev);
!
! // We add 2 hours on to the time so that the switch to DST doesn't
! // throw us off. So, all our dates are 2AM for that day.
! $sun = get_sunday_before($thisyear, $thismonth, $thisday) + 7200;
! $sat = $sun + (3600 * 24 * 7);
! // Our work week starts on Monday and ends on Sunday. Try to compensate
for that:
! $mon = $sun + (3600 * 24);
! $endweek = $sun + (3600 * 24 * 7);
! $nextmon = $mon + (3600 * 24 * 7);
! // For sql queries:
! $start_of_week = date('Y-m-d', $sun); //we are checking for dates
greater than this (i.e. Monday)
! $end_of_week = date('Y-m-d', $nextmon); // we are checking for dates
less than this
+ // Concept for viewing multiple timesheets by Sten During.
+ if(!$friendly &&
$GLOBALS['phpgw_info']['apps']['timetrack']['ispayroll'])
+ {
+ echo '<form method="POST" name="empname" action="' .
$GLOBALS['phpgw']->link('/timetrack/timesheets.php') . '">'."\n"
+ . '<b> ' . lang('Choose a timesheet') .
'</b><br> '."\n"
+ . '<select name="n_employee"
onChange="document.empname.submit.click()">'."\n";
+ $names = $GLOBALS['phpgw']->accounts->get_list('accounts');
+ for ($i=0; $i<count($names); $i++)
+ {
+ $n_employee_id = $names[$i]['account_id'];
+ echo ' <option value="'.$n_employee_id.'"'.($n_employee
== $n_employee_id?' selected':'').'>'.$names[$i]['account_firstname'].'
'.$names[$i]['account_lastname'].'</option>'."\n";
+ }
+ echo '</select>'."\n"
+ . '<input type="hidden" name="year" value="' .
$thisyear . '">'."\n"
+ . '<input type="hidden" name="month" value="' .
$thismonth . '">'."\n"
+ . '<input type="hidden" name="day" value="' . $thisday
. '">'."\n"
+ . '<input type="submit" name="submit" value="' .
lang("submit") . '">'."\n"
+ . '</form>'."\n";
+ }
+
+ if($friendly)
+ {
+ echo '<table border=0 width="100%">'."\n"
+ . '<tr>'."\n"
+ . ' <td width="200"><img
src="'.$GLOBALS['phpgw']->common->image('timetrack','timesheet_logo').'"
border=0></td>'."\n"
+ . ' <td>'."\n"
+ . ' <center>'."\n"
+ . ' <h2>'.lang('Timesheet Entries').'<br><font
size="-1">'.lang('for').' '.$employee_name.'</font></h2>."\n"
+ . ' </center>'."\n"
+ . ' </td>'."\n"
+ . ' <td width="200"> </td>'."\n"
+ . '</tr>."\n"
+ . '</table>'."\n;
+ }
+ else
+ {
+ echo '<center><h2>'.lang('Timesheet Entries').'<br><font
size="-1">'.lang('for').' '.$employee_name.'</font></h2></center>'."\n";
+ }
?>
! <table border="0" width="100%">
! <tr>
<?php
! if (! $friendly)
! {
! echo '<td align="left"><a href="' .
! $GLOBALS['phpgw']->link('/timetrack/timesheets.php',
! Array(
! 'year' => $prevyear,
! 'month' => $prevmonth,
! 'day' => $prevday,
! 'n_employee' => $n_employee
! )
! ).'"><<</a></td>';
! }
?>
! <td align="middle"><font size="+2" color="<?php echo $H2COLOR;?>"><B>
<?php
! // Bumped up $sun to $mon, $sat to $endweek
! if (date('m', $mon) == date('m', $endweek))
! {
! echo strftime('%b %d', $mon) . ' - ' . strftime('%d, %Y',
$endweek);
! }
! else
! {
! if (date('Y', $mon) == date('Y', $endweek))
! {
! echo strftime('%b %d', $mon) . ' - ' . strftime('%b %d,
%Y', $endweek);
! }
! else
! {
! echo strftime('%b %d, %Y', $mon) . ' - ' . strftime('%b
%d, %Y', $endweek);
! }
! }
?>
! </b></font>
! <font size="+1" color="<?php echo $H2COLOR;?>">
! </font>
! </td>
<?php
! if (! $friendly)
! {
! echo '<td align="right"><a href="'
! . $GLOBALS['phpgw']->link('/timetrack/timesheets.php',
! Array(
! 'year' => $nextyear,
! 'month' => $nextmonth,
! 'day' => $nextday,
! 'n_employee' => $n_employee
! )
! ).'">>></a></td>';
! }
?>
! </tr>
! </table>
! <table width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2"
cellpadding="2">
! <tr>
<?php
! echo ' <th colspan ="2" width="22%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font color="#000000">'.lang('Job
Number').'</font></th>'."\n"
! . ' <th width="24%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Comments').'</font></th>'."\n"
! . ' <th width="4%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('C').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Mon').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Tue').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Wed').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Thu').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Fri').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Sat').'</font></th>'."\n"
! . ' <th width="6%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Sun').'</font></th>'."\n"
! . ' <th width="8%" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"><font
color="#000000">'.lang('Total').'</font></th>'."\n"
! . '</tr>'."\n";
// In order to go any further, if I am going to do anything like the grid on
our manual timesheet, I will
***************
*** 217,384 ****
// and work_catagory (hope it works).
! $GLOBALS['phpgw']->db->query("select
jd.detail_id,jd.job_id,jd.work_catagory_id,jd.work_date,"
! . "jd.num_hours,c.company_name,j.job_number,j.job_revision "
! . "from phpgw_ttrack_job_details as jd "
! . "left join phpgw_ttrack_jobs as j on jd.job_id = j.job_id "
! . "left join phpgw_ttrack_customers as c on j.company_id = c.company_id
"
! . "WHERE jd.account_id='$n_employee' "
! . "AND work_date > '$start_of_week' AND work_date < '$end_of_week' "
! . "ORDER BY
c.company_name,j.job_number,j.job_revision,jd.work_catagory_id,jd.work_date asc
");
!
! $counter = 1;
! while ($GLOBALS['phpgw']->db->next_record()) {
! $detail_id[$counter] = $GLOBALS['phpgw']->db->f("detail_id");
! $job_id[$counter] = $GLOBALS['phpgw']->db->f("job_id");
! $workcat[$counter] = $GLOBALS['phpgw']->db->f("work_catagory_id");
! $work_date[$counter] = $GLOBALS['phpgw']->db->f("work_date");
! $num_hours[$counter] = $GLOBALS['phpgw']->db->f("num_hours");
! $comments[$counter] = $GLOBALS['phpgw']->db->f("comments");
! $counter = $counter + 1;
! }
! $num_details = $counter; // -1
! // Loop through all the details
! for($mydetails=1; $mydetails < $num_details; $mydetails++)
! {
! // After we've printed out the first job detail...
! if($mydetails > 1)
! {
! // If this detail is for the same job and same work category as the
previous detail
! // we skip to the next detail.
! if(($job_id[$mydetails] == $job_id[$mydetails -
1])&&($workcat[$mydetails] == $workcat[$mydetails - 1]))
! continue; //skip rest of for loop?
! }
! // Start by printing the Job Number/Customer, Comments and Catagory.
! $GLOBALS['phpgw']->db->query("SELECT
company_id,job_number,job_revision,summary FROM phpgw_ttrack_jobs WHERE job_id
="
! . $job_id[$mydetails]); // should only return one entry.
! $GLOBALS['phpgw']->db->next_record();
! $company_id[$mydetails] = $GLOBALS['phpgw']->db->f("company_id");
! $job_number[$mydetails] = $GLOBALS['phpgw']->db->f("job_number");
! $job_revision[$mydetails] = $GLOBALS['phpgw']->db->f("job_revision");
! $summary[$mydetails] = $GLOBALS['phpgw']->db->f("summary");
! $GLOBALS['phpgw']->db->query("SELECT company_name FROM
phpgw_ttrack_customers WHERE company_id =" . $company_id[$mydetails]);
! $GLOBALS['phpgw']->db->next_record();
! $company_name[$mydetails] = $GLOBALS['phpgw']->db->f("company_name");
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! echo '<tr>';
! echo ' <td width="16%" bgcolor="' . $tr_color . '">' . " " .
$company_name[$mydetails] . '</td>';
! echo ' <td width="6%" align="right" bgcolor="' . $tr_color . '">' .
$job_number[$mydetails]
! . $job_revision[$mydetails] . '</td>';
! echo ' <td width="24%" bgcolor="' . $tr_color . '">' .
$summary[$mydetails] . '</td>';
! echo ' <td width="4%" align="center" bgcolor="' . $tr_color . '">' .
$workcat[$mydetails] . '</td>';
! // The best idea I can come up with so far is to maybe now go back for
each date of the week
! // and re-query the database for entries for that particular job_id and
catagory, filling
! // in the dates as we get hits, then we can also do a SUM query for the
whole week, but we
! // will also need a method to track which entries we have already done.
Since I have sorted
! // the first query results by job_id, work_date and catagory (perhaps it
should be job_id, catagory)
! // I should just be able to test the current index job_id with the last
one (also catagory) and
! // skip it if it is the same.
! for($dayofweek = 1; $dayofweek < 8; $dayofweek++)
! {
! $mydate = $sun + (3600 * 24 * $dayofweek);
! $mydatesql = date("Y-m-d", $mydate);
! // Since I am going to assume there will only be ONE entry per job_id
per day, I have changed
! // the "SUM(num_hours)" from the select statement below to just
"num_hours". This makes more
! // sense for the added link to edit the job_detail for a particular
day and detail_id.
!
! $GLOBALS['phpgw']->db->query("SELECT
num_hours,detail_id,start_time,end_time"
! . " from phpgw_ttrack_job_details WHERE job_id = " .
$job_id[$mydetails]
! . " AND account_id ='" . $n_employee . "'"
! . " AND work_catagory_id = " . $workcat[$mydetails]
! . " AND work_date = '" . $mydatesql . "'");
!
! $GLOBALS['phpgw']->db->next_record();
! $tothours = $GLOBALS['phpgw']->db->f("num_hours");
! $detail_id = $GLOBALS['phpgw']->db->f("detail_id");
! $start_time = $GLOBALS['phpgw']->db->f("start_time");
! $end_time = $GLOBALS['phpgw']->db->f("end_time");
!
! echo ' <td width="6%" align="center" bgcolor="' . $tr_color . '">';
! if ($tothours == "")
! {
! echo " ";
! } else {
! if(! $friendly)
! {
! $st = date("h:i
A",mktime(substr($start_time,0,2),substr($start_time,3,2)));
! $et = date("h:i
A",mktime(substr($end_time,0,2),substr($end_time,3,2)));
! echo '<a href="' .
$GLOBALS['phpgw']->link("/timetrack/editdetail.php", "detailid=" .
$GLOBALS['phpgw']->db->f("detail_id")) . '"'
!
! . " title=\"Start Time: $st, End Time: $et\""
! . " onMouseOver=\"window.status='Start Time: $st, End Time:
$et';return true;\" "
! . "onMouseOut=\"window.status='';return true;\" "
! . '>'
! . $GLOBALS['phpgw']->db->f("num_hours")
! . '</a><br>';
! while ($GLOBALS['phpgw']->db->next_record()) {
! $start_time = $GLOBALS['phpgw']->db->f("start_time");
! $end_time = $GLOBALS['phpgw']->db->f("end_time");
! $st = date("h:i
A",mktime(substr($start_time,0,2),substr($start_time,3,2)));
! $et = date("h:i
A",mktime(substr($end_time,0,2),substr($end_time,3,2)));
! echo '<a href="' .
$GLOBALS['phpgw']->link("/timetrack/editdetail.php", "detailid=" .
$GLOBALS['phpgw']->db->f("detail_id")) . '"'
! . " title = \"Start Time: $st, End Time: $et\" "
! . " onMouseOver=\"window.status='Start Time: $st, End Time:
$et';return true;\" "
! . "onMouseOut=\"window.status='';return true;\" "
! . '>'
! . $GLOBALS['phpgw']->db->f("num_hours")
! . '</a><br>';
! }
! } else {
! // The printer friendly version is not used for editing hours, so
we don't need
! // to provide links to editdetail.php
! $tothours = $GLOBALS['phpgw']->db->f("num_hours");
! while ($GLOBALS['phpgw']->db->next_record()) {
! $tothours = $tothours +
$GLOBALS['phpgw']->db->f("num_hours");
! }
! //echo $tothours;
! printf("%2.2f", $tothours);
! }
! }
! echo "</td>";
! } //end of for loop (days)
! // Weekly Total Hours
! $GLOBALS['phpgw']->db->query("SELECT SUM(num_hours) from
phpgw_ttrack_job_details WHERE job_id = " . $job_id[$mydetails]
! . " AND account_id ='" . $n_employee . "'"
! . " AND work_catagory_id = " . $workcat[$mydetails]
! . " AND work_date > '" . $start_of_week . "' AND work_date < '" .
$end_of_week . "'");
!
! $GLOBALS['phpgw']->db->next_record();
! $weeklyhours = $GLOBALS['phpgw']->db->f(0);
! echo ' <td width="8%" align="center" bgcolor="' . $tr_color . '">' .
$weeklyhours . '</td>';
! echo "</tr>\n";
! } //end for loop($mydetails)
!
! // Now we need to do the bottom row which totals each day and then the
grand total for the week.
! echo '<tr>';
! $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! echo ' <td colspan="4" align="right" bgcolor="' . $tr_color . '">' . 'Daily
Totals' . '</td>';
! $mypayhours = 0.0;
! for($dayofweek = 1; $dayofweek < 8; $dayofweek++)
! {
! $mydate = $sun + (3600 * 24 * $dayofweek);
! $mydatesql = date("Y-m-d", $mydate);
! $GLOBALS['phpgw']->db->query("SELECT SUM(num_hours) from
phpgw_ttrack_job_details WHERE "
! . " account_id ='" . $n_employee . "'"
! . " AND work_date = '" . $mydatesql . "'");
! $GLOBALS['phpgw']->db->next_record();
! $tothours = $GLOBALS['phpgw']->db->f(0);
! if($tothours) $mypayhours += $tothours;
! if ($tothours == "")
! echo ' <td width="6%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"] . '">' . " " . '</td>';
! else
! echo ' <td width="6%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"] . '">'
! . $tothours . '</td>';
! } //end of for loop (days)
! echo ' <td width="8%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"] . '">' . " " . '</td>';
! echo '</tr>';
! echo '<tr>';
! $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! echo ' <td colspan="11" align="right" bgcolor="' . $tr_color . '">' .
'Weekly Total' . '</td>';
! echo ' <td width="8%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']["theme"]["th_bg"] . '">'
! . $mypayhours . '</td>';
?>
! </TABLE>
<?php
--- 264,438 ----
// and work_catagory (hope it works).
! $GLOBALS['phpgw']->db->query("select
jd.detail_id,jd.job_id,jd.work_catagory_id,jd.work_date,"
! . "jd.num_hours,c.company_name,j.job_number,j.job_revision "
! . "from phpgw_ttrack_job_details as jd "
! . "left join phpgw_ttrack_jobs as j on jd.job_id = j.job_id "
! . "left join phpgw_ttrack_customers as c on j.company_id =
c.company_id "
! . "WHERE jd.account_id='$n_employee' "
! . "AND work_date > '$start_of_week' AND work_date <
'$end_of_week' "
! . "ORDER BY
c.company_name,j.job_number,j.job_revision,jd.work_catagory_id,jd.work_date asc
");
!
! $counter = 1;
! while ($GLOBALS['phpgw']->db->next_record())
! {
! $detail_id[$counter] = $GLOBALS['phpgw']->db->f('detail_id');
! $job_id[$counter] = $GLOBALS['phpgw']->db->f('job_id');
! $workcat[$counter] =
$GLOBALS['phpgw']->db->f('work_catagory_id');
! $work_date[$counter] = $GLOBALS['phpgw']->db->f('work_date');
! $num_hours[$counter] = $GLOBALS['phpgw']->db->f('num_hours');
! $comments[$counter] = $GLOBALS['phpgw']->db->f('comments');
! $counter = $counter + 1;
! }
! $num_details = $counter; // -1
! // Loop through all the details
! for($mydetails=1; $mydetails < $num_details; $mydetails++)
! {
! // After we've printed out the first job detail...
! if($mydetails > 1)
! {
! // If this detail is for the same job and same work
category as the previous detail
! // we skip to the next detail.
! if(($job_id[$mydetails] == $job_id[$mydetails -
1])&&($workcat[$mydetails] == $workcat[$mydetails - 1]))
! {
! continue; //skip rest of for loop?
! }
! }
! // Start by printing the Job Number/Customer, Comments and
Catagory.
! $GLOBALS['phpgw']->db->query("SELECT
company_id,job_number,job_revision,summary FROM phpgw_ttrack_jobs WHERE job_id
=". $job_id[$mydetails]); // should only return one entry.
! $GLOBALS['phpgw']->db->next_record();
!
! $company_id[$mydetails] =
$GLOBALS['phpgw']->db->f('company_id');
! $job_number[$mydetails] =
$GLOBALS['phpgw']->db->f('job_number');
! $job_revision[$mydetails] =
$GLOBALS['phpgw']->db->f('job_revision');
! $summary[$mydetails] = $GLOBALS['phpgw']->db->f('summary');
!
! $GLOBALS['phpgw']->db->query("SELECT company_name FROM
phpgw_ttrack_customers WHERE company_id =" . $company_id[$mydetails]);
! $GLOBALS['phpgw']->db->next_record();
!
! $company_name[$mydetails] =
$GLOBALS['phpgw']->db->f('company_name');
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! echo '<tr>'."\n"
! . ' <td width="16%" bgcolor="' . $tr_color . '">' . ' '
. $company_name[$mydetails] . '</td>'."\n"
! . ' <td width="6%" align="right" bgcolor="' . $tr_color
. '">' . $job_number[$mydetails] . $job_revision[$mydetails] . '</td>'."\n"
! . ' <td width="24%" bgcolor="' . $tr_color . '">' .
$summary[$mydetails] . '</td>'."\n"
! . ' <td width="4%" align="center" bgcolor="' .
$tr_color . '">' . $workcat[$mydetails] . '</td>'."\n";
!
! // The best idea I can come up with so far is to maybe now go
back for each date of the week
! // and re-query the database for entries for that particular
job_id and catagory, filling
! // in the dates as we get hits, then we can also do a SUM query
for the whole week, but we
! // will also need a method to track which entries we have
already done. Since I have sorted
! // the first query results by job_id, work_date and catagory
(perhaps it should be job_id, catagory)
! // I should just be able to test the current index job_id with
the last one (also catagory) and
! // skip it if it is the same.
! for($dayofweek = 1; $dayofweek < 8; $dayofweek++)
! {
! $mydate = $sun + (3600 * 24 * $dayofweek);
! $mydatesql = date("Y-m-d", $mydate);
! // Since I am going to assume there will only be ONE
entry per job_id per day, I have changed
! // the "SUM(num_hours)" from the select statement below
to just "num_hours". This makes more
! // sense for the added link to edit the job_detail for
a particular day and detail_id.
!
! $GLOBALS['phpgw']->db->query('SELECT
num_hours,detail_id,start_time,end_time from phpgw_ttrack_job_details WHERE
job_id = ' . $job_id[$mydetails]
! . " AND account_id ='" . $n_employee . "'"
! . ' AND work_catagory_id = ' .
$workcat[$mydetails]
! . " AND work_date = '" . $mydatesql . "'");
! $GLOBALS['phpgw']->db->next_record();
!
! $tothours = $GLOBALS['phpgw']->db->f('num_hours');
! $detail_id = $GLOBALS['phpgw']->db->f('detail_id');
! $start_time = $GLOBALS['phpgw']->db->f('start_time');
! $end_time = $GLOBALS['phpgw']->db->f('end_time');
!
! echo ' <td width="6%" align="center" bgcolor="' .
$tr_color . '">';
! if ($tothours == '')
! {
! echo ' ';
! }
! else
! {
! if(! $friendly)
! {
! $st = date('h:i
A',mktime(substr($start_time,0,2),substr($start_time,3,2)));
! $et = date('h:i
A',mktime(substr($end_time,0,2),substr($end_time,3,2)));
! echo '<a href="' .
$GLOBALS['phpgw']->link('/timetrack/editdetail.php', 'detailid=' .
$GLOBALS['phpgw']->db->f('detail_id')) . '"'
! . ' title="Start Time: '.$st.',
End Time: '.$et.'"'
! . '
onMouseOver="window.status=\'Start Time: '.$st.', End Time: '.$et.'\';return
true;"'
! . '
onMouseOut="window.status=\'\';return true;" >' .
$GLOBALS['phpgw']->db->f('num_hours') . '</a><br>'."\n";
! while
($GLOBALS['phpgw']->db->next_record())
! {
! $start_time =
$GLOBALS['phpgw']->db->f('start_time');
! $end_time =
$GLOBALS['phpgw']->db->f('end_time');
! $st = date('h:i
A',mktime(substr($start_time,0,2),substr($start_time,3,2)));
! $et = date('h:i
A',mktime(substr($end_time,0,2),substr($end_time,3,2)));
! echo '<a href="' .
$GLOBALS['phpgw']->link('/timetrack/editdetail.php', 'detailid=' .
$GLOBALS['phpgw']->db->f('detail_id')) . '"' . ' title = "Start Time: '.$st.',
End Time: '.$et.'" '
! . '
onMouseOver="window.status=\'Start Time: '.$st.', End Time: '.$et.'\';return
true;"'
! . '
onMouseOut="window.status=\'\';return true;" >' .
$GLOBALS['phpgw']->db->f('num_hours') . '</a><br>'."\n";
! }
! }
! else
! {
! // The printer friendly version is not
used for editing hours, so we don't need
! // to provide links to editdetail.php
! $tothours =
$GLOBALS['phpgw']->db->f('num_hours');
! while
($GLOBALS['phpgw']->db->next_record())
! {
! $tothours = $tothours +
$GLOBALS['phpgw']->db->f('num_hours');
! }
! //echo $tothours;
! printf('%2.2f', $tothours);
! }
! }
! echo '</td>'."\n";
! } //end of for loop (days)
! // Weekly Total Hours
! $GLOBALS['phpgw']->db->query('SELECT SUM(num_hours) from
phpgw_ttrack_job_details WHERE job_id = ' . $job_id[$mydetails]
! . " AND account_id ='" . $n_employee . "'"
! . ' AND work_catagory_id = ' . $workcat[$mydetails]
! . " AND work_date > '" . $start_of_week . "' AND
work_date < '" . $end_of_week . "'");
! $GLOBALS['phpgw']->db->next_record();
!
! $weeklyhours = $GLOBALS['phpgw']->db->f(0);
!
! echo ' <td width="8%" align="center" bgcolor="' . $tr_color .
'">' . $weeklyhours . '</td>'."\n";
! echo '</tr>'."\n";
! } //end for loop($mydetails)
!
! // Now we need to do the bottom row which totals each day and then the
grand total for the week.
! echo '<tr>';
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! echo ' <td colspan="4" align="right" bgcolor="' . $tr_color . '">' .
'Daily Totals' . '</td>';
! $mypayhours = 0.0;
! for($dayofweek = 1; $dayofweek < 8; $dayofweek++)
! {
! $mydate = $sun + (3600 * 24 * $dayofweek);
! $mydatesql = date('Y-m-d', $mydate);
! $GLOBALS['phpgw']->db->query('SELECT SUM(num_hours) from
phpgw_ttrack_job_details WHERE '
! . " account_id ='" . $n_employee . "' AND work_date =
'" . $mydatesql . "'");
! $GLOBALS['phpgw']->db->next_record();
! $tothours = $GLOBALS['phpgw']->db->f(0);
! if($tothours)
! {
! $mypayhours += $tothours;
! }
! if ($tothours == '')
! {
! echo ' <td width="6%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"> </td>'."\n";
! }
! else
! {
! echo ' <td width="6%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '">' . $tothours . '</td>'."\n";
! }
! } //end of for loop (days)
! $tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
! echo ' <td width="8%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '"> </td>'."\n"
! . '</tr>'."\n"
! . '<tr>'."\n"
! . ' <td colspan="11" align="right" bgcolor="' . $tr_color .
'">' . lang('Weekly Total') . '</td>'."\n"
! . ' <td width="8%" align="center" bgcolor="' .
$GLOBALS['phpgw_info']['theme']['th_bg'] . '">' . $mypayhours . '</td>'."\n";
?>
! </table>
<?php
***************
*** 391,410 ****
<?php
! if ($thisyear) {
! $yeartext = "year=$thisyear&month=$thismonth&day=$thisday";
! }
! if (! $friendly) {
! echo "<P> <A HREF=\"" .
$GLOBALS['phpgw']->link("/timetrack/timesheets.php","$yeartext&friendly=1&n_employee=$n_employee")
. '"';
! echo ' TARGET="new_printer_friendly"'
! . " onMouseOver=\"window.status='" . lang("Generate printer-friendly
version") . "';\">"
! . '[' . lang("Printer Friendly") . ']</A>';
! echo " (" . lang("Use landscape mode") . ")";
! $GLOBALS['phpgw']->common->phpgw_footer();
! } else {
! // Add code for signature lines.
! echo '<table width="90%" border="0">';
! echo '<tr><td align="right">';
! echo '<br><pre> Employee Signature:
_________________________________</pre>';
! echo '</td></tr></table>';
! }
?>
--- 445,481 ----
<?php
! if ($thisyear)
! {
! $year_array = Array(
! 'year' => $thisyear,
! 'month' => $thismonth,
! 'day' => $thisday
! );
! }
! else
! {
! $year_array = Array();
! }
! if (! $friendly)
! {
! echo '<p> <a href="'
! . $GLOBALS['phpgw']->link('/timetrack/timesheets.php',
! $year_array +
! Array(
! 'friendly' => 1,
! 'n_employee' => $n_employee
! )
! )
! . '" target="new_printer_friendly"
onMouseOver="window.status=\'' . lang('Generate printer-friendly version') .
'\';">'
! . '[' . lang('Printer Friendly') . ']</A> (' .
lang('Use landscape mode') . ')';
! $GLOBALS['phpgw']->common->phpgw_footer();
! }
! else
! {
! // Add code for signature lines.
! echo '<table width="90%" border="0">'."\n"
! . '<tr><td align="right">'."\n"
! . '<br><pre> Employee Signature:
_________________________________</pre>'."\n"
! . '</td></tr></table>'."\n";
! }
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: timetrack addjobdetail.php,1.18.2.1,1.18.2.2 changeprofile.php,1.8.2.1,1.8.2.2 hr-profiles.php,1.8.2.1,1.8.2.2 index.php,1.8.2.2,1.8.2.3 timesheets.php,1.16.2.1,1.16.2.2,
Mark A Peters <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: timetrack/setup phpgw_fr.lang,1.1.2.2,1.1.2.3 phpgw_en.lang,1.3.2.2,1.3.2.3
- Next by Date:
[Phpgroupware-cvs] CVS: timetrack/inc header.inc.php,1.11,1.12
- Previous by thread:
[Phpgroupware-cvs] CVS: timetrack/setup phpgw_fr.lang,1.1.2.2,1.1.2.3 phpgw_en.lang,1.3.2.2,1.3.2.3
- Next by thread:
[Phpgroupware-cvs] CVS: timetrack/inc header.inc.php,1.11,1.12
- Index(es):