<!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-edit";
include ("../navigation/access.php");
?>

<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
</head>
<?php
if ($permission_num==1) {
	include ("../navigation/production_sidebar.php");

$page = $_GET['page'];
	
if ($page=='mix_design') {
$reference='mix_design_edit.php?design_no=';	
$page_name='Edit mix design.';
$table_name = $_SESSION['db_prefix']."_mix_design";
$mixQuery = "SELECT design_no, mix_design FROM $table_name  ORDER BY mix_design ASC";
$mixResult = execsql($mixQuery);
$mixNum = mysql_num_rows($mixResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $mixNum) {
		$arrId4[$w] = mysql_result($mixResult, $w, 'design_no');
		$arrName4[$w] = mysql_result($mixResult, $w, 'mix_design');
		$w++;
	}
}

if ($page=='packaging_design') {
$reference='packaging_design_edit.php?design_no=';	
$page_name='Edit packaging design.';
$table_name = $_SESSION['db_prefix']."_packaging_design";
$packagingQuery = "SELECT design_no, packaging_design FROM $table_name  ORDER BY packaging_design DESC";
$packagingResult = execsql($packagingQuery);
$packagingNum = mysql_num_rows($packagingResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $packagingNum) {
		$arrId4[$w] = mysql_result($packagingResult, $w, 'design_no');
		$arrName4[$w] = mysql_result($packagingResult, $w, 'packaging_design');
		$w++;
	}
}

if ($page=='production plan') {
$reference='edit_production_plan.php?e=0&production_date=';
$page_name='Production plan';
$table_name = $_SESSION['db_prefix']."_production_plan";
$planQuery = "SELECT production_date FROM $table_name WHERE planned = 'yes' AND depalleted IS NULL AND cancelled = 'no'  GROUP BY production_date ORDER BY production_date DESC";
$planResult = execsql($planQuery);
$planNum = mysql_num_rows($planResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $planNum) {
		$arrId4[$w] = mysql_result($planResult, $w, 'production_date');
		$arrName4[$w] = date("l, d-m-Y", strtotime(mysql_result($planResult, $w, 'production_date')));
		$w++;
	}
}

if ($page=='wet count') {
$reference='production_count_edit.php?production_no=';
$page_name='Production count';
$table_name = $_SESSION['db_prefix']."_production_plan";
$planQuery = "SELECT production_no, production_date, mix_design_name FROM $table_name WHERE produced_wet IS NOT NULL ORDER BY production_date DESC";
$planResult = execsql($planQuery);
$planNum = mysql_num_rows($planResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $planNum) {
		$arrId4[$w] = mysql_result($planResult, $w, 'production_no');
		$arrName4[$w] = mysql_result($planResult, $w, 'production_no').'  '.mysql_result($planResult, $w, 'production_date').'  '.mysql_result($planResult, $w, 'mix_design_name');
		$w++;
	}
}

if ($page=='depallet count') {
$reference='depallet_count_edit.php?production_no=';
$page_name='Depallet count';
$table_name = $_SESSION['db_prefix']."_production_plan";
$planQuery = "SELECT production_no, production_date, mix_design_name FROM $table_name WHERE depalleted IS NOT NULL  ORDER BY production_date DESC";
$planResult = execsql($planQuery);
$planNum = mysql_num_rows($planResult);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $planNum) {
		$arrId4[$w] = mysql_result($planResult, $w, 'production_no');
		$arrName4[$w] = mysql_result($planResult, $w, 'production_no').'  '.mysql_result($planResult, $w, 'production_date').'  '.mysql_result($planResult, $w, 'mix_design_name');
		$w++;
	}
}


?>
<body>

<div class="main_frame">
<table width="630" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td height="52" colspan="4" align="left" valign="top"><div class="page_head_frame">
        <table width="630" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="385"><label class="label_page_head">Select to edit</label></td>
            <td align="right">&nbsp;</td>
          </tr>
        </table>
      </div>
       <br />
<br /><br />
<br />
<br />
<br />

<div class="page_middle_frame"><br />
  <label class="label_std" style="font-size:16px;"><?php echo $page_name?></label>
  <br />
  <br />
  <form action="" method="get">
  <div class="wizard_frame">
    <label class="label_std"> Select <?php echo $page_name?> to edit : &nbsp;&nbsp;</label>
    <select name="job_no_select" autofocus="autofocus" class="selectbox300" id="job_no_select" onchange="window.location.href= this.form.job_no_select.options[this.form.job_no_select.selectedIndex].value"> 
      <option value=" " selected="selected" >&nbsp;</option>
      <?php
    	for ($j = 0; $j < count($arrId4); $j++) {
			echo "<option value=".$reference.$arrId4[$j].">".$arrName4[$j]."</option>";	
		}
     ?>
    </select>
  </div>
  </form>
  <br />
  <br />
<br />
<br />
<br />

</div>
    </td>
    </tr>
    </table>
</div>

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

<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "production/production_main.php?date=&branch=";	
    include ("../navigation/production_sidebar.php");?>
    <?php include ('../navigation/side_bar.php'); ?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>
</html>
