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

?>

<?php 
	
	$s = $_GET['s'];
	$p = $_GET['p'];
	
	//$error = $_SESSION['error'];
	$_SESSION['p']=$p;
	$_SESSION['s']=$s;
	
	
	if (isset($_GET['prev_button']) )
	   {
		 $_SESSION['p']= $_SESSION['p']-1;
	   }
		 
	if (isset($_GET['next_button']) )
	  {
		$_SESSION['p']=$_SESSION['p']+1;
	  }
	
		
	
	if ($s==1) {
		 $_SESSION['production_no'] = $_GET['production_select'];
		 	$table_name = $_SESSION['db_prefix']."_production_plan";
				$batch_query = "SELECT production_date, batch_code FROM $table_name WHERE production_no = '".$_SESSION['production_no']."'  ";
				$batch_result = mySQL_query($batch_query);
				$batch_num = mysql_num_rows($batch_result);
				$_SESSION['production_date'] = mysql_result($batch_result, 0, "production_date");
				$_SESSION['batch_code'] = mysql_result($batch_result, 0, "batch_code");
		
	}
		
	if($s==2) {
		$_SESSION['depallet_date']=$_GET['depallet_date'];
		
	  	$table_name = $_SESSION['db_prefix']."_depallet_count_temp";
		$delete_query = "DELETE FROM $table_name WHERE user_name = '".$_SESSION['username']."' "; 
		execsql($delete_query);
		
	 $_SESSION['depallet_date']=$_GET['depallet_date'];
	 
	 $i=0;
	 while ($i<$_SESSION['production_line_num'])  {
	   $mix_design_no = $_GET['mix_design_no'.$i];
	   $depallet_quantity = $_GET['depallet_text'.$i];
	   $pallets = $_GET['pallets_text'.$i];
	   	 
	 	$table_name = $_SESSION['db_prefix']."_depallet_count_temp";
		$temp_query = "INSERT INTO $table_name (production_no, mix_design_no, depallet_quantity, pallets, user_name) VALUES ('".$_SESSION['production_no']."', '".$mix_design_no."', '".$depallet_quantity."',  '".$pallets."', '".$_SESSION['username']."' ) ";
		execsql($temp_query);
		
		$i++;
	 }
	 
	 
	 
	 
	};
	
	
	 
	
	
		
	?>
<!--style sheets-->
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />

<!--jscript-->
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>

<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>    
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script> 
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script> 
<script language="javascript" src="../jscript/calendar.js"></script>   

   
</head>

<body>
<div class="main_frame">

<div class="page_head_frame">
  <label class="label_page_head">Depallet count &nbsp;&nbsp;<?php if ($_SESSION['production_date']!='') {echo $_SESSION['batch_code'].' -- '.date("d-m-Y", strtotime($_SESSION['production_date']));} ?></label>
</div>


      <div class="wizard_paging_frame">
       <table align="left">
      <tr>
      <td>
        <?php if ($_SESSION['p']==1) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;1</div>
      <div class="active_step_label"><br /><br /><br />
      Production date</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;1</div>
      <div class="de_active_step_label"><br /><br /><br />
        Production date</div>
      <?php } ?>
      </td>
      <td>
      <?php if ($_SESSION['p']==2) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;2</div>
      <div class="active_step_label"><br /><br /><br />
      Production count</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;2</div>
      <div class="de_active_step_label"><br /><br /><br />
        Production count</div>
      <?php } ?>
     </td>
      <td>
      <?php if ($_SESSION['p']==3) { ?>
      <div class="active_step_frame"><div class="active_step_head_label">&nbsp;3</div>
      <div class="active_step_label"><br /><br /><br />
      Finish</div>
      <?php } else { ?>
      <div class="de_active_step_frame"><div class="de_active_step_head_label">&nbsp;3</div>
      <div class="de_active_step_label"><br /><br /><br />
      Finish</div>
      <?php } ?>
      </td>     
      </tr>
      </table>
      </div>
      </td>
      </tr>
      <tr>
      <td><?php 
	if ($_SESSION['p']==1) { include("depallet_countWiz1.php"); }
	if ($_SESSION['p']==2) { include("depallet_countWiz2.php"); }
	if ($_SESSION['p']==3) { include("depallet_countWiz5.php"); }
	
    ?></td>
    
    </td>
  </tr>
</table>

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