<!--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['emp_id'] = $_GET['emp_id'];
	}
	$table_name = $_SESSION['db_prefix']."_employee";
	$query = "SELECT emp_id FROM $table_name WHERE emp_id = '". $_SESSION['emp_id']."' " ;
	$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="return_pettycashWizbase.php?s=0&p=2";
        -->
     </script>


     
     

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

$table_name = $_SESSION['db_prefix']."_pettycash";
$pettycash_query = "SELECT * FROM $table_name WHERE emp_id = '".$_SESSION['emp_id']."'  ";
$pettycash_result = mySQL_query($pettycash_query);
$pettycash_num = mysql_num_rows($pettycash_result);

   
?>


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

<style type="text/css">
<!--
select.select1601 {    background:#FFEAEA;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 1px;
    outline: none;
    padding: 2px;
    width:160px;
	height:24px;
	color:#000;
}
select.select16011 {background:#FFEAEA;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 1px;
    outline: none;
    padding: 2px;
    width:160px;
	height:24px;
	color:#000;
}
-->
</style>
</head>

<body >
   
<form id="feedbackform" method="get" action="return_pettycashWizbase.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 colspan="2"  valign="middle"><label class="label_std">There are <?php echo $pettycash_num ?> transactions outstanding. 
                    Select the transaction on which you want to return</label> </td>
                  </tr>
                <tr>
                  <td colspan="2" valign="middle">
                  <table width="600" id="table_list">
                  <?php
                  $i=0;
                  while ($i<$pettycash_num) {
					 $a= mysql_result($pettycash_result, $i, "pettycash_id");  
					 $a0= mysql_result($pettycash_result, $i, "issue_date"); 
					 $a1= mysql_result($pettycash_result, $i, "use");
					 $a2= mysql_result($pettycash_result, $i, "amount");
				  ?>
                    <tr>
                      <td width="66"><?php echo $i+1 . "-". $a ?>
                        <input type="hidden" name="pettycash_id" id="pettycash_id" value="<?php echo $a ?>" ></td>
                      <td width="229"><?php echo $a0 ?></td>
                      <td width="142"><?php echo $a1 ?></td>
                      <td width="143"><?php echo $a2 ?></td>
                    </tr>
                    <?php
					$i++;
				  }
				  ?>
                  </table></td>
                  </tr>
                <tr>
                  <td colspan="2" valign="middle"><label class="label_std">Enter the transaction number on which to return and click next.&nbsp;&nbsp;
                    <input name="choice_text" type="text" class="text100" id="choice_text">
                  </label></td>
                  </tr>
                <tr>
                  <td width="140" valign="middle">&nbsp;</td>
                  <td width="461" valign="middle">&nbsp;</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("choice_text","req","Please enter the number of the transaction.");
  
  
  </script>
<?php 
	}
	?>

	
 </body>