<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../css/main.css" rel="stylesheet" type="text/css" />
<!--jscript-->
<script language="JavaScript" src="../jscript/go_to_url.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/cancel_confirmation_2.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script> 
<!--<script language="JavaScript" src="../jscript/css-pop.js"  type="text/javascript"></script>--> 
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script> 
  


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

$today = date("Y-m-d");
$recording_date = $_GET['recording_date'];


$table_name = $_SESSION['db_prefix']."_employee";
$employee_query = "SELECT emp_id, emp_no, emp_first_name, emp_last_name, time_zone FROM $table_name WHERE time_keeping = 'yes' AND end_employ_date > '".$today."' AND premature_end_date > '".$today."' ORDER BY emp_first_name";
$employee_result = mySQL_query($employee_query);
$employee_num = mysql_num_rows($employee_result);

$table_name = $_SESSION['db_prefix']."_list_late";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId1 = array ();
	$arrName1 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId1[$b] = mysql_result($position_result, $b, "item_name");
		$arrName1[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}

$table_name = $_SESSION['db_prefix']."_list_absent";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}	
	
$table_name = $_SESSION['db_prefix']."_list_early";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId3 = array ();
	$arrName3 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId3[$b] = mysql_result($position_result, $b, "item_name");
		$arrName3[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}		
?>

<script>
function set_present() {
	list_num = <?php echo $employee_num ?>;
	i=0;
	while (i<list_num) {
		//reset the form
		document.getElementById('leave_div'+i).hidden = true;
		document.getElementById('public_div'+i).hidden = true;
		document.getElementById('late_div'+i).hidden = true;
		document.getElementById('absent_div'+i).hidden = true;
		document.getElementById('sick_div'+i).hidden = true;
		document.getElementById('early_div'+i).hidden = true;
		document.getElementById('leave_checkbox'+i).checked = false;
		document.getElementById('leave-half_day_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = false;
		document.getElementById('a_checkbox'+i).hidden = false;
		document.getElementById('u_checkbox'+i).hidden = true;
		document.getElementById('a-leave_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = false;
		document.getElementById('early_icon'+i).hidden = false;
		document.getElementById('status_text'+i).value = ''; 
		document.getElementById('in_time_checkbox'+i).checked = false;
		document.getElementById('in_time_checkbox'+i).disabled = false;
		document.getElementById('late_checkbox'+i).checked = false;
		document.getElementById('late_checkbox'+i).disabled = false;
		document.getElementById('absent_checkbox'+i).checked = false;
		document.getElementById('absent_checkbox'+i).disabled = false;
		document.getElementById('leave_checkbox'+i).checked = false;
		document.getElementById('leave_checkbox'+i).disabled = false;
		document.getElementById('sick_checkbox'+i).checked = false;
		document.getElementById('sick_checkbox'+i).disabled = false;
		document.getElementById('l-permission_checkbox'+i).checked = false;
		document.getElementById('a-permission_checkbox'+i).checked = false;
		document.getElementById('e-permission_checkbox'+i).checked = false;
		
		document.getElementById('p_edit').value = 'no';
		document.getElementById('p_edit3').value = 'no';
		//set all present
		document.getElementById('in_time_checkbox'+i).checked = true;
		document.getElementById('status_text'+i).value = 'present';
		
		document.getElementById('late_checkbox'+i).checked=false;
    	document.getElementById('absent_checkbox'+i).checked=false;
    	document.getElementById('leave_checkbox'+i).checked=false;
    	document.getElementById('sick_checkbox'+i).checked=false; 
       	document.getElementById('absent_div'+i).hidden=true; 
    	document.getElementById('late_div'+i).hidden=true;
    	document.getElementById('leave_div'+i).hidden=true;
    	document.getElementById('sick_div'+i).hidden=true; 
    	document.getElementById('early_icon'+i).hidden=false; 
    	document.getElementById('early_out'+i).value = 'no'; 
   
		i++;
	}
	document.getElementById('p_edit2').value='yes';
	document.getElementById('p_edit3').value='yes';
	alertMessage(1, '', 'You have set all employees to "Present" status. Make changes to those late, absent, on leave or sick before saving.<br><br>(Already set status were reset to "Present") ');
}
</script>

<script>
function paid_public() {
	list_num = <?php echo $employee_num ?>;
	i=0;
	while (i<list_num) {
		//reset the form
		document.getElementById('leave_div'+i).hidden = true;
		document.getElementById('public_div'+i).hidden = true;
		document.getElementById('late_div'+i).hidden = true;
		document.getElementById('absent_div'+i).hidden = true;
		document.getElementById('sick_div'+i).hidden = true;
		document.getElementById('early_div'+i).hidden = true;
		document.getElementById('leave_checkbox'+i).checked = false;
		document.getElementById('leave-half_day_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = false;
		document.getElementById('a_checkbox'+i).hidden = false;
		document.getElementById('u_checkbox'+i).hidden = true;
		document.getElementById('a-leave_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = false;
		document.getElementById('early_icon'+i).hidden = false;
		document.getElementById('status_text'+i).value = ''; 
		document.getElementById('in_time_checkbox'+i).checked = false;
		document.getElementById('in_time_checkbox'+i).disabled = false;
		document.getElementById('late_checkbox'+i).checked = false;
		document.getElementById('late_checkbox'+i).disabled = false;
		document.getElementById('absent_checkbox'+i).checked = false;
		document.getElementById('absent_checkbox'+i).disabled = false;
		document.getElementById('leave_checkbox'+i).checked = false;
		document.getElementById('leave_checkbox'+i).disabled = false;
		document.getElementById('sick_checkbox'+i).checked = false;
		document.getElementById('sick_checkbox'+i).disabled = false;
		document.getElementById('l-permission_checkbox'+i).checked = false;
		document.getElementById('a-permission_checkbox'+i).checked = false;
		document.getElementById('e-permission_checkbox'+i).checked = false;
		
		document.getElementById('p_edit').value = 'no';
		document.getElementById('p_edit3').value = 'no';
		// set to paid public
		document.getElementById('leave_div'+i).hidden = true;
		document.getElementById('public_div'+i).hidden = false;
		document.getElementById('leave_checkbox'+i).checked = true;
		document.getElementById('a_checkbox'+i).hidden = false;
		document.getElementById('u_checkbox'+i).hidden = true;
		document.getElementById('a-leave_checkbox'+i).checked = true;
		document.getElementById('u-leave_checkbox'+i).checked = true;
		document.getElementById('early_icon'+i).hidden = true;
		document.getElementById('status_text'+i).value = 'public'; 
		document.getElementById('in_time_checkbox'+i).disabled = true;
		document.getElementById('late_checkbox'+i).disabled = true;
		document.getElementById('absent_checkbox'+i).disabled = true;
		document.getElementById('leave_checkbox'+i).disabled = true;
		document.getElementById('sick_checkbox'+i).disabled = true;
		document.getElementById('p_edit').value = 'yes';
		document.getElementById('p_edit3').value = 'yes';
		i++;
	}
	alertMessage(1, '', 'You have set today as a paid public holiday. All employees will be recorded with their day hours.<br><br>If employees are working on this day, you need to record overtime hours seperately.<br><br>To cancel, click the "Reset" button.<br><br>');
}
</script>

<!--<script>
function un_paid_public() {
	list_num = <?php echo $employee_num ?>;
	i=0;
	while (i<list_num) {
		document.getElementById('leave_div'+i).hidden = true;
		document.getElementById('public_div'+i).hidden = false;
		document.getElementById('leave_checkbox'+i).checked = true;
		document.getElementById('a_checkbox'+i).hidden = true;
		document.getElementById('u_checkbox'+i).hidden = false;
		document.getElementById('a-leave_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = true;
		document.getElementById('early_icon'+i).hidden = true;
		document.getElementById('status_text'+i).value = 'unpaid public'; 
		document.getElementById('in_time_checkbox'+i).disabled = true;
		document.getElementById('late_checkbox'+i).disabled = true;
		document.getElementById('absent_checkbox'+i).disabled = true;
		document.getElementById('leave_checkbox'+i).disabled = true;
		document.getElementById('sick_checkbox'+i).disabled = true;
		document.getElementById('p_edit').value = 'yes';
		document.getElementById('p_edit3').value = 'yes';
		i++;
	}
	alertMessage(1, '', 'You have set today as an unpaid public holiday. No hours will be recorded.<br><br>To change for individual employees, use the edit function.<br><br>To cancel refresh the page or click close and open the time recording again.<br><br>');
}
</script>-->

<script>
function form_reset() {
	list_num = <?php echo $employee_num ?>;
	i=0;
	while (i<list_num) {
		document.getElementById('leave_div'+i).hidden = true;
		document.getElementById('public_div'+i).hidden = true;
		document.getElementById('late_div'+i).hidden = true;
		document.getElementById('absent_div'+i).hidden = true;
		document.getElementById('sick_div'+i).hidden = true;
		document.getElementById('early_div'+i).hidden = true;
		document.getElementById('leave_checkbox'+i).checked = false;
		document.getElementById('leave-half_day_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = false;
		document.getElementById('a_checkbox'+i).hidden = false;
		document.getElementById('u_checkbox'+i).hidden = true;
		document.getElementById('a-leave_checkbox'+i).checked = false;
		document.getElementById('u-leave_checkbox'+i).checked = false;
		document.getElementById('early_icon'+i).hidden = false;
		document.getElementById('status_text'+i).value = ''; 
		document.getElementById('in_time_checkbox'+i).checked = false;
		document.getElementById('in_time_checkbox'+i).disabled = false;
		document.getElementById('late_checkbox'+i).checked = false;
		document.getElementById('late_checkbox'+i).disabled = false;
		document.getElementById('absent_checkbox'+i).checked = false;
		document.getElementById('absent_checkbox'+i).disabled = false;
		document.getElementById('leave_checkbox'+i).checked = false;
		document.getElementById('leave_checkbox'+i).disabled = false;
		document.getElementById('sick_checkbox'+i).checked = false;
		document.getElementById('sick_checkbox'+i).disabled = false;
		document.getElementById('l-permission_checkbox'+i).checked = false;
		document.getElementById('a-permission_checkbox'+i).checked = false;
		document.getElementById('e-permission_checkbox'+i).checked = false;
		
		document.getElementById('p_edit').value = 'no';
		document.getElementById('p_edit3').value = 'no';
		i++;
	}
	alertMessage(1, '', 'You have reset the form.<br><br>');
}
</script>
</head>



<?php
include ("../navigation/header.php");
$page_name = "HR-time recording";
include ("../navigation/access.php");
if ($permission_num==1) {
	include ("../navigation/hr_sidebar.php");
?>

<body>


<div class="main_frame"  style="height:auto; min-height:570px;">

<div class="page_head_frame">
  <label class="label_page_head">Day time recording for <?php echo date("l, d-m-Y", strtotime($recording_date)) ?></label>
</div>
        <br /><br />
        <div class="page_middle_frame">

<form action="time_day_recording_save.php" method="post" name="form1"  id="form1" onSubmit="event.preventDefault();">         
<div class="page_inside_frame">
<input type="button" name="set_present_button" id="set_present_button" class="imagebutton" value="Set all present" onClick="set_present();">
<table width="660" id="table_list">
  <tr>
    <td width="52">Emp no</td>
    <td width="146">Name</td>
    <td width="136">&nbsp;P &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L&nbsp;&nbsp;&nbsp; &nbsp;A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S</td>
    <td width="25">Early</td>
    <td><img src="../images/info_blue.png" alt="" width="16" height="16">
      <label class="label_std" style="font-size:10px;">P=present&nbsp;&nbsp;L=late&nbsp;&nbsp;A=absent&nbsp;&nbsp;L=leave&nbsp;&nbsp;S=sick</label></td>
  </tr>
  <?php 
$i=0;
while ($i<$employee_num) {
	$emp_id = mysql_result($employee_result, $i, "emp_id");
	$emp_no = mysql_result($employee_result, $i, "emp_no");
	$emp_first_name = mysql_result($employee_result, $i, "emp_first_name");
	$emp_last_name = mysql_result($employee_result, $i, "emp_last_name");
	$time_zone = mysql_result($employee_result, $i, "time_zone");
	
	$le='';
	$lh='';
	//$table_name = $_SESSION['db_prefix']."_leave_records";
//	$leave_query = "SELECT emp_id FROM $table_name WHERE emp_id = '".$emp_id."' AND DATEDIFF('".$recording_date."',rec_date)>=0 AND DATEDIFF('".$recording_date."', rec_date) <= 0";
//	$leave_result = mySQL_query($leave_query);
//	$leave_num = mysql_num_rows($leave_result);
//	if ($leave_num>0) { $le='yes'; } else { $le=''; }
//	$lh='';
//	if ($leave_num>0) {
//		$table_name = $_SESSION['db_prefix']."_leave_records";
//		$half_day_query = "SELECT days_minus FROM $table_name WHERE emp_id = '".$emp_id."' AND from_date =  '".$recording_date."' ";
//		echo '<br>*****'.$half_day_query;
//		$half_day_result = mySQL_query($half_day_query);
//		$half_day_num = mysql_num_rows($half_day_result);
//		if ($half_day_num>0) {
//		$half_day = mysql_result($half_day_result, 0, "days_minus");
//		if ($half_day=='0.5') { $lh='yes'; } else { $lh=''; } 
//		}
//	}

?>
  <tr>
    <td><?php echo $emp_no ?>
      <input type="hidden" name="emp_no_text<?php echo $i ?>" id="emp_no_text<?php echo $i ?>" value="<?php echo $emp_no ?>">
      <input type="hidden" name="emp_id_text<?php echo $i ?>" id="emp_id_text<?php echo $i ?>" value="<?php echo $emp_id ?>"></td>
    <td><?php echo $emp_first_name.' '.$emp_last_name ?>
      <input name="emp_name_text<?php echo $i ?>" id="emp_name_text<?php echo $i ?>" type="hidden" value="<?php echo $emp_first_name.' '.$emp_last_name ?>">
      <input type="hidden" name="time_zone_text<?php echo $i ?>" id="time_zone_text<?php echo $i ?>" value="<?php echo $time_zone ?>"></td>
    <td><input name="status_text<?php echo $i ?>" id="status_text<?php echo $i ?>" type="hidden" value="">
      <input type="checkbox" name="in_time_checkbox<?php echo $i ?>" id="in_time_checkbox<?php echo $i ?>" onChange="document.getElementById('p_edit').value='yes'; document.getElementById('p_edit3').value = 'yes'; " 
    onClick="
    document.getElementById('in_time_checkbox<?php echo $i ?>').checked=true; 
    document.getElementById('late_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('absent_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('leave_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('sick_checkbox<?php echo $i ?>').checked=false; 
    
    document.getElementById('absent_div<?php echo $i ?>').hidden=true; 
    document.getElementById('late_div<?php echo $i ?>').hidden=true;
    document.getElementById('leave_div<?php echo $i ?>').hidden=true;
    document.getElementById('sick_div<?php echo $i ?>').hidden=true; 
    document.getElementById('early_icon<?php echo $i ?>').hidden=false; 
    
    document.getElementById('status_text<?php echo $i ?>').value = 'present'; 
    document.getElementById('early_out<?php echo $i ?>').value = 'no'; 
    ">
      <input type="checkbox" name="late_checkbox<?php echo $i ?>" id="late_checkbox<?php echo $i ?>" onChange="document.getElementById('p_edit').value='yes'; document.getElementById('p_edit3').value = 'yes'; " 
    onClick="
    document.getElementById('in_time_checkbox<?php echo $i ?>').checked=false; 
    document.getElementById('late_checkbox<?php echo $i ?>').checked=true;
    document.getElementById('absent_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('leave_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('sick_checkbox<?php echo $i ?>').checked=false; 
    
    document.getElementById('absent_div<?php echo $i ?>').hidden=true; 
    document.getElementById('late_div<?php echo $i ?>').hidden=false;
    document.getElementById('leave_div<?php echo $i ?>').hidden=true;
    document.getElementById('sick_div<?php echo $i ?>').hidden=true;
    document.getElementById('early_icon<?php echo $i ?>').hidden=false; 
    
    document.getElementById('hour_select<?php echo $i ?>').selectedIndex=0;
    document.getElementById('min_select<?php echo $i ?>').selectedIndex=0;
    document.getElementById('late_select<?php echo $i ?>').selectedIndex=0;
    document.getElementById('l-permission_checkbox<?php echo $i ?>').checked=false;
    
    document.getElementById('status_text<?php echo $i ?>').value = 'late';
    document.getElementById('early_out<?php echo $i ?>').value = 'no'; 
    ">
      <input type="checkbox" name="absent_checkbox<?php echo $i ?>" id="absent_checkbox<?php echo $i ?>" onChange="document.getElementById('p_edit').value='yes'; document.getElementById('p_edit3').value = 'yes'; "
    onClick="
    document.getElementById('in_time_checkbox<?php echo $i ?>').checked=false; 
    document.getElementById('late_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('absent_checkbox<?php echo $i ?>').checked=true;
    document.getElementById('leave_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('sick_checkbox<?php echo $i ?>').checked=false; 
    
    document.getElementById('absent_div<?php echo $i ?>').hidden=false; 
    document.getElementById('late_div<?php echo $i ?>').hidden=true;
    document.getElementById('leave_div<?php echo $i ?>').hidden=true;
    document.getElementById('sick_div<?php echo $i ?>').hidden=true;
    document.getElementById('early_icon<?php echo $i ?>').hidden=true;
    document.getElementById('early_div<?php echo $i ?>').hidden=true;
    
    document.getElementById('absent_select<?php echo $i ?>').selectedIndex=1;
    document.getElementById('a-permission_checkbox<?php echo $i ?>').checked=false;
    
    document.getElementById('status_text<?php echo $i ?>').value = 'absent'; 
    document.getElementById('early_out<?php echo $i ?>').value = 'no';
    ">
      <input type="checkbox" name="leave_checkbox<?php echo $i ?>" id="leave_checkbox<?php echo $i ?>" <?php if ($le=='yes') { ?> checked  <?php } ?> onChange="document.getElementById('p_edit').value='yes'; document.getElementById('p_edit3').value = 'yes'; alertMessage(1, '', 'Please note leave days are only recorded in the time records and not in the leave day records for the employee. In case of leave, you need to record the leave day for the employee.'); "
    onClick="
    document.getElementById('in_time_checkbox<?php echo $i ?>').checked=false; 
    document.getElementById('late_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('absent_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('leave_checkbox<?php echo $i ?>').checked=true;
    document.getElementById('sick_checkbox<?php echo $i ?>').checked=false; 
    
    document.getElementById('absent_div<?php echo $i ?>').hidden=true; 
    document.getElementById('late_div<?php echo $i ?>').hidden=true;
    document.getElementById('leave_div<?php echo $i ?>').hidden=false;
    document.getElementById('sick_div<?php echo $i ?>').hidden=true;
    document.getElementById('early_icon<?php echo $i ?>').hidden=true;
    document.getElementById('early_div<?php echo $i ?>').hidden=true;
    
    document.getElementById('a-leave_checkbox<?php echo $i ?>').checked=true;
    document.getElementById('u-leave_checkbox<?php echo $i ?>').checked=false;
    
    document.getElementById('status_text<?php echo $i ?>').value = 'leave';
    document.getElementById('early_out<?php echo $i ?>').value = 'no'; 
   ">
      <script>
   if (document.getElementById('leave_checkbox<?php echo $i ?>').checked==true)
    {
	 document.getElementById('status_text<?php echo $i ?>').value = 'leave';
	 }
   </script>
      <input type="checkbox" name="sick_checkbox<?php echo $i ?>" id="sick_checkbox<?php echo $i ?>" onChange="document.getElementById('p_edit').value='yes'; document.getElementById('p_edit3').value = 'yes'; "
    onClick="
    document.getElementById('in_time_checkbox<?php echo $i ?>').checked=false; 
    document.getElementById('late_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('absent_checkbox<?php echo $i ?>').checked=false;
    document.getElementById('leave_checkbox<?php echo $i ?>').checked=false; 
    document.getElementById('sick_checkbox<?php echo $i ?>').checked=true;
    
    
    
    document.getElementById('absent_div<?php echo $i ?>').hidden=true; 
    document.getElementById('late_div<?php echo $i ?>').hidden=true;
    document.getElementById('leave_div<?php echo $i ?>').hidden=true;
    document.getElementById('sick_div<?php echo $i ?>').hidden=false;
    document.getElementById('early_icon<?php echo $i ?>').hidden=true;
    document.getElementById('early_div<?php echo $i ?>').hidden=true;
    
    document.getElementById('p-sick_checkbox<?php echo $i ?>').checked=true;
    document.getElementById('u-sick_checkbox<?php echo $i ?>').checked=false;
    
    document.getElementById('status_text<?php echo $i ?>').value = 'sick';
    document.getElementById('early_out<?php echo $i ?>').value = 'no';  
  
    "></td>
    <td align="center"><div id="early_icon<?php echo $i ?>" <?php if ($le=='yes') { ?> hidden="true"; <?php } ?>> <a href="#" onMouseover="ddrivetip('Click to record early out time.', 150)"; onMouseout="hideddrivetip()" onclick="document.getElementById('early_div<?php echo $i ?>').hidden=false; document.getElementById('early_out<?php echo $i ?>').value='yes'; document.getElementById('p_edit').value = 'yes'; document.getElementById('p_edit3').value = 'yes'; "><img src="../images/early out.png" alt="" width="16" height="16"></a> </div></td>
    <td width="277"><div id='late_div<?php echo $i ?>' hidden="true;"> Late:
      <select name="hour_select<?php echo $i ?>" id="hour_select<?php echo $i ?>">
        <option value="07">07</option>
        <option value="08">08</option>
        <option value="09">09</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
      </select>
      <select name="min_select<?php echo $i ?>" id="min_select<?php echo $i ?>">
        <?php 
		$m=0;
		while ($m<10) {
		?>
        <option value="<?php echo '0'.$m ?>"><?php echo '0'.$m ?></option>
        <?php
		$m++;
		}
		
		
		while ($m<60) {
		?>
        <option value="<?php echo $m ?>"><?php echo $m ?></option>
        <?php
		$m++;
		}
		?>
      </select>
      <select name="late_select<?php echo $i ?>" id="late_select<?php echo $i ?>" class="select160" >
        <option value="No reason" selected="selected">No reason</option>
        <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
      </select>
      perm:
      <input type="checkbox" name="l-permission_checkbox<?php echo $i ?>" id="l-permission_checkbox<?php echo $i ?>">
    </div>
      <div id='absent_div<?php echo $i ?>' hidden="true;">
        <select name="absent_select<?php echo $i ?>" id="absent_select<?php echo $i ?>" class="select160" onClick="document.getElementById('absent_div<?php echo $i ?>').hidden=false; document.getElementById('in_time_checkbox<?php echo $i ?>').checked=false; document.getElementById('late_checkbox<?php echo $i ?>').checked=false; "  >
          <option value="No reason">No reason</option>
          <option value="No reason">No reason</option>
          <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
		}
?>
        </select>
        perm:
        <input type="checkbox" name="a-permission_checkbox<?php echo $i ?>" id="a-permission_checkbox<?php echo $i ?>" value="yes">
      </div>
      <div style="float:left" id='leave_div<?php echo $i ?>' <?php if ($le!='yes') { ?> hidden="false" <?php } ?> > Leave
        <input type="checkbox" name="a-leave_checkbox<?php echo $i ?>" id="a-leave_checkbox<?php echo $i ?>" <?php if ($le=='yes') { ?> checked  <?php } ?> onClick="document.getElementById('a-leave_checkbox<?php echo $i ?>').checked = true;"  onChange="document.getElementById('u-leave_checkbox<?php echo $i ?>').checked = false; document.getElementById('leave-half_day_checkbox<?php echo $i ?>').disabled = false;">
        &nbsp;Annual
        <input type="checkbox" name="u-leave_checkbox<?php echo $i ?>" id="u-leave_checkbox<?php echo $i ?>" onClick="document.getElementById('u-leave_checkbox<?php echo $i ?>').checked = true;"    onChange="document.getElementById('a-leave_checkbox<?php echo $i ?>').checked = false; document.getElementById('leave-half_day_checkbox<?php echo $i ?>').checked = false; document.getElementById('leave-half_day_checkbox<?php echo $i ?>').disabled = true;">
        Unpaid
        <input type="checkbox" name="leave-half_day_checkbox<?php echo $i ?>" id="leave-half_day_checkbox<?php echo $i ?>" <?php if ($lh=='yes') { ?> checked  <?php } ?>>
        Half day </div>
      <div style="float:left" id='public_div<?php echo $i ?>' hidden="true;">
        <div id="a_checkbox<?php echo $i ?>" style="float:left;">
          <input type="checkbox" name="a-leave_checkbox<?php echo $i ?>" id="a-leave_checkbox<?php echo $i ?>" checked  disabled>
          &nbsp;&nbsp;Public holiday </div>
        <div id="u_checkbox<?php echo $i ?>" style="float:left;">
          <input type="checkbox" name="u-leave_checkbox<?php echo $i ?>" id="u-leave_checkbox<?php echo $i ?>" checked disabled>
          &nbsp;&nbsp;Unpaid holiday </div>
      </div>
      <div id='sick_div<?php echo $i ?>' hidden="true;">
        <input type="checkbox" name="p-sick_checkbox<?php echo $i ?>" id="p-sick_checkbox<?php echo $i ?>" onClick="document.getElementById('p-sick_checkbox<?php echo $i ?>').checked = true;" onChange="document.getElementById('u-sick_checkbox<?php echo $i ?>').checked = false; document.getElementById('sick-half_day_checkbox<?php echo $i ?>').disabled = false;">
        Paid sick&nbsp;&nbsp;
        <input type="checkbox" name="u-sick_checkbox<?php echo $i ?>" id="u-sick_checkbox<?php echo $i ?>" onClick="document.getElementById('u-sick_checkbox<?php echo $i ?>').checked = true;" onChange="document.getElementById('p-sick_checkbox<?php echo $i ?>').checked = false; document.getElementById('sick-half_day_checkbox<?php echo $i ?>').checked = false; document.getElementById('sick-half_day_checkbox<?php echo $i ?>').disabled = true;">
        Unpaid sick&nbsp;&nbsp;
        <input type="checkbox" name="sick-half_day_checkbox<?php echo $i ?>" id="sick-half_day_checkbox<?php echo $i ?>">
        Half day </div>
      <div id='early_div<?php echo $i ?>' hidden="true;"> Early out:
        <select name="early_hour_select<?php echo $i ?>" id="early_hour_select<?php echo $i ?>">
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
        </select>
        <select name="early_min_select<?php echo $i ?>" id="early_min_select<?php echo $i ?>">
          <?php 
		$m=0;
		while ($m<10) {
		?>
          <option value="<?php echo '0'.$m ?>"><?php echo '0'.$m ?></option>
          <?php
		$m++;
		}
		while ($m<60) {
		?>
          <option value="<?php echo $m ?>"><?php echo $m ?></option>
          <?php
		$m++;
		}
		?>
        </select>
        <select name="early_select<?php echo $i ?>" id="early_select<?php echo $i ?>" class="select160" >
          <option value="No reason" selected="selected">No reason</option>
          <?php
        	for ($j = 0; $j < count($arrId3); $j++) {
    		echo "<option value=" . "\"" . $arrId3[$j] . "\"" . ">" . $arrName3[$j] . "</option>";
	}
?>
        </select>
        perm:
        <input type="checkbox" name="e-permission_checkbox<?php echo $i ?>" id="e-permission_checkbox<?php echo $i ?>">
      </div>
      <input name="early_out<?php echo $i ?>" id="early_out<?php echo $i ?>" type="hidden" value="no"></td>
  </tr>
  <?php
$i++;
}
?>
</table>
<br>
<input name="line_num" type="hidden" value="<?php echo $i ?>">
<input name="recording_date" type="hidden" value="<?php echo $recording_date ?>">


<table width="645" border="0">
    <tr>
      <td width="326">
      <input type="button" name="public_holiday_button" id="public_holiday_button" class="imagebutton" value="Public Holiday" onClick="paid_public();">
      <!--<input type="button" name="unpaid_holiday_button" id="unpaid_holiday_button" class="imagebutton" value="Unpaid Holiday" onClick="un_paid_public();">-->
      <input type="button" name="reset_button" id="reset_button" class="imagebutton" value="Reset" onClick="form_reset();">
      </td>
      <td width="309" align="right">
      <input name="week_day" type="hidden" value="<?php echo date("l", strtotime($recording_date));?>"></td>
    </tr>
  </table>
</div>

<div class="hidden_frame" id="hidden_frame">
<br>
<br>

  <input type="hidden" name="button_enabled" id="button_enabled" value="yes">
  <input name="p_edit" id="p_edit" type="hidden" value="no">
  <input name="p_edit2" id="p_edit2" type="hidden" value="no">
  <input name="p_edit3" id="p_edit3" type="hidden" value="no"> 
  <input type="hidden" name="emp_id_text" id="emp_id_text" value="<?php echo $emp_id ?>" />
  <input name="button2" type="button" class="imagebutton" id="button2" onclick="if (document.getElementById('p_edit3').value=='yes') { cancel_confirmation(3, '../hr_module/hr_main.php?date=');} else {needToConfirm = false; window.location='../hr_module/hr_main.php?date=';}" value="Close"/>
  <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Save &amp; Close" onclick="needToConfirm = false;
  if ((document.getElementById('p_edit').value=='no') && (document.getElementById('p_edit3').value=='yes')) { needToConfirm = false; event.preventDefault(); cancel_confirmation(10, '');} " />
</div>     
</form>
<!--form validation-->
  <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
     
  for (i = 0; i < 75; i++) {
	
	frmvalidator.addValidation("status_text"+i,"req","- status "+document.getElementById('emp_name_text'+i).value+".");
	
}	
  </script>
</div>
</div>


<?php include ('../navigation/side_bar.php'); ?>
</body>


<?php } else {
    $_SESSION['denied_return'] = "hr_module/hr_main.php?date=";	
    include ("../navigation/hr_sidebar.php");?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>



</html>