<html>
<head> 
<title>Laporan Pembayaran</title>
</head>
<body style="font-family: Times, Times New Roman, Georgia, serif;">
<?php 
//ttd 
function bulan($bulan)
{
Switch ($bulan){
    case 1 : $bulan="Januari";
        Break;
    case 2 : $bulan="Februari";
        Break;
    case 3 : $bulan="Maret";
        Break;
    case 4 : $bulan="April";
        Break;
    case 5 : $bulan="Mei";
        Break;
    case 6 : $bulan="Juni";
        Break;
    case 7 : $bulan="Juli";
        Break;
    case 8 : $bulan="Agustus";
        Break;
    case 9 : $bulan="September";
        Break;
    case 10 : $bulan="Oktober";
        Break;
    case 11 : $bulan="November";
        Break;
    case 12 : $bulan="Desember";
        Break;
    }
return $bulan;
}


if($status_det=='ALL'){$set = 'Semua';}
if($status_det=='0'){$set = 'Baru';}
if($status_det=='1'){$set = 'Disetujui';}
if($status_det=='2'){$set = 'Ditolak';}
if($status_det=='3'){$set = 'Lunas (Bulan & Tahun)';}
if($status_det=='4'){$set = 'Belum Lunas (Bulan & Tahun)';}
if($status_det=='5'){$set = 'Semua  Lunas  (Tahun)';}
if($status_det=='6'){$set = 'Semua Belum Lunas  (Tahun)';}

?>
<style type="text/css">
hr.style-one {
border-color: black;border-width: 1px 0 0 0;
}
hr.style-three {
    border: 0;
    border-bottom: 1px dashed #000;
    background: #999;
}
@media  hr.style-one {
border-color: black;border-width: 2px 0 0 0;
}
hr.style-three {
    border: 0;
    border-bottom: 1px dashed #000;
    background: #999;
}
@media print{
   .noprint{
       display:none;
   }
}
@media  .button {
  background-color: #4CAF50;
  border: none;
  color: white;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 12px;
  margin: 4px 2px;
  cursor: pointer;
}
</style>
<body style="font-family: Verdana, Geneva, sans-serif;">
<table border="0" cellpadding="0" cellspacing="0" style="width:650px;margin-left: auto;margin-right: auto; font-size:12px;" class="noprint">
		<tr>
			<td style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onclick="window.print()"class="button">Cetak</button></td>
		</tr>
		<tr>
			<td style="text-align: center;">&nbsp;</td>
		</tr>		
	</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="width:1300px;margin-left: auto;margin-right: auto; font-size:12px;">	
	<tbody>
		<tr align="center">
			<td rowspan="5" align="center" style="width:10%"><img src="<?php echo base_url();?>images/logokotamadiun.jpg" alt="logokotamadiun" width="80" height="90"></td>
			<td style="text-align: center;font-size:14pt;width: 140mm;color:#00468e; width:85%"><strong> ESEWA </strong></td> 
		</tr>
		<tr>
			<td style="text-align: center;font-size:12pt;color:#00468e;width:85%"><strong>GEDUNG DIKLAT PEMERINTAH KOTA MADIUN </strong></td>
		</tr>
		<tr>
			<td style="text-align: center;font-size:9pt;width:85%"><strong>Jalan Duku No 1 Kota Madiun</strong></td>
		</tr>		
		<tr>
			<td style="text-align: center;font-size:9pt;width:85%">Telp : (0351)  465095, 081 335 125 111</td>
		</tr>
		<tr>
			<td style="text-align: center;font-size:9pt;width:85%"><strong> <?php echo 'Laporan pada bulan : '.bulan($bulan).' '.$thn.', Status : '.$set;?> </strong></td>
		</tr>		
	</tbody>
</table> 
<table border="0" cellpadding="0" cellspacing="0" style="width:1300px;margin-left: auto;margin-right: auto; font-size:12px;">	
		<tr>
			<td style="text-align: center;"><hr class="style-one"></td>
		</tr>		
	</tbody>
</table>
<table border="1" cellpadding="0" cellspacing="0" style="width:1300px;margin-left: auto;margin-right: auto; font-size:12px;">	
	<tbody>
		<tr>
			<td style="text-align: center;background-color: #349467; color: #FFF;">No</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Id Pesan</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Nama Pemakai</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Tgl Pakai</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Tgl Selesai</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Tgl Bayar</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Status</td>
			<td style="text-align: center;background-color: #349467; color: #FFF;">Fasilitas</td>
		</tr>
<?php 

	
$no=0;
foreach($tampil->result() as $row){ 
$no++;
$idpesan = $row->idpesan;
$namapesan = $row->namapesan;
$namapemakai = $row->namapemakai;
$alamat = $row->alamat;
$hppesan = $row->hppesan;
$keperluan = $row->keperluan;
$status = $row->status;
$tglpakai = $row->tglpakai;
$tglselesai = $row->tglselesai;
$jampakai = $row->jampakai;
$tanggal = new DateTime($tglpakai); 
$sekarang = new DateTime($tglselesai);
$selisihhari = $tanggal->diff($sekarang);
$tgldp1 = $row->tgldp1;
$tgldp2 = $row->tgldp2;
//bayar
$dp1 = $row->dp1;
$dp2 = $row->dp2;
$pemkot = $row->pemkot;
$statusdp = $row->statusdp;
$res = $this->m_laporan->total($idpesan);
$totalharga = $res->total;
?>		
		<tr>
			<td  style="text-align: center;"><?php echo $no;?></td>
			<td style="text-align: center;"><?php echo $idpesan;?></td>
			<td><?php echo ucwords($namapemakai);?></td>
			<td style="text-align: center;"><?php echo date('d F Y', strtotime($tglpakai)) ;?></td>
			<td style="text-align: center;"><?php echo date('d F Y', strtotime($tglselesai));  ?></td>
			<td style="text-align: center;"><?php if($tgldp1 =='0000-00-00') { echo '-';}else{ echo date('d F Y', strtotime($tgldp1)) ;}  ?></td>
			<td style="text-align: center;"><?php if($statusdp==1 AND $tgldp1 !='0000-00-00'){ echo 'Lunas'; }else{ echo 'Belum Lunas';}  ?></td>
			<td style="text-align: left;">
			<?php 
			
				$da = $this->m_laporan->tampilfasilitas($idpesan);	
				foreach($da->result() as $r){ 
					echo $r->namafasilitas.'<br />';
				}
				
			?></td>

		</tr>
<?php }?>		
	</tbody>
</table>
<p>&nbsp;</p>
</body>
</html>