<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  
<link rel="stylesheet" type="text/css" href="popup.css" />
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<?php

//include('../include/db.php');
include('../include/session.php');	
include('../include/formValidations.php');


$time_id = $_GET['time_id'];




$table_name = $_SESSION['db_prefix']."_time_record";
$time_query = "SELECT * FROM $table_name WHERE time_id ='".$time_id."' ";
$time_result = mySQL_query($time_query);
$emp_name = mysql_result($time_result, 0, "emp_id");
$edit_date = mysql_result($time_result, 0, "date");
$clock_in = mysql_result($time_result, 0, "clock_in");
$clock_out = mysql_result($time_result, 0, "clock_out");
$permission = mysql_result($time_result, 0, "permission");


$clock_in_hrs = $hours =  floor($clock_in/60); 
$clock_in_min = $mins =   $clock_in % 60; 
$clock_out_hrs = $hours =  floor($clock_out/60); 
$clock_out_min = $mins =   $clock_out % 60; 


?>
<script type="text/javascript">
function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
}
document.onkeypress = stopRKey;
</script> 

<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>

 
<link href="../css/popup.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
label.label_std {	margin-left:5px;
    line-height:20px;
	padding-top:6px;
    color:#000;
    text-shadow:1px 1px 1px #fff;
    font:bold 12px Arial;
}
select.select50 {
	background:#FFF;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 1px;
    outline: none;
    padding: 2px;
    width:50px;
	height:24px;
	color:#000;
}
select.select80 {background:#FFEAEA;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 1px;
    outline: none;
    padding: 2px;
    width:80px;
	height:24px;
	color:#000;
}
select.select501 {    background:#FFF;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 1px;
    outline: none;
    padding: 2px;
    width:50px;
	height:24px;
	color:#000;
}
select.select502 {    background:#FFF;
    border: 1px solid #ddd;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 1px;
    outline: none;
    padding: 2px;
    width:50px;
	height:24px;
	color:#000;
}
-->
</style>
</head>
<form action="../hr_module/edit_timekeeping.php" method="get" name="form1" target="_top" id="form1">
<body onload="document.getElementById(;MM_callJS('document.getElementById(\'quantityText\').focus();')"editText").focus();">
<table width="290" border="0" align="center" cellpadding="0" cellspacing="0" class="list2">
  <tr>
    <td width="290" height="161" align="center" valign="middle"><p><label class="label_std">Edit the value and click "Edit"<br />
If you don't want to change, click "cancel"</label>
        <br />
        </p>
      <table width="500" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="242"><label class="label_std">Clock-in time:</label>
            <br />
            <label class="label_std"> hour: </label>
            <select name="clock_in_hrs_select" class="select50" id="clock_in_hrs_select" align='right'>
              <option value="7">7</option>
              <option value="8">8</option>
              <option value="9">9</option>
              <option value="10">10</option>
              <option value="11">11</option>
              <option value="12">12</option>
              <option value="<?php if ($clock_in_hrs==0) {echo "7";} else { echo $clock_in_hrs;} ?>" selected="selected"><?php if ($clock_in_hrs==0) {echo "7";} else { echo $clock_in_hrs;} ?></option>
            </select>
&nbsp;&nbsp;
<label class="label_std"> minutes: </label>
<select name="clock_in_min_select" class="select501" id="clock_in_min_select" align='right'>
  <option selected="selected"> </option>
  <option value="0">00</option>
  <option value="00">00</option>
  <option value="01">01</option>
  <option value="02">02</option>
  <option value="03">03</option>
  <option value="04">04</option>
  <option value="05">05</option>
  <option value="06">06</option>
  <option value="07">07</option>
  <option value="08">08</option>
  <option value="09">09</option>
  <?php 
  $i=10;
  while ($i<60) { ?>
  <option value="<?php echo $i?>"><?php echo $i?></option>
  <?php
  $i++;
  }
  ?>
  <option value="<?php echo $clock_in_min ?>" selected="selected"><?php echo $clock_in_min ?></option>
</select></td>
          <td width="258"><label class="label_std">Clock-out time:</label>
            <br />
            <label class="label_std"> hour: </label>
            <select name="clock_out_hrs_select" class="select50" id="clock_out_hrs_select" align='right'>
              <option value="17">17</option>
              <option value="16">16</option>
              <option value="15">15</option>
              <option value="14">14</option>
              <option value="13">13</option>
              <option value="<?php if ($clock_out_hrs==0) {echo "17";} else { echo $clock_out_hrs;} ?>" selected="selected"><?php if ($clock_out_hrs==0) {echo "17";} else { echo $clock_out_hrs;} ?></option>
            </select>
&nbsp;&nbsp;
<label class="label_std"> minutes: </label>
<select name="clock_out_min_select" class="select502" id="clock_out_min_select" align='right'>
  <option selected="selected"> </option>
  <option value="0">00</option>
  <option value="00">00</option>
  <option value="01">01</option>
  <option value="02">02</option>
  <option value="03">03</option>
  <option value="04">04</option>
  <option value="05">05</option>
  <option value="06">06</option>
  <option value="07">07</option>
  <option value="08">08</option>
  <option value="09">09</option>
  <?php 
  $i=10;
  while ($i<60) { ?>
  <option value="<?php echo $i?>"><?php echo $i?></option>
  <?php
  $i++;
  }
  ?>
  <option value="<?php echo $clock_out_min ?>" selected="selected"><?php echo $clock_out_min ?></option>
</select></td>
        </tr>
      </table>
             
  <input name="edit" type="hidden" id="edit" value="1"  />
        <input name="time_id" type="hidden" id="time_id" value="<?php echo $time_id ?>" />
        <input name="permission" type="hidden" id="permission" value="<?php echo $permission ?>" />
        <input name="edit_date" type="hidden" id="edit_date" value="<?php echo $edit_date ?>" />
        <label class="label_std"><br />
        In case of &quot;late&quot; or absent select permission: </label>
       <label class="label_std">
         <input type="radio" name="permission_group" value="yes" id="permission_group_0" <?php if ($permission=="yes") { ?> checked="checked" <?php } ?>  />      
       yes</label>
      <label class="label_std">
        <input type="radio" name="permission_group" value="no" id="permission_group_1" <?php if ($permission=="no") { ?> checked="checked" <?php } ?>/>
        no</label>
      <label class="label_std">
        <input type="radio" name="permission_group" value="" id="permission_group_2" <?php if ($permission=="") { ?> checked="checked" <?php } ?>/>
    n/a</label>
      <br />      <br />
    </td>
  </tr>
  <tr>
    <td height="46" align="center">
      <input name="input" type="submit" value="Edit" class="imagebutton"  />
      <input name="button" type="button" class="imagebutton" id="button" onclick="MM_goToURL('parent','../hr_module/edit_timekeeping.php?edit_date=<?php echo $edit_date ?>&edit=0');return document.MM_returnValue"  value="Cancel" /></form>
    <br />
    <hr /></td>
  </tr>
  <tr>
    <td height="58" align="left" valign="middle"><label class="label_std">
    To make this employee absent click: <img src="../images/absent_btn.png" width="90" height="30" onclick="MM_goToURL('parent','../hr_module/edit_timekeeping.php?time_id=<?php echo $time_id?>&edit=2&edit_date=<?php echo $edit_date ?>');return document.MM_returnValue" /></label></td>
  </tr>
  <tr>
    <td align="left">
      </td>
  </tr>
</table>

<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("ProductSelect","req","Please select a product.");
  frmvalidator.addValidation("QuantityText","req","Please enter the quantity.");
    
    
    
   


  
</script>
</body>
</html>