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

<?php
include("../include/session.php");

	
	$d = date("d");
	$m = date("m");
	$y = date("Y");
	
	$user_id = $_SESSION['username'];
	date_default_timezone_set('Africa/Khartoum');
    $entry_time = date("Y-m-d H:i:s",time()-3600); 
	
	$table_name = $_SESSION['db_prefix']."_pettycash";
   	$pettycash_query = "INSERT INTO `ps_pettycash`(`emp_id`, `amount`, `issue_date`, `use`, `notes`) VALUES ('".$_SESSION['emp_id'] ."' ,'".$_SESSION['amount']."' ,'".$_SESSION['issue_date']."','".$_SESSION['use']."','".$_SESSION['notes']."') ";
    execsql($pettycash_query);
	
		
	$table_name = $_SESSION['db_prefix']."_tracking_hr";
	$action_query = "INSERT INTO $table_name (entry_date, user, action, details) VALUES ('".$entry_time."' ,'".$user_id."','Petty cash to' ,'".$_SESSION['emp_id']."' )";
	execsql($action_query);
	
	
	
	if (isset($_GET['new_button']) )
	   {
		 $action='return_pettycashWiz0.php';
	   }
		 
	if (isset($_GET['finish_button']) )
	  {
		$action='pettycash_list.php?date=0';
	  }
	
	 
     $_SESSION['emp_id']="";
     $_SESSION['amount'] = "";
	 $_SESSION['issue_date'] = date('Y-m-d');
     $_SESSION['employee_name'] = "";
	 $_SESSION['use'] = "";
	 $_SESSION['notes'] = "";

	 
?>

<script language="javascript" type="text/javascript">
        <!--
		  window.location="<?php echo $action ?> ";
        -->
       </script>



