<head>
<!--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>  

<?php 

if($_SESSION['type']=="single") { 

	$table_name = $_SESSION['db_prefix']."_store_items";
	$item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory ='".$_SESSION['subCategory']."' ORDER BY item_name ASC";
	$arrId = array ();
	$arrName = array ();
	$item_result = execsql($item_query);
	$num = mysql_num_rows($item_result);
	$a = 0;
	while ($a < $num) {
		$arrId[$a] = mysql_result($item_result, $a, "store_item_id");
		$arrName[$a] = mysql_result($item_result, $a, "item_name")." - -~".mysql_result($item_result, $a, "unit");
		$a++;
	}
}


?>
<!--style sheets-->
<!--reference to main.css removed-->

<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>

</head>
<?php include('../include/wait.php') ?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="page_middle_frame">
<?php 
if($_SESSION['type']=="single") { 
?>

<table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#209949" border-collapse="collapse">
  <tr>
    <td width="525" ><div class="wizard_frame">
        <form id="feedbackform" method="get" action="stockCountWizbase.php">
          <label class="label_std">Product:<font color="#209949" size="3"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="wizard3">
            <select name="store_item_id" id="store_item_id" class="select200" autofocus onChange="
              unit = document.getElementById('store_item_id').options[document.getElementById('store_item_id').selectedIndex].text; 
              unit2 = unit.split('~'); 
              unit3 = unit2[1];
              if (unit3=='no') {
              document.getElementById('quantityText').value = '';
              document.getElementById('quantityText').onkeypress = function num(event) { return numbersonly(this, event);}
              }
              else {
              document.getElementById('quantityText').value = '';
              document.getElementById('quantityText').onkeypress = function decnum(event) { return isNumberKey(event);}  
              }            
              
              ">
              <option value=""></option>
              <?php
        	for ($i = 0; $i < count($arrId); $i++) {
    		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
	}
?>
            </select>
            </span></b></font></label>
          <br>
          <br />
          <label class="label_std"> Count quantity:&nbsp;&nbsp;&nbsp;
            <input  name="quantityText" type="text" class="text60" id="quantityText" style="text-align:right" onKeyPress="" value="" size="10" autocomplete="off" onFocus = "this.select();"/>
<input type="hidden" name="category" id="category" value="<?php echo $_SESSION['category'] ?>" />
            <input type="hidden" name="sub_category" id="sub_category" value="<?php echo $_SESSION['subCategory'] ?>" />
          </label>
          <input name="s" type="hidden" id="s" value="3" />
          <input name="p" type="hidden" id="p" value="3" />
          <input name="c" type="hidden" id="c" value="3" />
          </label
            >
          </label>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="submit" name="button2" id="button2" class="imagebutton" value="Count" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" />
        </form>
        <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("quantityText","req","Please enter a quantity.");
</script> 
      </div>
      <?php }
			else{
				?>
      <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#209949" border-collapse="collapse">
        <tr>
          <td width="525" height="291" valign="top" ><form id="feedbackform" method="get" action="stockCountWizbase.php">
              <div class="wizard_frame">
                <label class="label_std">Product:<font color="#209949" size="3"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#209949" size="3"><b>
                  <?php if ($a0=="") {echo "No more products.";} else { echo $a1; } ?>
                  </b></font></b></font></label>
                <br>
                <br />
                <label class="label_std"> Count quantity:&nbsp;&nbsp;&nbsp;
                  <input class="text100" type="text" name="quantityText" id="quantityText" onKeyPress="<?php if ($a6!='no') { ?>return isNumberKey(event) <?php } else {?>  return numbersonly(this, event)<?php } ?>" style="text-align:right" autofocus/>
                </label
            >
                <input type="hidden" name="store_item_id" id="store_item_id" value="<?php echo $a0 ?>" />
                <input type="hidden" name="stock" id="stock " value="<?php echo $a2 ?>" />
                <input type="hidden" name="category" id="category " value="<?php echo $a4 ?>" />
                <input type="hidden" name="sub_category" id="sub_category " value="<?php echo $a5 ?>" />
                </label>
                <input name="s" type="hidden" id="s" value="3" />
                <input name="p" type="hidden" id="p" value="3" />
                <input name="c" type="hidden" id="c" value="3" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <input type="submit" name="button" id="button" class="imagebutton" value="Count" onClick="needToConfirm = false;  MM_showHideLayers('wait','','show')";/>
              </div>
            </form>
            <br>
            <br>
            <br>
            <br>
            <br>
            <?php
} ?></td>
        </tr>
        <tr>
          <td><table width="590" height="50" align="center" id="table_button_bar">
              <tr>
                <td width="117">&nbsp;</td>
                <td width="115">&nbsp;</td>
                <td width="99"><span class="wizard">
                  <input name="p" type="hidden" id="p" value="3" />
                  <input name="s" type="hidden" id="s" value="3" />
                  <input name="c" type="hidden" id="c" value="5" />
                  </span></td>
                <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(2, '../store/store_main.php')" value="Stop" /></td>
                <td width="110" align="left">&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table>
</table>
</div>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("quantityText","req","- count quantity.");
</script>
</body>