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

	
	$d = date("d");
	$m = date("m");
	$y = date("Y");
	
	$user_id = $_SESSION['username'];
	date_default_timezone_set('Africa/Gaborone');
	$entry_date = date("Y-m-d H:i:s", time()); 
	
	$notes_string= $_SESSION['note_text'];			
	$notes_string = str_replace("'", "-", $notes_string);
	$notes_string = htmlentities($notes_string, ENT_QUOTES);

	
	$table_name = $_SESSION['db_prefix']."_employee_notes";
	$notes_query = "INSERT INTO $table_name (emp_id, note_date, note_text, entered_by ) VALUES ( '".$_SESSION['emp_id']."', '".$_SESSION['note_date']."', '".$notes_string."', '".$_SESSION['username']."'  ) ";
	execsql($notes_query);
	
	//$table_name = $_SESSION['db_prefix']."_warnings";
//    $warning_query = "SELECT warning_id  FROM $table_name ORDER BY warning_id DESC LIMIT 1  ";
//    $warning_result = mySQL_query($warning_query);
//    $warning_id = mysql_result($warning_result, 0, "warning_id");
//	
		
	$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 ('".$entry_date."' ,'".$_SESSION['username']."', '37', '".$_SESSION['emp_id']."' ,'','','' )";
   $trackingResult = mySQL_query($trackingQuery);
	
	if (isset($_GET['new_button']) )
	   {
		 $action='commentWiz0.php';
	   }
		 
	if (isset($_GET['finish_button']) )
	  {
		 $action='employee_details.php?emp_id='.$_SESSION['emp_id'] ;
	  }
	
	 
     $_SESSION['emp_id']="";
     $_SESSION['employee_name'] ="";
	 $_SESSION['note_date'] = date('Y-m-d');
	 $_SESSION['note_text'] = "";

	 
?>

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



