<style>
  .rpt_tbl{
  font-family:Arial;
  font-size:12px;
  width:750px;
  }
</style>
<center>
<?
$numpgbk = $_POST["npgbk"];

$tdate = $datefrom;
while($tdate<=$datetil){

  $tmkdate = getMKDate($tdate);
  $weekdate = date("N",$tmkdate);

if( count(getHoliday($tdate))>0 ){
  $strHol = "[" . implode(",",getHoliday($tdate)) . "]";
}else{
  $strHol = "";
}

?>

  <div style=" page-break-after:always">
  <table border="1" class="rpt_tbl">
    <tr>
	  <th colspan="9" style="height:30px">
	    <?= $mysys->schName ?> Laporan Kehadiran - <?= $tdate ?> (<?=  $arrMinggu[$weekdate] ?>)
	  </th>
	</tr>
	<tr>
      <th width="20px">&nbsp;</th>
	  <th>NAMA</th>
	  <th>WAKTU MASUK</th>
	  <th>WAKTU KELUAR</th>
	  <th></th>
	  <th width="20px">&nbsp;</th>
	  <th>NAMA</th>
	  <th>WAKTU MASUK</th>
	  <th>WAKTU KELUAR</th>
	</tr>
  <?
  $i=1;
  foreach($arrTea as $tteaid=>$tteaname){
  
    $strRemark = "";
  
    if( $arrPunchintime[$tdate][$tteaid] == "" ){
	  $arrPunchintime[$tdate][$tteaid] = "-";
	}
    if( $arrPunchouttime[$tdate][$tteaid] == "" ){
	  $arrPunchouttime[$tdate][$tteaid] = "-";
	}
    if( $arrRemark[$tdate][$tteaid] == "" ){
	  $arrRemark[$tdate][$tteaid] = "&nbsp;";
	}
	
    if( $arrComlate[$tdate][$tteaid]=="" ){
	  $arrComlate[$tdate][$tteaid]="00:00:00";
	}
    if( $arrLevearly[$tdate][$tteaid]=="" ){
	  $arrLevearly[$tdate][$tteaid]="00:00:00";
	}

    $lateDesc="";

	if( $arrComlate[$tdate][$tteaid]=="00:00:00" ){
	  $acolors1 = "";
	  $acolore1 = "";
	  $lateDesc = $lateDesc . "";
	}else{
	  if($highlight=="1"){
	    $acolors1 = " ( ";
	    $acolore1 = " ) ";
	  }else{
	    $acolors1 = " <font color='red'> ";
	    $acolore1 = " </font> ";
	  }
	  $lateDesc = $lateDesc . "Lewat = " . $arrComlate[$tdate][$tteaid] . "<br>";
	}
	
	if( $arrLevearly[$tdate][$tteaid]=="00:00:00" ){
	  $acolors2 = "";
	  $acolore2 = "";
	  $lateDesc = $lateDesc . "";
	}else{
	  if($highlight=="1"){
	    $acolors2 = " ( ";
	    $acolore2 = " ) ";
	  }else{
	    $acolors2 = " <font color='red'> ";
	    $acolore2 = " </font> ";
	  }
	  $lateDesc = $lateDesc . "Awal = " . $arrLevearly[$tdate][$tteaid] . "<br>";
	}
	
    if($arrMessage[$tdate][$tteaid]!=""){
	  if($arrRemarkEvent[$tdate][$tteaid]!=""){
	    $strRemark = $arrMessage[$tdate][$tteaid]."; [".$arrEvent[ $arrRemarkEvent[$tdate][$tteaid] ]."] ".$arrRemark[$tdate][$tteaid];
	  }else{
        $strRemark = $arrMessage[$tdate][$tteaid];
	  }
	}else{
	  if($arrRemarkEvent[$tdate][$tteaid]!=""){
	    $strRemark = "[".$arrEvent[ $arrRemarkEvent[$tdate][$tteaid] ]."] ".$arrRemark[$tdate][$tteaid];
	  }else{
	    $strRemark = "";
	  }
	}
	
	if(str_replace(" ","",$strRemark)!=""){
	  $arrStrRemark[] = "<u>$arrTea[$tteaid]</u>" . " - " . $strRemark;
	}
	
  ?>
  <?
    if($i%2!=0){
	?>
	<tr <?= $tborder ?> >
	<?
	}else{
	?>
	<td></td>
	<?
	}
  ?>
	  <td align="center"><?= $i ?></td>
      <td width="200px"><?= $tteaname ?></td>
	  <td align="center" width="95px"><?= $acolors1 . $arrPunchintime[$tdate][$tteaid] . $acolore1 ?></td>
	  <td align="center" width="95px"><?= $acolors2 . $arrPunchouttime[$tdate][$tteaid] . $acolore2 ?></td>
  <?
    if($i%2==0){
	?>
    </tr>
	<?
	}
  ?>
	
  <?
    if( ($i%$numpgbk)==0 ){
	?>
	</table>
	</div>
	
	  <?
	  if( ($i<count($arrTea)) ){
	  ?>
	  <div style=" page-break-after:always">
      <table border="1" class="rpt_tbl">
    <tr>
	  <th colspan="9" style="height:30px">
	    <?= $mysys->schName ?> Laporan Kehadiran - <?= $tdate ?> (<?=  $arrMinggu[$weekdate] ?>)
	  </th>
	</tr>
	<tr>
      <th width="20px">&nbsp;</th>
	  <th>NAMA</th>
	  <th>WAKTU MASUK</th>
	  <th>WAKTU KELUAR</th>
	  <th></th>
	  <th width="20px">&nbsp;</th>
	  <th>NAMA</th>
	  <th>WAKTU MASUK</th>
	  <th>WAKTU KELUAR</th>
	</tr>
	  <?
	  }
	  ?>
	  
	<?
	}
  ?>
  <?
    $i++;
  }
  ?>
  
  <?
  for($i2=$i;$i2<81;$i2++){
  
    if($i2%2!=0){
	?>
	<tr <?= $tborder ?> >
	<?
	}else{
	?>
	<td></td>
	<?
	}
  ?>
	  <td align="center"><?= $i2 ?></td>
      <td width="200px">&nbsp;</td>
	  <td align="center" width="95px">&nbsp;</td>
	  <td align="center" width="95px">&nbsp;</td>
  <?
    if($i2%2==0){
	?>
    </tr>
	<?
	}
  }
  ?>
  <tr>
    <td colspan="9" height="130px">
	<?
	echo "<center><span style='font-size: 18px'>$strHol</span></center>";
	foreach($arrStrRemark as $tremark){
      echo $tremark . "<br>";
	}
	?>
	</td>
  </tr>
  <tr>
    <td colspan="2">TANDATANGAN<br /><?= $mypcsetting->gtname ?></td>
	<td colspan="2">&nbsp;</td>
	<td></td>
	<td colspan="2">TANDATANGAN<br /><?= $mypcsetting->gbname ?></td>
	<td colspan="2">&nbsp;</td>
  </tr>
  </table>
  </div>
  
<?
  unset($arrStrRemark);
  $tdate=add_date($tdate,1);
}
?>
</center>