<!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" />
  

<?php
include ("../navigation/header.php");
$page_name = "Production-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/production_sidebar.php");
	
	$table_name = $_SESSION['db_prefix']."_captured_jobs";
	$job_query = "SELECT * FROM $table_name WHERE captured='yes' AND (delivered IS NULL OR delivered = 'no') ";
	$job_result = execsql($job_query);
	$job_num = mysql_num_rows($job_result);
?>

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

<!--jscript-->
<script type="text/javascript" src="../jscript/tablesort.js"></script>
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 
</head>

<body>

<div class="main_frame">
  <div class="page_head_frame">
        
        <table width="600" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><label class="label_page_head">Production 
              </label></td>
            <td width="171" align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
        <br />
<br />

<tr>
  <td align="left">
  <div class="scroll_frame_long" style="height:450px; width:700px;">
  <div align="right">
    <label class="label_end"><img src="../images/round_green.png" width="8" height="8" />: completed&nbsp;&nbsp;<img src="../images/round_orange.png" width="8" height="8" />: in progress&nbsp;&nbsp;<img src="../images/round_red.png" width="8" height="8" />:pending</label></div>
  <table width="689" id="table_list" class="sortable-onload-1r rowstyle-alt no-arrow "  >
    <thead>
      <tr>
        <th width="10" style="border-right:hidden;">&nbsp;</th>
        <th width="31" align="left"  class="sortable-numeric">Job no</th>
        <th width="64" align="left" class="sortable-date-dmy">Delivery Date</th>
        <th width="164" align="left" class="sortable-text">Customer</th>
        <th width="56" align="center" >Capture<br />
          quote qty</th>
        <th width="55" align="center" >Cutting bill</th>
        <th width="67" align="center" >Issue direct<br />
          materials</th>
        <th width="66" align="center" >Produced</th>
        <th width="55" align="center" >Autho-<br />
          risation</th>
        <th width="68" align="center">Delivered</th>
      </tr>
    </thead>
    <tbody>
      <?php
$i = 0;
$amount=0;
	while ($i < $job_num) {
		$b0 = mysql_result($job_result, $i, "job_no");
		$b1 = mysql_result($job_result, $i, "cust_id");
		 $table_name3 = $_SESSION['db_prefix']."_customer";
         $customer_query = "SELECT comp_name, status, bag_box, box_no, postal_place, phone, contact_1 FROM $table_name3 WHERE cust_id = '".$b1."' ";
		 $customer_result = mySQL_query($customer_query);
		 $customer_num = mysql_num_rows($customer_result);
		 if ($customer_num!=0) {
         $a2a = mysql_result($customer_result, 0, "comp_name");
		 $a2b = mysql_result($customer_result, 0, "bag_box");
		 $a2c = mysql_result($customer_result, 0, "box_no");
		 $a2d = mysql_result($customer_result, 0, "postal_place");
		 $a2e = mysql_result($customer_result, 0, "phone");
		 $a2f = mysql_result($customer_result, 0, "contact_1");
		 $a3 = mysql_result($customer_result, 0, "status");
		 }
		$b2 = mysql_result($job_result, $i, "del_date");
		if ($b2!='') {$b2a=date("d-m-Y", strtotime($b2));
		}
		else {
			$b2a='';
		}
		
		
		$b9 = mysql_result($job_result, $i, "project_no");
		$b10 = mysql_result($job_result, $i, "project_place");
		$b11 = mysql_result($job_result, $i, "project_description");
		$b12 = mysql_result($job_result, $i, "designer");
		$b13 = mysql_result($job_result, $i, "value");
		
		$b15 = mysql_result($job_result, $i, "compiled");
		$b16 = mysql_result($job_result, $i, "cutting_bill");
		$b17 = mysql_result($job_result, $i, "delivered");
		$b18 = mysql_result($job_result, $i, "produced");
		$b19 = mysql_result($job_result, $i, "supplied");
		$b20 = mysql_result($job_result, $i, "authorisation");
				
		$jobTT ="<table id=table_tool_tip width=300 ><tr><td  width=100>Job no:</td><td width=175>".$b0."</td></tr><tr><td valign=top>Project no /place:</td><td>".$b9."&nbsp;".$b10."</td></tr><tr><td>Project description:</td><td>".$b11."</td></tr><tr><td>Designer:</td><td>".$b12."</td></tr><tr><td>Job value:</td><td>P ".number_format($b13, 2, '.', ',')."</td></tr><tr><td>Delivery date:</td><td>".$b2a."</td></tr></table><br><b>Click for details</b>";

		$customerTT ="<table id=table_tool_tip width=250 ><tr><td  width=75>Company:</td><td width=175>".$a2a."</td></tr><tr><td>Address:</td><td>".$a2b."&nbsp;".$a2c."<br>".$a2d."</td></tr><tr><td>Phone:</td><td>".$a2e."</td></tr><tr><td>Contact:</td><td>".$a2f."</td></tr></table><br><b>Click for details</b>";
?>
      <tr class="alt">
        <td align="right" style="border-right:hidden; padding-right:0px;">J</td>
        <td align="left" style="padding-left:0px;"><a href="captured_job.php?job_no=<?php echo $b0?>" onmouseover="ddrivetip('<?php echo $jobTT?>', 300)"; onmouseout="hideddrivetip()" target="_parent"><?php echo $b0?></a></td>
        <td><?php  if ($b2!='') {echo date("d-m-Y", strtotime($b2));}?></td>
        <td align="left" ><a href="../sales/customer_details.php?cust_id=<?php echo $b1?>" onmouseover="ddrivetip('<?php echo $customerTT?>', 250)"; onmouseout="hideddrivetip()"><?php echo $a2a?></a></td>
        
        <td align="center"><?php if ($b15=='yes') {?>
          <a href="captured_job_1.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Click to view this job', 110)"; onMouseout="hideddrivetip()"><img src="../images/round_green.png" alt="" width="12" height="12" /></a>
          <?php } else {?>
          <a href="captureJobWiz0.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Click to capture quote quantities', 170)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }?></td>
        <td align="center">
		<?php if ($b15!='yes') {?>
          <a href="" onMouseover="ddrivetip('No cutting bill, capture the job first.', 100)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a><?php }?>
		  <?php if ($b16=='yes') {?>
          <a href="cutting_bill.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Cutting bill made.<br>Click for details', 100)"; onMouseout="hideddrivetip()"><img src="../images/round_green.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b15=='yes' && $b16!='yes') {?>
          <a href="trussesJobWiz0.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Click to make the cutting bill', 150)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }?></td>
        <td align="center"><?php if ($b19=='yes') {?>
          <a href="../store/timber_supply.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Direct materials supplied<br>Click for details', 150)"; onMouseout="hideddrivetip()"><img src="../images/round_green.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b16!='yes') {?>
          <a href="" onMouseover="ddrivetip('No cutting bill yet,<br> make cutting bill first', 100)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b19=='no') {?>
          <a href="../store/cutJobWiz0.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Direct materials partly supplied,<br>click to supply balance.', 170)"; onMouseout="hideddrivetip()"><img src="../images/round_orange.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b19==''&&$b16=='yes') {?>
          <a href="../store/cutJobWiz0.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('No direct materials supplied yet,<br>click to supply.', 170)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }?></td>
        <td align="center"><?php if ($b18=='yes') {?>
          <a href="truss_production.php?&job_no=<?php echo $b0?>" onmouseover="ddrivetip('All trusses produced.<br>Click for details.', 120)"; onmouseout="hideddrivetip()"><img src="../images/round_green.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b18=='no') {?>
          <a href="produceWiz0.php?job_no=<?php echo $b0?>" onmouseover="ddrivetip('Trusses partly produced.<br>Click to produce balance.', 120)"; onmouseout="hideddrivetip()"><img src="../images/round_orange.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b18==''&&$b19!='') {?>
          <a href="produceWiz0.php?job_no=<?php echo $b0?>" onmouseover="ddrivetip('Trusses not produced yet.<br>Click to produce.', 120)"; onmouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b19=='') {?>
          <a href="" onmouseover="ddrivetip('No timber supplied,<br>supply timber first.', 100)"; onmouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }?></td>
        <td align="center">
          <?php if ($b15!='yes') {?>
          <a href="" onMouseover="ddrivetip('No authorisation, compile the job first.', 100)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a><?php }?>
          <?php if ($b20=='yes') {?>
          <a href="authorisation.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Authorisation for delivery done.<br>Click for details', 150)"; onMouseout="hideddrivetip()"><img src="../images/round_green.png" alt="" width="12" height="12" /></a>
          <?php }?>
          <?php if ($b15=='yes' && $b20!='yes' ) {?>
          <a href="authorisationWiz0.php?job_no=<?php echo $b0?>" onMouseover="ddrivetip('Click to authorise this job.', 120)"; onMouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a><?php }?></td>
        <td align="center">
        
		<?php if ($b17=='yes') {?>
          <a href="" onmouseover="ddrivetip('Job delivered in full.', 100)"; onmouseout="hideddrivetip()"><img src="../images/round_green.png" alt="" width="12" height="12" /></a>
          <?php }?>
         <?php if ($b17=='no')  {?>
          
          <a href="../store/deliverJobWiz0.php?job_no=<?php echo $b0?>" onmouseover="ddrivetip('Job partly delivered.', 100)"; onmouseout="hideddrivetip()"><img src="../images/round_orange.png" alt="" width="12" height="12" /></a>
         
          <?php }?>
          
          <?php if (($b17=='') AND (($b18=='yes') OR ($b20=='yes')))  {?>
          
          <a href="../store/deliverJobWiz0.php?job_no=<?php echo $b0?>" onmouseover="ddrivetip('Click to deliver job.', 100)"; onmouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          
		  <?php } else {?>
         <?php if ($b17=='')  {?> 
          <a href="" onmouseover="ddrivetip('No delivery, compile, produce and/or authorise the job first.', 150)"; onmouseout="hideddrivetip()"><img src="../images/round_red.png" alt="" width="12" height="12" /></a>
          <?php }} ?>
          
          </td>
      </tr>
      <?php
    $i++;
		
	}?>
    </tbody>
  </table>
  </div></td>
</tr>
</table>  <!--end of tableMain-->
  
</div>
</body>



<?php } else {
	
$_SESSION['denied_return'] = $_SESSION['location'];	
include ("../navigation/production_sidebar.php");?>
	<body onload="accessdenied(); return false">
	</body>
<?php }
?>

<?php include ('../navigation/side_bar.php');?>
</html>