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

	
	$d = date("d");
	$m = date("m");
	$y = date("Y");
	
	$user_id = $_SESSION['username'];
	date_default_timezone_set('Africa/Gaborone');
    $entryDate = date("Y-m-d H:i:s",time()); 
	
	$table_name = $_SESSION['db_prefix']."_severance";
   	$severance_query = "INSERT INTO $table_name (emp_id, pay_out_date, amount, period_years, period_months, period_from, period_to, authorised_by, pay_out_by, notes) VALUES ('".$_SESSION['emp_id'] ."' , '".$_SESSION['pay_out_date']."', '".$_SESSION['amount']."', '".$_SESSION['period_years']."', '".$_SESSION['period_months']."',  '".$_SESSION['period_from_date']."', '".$_SESSION['period_to_date']."',  '".$_SESSION['authorised_by']."', '".$_SESSION['pay_out_by']."', '".$_SESSION['notes']."') ";
	execsql($severance_query);
	
			
	$table_name = $_SESSION['db_prefix']."_tracking_hr";
   $trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entryDate."' ,'".$_SESSION['username']."', '34', '".$_SESSION['emp_id'] ."' ,'".$_SESSION['amount']."','".$_SESSION['pay_out_by']."', '".$_SESSION['pay_out_date']."' )";
   $trackingResult = mySQL_query($trackingQuery);
	
	
	
	if (isset($_GET['new_button']) )
	   {
		 $action='severanceWiz0.php';
	   }
		 
	if (isset($_GET['finish_button']) )
	  {
		$action='severance_list.php?date=0';
	  }
	
	 $_SESSION['emp_id']="";
     $_SESSION['amount'] = "";
	 $_SESSION['pay_out_by'] = "";
	 $_SESSION['authorised_by'] = "";
	 $_SESSION['pay_out_date'] = date('Y-m-d');
	 $_SESSION['period_from_date'] = date('Y-m-d');
	 $_SESSION['period_to_date'] = date('Y-m-d');
	 $_SESSION['period_years'] = '';
	 $_SESSION['period_months'] = '';
     $_SESSION['employee_name'] = "";
	 $_SESSION['notes'] = "";

	 
?>

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



