<?php
include("../include/session.php");
if(!$session->isRadstoneReceptionUser() && !$session->isAdmin()){
	header("Location: ../HR/employeeMenu.php");
}else{
	require_once('classes/tc_calendar.php');
    include ("../header.php");
$date = mysql_real_escape_string($_GET['date']);
	if($date > 0){
		$d = date("d", strtotime($date));
		$m = date("m", strtotime($date));
		$y = date("Y", strtotime($date));
	}else{
		$d = date("d");
		$m = date("m");
		$y = date("Y");
	}
//include("../include/db.php");
    	require_once('classes/tc_calendar.php');
        $q = "SELECT empId, empFName, empLName FROM employees ORDER BY empFName ASC";
        $result = execsql($q);
        $num = mysql_num_rows($result);
        $a = 0;
        $arrId = array();
        $arrName = array();
        while($a < $num) {
            $arrId[$a] = mysql_result($result, $a, "empId");
            $arrFName[$a] = mysql_result($result, $a, "empFName");
            $arrLName[$a] = mysql_result($result, $a, "empLName");
            $a++;
        }
?>
<link href="calendar.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../include/calendar.js"></script>
	<script type="text/javascript">
<!--
function validate() {
	var ErrorString='';
		if(document.late.empId.value==''){
	    ErrorString+='Please select the employee\n';
		}
		if(document.late.details.value==''){
		    ErrorString+='Please give details\n';
		}
		if(document.late.absent.value==''){
		    ErrorString+='Please give more details\n';
		}

		if( ErrorString == '' ){
	    return true;
	     }else{
		alert(ErrorString);
		return false;
		}
	}

///---->
</script>
<h3>Absenteeism</h3><br />
<form action="insertLate.php" name="late" method="post">
Employee: <select name="empId"><option value="">Choose Me</option>
    <?php
    for ($i = 0 ; $i < count($arrId) ; $i++) {

        echo "<option value=". "\"". $arrId[$i]. "\"" .">" . $arrFName[$i] . " " . $arrLName[$i] ."</option>";
    }

    ?>
    </select><br />



Permission: <select name="permission"><option value="0">Without Permission</option><option value="1">With Permission</option> </select><br />
Absent <input type="radio" checked name="absent" value="Absent" />
Late <input type="radio" name="absent" value="Late" /><br />
Hours Missed: <select name="hours"><option value="0">0 hours</option><option value="1">1 hours</option>
<option value="2.3">2 hours</option><option value="3">3 hours</option><option value="4">4 hours</option><option value="5">5 hours</option>
<option value="6">6 hours</option><option value="7">7 hours</option><option value="8">8 hours</option><option value="9">9 hours</option></select> . <select name="minutes">
<option value="0">0</option><option value=".25">15 minutes</option><option value=".50">30 minutes</option><option value=".75">45 minutes</option></select><br />

Details:<br />
 <textarea name="details" rows="10" cols="80"></textarea><br />
 Date: <?php
	  $myCalendar = new tc_calendar("date1", true);
	  $myCalendar->setIcon("../img/iconCalendar.gif");
	 $myCalendar->setDate($d, $m, $y);
	  $myCalendar->setPath("./");
	  $myCalendar->setYearInterval(2000, 2030);
	 // $myCalendar->dateAllow('2008-05-13', '2010-03-01', false);
	  //$myCalendar->setHeight(350);	  
	  //$myCalendar->autoSubmit(true, "form1");
	  $myCalendar->writeScript();
	
	  ?><br />
 
<input type="submit" name="submitok" onclick="return validate();"
	value="Save and New" /><input type="submit" name="submitok" onclick="return validate();"
	value="Save and Close" /><input type="reset" value="Reset Form" /></form></div>
<p></p>


<?php
     include "../footer.html";
}
 ?>