<head>

<?php

$table_name = $_SESSION['db_prefix']."_store_items";
//if ($_SESSION['subCategory']=="Timber") {
//$progressQuery = "SELECT store_item_id FROM $table_name WHERE subCategory = '". $_SESSION['subCategory']."' AND stockTake = 'P' ORDER BY width, depth, length";
//}
//else {
	$progressQuery = "SELECT store_item_id FROM $table_name WHERE subCategory = '". $_SESSION['subCategory']."' AND stockTake = 'P' AND subCategory <> 'Old'  ORDER BY item_name ASC";
//}
$progressResult = execsql($progressQuery);
$progressNum = mysql_num_rows($progressResult);


//if ($_SESSION['subCategory']=="Timber") {
//$countQuery = "SELECT store_item_id FROM $table_name WHERE subCategory = '". $_SESSION['subCategory']."' ORDER BY width, depth, length";
//}
//else {
	$countQuery = "SELECT store_item_id FROM $table_name WHERE subCategory = '". $_SESSION['subCategory']."' AND subCategory <> 'Old'   ORDER BY item_name ASC";
//}
$countResult = execsql($countQuery);
$countNum = mysql_num_rows($countResult);

?>
</head>
<?php include('../include/wait.php') ?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">

<body onLoad="MM_showHideLayers<?php if ($_SESSION['finished'] =="0") { ?>('info_frame','','show','ok_frame','','hide','wait','','hide') <?php  } else { ?> ('info_frame','','hide','ok_frame','','show','wait','','hide'); <?php } ?>" onFocus="MM_showHideLayers('wait','','hide');" >

<div class="wizard_page_middle_frame">

<label class="label_std">
      <?php if ($countNum != $progressNum) {  ?>
      <div class="wizard_frame"> <img src="../images/exclamation_mark_green_small.png" width="20" height="32"> There is a stock count in progress.<br />
        <br />
        &nbsp; If you want to complete this stock count click 'Next', otherwise prepare the stock list for a new stock count by clicking the prepare button and wait for confirmation that the list is prepared. </div>
      <br />
      <?php } else { ?>
      <div class="wizard_frame">To do a stock take, the stock list for <?php echo $_SESSION['store'] ?> needs to be prepared.<br />
        <br />
        Click the "Prepare" button and wait for confirmation that the list is prepared.
        </label>
      </div>
      <?php } ?>
      <br />
      <br />
      <form id="form1" name="form1" method="get" action="stockCountWizbase.php">
        <div class="wizard_frame" id="info_frame">
          <label class="std"><img src="../images/info_green.png" width="32" height="32">List is not prepared yet. <br />
            To prepare the list for department &quot;<?php echo $_SESSION['subCategory'] ?>&quot;, click:</label>
          &nbsp;&nbsp;&nbsp;
          <input name="prepareButton" type="submit" class="imagebutton" id="prepareButton" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" value="Prepare" tabindex="1"/>
          <input name="s" type="hidden" id="s" value="2" />
          <input name="p" type="hidden" id="p" value="2" />
          <input name="prepare" type="hidden" id="prepare" value="yes" />
          <input name="category" type="hidden" id="category" value="<?php echo $_SESSION['store'] ?>" />
        </div>
      </form>
      <div class="wizard_frame" id="ok_frame"><img src="../images/check_mark_green.png" width="32" height="32" /><?php echo $_SESSION['message1'] ?></div>
<div class="spacer_frame" style="height:30px;"></div>
<div class="wizard_frame">      
  <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="error" type="hidden" id="error" value="0" />
            </span></td>
          <td width="125" align="left"><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"><input type="button" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false;  MM_showHideLayers('wait','','show'); MM_goToURL('parent','stockCountWizbase.php?p=3&s=3&c=2');return document.MM_returnValue;" tabindex="2"/></td>
        </tr>
      </table>
</div>      
</div>
<!--form validation-->
</body>
