
<?php
    $table_name = $_SESSION['db_prefix']."_store_items";
	$check_query = "SELECT item_name FROM $table_name WHERE  item_name = '".$_SESSION['item_name']."' " ;
	
	$check_result = mySQL_query($check_query) or die ("Error in query:   $check_query . * ". mySQL_error());
	$check_num = mysql_num_rows($check_result);
	if ($check_num!=0) { 
	$_SESSION['error']=1;
	$_SESSION['p']=2;
	
	?>
    
    <script language="javascript" type="text/javascript">
        <!--
		needToConfirm = false;
	 window.location="storeWizbase.php?s=0&p=2";
        -->
     </script>

<?php	
       }
    else{
$table_name = $_SESSION['db_prefix']."_list_stores_location";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId1 = array ();
	$arrName1 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$k = 0;
	while ($k < $position_num) {
		$arrId1[$k] = mysql_result($position_result, $k, "item_name");
		$arrName1[$k] = mysql_result($position_result, $k, "item_name");
		$k++;
	}
	}
?>
<!--jscript-->
<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>

<link href="../css/main.css" rel="stylesheet" type="text/css">
</head>
<?php include('../include/wait.php') ?>
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="wizard_page_middle_frame">
<form id="feedbackform" method="get" action="storeWizbase.php">
<div class="wizard_frame">
<table width="645" height="95" border="0">
  <tr>
    <td width="130" height="49" align="left" valign="middle">Minimum stock:&nbsp;&nbsp;&nbsp;<label class="star">*</label></td>
    <td width="193" align="left" valign="middle"><input class="text100" id="minimumStockText" name="minimumStockText" value="<?php echo $_SESSION['minimumStock'] ?>" type="text" onKeyPress="return numbersonly(this, event)" style="text-align:right" autofocus/></td>
    <td width="131" align="left" valign="middle">Maximum stock:&nbsp;&nbsp;&nbsp;
      <label class="star">*</label></td>
    <td width="173" align="left" valign="middle"><input class="text100" id="maximumStockText" name="maximumStockText" value="<?php echo $_SESSION['maximumStock'] ?>" type="text" onKeyPress="return numbersonly(this, event)" style="text-align:right" autofocus/></td>
  </tr>
  <tr>
    <td align="left" valign="middle">Cost price:&nbsp;&nbsp;<label class="star">*</label></td>
    <td align="left" valign="middle"><input class="text100" name="priceText" id="priceText" type="text" value="<?php echo $_SESSION['price'] ?>" style="text-align:right" onChange=" this.value = this.value.replace (/(\...).*/, '$1')" onKeyPress="return isNumberKey(event)"/>
          <label class="label_std">per unit</label></td>
    <td align="left" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">&nbsp;</td>
  </tr>
</table>
</div>
  
    <div class="wizard_frame">
      <label class="label_std">Unit:</label>
      &nbsp;&nbsp;
      <label class="star">*</label>
&nbsp;&nbsp;&nbsp;&nbsp;
          <label class="label_std">
            <input type="radio" name="unit_group" value="no" id="unit_group_0" <?php if ($_SESSION['unit']=="no") { echo "checked='checked' " ;} ?> />
      no</label>
          <label class="label_std">
            <input type="radio" name="unit_group" value="kg" id="unit_group_1" <?php if ($_SESSION['unit']=="kg") { echo "checked='checked' " ;} ?> />
            kg</label>
          <label class="label_std">
            <input type="radio" name="unit_group" value="ltr" id="unit_group_2" <?php if ($_SESSION['unit']=="ltr") { echo "checked='checked' " ;} ?> />
            ltr</label>
      <label class="label_std">
            <input type="radio" name="unit_group" value="m" id="unit_group_6" <?php if ($_SESSION['unit']=="mm") { echo "checked='checked' " ;} ?> />
            m</label>
          <label class="label_std">
            <input type="radio" name="unit_group" value="m2" id="unit_group_4" <?php if ($_SESSION['unit']=="m2") { echo "checked='checked' " ;} ?> />
      m2</label>
      <label class="label_std">
            <input type="radio" name="unit_group" value="pair" id="unit_group_5" <?php if ($_SESSION['unit']=="pair") { echo "checked='checked' " ;} ?> />
        pair</label>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Register product? 
      <label class="star">*</label>
<select name="register_select" class="select50" id="register_select">
        <option value="yes">yes</option>
        <option value="no">no</option>
        <option value="<?php $_SESSION['register'] ?>" selected="selected"><?php echo $_SESSION['register'] ?></option>
</select>
    </div>
        
        <div class="wizard_frame">
          <label class="label_std">Location:</label>
          <select name="location_select" class="select120"  tabindex="1" >
            <option value="<?php echo $_SESSION['location'] ?>" selected="selected"><?php echo $_SESSION['location'] ?></option>
            <?php
        	for ($k = 0; $k < count($arrId1); $k++) {
    		echo "<option value=" . "\"" . $arrId1[$k] . "\"" . ">" . $arrName1[$k] . "</option>";
	}
?>
          </select>
        </div>
    <div class="wizard_spacer_frame" style="height:25px;"></div>
        <div class="wizard_frame">
        <table width="590" height="50" align="left" id="table_button_bar">
          <tr>
            <td width="117"><input type="button" name="lastprev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false;MM_showHideLayers('wait','','show');MM_goToURL('parent','storeWizbase.php?s=&amp;p=2');return document.MM_returnValue" /></td>
            <td width="115"><span class="wizard">
              <input name="s" type="hidden" id="s" value="3" />
              <input name="p" type="hidden" id="p" value="3" />
            </td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php');" value="Cancel" /></td>
            <td width="110" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false;  validate();  MM_showHideLayers('wait','','show');"  tabindex="2"/></td>
          </tr>
        </table>
        </div>
 </form>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  function validate() {
  frmvalidator.addValidation("minimumStockText","req","- minimum stock.");
  frmvalidator.addValidation("maximumStockText","req","- maximum stock.");
  frmvalidator.addValidation("priceText","req","- cost price.");
  frmvalidator.addValidation("unit_group","selone","- unit.");
  frmvalidator.addValidation("register_select","req","- product registration.");
  }
</script>
<?php
}
?>
</body>