<style>
  .mytable{
    font-size:16px;
	width:700px;
	margin-top:10px;
	color:#FFFFFF;
  }
  
  .mytableth{
    background-color:#000000;
	color:#FFCC00;
	padding:5px 5px 5px 5px;
  }
  
    .mytabletd{
        background-color: #EEEEEE;
        text-align: center;
        color: #000000;
    }
    
    .mytabletd2{
        padding-left: 10px;
    }
    
  .mybtn{
    width:100px;
	font-size:14px;
	font-weight: bold;
	font-family: Arial;
    color: #0000FF;
  }
    
  .mytext{
    text-align: center;
    padding: 3px;
  }
</style>

<?
  function convertDateFor($pdate){
      $arrDate = explode("-",$pdate);
      return $arrDate[2] . "-" . $arrDate[1] . "-" . $arrDate[0];
  }
?>
<?
//  $arrTea1 = getTeaList();
  $hid = $_GET["hid"];
?>
<?
  $qtea = "SELECT * FROM punchsys_staff WHERE id NOT IN ('admin','pejabat') AND  userID<>'1'";
  $rtea = mysqli_query($conn,$qtea);
  $ntea = mysqli_num_rows($rtea);
  while($myrow = mysqli_fetch_array($rtea)){
	$tid = $myrow["id"];
	$arrTea[$tid] = substr($myrow["eName"],0,24);
  }
?> 
<?
  $qrecord = "SELECT * FROM punchsys_punchrecord WHERE punch_Id='$hid'";
  $rresult = mysqli_query($conn,$qrecord);
  while($myrow = mysqli_fetch_array($rresult)){
    $tteaid = $myrow["staffId"];
    $tpunchDate = $myrow["punchDate"];
    $tpunchin = $myrow["punchIn"];
    $arrPunchin = explode(":",$tpunchin);
    $tpunchout = $myrow["punchOut"];
    $arrPunchout = explode(":",$tpunchout);
  }
?>

<table border="0" cellpadding="0" cellspacing="1" class="mytable">
<form action="record_up.php" method="post">
<input type="hidden" name="hid" value="<?= $hid ?>" />
<input type="hidden" name="pdate" value="<?= $tpunchDate ?>" />
<input type="hidden" name="teaid" value="<?= $tteaid ?>" />
<tr>
  <th colspan="3" class="mytableth">DATE : <?= convertDateFor($tpunchDate) ?></th>
</tr>
<tr>
  <th class="mytableth">STAFF</th>
  <th class="mytableth">PUNCH IN</th>
  <th class="mytableth">PUNCH OUT</th>
</tr>
<tr>
  <td class="mytabletd" style="height: 50px">
    <?= $arrTea[$tteaid] ?>
  </td>
  <?
    for($i=0;$i<24;$i++){
	  if($i<10){
	    $thr="0".$i;
	  }else{
	    $thr=$i;
	  }
	  $arrHr[]=$thr;
	}
    for($i=0;$i<60;$i++){
	  if($i<10){
	    $tmin="0".$i;
	  }else{
	    $tmin=$i;
	  }
	  $arrMin[]=$tmin;
	}
  ?>
  <td bgcolor="#CCCCCC" align="center">
  <select name="inhr">
    <?
	foreach($arrHr as $thr){
	  if($arrPunchin[0]==$thr){
	    $selected = "SELECTED";
	  }else{
	    $selected = "";
	  }
	  ?>
	  <option value="<?= $thr ?>" <?= $selected ?>><?= $thr ?></option>
	  <?
	}
	?>
  </select>:
  <select name="inmin">
    <?
	foreach($arrMin as $tmin){
	  if($arrPunchin[1]==$tmin){
	    $selected = "SELECTED";
	  }else{
	    $selected = "";
	  }
	  ?>
	  <option value="<?= $tmin ?>" <?= $selected ?>><?= $tmin ?></option>
	  <?
	}
	?>
  </select>
  </td>
  <td bgcolor="#CCCCCC" align="center">
  <select name="outhr">
    <?
	foreach($arrHr as $thr){
	  if($arrPunchout[0]==$thr){
	    $selected = "SELECTED";
	  }else{
	    $selected = "";
	  }
	  ?>
	  <option value="<?= $thr ?>" <?= $selected ?>><?= $thr ?></option>
	  <?
	}
	?>
  </select>:
  <select name="outmin">
    <?
	foreach($arrMin as $tmin){
	  if($arrPunchout[1]==$tmin){
	    $selected = "SELECTED";
	  }else{
	    $selected = "";
	  }
	  ?>
	  <option value="<?= $tmin ?>" <?= $selected ?>><?= $tmin ?></option>
	  <?
	}
	?>
  </select>
  </td>
</tr>
<tr>
  <th colspan="3"  class="mytableth">
    <input name="submit" type="submit" value="SAVE" class="mybtn" style="color: #0000FF" />
	<input name="submit" type="submit" value="DEL" class="mybtn" style="color: #FF0000" />
  </th>
</tr>
</form>
</table>
