<!--Notice: (c)2013 This page is part of the management program for Tlhomeso Timbers, Gaborone, 
and developed by Customized Software (Pty) Ltd, Gaborone, Botswana. 
Customized Software holds the copyright on the source code on this and all other pages in the 
management program. For more info contact Customized Software on email: info@bwcustomized.com-->


<head>
<?php
	if($_SESSION['p']==1) {
		    $_SESSION['item_name'] = $_GET['item_name_text'];
	}
	$table_name = $_SESSION['db_prefix']."_item_supply";
	$query = "SELECT item_id FROM $table_name WHERE item_name = '". $_SESSION['item_name']. "'" ;

	$result = mySQL_query($query) or die ("Error in query:   $query . * ". mySQL_error());
	$num = mysql_num_rows($result);
	if ($num!=0)
	{ 
	$_SESSION['error']=1;
	$_SESSION['p']=1;
	
	?>
    <script language="javascript" type="text/javascript">
        <!--
		needToConfirm = false;
	 window.location="storeItemWizbase.php?s=0&p=1";
        -->
     </script>
     
     

<?php	
       }
    else{
$_SESSION['error']=0;	
require_once('../include/tc_calendar.php');

   include ('../include/formValidations.php');
   
    $table_name = $_SESSION['db_prefix']."_list_item_group";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
?>




<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" ></script>
<script language="javascript" src="../jscript/calendar.js"></script>


<script language="JavaScript">
    function toggle(id) {
        var state = document.getElementById(id).style.display;
                document.getElementById(id).style.display = 'block';
				document.form1.sub_cat_group_0.checked=false;
           }
		
	function toggle2(id) {
        var state = document.getElementById(id).style.display;
               document.getElementById(id).style.display = 'none';
			   document.form1.sub_cat_group_0.checked=true;
           }
             
        
</script>


<script language="JavaScript">
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to cancel this entry?");
var url='employee_list.php'
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>
<link href="../css/main.css" rel="stylesheet" type="text/css" />

</head>

<body>
   
<form id="feedbackform" method="get" action="storeItemWizbase.php">
  <table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
      <td><!--center of tableMain-->
        <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
          <tr>
            <td width="525" valign="top" >



            <div class="wizard_frame">
              <table width="618" id="table_display_wizard">
                <tr>
                  <td width="85"><span class="wizard">Item group: 
                      <label class="star">*</label></span></td>
                  <td colspan="3"><select name="item_group_select" class="selectbox160"  >
                    <option value="<?php echo $_SESSION['item_group'] ?>" selected="selected"><?php echo $_SESSION['item_group'] ?></option>
                    <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                  </select></td>
                  </tr>
                <tr>
                  <td><span class="wizard">Cost:
                      <label class="star">*</label>
                  </span></td>
                  <td width="198"><span class="wizard">
                    <input name="cost_text" type="text" class="text100" id="cost_text" value="<?php echo $_SESSION['cost'] ?>" style="text-align:right" onKeyPress="return isNumberKey(event)"/>
                  </span></td>
                  <td width="92">returnable:&nbsp;&nbsp;<label class="star">*</label></td>
                  <td width="223"><select name="returnable_select" class="select80" id="returnable_select">
                    <option value="yes">yes</option>
                    <option value="no">no</option>
                    <option value="<?php echo $_SESSION['returnable'] ?>" selected><?php echo $_SESSION['returnable'] ?></option>
                  </select></td>
                  </tr>
                </table>
            </div>
            <br />
<br />
<br /><br /><br /><br /></td>
            <!--center of tableMain-->
          </tr>
          <tr>
            <td><!--center of tableMain-->
              <table width="675" height="50" align="center" id="table_button_bar">
                <tr>
                  <td width="117"><input type="submit" name="prev_button" id="prev_button" class="imagebutton" value="Prev" onClick=" needToConfirm = false; " /></td>
                  <td width="115">&nbsp;</td>
                  <td width="99">
                    <input name="p" type="hidden" id="p" value="2" />
                    <input name="s" type="hidden" id="s" value="2" />
                  </span></td>
                  <td width="125" align="right"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; confirmRefresh();" value="Cancel" /></td>
                  <td width="110" align="right"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; " /></td>
                </tr>
              </table></td>
          </tr>
        </table>
  </table>
  <!--end of tableMain-->
</form>
<!--form validation-->
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("item_group_select","req","Please select item group.");
  frmvalidator.addValidation("cost_text","req","Please enter cost of item.");
  frmvalidator.addValidation("returnable_select","req","Please select to return.");
  
 
  </script>

<?php
	}
	?>
	
    </body>