<head> 
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
<?php
include ("../navigation/header.php");
$page_name = "Sales-main";
include ("../navigation/access.php");

if ($permission_num==1) {
	include ("../navigation/production_sidebar.php");

$job_no = $_GET['job_no'];
$quote='no';

$table_name = $_SESSION['db_prefix']."_captured_jobs";
$job_query = "SELECT * FROM $table_name WHERE job_no = '".$job_no."' ";
$job_result = mySQL_query($job_query);
$cust_id = mysql_result($job_result, 0, "cust_id");
$press_points = mysql_result($job_result, 0, "press_points");
$press_price = mysql_result($job_result, 0, "press_charge");
$plate_area = mysql_result($job_result, 0, "plate_area");
$plate_charge = mysql_result($job_result, 0, "plate_charge");
$job_value = mysql_result($job_result, 0, "value");

$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");
 			}
?>

<?php
$table_name = $_SESSION['db_prefix']."_cutting_bill";
$cutting_query = "SELECT * FROM $table_name WHERE job_no = '".$job_no."' ";
$cutting_result = mySQL_query($cutting_query);
$cutting_num = mysql_num_rows($cutting_result);
if ($cutting_num!=0) {
		$bill_id = mysql_result($cutting_result, 0, "bill_id");
}
else {
	$bill_id='';
}

$table_name = $_SESSION['db_prefix']."_cutting_bill_lines";
$truss_query = "SELECT * FROM $table_name WHERE type = 'Truss' AND bill_id = '".$bill_id."' ";
$truss_result = mySQL_query($truss_query);
$truss_num = mysql_num_rows($truss_result);

$table_name = $_SESSION['db_prefix']."_cutting_supplies_lines";
$truss_supply_query = "SELECT store_item_id, SUM(quantity) AS summed_quantity, price FROM $table_name WHERE job_no = '".$job_no."' GROUP BY store_item_id ORDER BY type DESC";
$truss_supply_result = mySQL_query($truss_supply_query);
$truss_supply_num = mysql_num_rows($truss_supply_result);

$table_name = $_SESSION['db_prefix']."_captured_timber";
$timber5_check_query = "SELECT cap_timber_id FROM $table_name WHERE cap_timber_group = 'Trusses' AND cap_job = '".$job_no."' AND cap_class = 'S5'  ";
$timber5_check_result = mySQL_query($timber5_check_query);
$timber5_check_num = mysql_num_rows($timber5_check_result);
		
if ($timber5_check_num>0) {
		$table_nameS5 = $_SESSION['db_prefix']."_captured_timber";
	}
else {
	$table_nameS5 = $_SESSION['db_prefix']."_captured_timber_done";
}
$timber_query = "SELECT * FROM $table_nameS5 WHERE cap_timber_group = 'Trusses' AND cap_job = '".$job_no."' AND cap_class = 'S5'  ";
$timber_result = mySQL_query($timber_query);
$timber_num = mysql_num_rows($timber_result);



$table_name = $_SESSION['db_prefix']."_captured_timber";
$timber7_check_query = "SELECT cap_timber_id FROM $table_name WHERE cap_timber_group = 'Trusses' AND cap_job = '".$job_no."' AND cap_class = 'S7'  ";
$timber7_check_result = mySQL_query($timber7_check_query);
$timber7_check_num = mysql_num_rows($timber7_check_result);
		
if ($timber7_check_num>0) {
		$table_nameS7 = $_SESSION['db_prefix']."_captured_timber";
	}
else {
	$table_nameS7 = $_SESSION['db_prefix']."_captured_timber_done";
}
$timber2_query = "SELECT * FROM $table_nameS7 WHERE cap_timber_group = 'Trusses' and cap_job = '".$job_no."' AND cap_class = 'S7' ";
$timber2_result = mySQL_query($timber2_query);
$timber2_num = mysql_num_rows($timber2_result);

$table_name = $_SESSION['db_prefix']."_captured_mitek";
$mitek_check_query = "SELECT cap_mitek_id FROM $table_name WHERE cap_job = '".$job_no."'  ";
$mitek_check_result = mySQL_query($mitek_check_query);
$mitek_check_num = mysql_num_rows($mitek_check_result);

if ($mitek_check_num>0) {
$table_name = $_SESSION['db_prefix']."_captured_mitek";
}
else {
$table_name = $_SESSION['db_prefix']."_captured_mitek_done";
}
$mitek_query = "SELECT * FROM $table_name WHERE cap_job = '".$job_no."' AND ( (cap_quantity > 0) OR (auth_quantity > 0) )";
$mitek_result = mySQL_query($mitek_query);
$mitek_num = mysql_num_rows($mitek_result);


$table_name = $_SESSION['db_prefix']."_captured_sundries";
$additional_check_query = "SELECT cap_sundries_id FROM $table_name WHERE cap_job = '".$job_no."'  ";
$additional_check_result = mySQL_query($additional_check_query);
$additional_check_num = mysql_num_rows($additional_check_result);
		
if ($additional_check_num>0) {
		$table_name = $_SESSION['db_prefix']."_captured_sundries";
	}
else {
	$table_name = $_SESSION['db_prefix']."_captured_sundries_done";
}
$sundries_query = "SELECT * FROM $table_name WHERE cap_job = '".$job_no."' AND ( (cap_quantity > 0) OR (auth_quantity > 0) )";
$sundries_result = mySQL_query($sundries_query);
$sundries_num = mysql_num_rows($sundries_result);

$table_name = $_SESSION['db_prefix']."_captured_timber";
$bracing_check_query = "SELECT cap_timber_id FROM $table_name WHERE cap_job = '".$job_no."' AND cap_timber_group = 'Bracing' ";
$bracing_check_result = mySQL_query($bracing_check_query);
$bracing_check_num = mysql_num_rows($bracing_check_result);
		
if ($bracing_check_num>0) {
		$table_name = $_SESSION['db_prefix']."_captured_timber";
	}
else {
	$table_name = $_SESSION['db_prefix']."_captured_timber_done";
}
$timber3_query = "SELECT * FROM $table_name WHERE cap_timber_group = 'Bracing' and cap_job = '".$job_no."' AND ( (cap_timber_length > 0) OR (auth_timber_length > 0) )";
$timber3_result = mySQL_query($timber3_query);
$timber3_num = mysql_num_rows($timber3_result);



$table_name = $_SESSION['db_prefix']."_captured_timber";
$sundries_check_query = "SELECT cap_timber_id FROM $table_name WHERE cap_job = '".$job_no."' AND cap_timber_group = 'Sundries' ";
$sundries_check_result = mySQL_query($sundries_check_query);
$sundries_check_num = mysql_num_rows($sundries_check_result);
		
if ($sundries_check_num>0) {
		$table_name = $_SESSION['db_prefix']."_captured_timber";
	}
else {
	$table_name = $_SESSION['db_prefix']."_captured_timber_done";
}
$timber4_query = "SELECT * FROM $table_name WHERE cap_timber_group = 'Sundries' and cap_job = '".$job_no."' AND ( (cap_timber_length > 0) OR (auth_timber_length > 0) )";
$timber4_result = mySQL_query($timber4_query);
$timber4_num = mysql_num_rows($timber4_result);

$table_name6 = $_SESSION['db_prefix']."_captured_extra";
$extra_query = "SELECT * FROM $table_name6 WHERE job_no = '".$job_no."' ";
$extra_result = mySQL_query($extra_query);
$extra_num = mysql_num_rows($extra_result);

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

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

</head>
<body>
<div class="main_frame" style="height:auto;">
  <table id="tableMain" > <!--begin of tableMain-->
    <tr>
      <td width="830" height="62" valign="top" ><div class="page_head_frame">
         
        <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="472"><label class="label_page_head">Captured quote</label>
              &nbsp;&nbsp;&nbsp;<label class="label_page_head_2">&nbsp;&nbsp;&nbsp;<?php echo $name ?></label></td>
            <td width="208"><label style="font-size:24px; color:#FB6808;"><?php echo "J".$job_no ?></label></td>
            </tr>
        </table>
      </div>
        <br />

<br /></td> <!--center of tableMain-->
</tr>
<tr>
<td height="93"> <!--center of tableMain-->
<div class="page_middle_frame">
<?php
include('../include/customer_block.php');
?>
</div>
    <div class="page_middle_frame">
    <?php 
	include('../include/job_block.php');
	?>
    </div>
</td>
</tr>
<tr>
<td>
</tr>
<tr>
<td height="220">
<div class="page_middle_frame">
	<div align="left">
	  <label class="label_std">Trusses FT</label>
	and plate charge</div>
 	 <table width="661" id="table_details_display">
            
             
             <tr>
               <td width="376"><?php echo $press_points ?>&nbsp;FT<?php $press_total=$press_points*$press_price;?>
               </td>
               <td width="172" align="right" ><span style="border-right:hidden;"><?php echo number_format($press_total, 2, '.', ',') ?></span></td>
               <td width="97" align="right" >&nbsp;</td>
             </tr>
            
             <tfoot>
             <tr>
               <td align="left"><?php echo $plate_area ?>&nbsp;m<sup>2</sup><?php $plate_total=$plate_area*$plate_charge;?></td>
               <td align="right"><?php echo number_format($plate_total, 2, '.', ',') ?></td>
               <td align="right" >&nbsp;</td>
             </tr>
             <tr>
               <td colspan="2" align="right"><?php $truss_total =$press_total+$plate_total?>Total FT and plates:&nbsp;&nbsp;</td>
               <td align="right" ><span style="border-right:hidden;"><?php echo number_format($truss_total, 2, '.', ',') ?></span></td>
             </tr>
             </tfoot>
    </table>
    </div>
<div class="page_middle_frame">
<table width="661" align="left" id="table_details_display" cellpadding="0"> 
				<tr  style="background-color:#F0F0F0;">
      			<th height="22" align="left">Timber Class</th>
      			<th align="left">Total Length</th>
      			<th width="109" align="left">&nbsp;&nbsp;&nbsp;Timber</th>
      			<th width="57" align="center">Length</th>
      			<th width="44" align="center">Unit</th>
      			<th width="78" align="center">Price/m</th>
      			<th width="76" align="center">Price</th>
      			<th width="99" align="center">&nbsp;</th>
     			</tr>
              <tr>
                <?php
				$timber_check_query = "SELECT  cap_timber_id FROM $table_nameS5 WHERE cap_job = '".$job_no."'  ";
				$timber_check_result = mySQL_query($timber_check_query);
				$timber_check_num = mysql_num_rows($timber_check_result);
				
				
				$tot_5=0;
				
				$class5_query = "SELECT cap_timber, cap_timber_length, cap_timber_price FROM $table_nameS5 WHERE cap_class='S5' AND cap_job = '".$job_no."' AND cap_timber_name='Trusses'  ORDER BY cap_depth, cap_width ";
				$class5_result = mySQL_query($class5_query);
				$class5_num = mysql_num_rows($class5_result);
				
				
				$class5_tot_query = "SELECT SUM(cap_timber_length) AS tot_5 FROM $table_nameS5 WHERE cap_class='S5' AND cap_job = '".$job_no."' AND cap_timber_name='Trusses'";
				$class5_tot_result = mySQL_query($class5_tot_query);
				$tot_5 = mysql_result($class5_tot_result, 0, "tot_5"); 
				
                $i=0;
				
				?>
                <td width="87" align="left" valign="top" ><label class="label_std">Class 5  </label></td>
                <td width="91" align="left" valign="top"><?php echo $tot_5; ?>
<label class="label_std">m</label></td>
                <td colspan="5" align="right" valign="top" ><table width="371" align="left" id="table_details_display" style="border-top:hidden; border-bottom:hidden;">
                <?php
				$timber_total='0';
				while ($i<$class5_num) {
				   $size = mysql_result($class5_result, $i, "cap_timber"); 
				   $length = mysql_result($class5_result, $i, "cap_timber_length"); 
				   $price = mysql_result($class5_result, $i, "cap_timber_price");  	
				   $tot_price = $length*$price; 
				   $timber_total = $timber_total+$tot_price; 	
				?>
                <tr>
                    <td width="105"  style="border-left:hidden;"><?php echo $size ?>&nbsp;</td>
                    <td width="53" align="right"><?php echo $length ?>&nbsp;</td>
                    <td width="42">&nbsp;m</td>
                    <td width="78" align="right"><span style="border-right:hidden;"><?php echo number_format($price, 2, '.', ',') ?></span></td>
                    <td width="69" align="right"  style="border-right:hidden;"><?php echo number_format($tot_price, 2, '.', ',') ?></td>
                  </tr>
                  <?php
				  $i++;
				}
				  ?>
                </table></td>
                <td align="right" valign="top" style="border-bottom:hidden;" >&nbsp;</td>
            </tr>
              
              <tr>
                <?php
				
				$class7_query = "SELECT cap_timber, cap_timber_length, cap_timber_price FROM $table_nameS7 WHERE cap_class='S7' AND cap_job = '".$job_no."' AND cap_timber_name='Trusses'  ORDER BY cap_depth, cap_width ";
				$class7_result = mySQL_query($class7_query);
				$class7_num = mysql_num_rows($class7_result);
				
				
				$class7_tot_query = "SELECT SUM(cap_timber_length) AS tot_7 FROM $table_nameS7 WHERE cap_class='S7' AND cap_job = '".$job_no."' AND cap_timber_name='Trusses'";
				$class7_tot_result = mySQL_query($class7_tot_query);
				$tot_7 = mysql_result($class7_tot_result, 0, "tot_7");
				 
				?>
                <td align="left" valign="top" ><label class="label_std">Class 7</label></td>
                <td align="left" valign="top"><?php echo $tot_7 ?>
<label class="label_std">m</label></td>
                <td colspan="5" align="left" valign="top"><table width="371" id="table_details_display" style="border-top:hidden; border-bottom:hidden;">
                  <?php
								
                $i=0;
				while ($i<$class7_num) {
				   $size = mysql_result($class7_result, $i, "cap_timber"); 
				   $length = mysql_result($class7_result, $i, "cap_timber_length"); 
				   $price = mysql_result($class7_result, $i, "cap_timber_price");  	
				   $tot2_price = $length*$price; 
				   $timber_total = $timber_total+$tot2_price;	
				?>
                  <tr>
                    <td width="105"  style="border-left:hidden;"><?php echo $size ?>&nbsp;</td>
                    <td width="54" align="right"><?php echo $length ?>&nbsp;</td>
                    <td width="41">&nbsp;m</td>
                    <td width="78" align="right"><span style="border-right:hidden;"><?php echo number_format($price, 2, '.', ',') ?></span></td>
                    <td width="69" align="right"  style="border-right:hidden;"><?php echo number_format($tot2_price, 2, '.', ',') ?></td>
                  </tr>
                  <?php
				  $i++;
				}
				  ?>
                </table>
                </td>
                <td align="left" valign="top" style="border-bottom:hidden;">&nbsp;</td>
   	        </tr>
              <tr>
                <td height="34" colspan="7" align="right" valign="bottom" >Total timber:&nbsp;&nbsp;</td>
                <td align="right" valign="bottom"><span style="border-right:hidden;"><?php echo number_format($timber_total, 2, '.', ',') ?></span></td>
              </tr>
                </table>

</div><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>

<div class="page_middle_frame">
  <table width="661" id="table_details_display">
  <tr>
      <th><label class="label_std">Item</label></th>
      <th align="center"><label class="label_std">Quoted Qty</label></th>
      <th align="center"><label class="label_std">Unit</label></th>
      <th align="center">Price each</th>
      <th align="center">Price</th>
      <th align="center">&nbsp;</th>
      </tr>
    <tr  style="background-color:#F0F0F0;">
      <th height="22" align="left">eCo products</th>
      <th align="left">&nbsp;</th>
      <th align="left">&nbsp;</th>
      <th colspan="2" align="left">&nbsp;</th>
      <th align="left">&nbsp;</th>
      </tr>
    <?php 
	$i=0;
	$mitek_total='0';
	while ($i<$mitek_num) {
		$cap_item_id = mysql_result($mitek_result, $i, "cap_item_id");
			$table_name4 = $_SESSION['db_prefix']."_store_items";
			$item_query = "SELECT item_name, unit FROM $table_name4 WHERE store_item_id = '".$cap_item_id."' ";
			$item_result = mySQL_query($item_query);
			$item_name = mysql_result($item_result, 0, "item_name");
			$unit = mysql_result($item_result, 0, "unit");
		$cap_quantity = mysql_result($mitek_result, $i, "cap_quantity");
		//$auth_quantity = mysql_result($mitek_result, $i, "auth_quantity");
		$mitek_unit_price = mysql_result($mitek_result, $i, "cap_price");
		$mitek_price = $mitek_unit_price*$cap_quantity;
		//$balance = $auth_quantity - $delivered;
		$mitek_total = $mitek_total+$mitek_price;
	?>
	
    
    
    <tr>
      <td width="297"><?php echo $item_name ?>
      </td>
      <td width="56" align="center"><?php echo $cap_quantity ?></td>
      <td width="39" align="left"><?php echo $unit ?></td>
      <td width="71" align="right"><span style="border-right:hidden;"><?php echo number_format($mitek_unit_price, 2, '.', ',') ?></span></td>
      <td width="72" align="right"><span style="border-right:hidden;"><?php echo number_format($mitek_price, 2, '.', ',') ?></span></td>
      <td width="98" align="right" style="border-bottom:hidden;">&nbsp;</td>
      </tr>
    <?php
	$i++;
	}
	?>
    <tfoot>
    <tr>
      <td colspan="5" align="right">Total Mitek:&nbsp;&nbsp;</td>
      <td align="right"><span style="border-right:hidden;"><?php echo number_format($mitek_total, 2, '.', ',') ?></span></td>
    </tr>
    </tfoot>
    </table>
    </div><br>
    <br>

    <div class="page_middle_frame">
	<div align="left">
	  <label class="label_std">Bracing</label>
	</div>
 	 <table width="661" id="table_details_display">
            
             <?php 
			 $j=0;
			 $bracing_total='0';
			 while ($j<$timber3_num) {
				 $bracing_name = mysql_result($timber3_result, $j, "cap_timber_name");
				 $bracing_length = mysql_result($timber3_result, $j, "cap_timber_length");
				 //$auth_bracing_length = mysql_result($timber3_result, $j, "auth_timber_length");
				 $delivered = mysql_result($timber3_result, $j, "delivered");
				 //$balance = $auth_bracing_length - $delivered;
				 $meter_price = mysql_result($timber3_result, $j, "cap_timber_price");
				 $bracing_price = $meter_price *$bracing_length;
				 $bracing_total = $bracing_total+$bracing_price;
			 ?>
             <tr>
               <td width="297"><?php echo $bracing_name ?>
               </td>
               <td width="56" align="center"><?php echo $bracing_length ?></td>
               <td width="41" align="left" >m</td>
               <td width="66" align="right" ><span style="border-right:hidden;"><?php echo number_format($meter_price, 2, '.', ',') ?></span></td>
               <td width="73" align="right" ><span style="border-right:hidden;"><?php echo number_format($bracing_price, 2, '.', ',') ?></span></td>
               <td width="100" align="right" style="border-bottom:hidden;">&nbsp;</td>
             </tr>
             
             <?php
			 $j++;
			 }
			 ?>
             <tfoot>
             <tr>
               <td colspan="5" align="right">Total bracing:&nbsp;&nbsp;</td>
               <td align="right" ><span style="border-right:hidden;"><?php echo number_format($bracing_total, 2, '.', ',') ?></span></td>
             </tr>
             </tfoot>
    </table>
    </div>
    <div class="page_middle_frame">
	<div align="left">
	  <label class="label_std">Sundry timbers</label>
	</div>
 	 <table width="661" id="table_details_display">
             <?php 
			 $sundries_total='0';
			 $k=0;
			 while ($k<$timber4_num) {
				 $sundries_name = mysql_result($timber4_result, $k, "cap_timber_name");
				 $sundries_length = mysql_result($timber4_result, $k, "cap_timber_length");
				 //$auth_sundries_length = mysql_result($timber4_result, $k, "auth_timber_length");
				 //$delivered = mysql_result($timber4_result, $k, "delivered");
				 //$balance = $auth_sundries_length - $delivered;
				 $meter_price = mysql_result($timber4_result, $k, "cap_timber_price");
				 $sundries_price = $meter_price*$sundries_length;
				 $sundries_total = $sundries_total+$sundries_price;
			 ?>
             <tr>
               <td width="297"><?php echo $sundries_name ?>
               </td>
               <td width="56" align="center"><?php echo $sundries_length ?></td>
               <td width="41" align="left" >m</td>
               <td width="66" align="right" ><span style="border-right:hidden;"><?php echo number_format($meter_price, 2, '.', ',') ?></span></td>
               <td width="73" align="right" ><span style="border-right:hidden;"><?php echo number_format($sundries_price, 2, '.', ',') ?></span></td>
               <td width="100" align="right" style="border-bottom:hidden;">&nbsp;</td>
             </tr>
             
             <?php
				
			 $k++;
			 }
			 ?>
             <tfoot>
             <tr>
               <td colspan="5" align="right">Sundries timber total:&nbsp;&nbsp;</td>
               <td align="right" ><span style="border-right:hidden;"><?php echo number_format($sundries_total, 2, '.', ',') ?></span></td>
             </tr>
             </tfoot>
  </table>
</div>
<div class="page_middle_frame">
<div align="left">
  <label class="label_std">Additional sundries</label>
</div>
  <table width="661" id="table_details_display">
   
             <?php
			      $additional_total='0'; 
				  $m=0;
				   while ($m<$sundries_num) { 
					    $_SESSION['additional_item_id'.$m] = mysql_result($sundries_result, $m, "cap_item_id");
						$table_name = $_SESSION['db_prefix']."_store_items";
							$name_query = "SELECT item_name, unit FROM $table_name WHERE store_item_id = '".$_SESSION['additional_item_id'.$m]."' ";
							$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");
							$unit = mysql_result($name_result, 0, "unit"); 
							}
						$additional_quantity = mysql_result($sundries_result, $m, "cap_quantity");
						//$auth_additional_quantity = mysql_result($sundries_result, $m, "auth_quantity");
						//$delivered = mysql_result($sundries_result, $m, "delivered");
						//$balance = $auth_additional_quantity - $delivered;
						$item_price = mysql_result($sundries_result, $m, "cap_price");
						$additional_price = $item_price*$additional_quantity;
						$additional_total = $additional_total + $additional_price;
				 ?>
             <tr>
               <td width="297"><?php echo $item_name ?>
               <input type="hidden" name="additional_item_id_<?php echo $m?>" id="additional_item_id_<?php echo $m?>" value="<?php echo $_SESSION['additional_item_id'.$m] ?>"></td>
               <td width="56" align="center"><?php echo $additional_quantity ?></td>
               <td width="41" align="left" ><?php echo $unit ?></td>
               <td width="66" align="right" ><span style="border-right:hidden;"><?php echo number_format($item_price, 2, '.', ',') ?></span></td>
               <td width="73" align="right" ><span style="border-right:hidden;"><?php echo number_format($additional_price, 2, '.', ',') ?></span></td>
               <td width="100" align="right" style="border-bottom:hidden;">&nbsp;</td>
             </tr>
             
              <?php
			  $m++;
             }
             ?>
             <tfoot>
             <tr>
               <td colspan="5" align="right">Total Sundries:&nbsp;&nbsp;</td>
               <td align="right" ><span style="border-right:hidden;"><?php echo number_format($additional_total, 2, '.', ',') ?></span></td>
             </tr>
             </tfoot>
  </table>
</div>
<div class="page_middle_frame">
<table width="661"id="table_details_display">
  <tr>
    <td width="472" align="left"><?php $captured_total=$timber_total+$plate_total+$press_total+$mitek_total+$bracing_total+$sundries_total+$additional_total ?>
Job value: <?php echo number_format($job_value, 2, '.', ',') ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Result:&nbsp;&nbsp;
    <?php $result = (($job_value-$captured_total)/$job_value)*100; echo number_format($result, 2, '.', ','); ?>
    %
    <input type="hidden" name="result_text" id="result_text" value="<?php echo $result ?>">
    <?php if ($result<10) { ?>
    <script>alertMessage(1, '', 'The result on this job is less than 10%. Check used quantities again.');</script>
    <?php } ?>
    <input type="hidden" name="job_value_text" id="job_value_text" value="<?php echo $job_value ?>">
    <input type="hidden" name="captured_value_text" id="captured_value_text" value="<?php echo $captured_total?>"></td>
    <td width="75" align="right"><?php $all_total=$truss_total+$timber_total+$mitek_total+$bracing_total+$sundries_total+$additional_total?>
      All total:&nbsp;</td>
    <td width="98" align="right"><span style="border-right:hidden;"><?php echo number_format($all_total, 2, '.', ',') ?></span></td>
  </tr>
</table>

</div></td>
</tr>
</table> 
 <!--end of tableMain-->
  
</div>

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

</body>
<?php } else {
$_SESSION['denied_return'] = "sales/sales_main.php";	
include ("../navigation/sales_sidebar.php");?>
	<body onLoad="accessdenied(); return false">
	</body>
<?php }
?>
</html>