<!--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_name 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="issueToWizbase.php?s=0&p=1";
        -->
     </script>
     
     

<?php	
       }
    else{
$_SESSION['error']=0;	


	
require_once('../include/tc_calendar.php');
$issue_date = strtotime($_SESSION['issue_date']);
$d1 = date("d", $issue_date ) ;
$m1 = date("m", $issue_date ) ;
$y1 = date("Y", $issue_date ) ;
   
?>


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

<link rel="stylesheet" type="text/css" href="../css/jquery.autocomplete.css" />
<script type="text/javascript" src="../jscript/jquery.autocomplete.js"></script>
<script type="text/javascript">
 $(document).ready(function(){
  $("#employee_name_text").autocomplete("employee_autocomplete.php", {
        selectFirst: true
  });
 });
</script>


<script language="JavaScript">
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to cancel this entry?");
var url='hr_main.php?date='
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="issueToWizbase.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" >
            
            <?php if ($_SESSION['error2']==1) { ?>
            <div class="wizard_frame">
        <table width="613"  id="table_display_wizard">
                <tr>
                  <td width="253" height="45" valign="middle"><label class="label_std"><font color='red'>An employee with the name "<?php echo $_SESSION['employee_name']?>" does not exists, please select another employee.</font></label>
        </td>
       </tr>
       </table><br>
        <?php 
	// $_SESSION['comp_name'] = "";
	   } ?>
   </div>
   <div class="wizard_frame">         
              <table width="613"  id="table_display_wizard">
                <tr>
                  <td width="175"  valign="middle"><label class="label_std">Date of issue:</label>
&nbsp;&nbsp;
<label class="star">*</label></td>
                  <td width="426" valign="middle"><?php 
				  //instantiate class and set properties
		$myCalendar = new tc_calendar("issue_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d1, $m1, $y1);
		$myCalendar->setYearInterval(2010, 2020);
		//output the calendar
		$myCalendar->writeScript();
?></td>
                  </tr>
                <tr>
                  <td valign="middle">Select employee to issue to:</td>
                  <td valign="middle"><span class="wizard">
                    <input name="employee_name_text" type="text" id="employee_name_text" class="text200" value="<?php echo $_SESSION['employee_name'] ?>"  "this.value='';" onclick = "this.value='';"/>
                  </span></td>
                  </tr>
              </table>
            </div><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("employee_name_text","req","Please select an employee.");
  
  </script>
<?php 
	}
	?>

	
 </body>