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

date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 


$emp_id = $_GET['emp_id_text'];


$record_date = $_GET['record_date'];
$overtime150 = $_GET['overtime150_select'];
$overtime200 = $_GET['overtime200_select'];
$reason = $_GET['overtime_reason_select'];
$notes = $_GET['notes_text'];


$table_name = $_SESSION['db_prefix']."_overtime_records";
$leave_query = "INSERT INTO $table_name (emp_id, overtime_date, overtime_hours_150, overtime_min_150, overtime_hours_200, overtime_min_200, reason, notes ) VALUES ('".$emp_id."', '".$record_date."', '".$overtime150."', '".$overtime150*60 ."', '".$overtime200."', '".$overtime200*60 ."', '".$reason."', '".$notes."') ";
execsql($leave_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 ('".$entry_date."' ,'".$_SESSION['username']."', '33', '".$emp_id."' ,'".$record_date."','".$overtime150."','".$overtime200."' )";
   $trackingResult = mySQL_query($trackingQuery);




if (isset($_GET['save_close_button']) )
	   { ?>
       <script>
	 		 window.location="../hr_module/hr_main.php?date=0";
		</script>
        <?php		 
	   }
	   
	if (isset($_GET['save_button']) )
	   {  ?>
       <script>
	         window.location="overtime_rec.php?emp_id="
	   </script>
        <?php		 
	   }
	   ?>

