<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include ("../navigation/header.php");
include ("../navigation/store_sidebar.php");

	$s = $_GET['s'];
	$p = $_GET['p'];
	$_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['delivery_address']=$_GET['delivery_address_text'];
	 	$_SESSION['driver']=$_GET['driver_select'];
	 	$_SESSION['vehicle']=$_GET['vehicle_select'];
	 	$_SESSION['hour']=$_GET['hour_select'];
	 	$_SESSION['min']=$_GET['min_select'];
	};
	
	if($s==2) {
		$table_name = $_SESSION['db_prefix']."_tile_deliver_lines_temp";
		$delete_query = "DELETE FROM $table_name WHERE  user_name = '".$_SESSION['username']."'   "; 
		execsql($delete_query);
		
$line_num = $_GET['line_num'];
$i=0;
while ($i<$line_num) {
$store_item_id = $_GET['store_item_id'.$i];
$quantity = $_GET['quantity_text'.$i];	
$price = $_GET['price_text'.$i];
$purchase_price = $_GET['purchase_price_text'.$i];

				$table_name = $_SESSION['db_prefix']."_store_items";
				$name_query = "SELECT item_name FROM $table_name WHERE store_item_id = '".$store_item_id."'  ";
				$name_result = mySQL_query($name_query);
				$_SESSION['store_item_name'] = mysql_result($name_result, 0, "item_name");
				$_SESSION['store_item_id'] = $store_item_id;
				

$table_name = $_SESSION['db_prefix']."_tile_deliver_lines_temp";
$deliver_query = "INSERT INTO $table_name ( order_no, store_item_id, quantity, price, purchase_price, user_name) VALUES ('".$_SESSION['order_no']."', '".$store_item_id."','".$quantity."', '".$price."', '".$purchase_price."', '".$_SESSION['username']."' ) ";
execsql($deliver_query);
$i++;
};
$pallets = $_GET['pallets_text'];
$table_name = $_SESSION['db_prefix']."_tile_deliver_lines_temp";
$deliver_query = "INSERT INTO $table_name ( order_no, pallets, user_name) VALUES ('".$_SESSION['order_no']."', '".$pallets."', '".$_SESSION['username']."' ) ";
execsql($deliver_query);
}

?>

<!--style sheets-->
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="../window/dhtmlwindow.css" type="text/css" />
<link rel="stylesheet" href="../window/modal.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/tooltip.css" />

<!--jscript-->
<script type="text/javascript" src="../jscript/jquery.1.4.2.js"></script>
<script type="text/javascript" src="../window/dhtmlwindow.js"></script>
<script type="text/javascript" src="../window/modal.js"></script>
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></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/numbers_only.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 


<div class="main_frame">

<div class="page_head_frame">
  <table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr>
              <td width="459"><label class="label_page_head">Deliver tiles </label>
&nbsp;&nbsp;
<label class="label_page_head_2"><?php echo $_SESSION['cust_name'] ?></label></td>
              <td width="141" align="center"><b><?php echo $_SESSION['userbranch'].'<br>branch'?></b></td>
      </tr>
    </table>
</div>
        <br /><br /><br /><br />
        <table >
     	<tr>
      	<td >
        <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>
                <div class="active_step_label">
                  Supplier</div>
              <?php } else { ?>
              <div class="de_active_step_frame">
                <div class="de_active_step_head_label">&nbsp;1</div></div>
                <div class="de_active_step_label">
                  Supplier</div>
              <?php } ?></td>
            <td><?php if ($_SESSION['p']==2) { ?>
              <div class="active_step_frame">
                <div class="active_step_head_label">&nbsp;2</div></div>
                <div class="active_step_label">
                  Items</div>
             <?php } else { ?>
              <div class="de_active_step_frame">
                <div class="de_active_step_head_label">&nbsp;2</div></div>
                <div class="de_active_step_label">
                  Items</div>
            <?php } ?></td>
            <td><?php if ($_SESSION['p']==3) { ?>
              <div class="active_step_frame">
                <div class="active_step_head_label">&nbsp;3</div></div>
                <div class="active_step_label">
                  Finish</div>
             <?php } else { ?>
              <div class="de_active_step_frame">
                <div class="de_active_step_head_label">&nbsp;3</div></div>
                <div class="de_active_step_label">
                  Finish</div>
              <?php } ?></td>
          </tr>
        </table>
        </div>
        </td>
       </tr>
    <tr>
    <td>
        
        <?php 
	if ($_SESSION['p']==1) { include("deliver_tilesWiz1.php"); }
	if ($_SESSION['p']==2) { include("deliver_tilesWiz2.php"); }
	if ($_SESSION['p']==3) { include("deliver_tilesWiz4.php"); }
	
    ?></td>
    </tr>
  </table>
</div>


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


