<?php 
$page_name = "Production-count";
include ("../navigation/access.php");

if ($permission_num==1) {
	 

$table_name2 = $_SESSION['db_prefix']."_production_plan";
$production_query = "SELECT production_no, production_date, batch_code FROM $table_name2 WHERE produced IS NULL ORDER BY production_date DESC";

$production_result = execsql($production_query);
$production_num = mysql_num_rows($production_result);
if ($production_num!=0) {
	$v = 0;
	$arrId1 = array ();
	$arrName1 = array ();
	while ($v < $production_num) {
		$arrId1[$v] = mysql_result($production_result, $v, "production_no");
		$arrName1[$v] = mysql_result($production_result, $v, "batch_code").' -- '.date("l, d-m-Y", strtotime(mysql_result($production_result, $v, "production_date")));
		$v++;
	}
}
else {
	$arrId1[0] = '';
	$arrName1[0] = 'No production dates available';
}
	
?>

<body>
<div class="wizard_page_middle_frame">
<form id="form1" name="form1" method="get" action="production_countWizbase.php">
   <?php if ($_SESSION['error']==1) { ?>
      <div class="wizard_frame"></div>
        <?php 
	 $_SESSION['employee_name'] = "";
	   } ?>

     <div class="wizard_frame">
     <table width="600"  id="table_display_wizard">
       <tr>
         <td width="226">
         
         <label class="label_std">
         
         Select production date to count:</label></td>
         <td width="362"><select name="production_select" id="production_select" class="select300" >
           <option selected> </option>
           <?php
    	for ($j = 0; $j < count($arrId1); $j++) {
		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
		}
     ?>
         </select></td>
       </tr>
     </table>
     </div>  
<div class="wizard_spacer_frame" style="height:150px;"></div>

    
      <div class="wizard_frame"><table width="640" height="50" align="center" id="table_button_bar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115">&nbsp;</td>
            <td width="99"><span class="wizard">
              <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="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../production/production_main.php?date=0');" value="Cancel" /></td>
            <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; " /></td>
          </tr>
        </table>
        </div>
 </form>
 </div>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("warning_radio_group","selone","Please select type of warning.");
  frmvalidator.addValidation("offence_select","req","Please select the offence for this warning.");
  </script>
</body>
<?php } else { ?>
<script> needToConfirm = false; </script>
<?php
    $_SESSION['denied_return'] = "production/production_main.php?date=0";	?>
<body onLoad="accessdenied(); return false">
</body>
<?php }
?>