<?php 

$page_name = "Stores-supply m-order";
include ("../navigation/access.php");

if ($permission_num==1) {
	
$table_name = $_SESSION['db_prefix']."_employee";
$employeeQuery = "SELECT emp_id, emp_first_name, emp_last_name FROM $table_name  ORDER BY emp_first_name ASC";
	$employeeResult = execsql($employeeQuery);
	$employeeNum = mysql_num_rows($employeeResult);
	$w = 0;
	$arrId2 = array ();
	$arrName2 = array ();
	while ($w < $employeeNum) {
		$arrId2[$w] = mysql_result($employeeResult, $w, "emp_id");
		$arrName2[$w] = mysql_result($employeeResult, $w, "emp_first_name").' '.mysql_result($employeeResult, $w, "emp_last_name");
		$w++;
	}
	

$table_name = $_SESSION['db_prefix']."_compiled_jobs";
$job_query = "SELECT * FROM $table_name WHERE job_card_no = '".$_SESSION['job_card_no']."' ";
$job_result = mySQL_query($job_query);

$cust_id = mysql_result($job_result, 0, "cust_id");
$order_date = mysql_result($job_result, 0, "date");
$project = mysql_result($job_result, 0, "project");


$b13 = mysql_result($job_result, 0, "value");
$_SESSION['cust_id']=$cust_id;
$_SESSION['order_date']=$order_date;
$_SESSION['project']=$project;

$quote='no';
$job_card_no = $_SESSION['job_card_no'];

?>

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

<?php include('../include/wait.php') 
?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="wizard_page_middle_frame">
<form id="form1" name="form1" method="GET" action="">
<div class="wizard_frame">
<?php 
include('../include/customer_block.php');
echo '<br>';

include('../include/job_block.php');
?>
</div> 
   
<div class="wizard_frame">
  Supply to: 
    <select name="emp_id_select" id="emp_id_select" class="select160">
      <option value="<?php echo $_SESSION['emp_id']?>" ><selected="selected"><?php echo $_SESSION['employee_name']?></option>
      <?php 
    	for ($w = 0; $w < count($arrId2); $w++) {
		echo "<option value=\"".$arrId2[$w] . "\"" . ">" . $arrName2[$w] . "</option>";	
	    }
     ?>
    </select>
</div>     
<div class="wizard_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" /></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" /></td>
            <td width="110" align="right"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next" tabindex="0" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" /></td>
          </tr>
      </table></td>
    </tr>
  </table>
</div>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("emp_id_select","req","- supply to.");
</script>
</div>
</body>
<?php } else { 
$_SESSION['denied_return'] = "store/store_main.php";	?>
<body onLoad="needToConfirm = false; accessdenied(); return false"; >
</body>
<?php }
?>
