<?php
include('class/mysql_crud.php');
$db_finger=new Database();
$db_finger->connect();
?>
<!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" />
<title>Untitled Document</title>
</head>

<body>
<p align="center"><B>LAPORAN DATA SCAN ABSENSI FINGERPRINT</B></p>
BULAN : 
<?php if($_GET['bulan']=="01"){
echo"JANUARI";	
}elseif($_GET['bulan']=="02"){
echo"FEBRUARI";	
}elseif($_GET['bulan']=="03"){
echo"MARET";	
}elseif($_GET['bulan']=="04"){
echo"APRIL";	
}elseif($_GET['bulan']=="05"){
echo"MEI";	
}elseif($_GET['bulan']=="06"){
echo"JUNI";	
}elseif($_GET['bulan']=="07"){
echo"JULI";	
}elseif($_GET['bulan']=="08"){
echo"AGUSTUS";	
}elseif($_GET['bulan']=="09"){
echo"SEPTEMBER";	
}elseif($_GET['bulan']=="10"){
echo"OKTOBER";	
}elseif($_GET['bulan']=="11"){
echo"NOVEMBER";	
}elseif($_GET['bulan']=="12"){
echo"DESEMBER";	
}else{
echo"-";	
} ?> <?php echo $_GET['tahun'];?>
<BR />
KELAS : 
<?php
$db_finger->select('rombel','*','','id_rombel="'.$_GET['rombel'].'"','','');
$data_rombel = $db_finger->getResult();
echo $data_rombel[0]['rombel'];
?><BR /><BR /> 
<?php
if(isset($_GET['proses'])){
$jml_hari=@cal_days_in_month(CAL_GREGORIAN, $_GET['bulan'], $_GET['tahun']);	
?>
<span style="font-size:42pt"></span>
<table border="1" width="100%">
<tr>
<th height="25" width="20" align="center"><span style="font-size:7pt">No.</span></th>
<th height="25" width="35" align="center"><span style="font-size:7pt">NIS</span></th>
<th height="25" width="35" align="center"><span style="font-size:7pt">PIN</span></th>
<th height="25" width="134" align="center"><span style="font-size:7pt">Nama</span></th>
<?php
for($x=1;$x<=$jml_hari;$x++){
$tanggal=$x;	
$d = date("l", mktime(0, 0, 0, $_GET['bulan'], $tanggal, $_GET['tahun']));
?>
<th width="24" <?php if($d=="Sunday"){echo"bgcolor=#cccccc";}?> align="center"><span style="font-size:7pt"><?php echo $tanggal;?></span></th>
<?php	
}
?>
</tr>
<?php
$db_finger->select('kelas','*','siswa on kelas.nis=siswa.nis','id_rombel="'.$_GET['rombel'].'"','siswa.nis ASC','');
$data_kelas = $db_finger->getResult();
$no=1;
foreach($data_kelas as $d_data_kelas){
?>
<tr>
<td align="center"><span style="font-size:7pt"><?php echo $no; ?></span></td>
<td align="center"><span style="font-size:7pt"><?php echo $d_data_kelas['nis'];?></span></td>
<td align="center"><span style="font-size:7pt"><?php echo $d_data_kelas['pin'];?></span></td>
<td><span style="font-size:7pt"><?php echo strtoupper($d_data_kelas['nama']);?></span></td>

<?php
for($x=1;$x<=$jml_hari;$x++){
if($x<10){
$tanggal="0".$x;
}else{
$tanggal=$x;	
}
$d = date("l", mktime(0, 0, 0, $_GET['bulan'], $tanggal, $_GET['tahun']));

$cektanggal="$_GET[tahun]-$_GET[bulan]-$tanggal";
$db_finger->select('absensi_log','*',NULL,'pin="'.$d_data_kelas['pin'].'"'.'and left(scan_date,10)="'.$cektanggal.'"','','');
$data_log=$db_finger->getResult();
$res = $db_finger->getResult(); 
if(@$data_log[0]['scan_date']==0){
$log="-";	
}else{
$log=substr($data_log[0]['scan_date'],11,5);	
}
?>
<td align="center" <?php if($d=="Sunday"){echo"bgcolor=#cccccc";}?>><span style="font-size:7pt"><?php echo $log;?></span></td>
<?php	
}
?>
</tr>

<?php
$no++;}
}
?>
</table>  
<page_footer>
    <span style="font-size:6pt"> Halaman [[page_cu]] / [[page_nb]] - Dicetak Pada Tanggal : <?php echo date("d/m/Y");?></span>
  </page_footer>
</body>
</html>
