Location: PHPKode > projects > Phpgw Time Tracking Add On App > timetrack/viewjob.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: viewjob.php,v 1.6 2001/01/08 21:31:54 rschader Exp $ */

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

	inc_cal();
        if ($error) {
            echo "<center>" . lang("Error") . ":$error</center>";
        }
	echo "<center>Internal Job ID is: " . $jobid . "</center><br>";
	$phpgw->db->query("select * from jobs where job_id=" . $jobid);
        $phpgw->db->next_record();
        $n_company_id = $phpgw->db->f("company_id");
	$n_contact_id = $phpgw->db->f("contact_id");
	$n_account_id = $phpgw->db->f("account_id");
	$n_job_number = $phpgw->db->f("job_number");
	$n_job_revision = $phpgw->db->f("job_revision");
	$n_description = $phpgw->db->f("description");
	$n_quote_date = $phpgw->db->f("quote_date");
	$n_quoted_hours = $phpgw->db->f("quoted_hours");
	$n_opened_date = $phpgw->db->f("opened_date");
	$n_deadline = $phpgw->db->f("deadline");
	$n_approved_by = $phpgw->db->f("approved_by");
	$n_status_id = $phpgw->db->f("status_id");
	$n_billable = $phpgw->db->f("billable");
	$n_summary = $phpgw->db->f("summary");
	$n_completed_date = $phpgw->db->f("completed_date");
	$n_paid_date = $phpgw->db->f("paid_date");
	$n_cancelled_date = $phpgw->db->f("cancelled_date");
	// Info to get from other tables: customers.company_name
	// other table info should be able to get when doing the SELECT dropdowns:
	// contact_id(name), account_id(employee), status_name, approved_by.
	$phpgw->db->query("select company_name from customers where company_id=" . $n_company_id);
	$phpgw->db->next_record();
	$n_customer = $phpgw->db->f("company_name");
	$phpgw->db->query("select ab_id,ab_firstname,ab_lastname from addressbook WHERE ab_id=" . $n_contact_id);
	if($phpgw->db->num_rows() > 0)
	{
	 $phpgw->db->next_record();
	 $n_contact_name = $phpgw->db->f("ab_firstname") . " " . $phpgw->db->f("ab_lastname");
	}
	$phpgw->db->query("select account_id,account_firstname,account_lastname "
	  . "from accounts WHERE account_id=" . $n_account_id);
	if($phpgw->db->num_rows() > 0)
	{
	 $phpgw->db->next_record();
	 $n_employee_name = $phpgw->db->f("account_firstname") . " " . $phpgw->db->f("account_lastname");
	}
	$phpgw->db->query("select status_name from job_status where status_id=" . $n_status_id);
	if($phpgw->db->num_rows() > 0)
	{
	 $phpgw->db->next_record();
	 $n_status_name = $phpgw->db->f("status_name");
	}
	$phpgw->db->query("select account_id,account_firstname,account_lastname "
	  . "from accounts WHERE account_id=" . $n_approved_by);
	if($phpgw->db->num_rows() > 0)
	{
	 $phpgw->db->next_record();
	 $n_approvedby_name = $phpgw->db->f("account_firstname") . " " . $phpgw->db->f("account_lastname");
	}

	if($n_job_number == "") $n_job_number 		= "&nbsp;";
	if($n_job_revision == "") $n_job_revision 	= "&nbsp;";
	if($n_description == "") $n_description 	= "&nbsp;";
	if($n_quoted_hours == "") $n_quoted_hours 	= "&nbsp;";

	if(($n_quote_date == "") || ($n_quote_date == "0000-00-00"))
		$n_quote_date = "&nbsp;";
	if(($n_opened_date == "") || ($n_opened_date == "0000-00-00"))
		$n_opened_date = "&nbsp;";
	if(($n_deadline == "") || ($n_deadline == "0000-00-00"))
		$n_deadline = "&nbsp;";
	if(($n_completed_date == "") || ($n_completed_date == "0000-00-00"))
		$n_completed_date = "&nbsp;";
	if(($n_paid_date == "") || ($n_paid_date == "0000-00-00"))
		$n_paid_date = "&nbsp;";
	if(($n_cancelled_date == "") || ($n_cancelled_date == "0000-00-00"))
		$n_cancelled_date = "&nbsp;";

	if($n_summary == "") $n_summary 		= "&nbsp;";
	if($n_customer == "") $n_customer 		= "&nbsp;";
	if($n_contact_name == "") $n_contact_name 	= "&nbsp;";
	if($n_employee_name == "") $n_employee_name 	= "&nbsp;";
	if($n_status_name == "") $n_status_name 	= "&nbsp;";
	if($n_approvedby_name == "") $n_approvedby_name = "&nbsp;";
       ?>
        <center>
         <table border=0 width=65%>
           <tr>
            <?php
             echo '<th colspan="2" bgcolor="' . $phpgw_info["theme"]["th_bg"] . '">View Job Entry</th>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Company</td>';
	     echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_customer . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Contact</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_contact_name . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Assigned To</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_employee_name . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Job Number</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_job_number . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Revision</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_job_revision . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Summary Description</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_summary . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Detailed Description</td>';
	     echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_description . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Quote Date</td>';
	     echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_quote_date . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Quoted Hours</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_quoted_hours . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Opened Date</td>';
	     echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_opened_date . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Deadline</td>';
	     echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_deadline . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Date Completed</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_completed_date . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Paid in Full</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_paid_date . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Date Cancelled</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_cancelled_date . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Approved By</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_approvedby_name . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Status</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_status_name . '</td>';
           echo '</tr>';
           echo '<tr>';
             $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
             echo '<td width="30%" bgcolor="' . $tr_color . '">Billable</td>';
             echo '<td width="70%" bgcolor="' . $tr_color . '">' . $n_billable . '</td>';
           echo '</tr>';
          ?>
         </table>
        </center>
     <?php
  // add form button for generating detail reports
  $thismonth = date("n") - 1;
  $thisyear = date("Y");
  echo '<form name="Report" method=POST action="' . $phpgw->link("detail_report1.php")
	. '">';
  echo '<input type="hidden" name="job_id" value="' . $jobid . '">';
  echo '<center><table width="65%" border="0">'
	. '<th colspan="4" bgcolor="' . $phpgw_info["theme"]["th_bg"] . '">Activity Report</th>'
	. '<tr>'; //<td width="20%"><input type="submit" value="Generate"</td>';

  echo '<td width="40%">&nbsp;Start Date:';
  // Set the beginning date to automatically be the same as the quote date here.
  $yr=strval(substr($n_quote_date,0,4));
  $mo=strval(substr($n_quote_date,5,2));
  $da=strval(substr($n_quote_date,8,2));
  CalDateSelector("Report","startdate",0,"",$mo,$da,$yr);
  echo '</td>';

  echo '<td width="40%">&nbsp;End Date:';
  CalDateSelector("Report","enddate",0,"");
  echo '</td>';

  echo '<td>';
  //cal_layer();
  echo '</td>';

  echo '<td align="center"><input type="submit" value="Generate"</td></tr>';

  echo '</table></form></center>';

  $phpgw->common->phpgw_footer();
?>
Return current item: Phpgw Time Tracking Add On App