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

<!--reference to main.css removed-->
<?php
include ("../navigation/header.php");
$page_name = "Stores-main";
include ("../navigation/access.php");

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

$cutting_supply_id = $_GET['cutting_supply_id'];
//$job_no = $_GET['job_no'];

?>

<?php
$table_name = $_SESSION['db_prefix']."_cutting_supplies";
$cutting_query = "SELECT * FROM $table_name WHERE cutting_supply_id = '".$cutting_supply_id."' ";
$cutting_result = mySQL_query($cutting_query);
$job_no = mysql_result($cutting_result, 0, "job_no");


$table_name = $_SESSION['db_prefix']."_cutting_supplies_lines";
$timber_query = "SELECT * FROM $table_name WHERE type = 'Timber' AND cutting_supply_id = '".$cutting_supply_id."' ";
$timber_result = mySQL_query($timber_query);
$timber_num = mysql_num_rows($timber_result);

$table_name = $_SESSION['db_prefix']."_cutting_supplies_lines";
$plates_query = "SELECT * FROM $table_name WHERE type = 'Plate' AND cutting_supply_id = '".$cutting_supply_id."' ";
$plates_result = mySQL_query($plates_query);
$plates_num = mysql_num_rows($plates_result);
?>
</head>

<script type="text/javascript" src="../jscript/tablesort.js"></script>

<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<body>
<?php include ('../include/tooltip.php'); ?>

<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><label class="label_page_head">Cutting bill supply:</label>
              &nbsp;&nbsp;&nbsp;<label class="label_page_head_2"><?php echo "J".$job_no ?></label></td>
            </tr>
        </table>
      </div>
        <br />

<br /></td> <!--center of tableMain-->
</tr>
<tr>
<td height="93"><div class="wizard_frame">
  <p>
    <label class="label_std" style="font-size:18px">Timber</label>
</p>
  <table width="434" id="table_details_display">
    <tr>
      <th align="left" valign="top">Timber</th>
      <th align="left" valign="top">Supplied</th>
      </tr>
    <?php 
	
	$i=0;
	while ($i<$timber_num) {
		$a1 = mysql_result($timber_result, $i, "store_item_id");
		 	$table_name = $_SESSION['db_prefix']."_store_items";
			$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$a1."' ";
			$name_result = mySQL_query($name_query);
			$a1a = mysql_result($name_result, 0, "item_name");
		$a2 = mysql_result($timber_result, $i, "quantity");
		
	?>
    <tr>
      <td align="left" valign="middle" width="205"><?php echo $a1a ?></td>
      <td align="left" valign="middle" width="92"><?php echo $_SESSION['timber_no'.$i] ?></td>
      </tr>
    <?php
	$i++;
	}
	$_SESSION['line_no3'] = $i;
	?>
  </table>
  <p>
    <label class="label_std" style="font-size:18px">Plates</label>
  </p>
  <table width="434" id="table_details_display">
    <tr>
      <th align="left" valign="top">Plate</th>
      <th align="left" valign="top">Supplied</th>
      </tr>
    <?php 
	
	$i=0;
	while ($i<$plates_num) {
		$a1 = mysql_result($plates_result, $i, "store_item_id");
		  	$table_name = $_SESSION['db_prefix']."_store_items";
			$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$a1."' ";
			$name_result = mySQL_query($name_query);
			$a1a = mysql_result($name_result, 0, "item_name");
		$a2 = mysql_result($plates_result, $i, "quantity");
		
	?>
    <tr>
      <td align="left" valign="middle" width="205"><?php echo $a1a ?></td>
      <td align="left" valign="middle" width="92"><?php echo $_SESSION['plates_no'.$i] ?></td>
      </tr>
    <?php
	$i++;
	}
	$_SESSION['line_no5'] = $i;
	?>
  </table>
  <p>&nbsp;</p>
</div>  <!--center of tableMain--></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>