
<?php 
include('../include/formValidations.php');

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

if ($_SESSION['store']=="Tiles and Accessories") {
$q = "SELECT productId, productName FROM products WHERE category ='Tiles and Accessories' AND isRemoved != '1' ORDER BY productName ASC";
	$arrId = array ();
	$arrName = array ();
	$result = execsql($q);
	$num = mysql_num_rows($result);
	$a = 0;
	while ($a < $num) {
		$arrId[$a] = mysql_result($result, $a, "productId");
		$arrName[$a] = mysql_result($result, $a, "productName");
		$a++;
	}
			  }
			  
if ($_SESSION['store']=="Direct Materials") {
$q = "SELECT productId, productName FROM products WHERE category ='Direct Materials' AND isRemoved != '1' ORDER BY productName ASC";
	$arrId = array ();
	$arrName = array ();
	$result = execsql($q);
	$num = mysql_num_rows($result);
	$a = 0;
	while ($a < $num) {
		$arrId[$a] = mysql_result($result, $a, "productId");
		$arrName[$a] = mysql_result($result, $a, "productName");
		$a++;
	}
			  }	
			  
if ($_SESSION['store']=="Store Item") {
$q = "SELECT productId, productName FROM products WHERE category ='Store Item' AND isRemoved != '1' ORDER BY productName ASC";
	$arrId = array ();
	$arrName = array ();
	$result = execsql($q);
	$num = mysql_num_rows($result);
	$a = 0;
	while ($a < $num) {
		$arrId[$a] = mysql_result($result, $a, "productId");
		$arrName[$a] = mysql_result($result, $a, "productName");
		$a++;
	}
			  }				  

?>

<script type="text/javascript" src="../css/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<script type="text/javascript" src="../css/jquery.1.4.2.js"></script>
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<!--form validation-->
<script language="javascript" type="text/javascript" >
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to stop?\n\nYou can stop and restart the count later.");
var url='countStockReport.php?date=0&category=<?php echo $_SESSION['store'] ?>'
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>



<body >
<table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" >
      <form id="feedbackform" method="get" action="stockCountWizbase.php">
      
      <p class="wizard"> <label class="std">Product:<font color="#0066FF" size="3"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="wizard3">
        <select name="productId" class="wizard3">
          <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="std"> Count quantity:&nbsp;&nbsp;&nbsp;
         <input class="wizard2" type="text" name="quantityText" id="quantityText" onKeyPress="return numbersonly(this, event)" />
       </label
            >
       
          
          
      </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="5" />
            &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; " />
            <font size="1">(or hit "Enter".)</font>
      </p></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>
</td>
    </tr>
    <tr>
      <td><table width="590" height="50" align="center" id="tableButtonBar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115">&nbsp;</td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; confirmRefresh()" value="Stop" /></td>
            <td width="110" align="left">&nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
  </table>

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


<?php } 

else {
	
	

if ($_SESSION['finished'] != "finished" ) { ?>
<script type="text/javascript">
     function toggle()  {
			document.getElementById('directContainer').style.display = 'none';
	        document.getElementById('dieselContainer').style.display = 'block';
	        document.getElementById("quantityText").focus();	
		 }
</script> 
<?php } else { ?>
<script type="text/javascript">
     function toggle()  {
			document.getElementById('directContainer').style.display = 'block';
	        document.getElementById('dieselContainer').style.display = 'none';
	     }
</script> 
<?php } ?>



<script type="text/javascript" src="../css/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<script type="text/javascript" src="../css/jquery.1.4.2.js"></script>
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<!--form validation-->
<script language="javascript" type="text/javascript" >
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to stop?\n\nYou can stop and restart the count later.");
var url='countStockReport.php?date=0&category=<?php echo $_SESSION['store'] ?>'
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>



<body   onload="toggle();"  >

<script language="JavaScript">

};
</script>
 
  <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" ><div id="fullContainer"> <div id="dieselContainer">
      <form id="feedbackform" method="get" action="stockCountWizbase.php">
      
      <p class="wizard"> <label class="std">Product:<font color="#0066FF" size="3"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $a1 ?></b></font></label><br />
       <label class="std"> Count quantity:&nbsp;&nbsp;&nbsp;
         <input class="wizard2" type="text" name="quantityText" id="quantityText" onKeyPress="return numbersonly(this, event)" />
       </label
            >
       <input type="hidden" name="productId" id="productId" 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" />
            <input type="submit" name="button" id="button" class="imagebutton" value="Count" onClick="needToConfirm = false; " />
          <font size="1">(or hit "Enter".)</font>
      </p></form>
      <form id="form1" name="form1" method="get" action="stockCountWizbase.php">
      <p class="wizard">
        <label class="std">If you want to skip the entry for this product, click <a href="countStockReport.php">here</a></label>
        <input type="hidden" name="stock2" id="stock" value="<?php echo $a2 ?>" />
        </label>
        <input name="c" type="hidden" id="c" value="4" />
        <input name="date" type="hidden" id="date" value="0">
        <input type="submit" name="skipButton" id="skipButton" class="imagebutton" value="Skip" onClick="needToConfirm = false; "  />
        <input type="hidden" name="productId2" id="productId2" value="<?php echo $a0 ?>" />
        <input type="hidden" name="category" id="category" value="<?php echo $a4 ?>" />
        <input type="hidden" name="sub_category" id="sub_category" value="<?php echo $a5 ?>" />
        <input name="s" type="hidden" id="s" value="3" />
        <input name="p" type="hidden" id="p" value="3" />
      </p>
             
      </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></div>
<div id="directContainer"><p class="wizard"><label class="std">Stock count finished, click "Finish to leave this wizard and generate a report"<br />
<br />
If you have skipped any items, you can restart the wizard and make the entries.<br />
<br />
</label>
  <input name="cancelbutton2" type="button" class="imagebutton" id="cancelbutton2" onClick="needToConfirm = false; confirmRefresh(); " value="Finish" />
</p>
</div></td>
    </tr>
    <tr>
      <td><table width="590" height="50" align="center" id="tableButtonBar">
          <tr>
            <td width="117">&nbsp;</td>
            <td width="115">&nbsp;</td>
            <td width="99">&nbsp;</td>
            <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; confirmRefresh()" value="Stop" /></td>
            <td width="110" align="left">&nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
  </table>

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

<?php } ?>
</body>