<?php
include("../include/session.php");
if( !$session->isAdmin() && !$session->isRadstoneStoreUser() ){
	//header("Location: ../Store/storeMenu.php");?>
<script language="javascript" type="text/javascript">
        <!--
		  window.location="denied.php";
        -->
       </script>
<?php 
}else{
	
	include("../storeHeader.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['category'] = $_GET['category_group'];
		     if ($_SESSION['changed'] == $_SESSION['category']) {
				 $_SESSION['changed'] = $_SESSION['category'];
			 }
			 else  {
				  	    $_SESSION['productName'] ="";
    				    $_SESSION['suppliersName'] = "";
	 					
					 	$_SESSION['shelf'] = "";
	 					$_SESSION['unit'] = "";
	 					$_SESSION['returnable'] = "";
	 					$_SESSION['quantity'] = "";
	 					$_SESSION['minimumStock'] = "";
	 					$_SESSION['price'] = "";
	 					$_SESSION['price2'] = "00";
	 					$_SESSION['depreciation'] = "";
						$_SESSION['date'] = "";
	 					$_SESSION['productSpecs'] = "";
						$_SESSION['changed'] = $_SESSION['category'];
			 }
		 
		
		if ($_SESSION['category'] == "Store Item") {
			$_SESSION['subCategory'] = $_GET['sub_cat_group'];
		     if ($_SESSION['changed2'] == $_SESSION['subCategory']) {
				 $_SESSION['changed2'] = $_SESSION['subCategory'];
			 }
			 else  {
				  	    $_SESSION['productName'] ="";
    				    $_SESSION['suppliersName'] = "";
	 					
					 	$_SESSION['shelf'] = "";
	 					$_SESSION['unit'] = "";
	 					$_SESSION['returnable'] = "";
	 					$_SESSION['quantity'] = "";
	 					$_SESSION['minimumStock'] = "";
	 					$_SESSION['price'] = "";
	 					$_SESSION['price2'] = "00";
	 					$_SESSION['depreciation'] = "";
						$_SESSION['date'] = "";
	 					$_SESSION['productSpecs'] = "";
						$_SESSION['changed2'] = $_SESSION['subCategory'];
			 }
		}
				
	};
	
	
	
	if($s==2) {
	if ($_SESSION['category'] == "Tiles and Accessories"){
	 $_SESSION['productName'] = $_GET['productName_text'];
	 $_SESSION['color'] = $_GET['color_text'];
    }
	else {
	 $_SESSION['productName'] = $_GET['productName_text'];
	};
	};
	
	
	if($s==3) {
	$_SESSION['minimumStock'] = $_GET['minimumStockText'];
	$_SESSION['price'] = $_GET['priceText'];
	
	if ($_SESSION['category'] == "Direct Materials"){
		$_SESSION['subCategory'] = $_GET['subCat_select'];
	}
	
	if ($_SESSION['category'] != "Tiles and Accessories"){
		
	$_SESSION['shelf'] = $_GET['shelfText'];
	$_SESSION['unit'] = $_GET['unit_group'];
	$_SESSION['returnable'] = $_GET['return_group'];
	};
	};
	
	if($s==4) {
	 $_SESSION['productSpecs'] = $_GET['specText'];
	}
	
	?>
<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>
<script language="JavaScript">
  var needToConfirm = true;
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    if (needToConfirm)
      return "You did not finish the wizard./nIf you leave now your data will not be saved.";
  }
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
</script>
<table id="tableMain" width="595">
  <!--begin of tableMain-->
  <tr>
    <td ><div class="headerbox2">New Store Item</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">Select store</font>
        </label>
        <?php if ($_SESSION['p']==2) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 2<br />
        <font size="1">Product name</font>
        </label>
        <?php if ($_SESSION['p']==3) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 3<br />
        <font size="1">Stock details</font>
        </label>
        <?php if ($_SESSION['p']==4) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 4<br />
        <font size="1">Notes</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 "Select store."; } 
		  if ($_SESSION['p']==2) { echo "Enter product name."; } 
		  if ($_SESSION['p']>2) {
			  if ($_SESSION['category'] == "Tiles and Accessories"){ echo "New product:&nbsp;&nbsp;&nbsp;&nbsp; ".$_SESSION['productName']." ".$_SESSION['color']; } 
			  else {
			  echo "New product:&nbsp;&nbsp;&nbsp;&nbsp; ".$_SESSION['productName'];
			  }
		  }
		  ?>
        </label>
      </p>
      <br /></td>
    <!--center of tableMain-->
  </tr>
  <tr>
    <td><!--center of tableMain-->
      <?php 
	if ($_SESSION['p']==1) { include("storeWiz1.php"); }
	if ($_SESSION['p']==2) { include("storeWiz2.php"); }
	if ($_SESSION['p']==3) { include("storeWiz3.php"); }
	if ($_SESSION['p']==4) { include("storeWiz4.php"); }
	if ($_SESSION['p']==5) { include("storeWiz5.php"); }
    ?></td>
  </tr>
</table>
<?php

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

?>
