<head>
<?php 
$page_name = "Stores-supply";
include ("../navigation/access.php");
include ("../include/formValidations.php");
if ($permission_num==1) {

	?>

<?php
$job_no = $_SESSION['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");	

$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") { 
				$_SESSION['name'] = mysql_result($customer_result, 0, "comp_name"); 
			} 
			else {
				$_SESSION['name'] = mysql_result($customer_result, 0, "title")." ".mysql_result($customer_result, 0, "name_2")." ".mysql_result($customer_result, 0, "comp_name");
 			}



$table_name = $_SESSION['db_prefix']."_cutting_supplies";
$supply_query = "SELECT job_no, follow_no FROM $table_name WHERE job_no = '".$_SESSION['job_no']."' ORDER BY follow_no DESC ";
$supply_result = mySQL_query($supply_query);
$supply_num = mysql_num_rows($supply_result);
if ( $supply_num>0) {
$_SESSION['follow_no'] = mysql_result($supply_result, 0, "follow_no");
$message = 'There have been '.$supply_num.' supplies on this job already.';
$_SESSION['follow_no'] = $_SESSION['follow_no']+1;
}
else {
	$_SESSION['follow_no']=1;
	$message='';
}
		 
?>


</head>



<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />
<?php include('../include/wait.php') ?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">

<?php include ('../include/tooltip.php'); ?>
<div class="page_middle_frame">
<form id="form1" name="form1" method="POST" action="cutJobWizbase.php?p=2&s=1&all=">
  
<div class="wizard_frame">
		<?php 
		include ('../include/customer_block.php');
		echo '<br>';
		include ('../include/job_block.php')
		?>      
    
</div>
<div class="button_bar_frame">
<table width="675" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115"><input name="p" type="hidden" id="p" value="1" />
              <input name="error" type="hidden" id="error" value="0" />
            <input name="s" type="hidden" id="s" value="1" />
             <input name="all" type="hidden" id="all" value="none" /></td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php'); " value="Cancel"  tabindex="-1"/></td>
            <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); MM_showHideLayers('wait','','show');" /></td>
          </tr>
        </table>
 </div>   
 </form>
 </div>

</body>  
<?php } else { 
    $_SESSION['denied_return'] = "store/store_main.php";	?>
	<body onLoad="accessdenied(); return false">
	</body>
<?php }
?>