<?php
include("../include/session.php");
if( !$session->isAdmin() && !$session->isRadstoneReceptionUser()){
	//header("Location: ../Store/storeMenu.php");?>
<script language="javascript" type="text/javascript">
        <!--
		  window.location="denied.php";
        -->
       </script>
<?php 
}else{
	
	include("../storeHeader.php");
	
	
	//$_SESSION['ContactText'];
	$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['orderNo'] = $_GET['order_no_text'];
		$_SESSION['OrderDate'] = $_GET['order_date'];
	};
	
	if($s==2) {
	 $_SESSION['CustNo'] = $_GET['CustText'];	
	 $nameQuery = "SELECT CompanyName FROM customer WHERE CustNo = '".$_SESSION['CustNo']."'" ;
	 $nameResult = execsql($nameQuery);
	 $nameNum = mysql_num_rows($nameResult);
	 $_SESSION['CustomerName'] = mysql_result($nameResult, 0, "CompanyName");
	
	 $_SESSION['DeliverTo'] = $_GET['deliver_to_text'];
	 $_SESSION['AddressText'] = $_GET['address_text'];
	 $_SESSION['PlaceText'] = $_GET['PlaceText'];
	 $_SESSION['CellText'] = $_GET['CellText'];
	 
	 $_SESSION['delCol'] = $_GET['del_col_group'];
	 $_SESSION['DelDate'] = $_GET['delivery_group'];
	 $_SESSION['DeliveryDate'] = mysql_real_escape_string($_GET['DeliveryDate']);
	};
	
	
	
	if($s==8) {
	 $_SESSION['line_no'] = $_GET['l'];
	 $l = $_GET['l'];
	 $_SESSION['ProductSelect'.$l] = $_GET['ProductSelect'];
	 $_SESSION['QuantityText'.$l] = $_GET['QuantityText'];
	 $_SESSION['line_no'] = $_SESSION['line_no'] + 1;
	 
	 
	 $nameQuery = "SELECT  productName, price FROM products WHERE category ='Tiles and Accessories' AND productId = ". $_SESSION['ProductSelect'.$l];
	 $nameResult = execsql($nameQuery);
	 $nameNum = mysql_num_rows($nameResult);
	 $_SESSION['ProductText'.$l] =  mysql_result($nameResult, 0, "productName");
	 $_SESSION['PriceText'.$l] =  mysql_result($nameResult, 0, "price");
	 $_SESSION['TotalText'.$l] =  $_SESSION['QuantityText'.$l] * $_SESSION['PriceText'.$l];
	};
	
	if($s==9) {
	 //$_SESSION['line_no'] = $_GET['l'];
	 $l = $_GET['l'];
	 
	 
	 $_SESSION['ProductSelect'.$l] = $_GET['ProductSelect'];
	 $_SESSION['QuantityText'.$l] = $_GET['QuantityText'];
	 //$_SESSION['line_no'] = $_SESSION['line_no'] + 1;
	 
	 
	 $nameQuery = "SELECT  productName, price FROM products WHERE category ='Tiles and Accessories' AND productId = ". $_SESSION['ProductSelect'.$l];
	 $nameResult = execsql($nameQuery);
	 $nameNum = mysql_num_rows($nameResult);
	 $_SESSION['ProductText'.$l] =  mysql_result($nameResult, 0, "productName");
	 $_SESSION['PriceText'.$l] =  mysql_result($nameResult, 0, "price");
	 $_SESSION['TotalText'.$l] =  $_SESSION['QuantityText'.$l] * $_SESSION['PriceText'.$l];
	};
	
	if($s==4) {
	 $_SESSION['RemarksText'] = $_GET['RemarksText'];
	}
	
	?>
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<!--form validation-->
<script type="text/javascript" src="../css/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<script language="javascript" type="text/javascript" >
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to cancel this entry?");
var url='showAllProducts.php?cat=Tiles and Accessories&productSelect=All&colorSelect=All'
if (okToRefresh)
	{
			window.location=url;
	}
}
// -->
</script>

<table id="tableMain" width="595">
  <!--begin of tableMain-->
  <tr>
    <td ><div class="headerbox2">New order</div>
      <br />
      <p class="stepbar">
        <?php if ($_SESSION['p']==1) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 1<br />
        <font size="1">Order Number</font>
        </label>
        <?php if ($_SESSION['p']==2) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 2<br />
        <font size="1">Customer</font>
        </label>
        <?php if ($_SESSION['p']==3) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 3<br />
        <font size="1">Products</font>
        </label>
        <?php if ($_SESSION['p']==4) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
Step 4<br />
        <font size="1">Additional</font>
        </label>
        <?php if ($_SESSION['p']==5) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 5<br />
        <font size="1">Finish</font>
        </label>
        <label class="steptext">
          <?php if ($_SESSION['p']==1) { echo "Entering order number."; } else { echo "Order no:&nbsp; ".$_SESSION['orderNo'] . " for ". $_SESSION['CustomerName']."."; } ?>
        </label>
      </p>
    <br /></td>
    <!--center of tableMain-->
  </tr>
  <tr>
    <td><!--center of tableMain-->
      <?php 
	if ($_SESSION['p']==1) { include("orderWiz1.php"); }
	if ($_SESSION['p']==2) { include("orderWiz2.php"); }
	if ($_SESSION['p']==3) { include("orderWiz3.php"); }
	if ($_SESSION['p']==4) { include("orderWiz4.php"); }
	if ($_SESSION['p']==5) { include("orderWiz5.php"); }
    ?></td>
  </tr>
</table>
<?php

	}
	include("../footer.php");

?>
