Location: PHPKode > projects > Phpgw Time Tracking Add On App > timetrack/detail_report1.php
<?php
  /**************************************************************************\
  * phpgwtimetrack - phpGroupWare addon application                          *
  * http://phpgwtimetrack.sourceforge.net                                    *
  * Written by Robert Schader <hide@address.com>                         *
  * --------------------------------------------                             *
  *  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: detail_report1.php,v 1.5 2001/01/08 21:28:56 rschader Exp $ */

  $phpgw_info["flags"]["enable_nextmatchs_class"] = "True";
  $phpgw_info["flags"]["currentapp"] = "timetrack";
  include("../header.inc.php");

  if ($error) {
     echo "<center>" . lang("Error") . ":$error</center>";
  }
// Testing:
//echo "<center>job_id=$job_id, startdate=$startdate, enddate=$enddate<br></center>";
if(! $enddate) {
 $enddate = "2999-12-30";
}
if(! $startdate) {
 $startdate = "1900-01-01";
 $heading = "Complete Job Activity Report";
} else {
  $heading = "Job Activity Report from $startdate to $enddate";
}

echo "<h2><center>$heading</center></h2>";

  $phpgw->db->query("select c.company_name,j.job_number,j.job_revision,s.status_name,"
	. "j.summary,j.description "
	. "from jobs as j "
	. "left join customers as c on j.company_id = c.company_id "
	. "left join job_status as s on j.status_id = s.status_id "
	. "WHERE j.job_id='$job_id'");
  $phpgw->db->next_record();
  $company_name = $phpgw->db->f("company_name");
  $job_number = $phpgw->db->f("job_number");
  $job_revision = $phpgw->db->f("job_revision");
  $description = $phpgw->db->f("description");
  $status_name = $phpgw->db->f("status_name");
  $summary = $phpgw->db->f("summary");

  if($description == "") $description = "&nbsp;";
?>
<br><CENTER><TABLE WIDTH=90% BORDER=0 bordercolor=FFFFFF cellspacing=2 cellpadding=2>
<TR>
<?php
echo '<TH WIDTH=20% BGCOLOR="' . $phpgw_info["theme"]["th_bg"] 
  . '"><FONT COLOR="#000000">Company</FONT></TH>';
echo '<TH WIDTH=10% BGCOLOR="' . $phpgw_info["theme"]["th_bg"] . '"><FONT COLOR="#000000">Job No.</FONT></TH>';
echo '<TH WIDTH=60% BGCOLOR="' . $phpgw_info["theme"]["th_bg"] . '"><FONT COLOR="#000000">Description</FONT></TH>';
echo '<TH WIDTH=10% BGCOLOR="' . $phpgw_info["theme"]["th_bg"] . '"><FONT COLOR="#000000">Status</FONT></TH>';
echo '</TR>';
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
echo '<tr>';
echo ' <td width="20%" bgcolor="' . $tr_color . '">' . " "
  . $company_name . '</td>';
echo ' <td width="10%" align="center" bgcolor="' . $tr_color . '">'
  . $job_number . $job_revision . '</td>';
echo ' <td width="60%" bgcolor="' . $tr_color . '">' . " "
  . $summary . '</td>';
echo ' <td width="10%" align="center" bgcolor="' . $tr_color . '">' . " "
  . $status_name . '</td></tr>';
echo '<tr>';
echo ' <td width="20%" bgcolor="' . $tr_color . '">' . " "
  . '&nbsp;</td>';
echo ' <td width="10%" align="center" bgcolor="' . $tr_color . '">'
  . '&nbsp;</td>';
echo ' <td width="60%" bgcolor="' . $tr_color . '">' . " "
  . $description . '</td>';
echo ' <td width="10%" align="center" bgcolor="' . $tr_color . '">' . " "
  . '&nbsp;</td></tr>';
echo '</tr>';
echo '</table>';

// Should add a test here later to sum num_hours for the job, don't print table if num_hours is 0
$phpgw->db->query("SELECT j.work_date,a.account_firstname,a.account_lastname,w.catagory_desc,"
	. "j.num_hours,j.comments "
	. "FROM job_details as j "
	. "LEFT JOIN accounts as a on j.account_id = a.account_id "
	. "left join work_catagories as w on j.work_catagory_id = w.work_catagory_id "
	. "WHERE j.job_id='$job_id' "
	. "AND j.work_date >= '$startdate' AND j.work_date <= '$enddate' "
	. "ORDER by work_date");
//start the table before the loop
echo '<br><TABLE WIDTH=90% BORDER=0 bordercolor=FFFFFF cellspacing=2 cellpadding=2>';
echo '<tr>';
echo '<TH WIDTH=12% BGCOLOR="' . $phpgw_info["theme"]["th_bg"]
  . '"><FONT COLOR="#000000">Date</FONT></TH>';
echo '<TH WIDTH=20% BGCOLOR="' . $phpgw_info["theme"]["th_bg"]
  . '"><FONT COLOR="#000000">Employee</FONT></TH>';
echo '<TH WIDTH=56% BGCOLOR="' . $phpgw_info["theme"]["th_bg"]
 . '"><FONT COLOR="#000000">Type of Work</FONT></TH>';
echo '<TH WIDTH=12% BGCOLOR="' . $phpgw_info["theme"]["th_bg"]
  . '"><FONT COLOR="#000000">Hours</FONT></TH>';
echo '</TR>';

while ($phpgw->db->next_record()) {
 $employee = $phpgw->db->f("account_firstname")
  . " " . $phpgw->db->f("account_lastname");
 $wdate = $phpgw->db->f("work_date");
 $wcat = $phpgw->db->f("catagory_desc");
 $nhours = $phpgw->db->f("num_hours");
 $comments = $phpgw->db->f("comments");
 if($comments == "") $comments = "&nbsp;";
 $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
 echo '<tr>';
 echo ' <td width="12%" align="center" bgcolor="' . $tr_color . '">' . " "
  . $wdate . '</td>';
 echo ' <td width="20%" align="center" bgcolor="' . $tr_color . '">'
  . $employee . '</td>';
 echo ' <td width="56%" bgcolor="' . $tr_color . '">' . " "
  . $wcat . '</td>';
 echo ' <td width="12%" align="center" bgcolor="' . $tr_color . '">' . " "
  . $nhours . '</td>';
 echo '<tr>';
 echo ' <td width="12%" bgcolor="' . $tr_color . '">' . " "
  . '&nbsp;</td>';
 echo ' <td width="20%" align="center" bgcolor="' . $tr_color . '">'
  . '&nbsp;</td>';
 echo ' <td width="56%" bgcolor="' . $tr_color . '">' . " "
  . $comments . '</td>';
 echo ' <td width="12%" align="center" bgcolor="' . $tr_color . '">' . " "
  . '&nbsp;</td></tr>';
 echo '</tr>';
}
echo '</table>';
$phpgw->common->phpgw_footer();
Return current item: Phpgw Time Tracking Add On App