<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../css/main.css" rel="stylesheet" type="text/css" />
<?php
include ("../navigation/header.php");
$page_name = "AD-tracking";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/admin_sidebar.php");
?>
<?php

require_once('../include/tc_calendar.php');
	$date = mysql_real_escape_string($_GET['date']);
	
	if ($date==1) {
	$start = mysql_real_escape_string($_GET['date1']);
    $end = mysql_real_escape_string($_GET['date2']);
	}
	else {
	$start = date("Y-m-01");
	$end = date("Y-m-31");
	}
		
	if ($date!=1) {
	   $ds = "1"; }
	   else {
		$ds = date("d", strtotime($start) );
	   }
	$ms = date("m", strtotime($start) );
	$ys = date("Y", strtotime($start) );
	
	
	$de = date("d", strtotime($end) );
	$me = date("m", strtotime($end) );
	$ye = date("Y", strtotime($end) );	 
	
	//$endsearch = date('Y-m-d', strtotime('+1 day', strtotime($end)));
	
	
	
$table_name2 = $_SESSION['db_prefix']."_tracking_production";
$tracking_query = "SELECT * FROM $table_name2 WHERE entry_date >= '".$start."' AND entry_date <= '".$end."' ORDER BY action_id, entry_date DESC ";
$tracking_result = mySQL_query($tracking_query);
$tracking_num = mysql_num_rows($tracking_result);


?>
<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/scroll_table.css" />

<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
<script type="text/javascript" language="javascript" src="../jscript/jquery.dataTables.js"></script><script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#scroll_table').dataTable( {
					"sScrollY": "500px",
					"bPaginate": false,
					"bScrollCollapse": true,
					"aaSorting": [[ 0, "desc" ]],
					"aoColumns": [
								{"iDataSort": 5},
                              	{"bSortable": true},
                             	{"bSortable": true},
								{"bSortable": true},
								{"bSortable": true},
								{"bVisible": false}
								 ]
				} );
			} );
		</script>
</head>
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<body>
<?php include ('../include/tooltip.php'); ?>

<div class="main_frame">
 <div class="page_head_frame">
        
        <table width="825" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="523"><label class="label_page_head">Production tracking</label></td>
            <td width="287">&nbsp;</td>
            </tr>
        </table>
      </div>
        <br />
<br />

<div class="page_middle_frame">
<form action="tracking_production.php" method="get" name="dateform" class="today" id="dateform">
    <table width="668"  id='table_calendar'>
      <tr>
        <td height="20" colspan="3" align="left" valign="middle"><label class="label_std">Select time period to display</label></td>
        <td valign="middle">&nbsp;</td>
        <td colspan="2" valign="middle"><input name="date" type="hidden" id="date" value="1" /></td>
        </tr>
      <tr>
        <td width="12" height="25" valign="middle">&nbsp;&nbsp; </td>
        <td width="37" valign="middle"><label class="label_std">  from:</label> </td>
        <td width="292" valign="middle"><?php
		$myCalendar = new tc_calendar("date1", true);
		$myCalendar->setIcon("iconCalendar.gif");
		$myCalendar->setDate($ds, $ms, $ys);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2010, 2030);
	 	$myCalendar->writeScript();?></td>
        <td width="11" valign="middle"><label class="label_std">to:</label></td>
        <td width="236" valign="middle"><?php
		$myCalendar = new tc_calendar("date2", true);
		$myCalendar->setIcon("iconCalendar.gif");
		$myCalendar->setDate($de, $me, $ye);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2010, 2030);
		$myCalendar->writeScript();?></td>
        <td width="52" valign="middle"><input name="button5" type="submit" class="linkbutton"  id="button5" value="Go" /></td>
        </tr>
    </table>
  </form>
  </div>
<div class="page_middle_frame">
<table width="645" id="scroll_table" class="data_display"  >
  <thead>
  <tr>
    <th >date</th>
    <th >time</th>
    <th >user</th>
    <th>action</th>
    <th width="369">details</th>
    <th width="369">&nbsp;</th>
    </tr>
    </thead>
<?php 

$i=0;

while ($i<$tracking_num) {
    $b0  =  mysql_result($tracking_result, $i, "action_id");
	$b1 =  mysql_result($tracking_result, $i, "entry_date");
	$b2 =  mysql_result($tracking_result, $i, "user");
	$b3 =  mysql_result($tracking_result, $i, "action");
	$d1 = mysql_result($tracking_result, $i, "details_1");
	$d2 = mysql_result($tracking_result, $i, "details_2");
	$d3 = mysql_result($tracking_result, $i, "details_3");
	$d4 = mysql_result($tracking_result, $i, "details_4");
	
	
	
	$action='';
	$details='';
	switch ($b3) {
    case 60:
        $action = 'edit captured job';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' old: '.$d3.' new: '.$d4 ;
        break;
    case 61:
        $action = 'edit captured job';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
				$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old: '.$d3.' new: '.$d4 ;
        break;
    case 62:
        $action = 'added on captured job';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> new: '.$d4 ;
        break;
	case 63:
        $action = 'edit captured job';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' old: '.$d3.' new: '.$d4 ;
        break;
	case 64:
        $action = 'added on captured job';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' new: '.$d4 ;
        break;
	case 65:
        $action = 'edit authorised job';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old: '.$d3.' new: '.$d4 ;
        break;
    case 66:
        $action = 'added on authorised job';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> new: '.$d4 ;
        break;
	case 67:
        $action = 'edit authorised job';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' old: '.$d3.' new: '.$d4 ;
        break;
	case 68:
        $action = 'added on authorised job';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' new: '.$d4 ;
        break;
	case 69:
        $action = 'job captured';
		    $table_name = $_SESSION['db_prefix']."_captured_jobs";
			$job_query = "SELECT cust_id, project_no, project_place FROM $table_name WHERE job_no = '".$d1."' ";
			$job_result = mySQL_query($job_query);
			$job_num = mysql_num_rows($job_result);
			$cust_id = mysql_result($job_result, 0, "cust_id");
			$project_no = mysql_result($job_result, 0, "project_no");
			$project_place = mysql_result($job_result, 0, "project_place");
				
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);	
			$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$name = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$name = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}
			
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a> for <a href=../sales/customer_details.php?cust_id='.$cust_id.'>'.$name.'</a> '.$project_no.' '.$project_place;
        break;		
	case 70:
        $action = 'cutting bill';
		    $table_name = $_SESSION['db_prefix']."_captured_jobs";
			$job_query = "SELECT cust_id, project_no, project_place FROM $table_name WHERE job_no = '".$d1."' ";
			$job_result = mySQL_query($job_query);
			$job_num = mysql_num_rows($job_result);
			$cust_id = mysql_result($job_result, 0, "cust_id");
			$project_no = mysql_result($job_result, 0, "project_no");
			$project_place = mysql_result($job_result, 0, "project_place");
				
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);	
			$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$name = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$name = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}
			
		$details = '<a href=../production/cutting_bill.php?job_no='.$d1.'>J'.$d1.'</a> for <a href=../sales/customer_details.php?cust_id='.$cust_id.'>'.$name.'</a> '.$project_no.' '.$project_place;
        break;	
	case 71:
        $action = 'truss production';
		    $table_name = $_SESSION['db_prefix']."_captured_jobs";
			$job_query = "SELECT cust_id, project_no, project_place FROM $table_name WHERE job_no = '".$d1."' ";
			$job_result = mySQL_query($job_query);
			$job_num = mysql_num_rows($job_result);
			$cust_id = mysql_result($job_result, 0, "cust_id");
			$project_no = mysql_result($job_result, 0, "project_no");
			$project_place = mysql_result($job_result, 0, "project_place");
				
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);	
			$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$name = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$name = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}
			
		$details = '<a href=../production/truss_production.php?&job_no='.$d1.'>J'.$d1.'</a> for <a href=../sales/customer_details.php?cust_id='.$cust_id.'>'.$name.'</a> '.$project_no.' '.$project_place;
        break;
	case 72:
        $action = 'job authorised';
		    $table_name = $_SESSION['db_prefix']."_captured_jobs";
			$job_query = "SELECT cust_id, project_no, project_place FROM $table_name WHERE job_no = '".$d1."' ";
			
			$job_result = mySQL_query($job_query);
			$job_num = mysql_num_rows($job_result);
			$cust_id = mysql_result($job_result, 0, "cust_id");
			$project_no = mysql_result($job_result, 0, "project_no");
			$project_place = mysql_result($job_result, 0, "project_place");
				
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);	
			$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$name = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$name = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}
			
		$details = '<a href=../production/authorisation.php?job_no='.$d1.'>J'.$d1.'</a> for <a href=../sales/customer_details.php?cust_id='.$cust_id.'>'.$name.'</a> '.$project_no.' '.$project_place;
        break;		
		
	case 74:
        $action = 'edit cutting bill';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {				
				   $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
				$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old: '.$d3.' new: '.$d4 ;
        break;
    case 75:
        $action = 'added on cutting bill';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> new: '.$d4 ;
        break;
	case 76:
        $action = 'edit cutting bill';
		$table_name = $_SESSION['db_prefix']."_store_items";
		$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
		$name_result = mySQL_query($name_query);
		$d2a = mysql_result($name_result, 0, "item_name");
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>,  <a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$d2a.'</a> old: '.$d3.' new: '.$d4 ;
        break;
	case 77:
	    $table_name = $_SESSION['db_prefix']."_store_items";
		$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
		$name_result = mySQL_query($name_query);
		$d2a = mysql_result($name_result, 0, "item_name");
        $action = 'added on cutting bill';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, <a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$d2a.'</a> new: '.$d4 ;
        break;
	case 78:
        $action = 'edit cutting bill';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' old: '.$d3.' new: '.$d4 ;
        break;
	case 79:
        $action = 'add to cutting bill';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' new: '.$d4 ;
        break;	
	case 80:
        $action = 'edit job details';
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.$d2.' old: '.$d3.' new: '.$d4 ;
        break;
	case 81:
        $action = 'de-authorise Mitek';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old authorised: '.$d3.' new authorised: '.$d4 ;
        break;
	 case 82:
        $action = 'de-authorise Timber';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old authorised: '.$d3.' new authorised: '.$d4 ;
        break;
	case 83:
        $action = 'de-authorise Sundries';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old authorised: '.$d3.' new authorised: '.$d4 ;
        break;
	case 84:
        $action = 'extra supply Mitek';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> extra supplied: '.$d3 ;
        break;
		case 85:
        $action = 'de-authorise Bracing Timber';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old authorised: '.$d3.' new authorised: '.$d4 ;
        break;
	case 86:
        $action = 'extra supply Bracing Timber';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> extra supplied: '.$d3 ;
        break;		
	case 87:
        $action = 'de-authorise Sundries Timber';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> old authorised: '.$d3.' new authorised: '.$d4 ;
        break;
	case 88:
        $action = 'extra supply Sundries Timber';
				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d2."'  ";
				$name_result = mySQL_query($name_query);
				$name_num = mysql_num_rows($name_result);
				if ($name_num!=0) {
				      $item_name = mysql_result($name_result, 0, "item_name"); }
				else {
					$item_name = '';
				}
		$details = '<a href=../production/captured_job_1.php?job_no='.$d1.'>J'.$d1.'</a>, '.'<a href=../store/store_item_display.php?store_item_id='.$d2.'>'.$item_name.'</a> extra supplied: '.$d3 ;
        break;
		
		case 89:
        $action = 'complete job manually';
		    $table_name = $_SESSION['db_prefix']."_captured_jobs";
			$job_query = "SELECT cust_id, project_no, project_place FROM $table_name WHERE job_no = '".$d1."' ";
			$job_result = mySQL_query($job_query);
			$job_num = mysql_num_rows($job_result);
			$cust_id = mysql_result($job_result, 0, "cust_id");
			$project_no = mysql_result($job_result, 0, "project_no");
			$project_place = mysql_result($job_result, 0, "project_place");
				
			$table_name2 = $_SESSION['db_prefix']."_customer";
			$customer_query = "SELECT * FROM $table_name2 WHERE cust_id ='".$cust_id."' ";
			$customer_result = mySQL_query($customer_query);
			$customer_num = mysql_num_rows($customer_result);	
			$a1 = mysql_result($customer_result, 0, "account_type");
			if ($a1=="corporate") { 
				$name = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$name = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}
			
		$details = '<a href=../production/captured_job.php?&job_no='.$d1.'>J'.$d1.'</a> for <a href=../sales/customer_details.php?cust_id='.$cust_id.'>'.$name.'</a> '.$project_no.' '.$project_place.' was set completed.';
        break;
		
	case 90:
        $action = 'Cost price adjustment';
		$table_name = $_SESSION['db_prefix']."_store_items";
		$item_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$d1."' ";
		$item_result = mySQL_query($item_query);
		$item_num = mysql_num_rows($item_result);
		if ($item_num!=0)  {
		       $item_name = mysql_result($item_result, 0, "item_name");
			   $details = '<a href=../store/store_item_display.php?store_item_id='.$d1.'>'.$item_name.'</a> old:'.number_format($d3, 2, '.', ',').' new: '.number_format($d4, 2, '.', ',');
		}
		else {
			$item_name='something';
			if ($d3=='') {$d3=0;}
			$details = $d1.' old:'.number_format($d3, 2, '.', ',').' new: '.number_format($d4, 2, '.', ',');
	}
	    break;	
		
			
		
}
	
	?>
  
  
  <tr>
    <td width="66" align="left"><?php echo date("d-m-Y", strtotime($b1 )) ?></td>
    <td width="34" align="left"><?php echo date("H:i", strtotime($b1 ))  ?></td>
    <td width="54" align="left"><?php echo $b2 ?></td>
    <td width="136" align="left"><?php echo $action ?></td>
    <td align="left"><?php echo $details ?></td>
    <td align="left"><?php echo $b1 ?></td>
    </tr>
  <?php
  $i++;
}
?>

</table>

</div>
</div>
</body>
<?php } else {
$_SESSION['denied_return'] = "admin_module/user_list.php";	
    include ("../navigation/admin_sidebar.php");?>
	<body onLoad="accessdenied(); return false">
<?php }
?>
<?php include ('../navigation/side_bar.php'); ?>
</html>