<div style="padding:5px;width:1500px;">
<div style="padding:20px;"></div>
<button class="btn btnExcel" style="width:150px;text-align:center;">Export Excel</button></div>
<table id="view_laporan" class="cetakExcel" border="0" cellpadding="2" cellspacing="0" style="margin:10px;width:1500px;border-style: solid;">
	<tbody>
		<tr>
			<td align="center" colspan="17" style="text-align: center;border:0px;border-top:0;font-size:14px;border-right:0px;">LAPORAN PERKARA <?php echo $perkara_nama;?> YANG DIMOHONKAN BANDING</td>
		</tr>
		<tr>
			<td align="center" colspan="17" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="17" style="text-align: center;border:0px;font-size:14px;border-bottom:1px solid #000000;border-right:0px;">Bulan <?php echo fetch_montd($bulan);?> <?php echo $tahun;?></td>
		</tr>
	</tbody>
	<tr>
		<th rowspan="3" style='width:50px;border-style: solid;border-width:0.1em;' colspan="1">NOMOR URUT</th>
		<th rowspan="3" style='width:150px;border-style: solid;border-width:1px;' colspan="1">NOMOR PERKARA PN</th>
		<th rowspan="3" style='width:150px;border-style: solid;border-width:1px;' colspan="1">NOMOR PERKARA PT</th>
		<th rowspan="1" colspan="3">NAMA</th>
		<th rowspan="1" colspan="9">TANGGAL</th>
		<th rowspan="3" colspan="2" style='border-style: solid;border-width:1px;'>KETERANGAN</th>
	</tr>
	<tr>
		<th rowspan="2" style='width:170px;border-style: solid;border-width:1px;' colspan="1" style="border-left:0px;" >MAJELIS HAKIM TINGKAT BANDING</th>
		<th rowspan="2" style='width:170px;border-style: solid;border-width:1px;' colspan="1">PANITERA PENGGANTI TINGKAT BANDING</th>
		<th rowspan="2" style='width:170px;border-style: solid;border-width:1px;' colspan="1">PEMOHON</th>
		<th rowspan="2" style='width:100px;border-style: solid;border-width:1px;' colspan="1">PUTUSAN PN</th>
		<th rowspan="2" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PEMBERITAHUAN PUTUSAN PN KEPADA PEMOHON</th>
		<th rowspan="2" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PERMOHONAN</th>
		<th rowspan="1" colspan="2" style='width:100px;border-style: solid;border-width:1px;'>INSAGE</th>
		<th rowspan="2" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PENGIRIMAN BERKAS BANDING</th>
		<th rowspan="2" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PENERIMAAN BERKAS BANDING</th>
		<th rowspan="2" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PUTUSAN PT</th>
		<th rowspan="2" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PEMBERITAHUAN PUTUSAN PT KEPADA PEMBANDING/TERBANDING</th>
	</tr>
	<tr>
		<th rowspan="1" colspan="1" style="border-left:0px;width:100px;border-style: solid;border-width:1px;">PEMBERITAHUAN</th>
		<th rowspan="1" colspan="1" style='width:100px;border-style: solid;border-width:1px;'>PELAKSANAAN</th>
	</tr>
	<tr>
	<?php
		for ($i=1; $i<=16 ; $i++) { 
			echo "<th style='border-style: solid;border-width:1px;'>".$i."</th>";
		}
		echo "<th style='border-style: solid;border-width:1px;'>17</th>";
		?>
	</tr>
	<tr>
		<?php
		for ($i=1; $i<=16 ; $i++) { 
			echo "<td style='padding:10px;border-style: solid;border-width:1px;'></td>";
		}
		echo "<td style='border-style: solid;border-width:1px;'></td>";
		?>
	</tr>
	<?php
	
	$rekap = array();
	if($stat!=''){
		if($stat->num_rows>0){
			foreach ($stat->result() as $row) {
				array_push($rekap, $row);
			}
		}
	}

	if($laporan!=''){
		if($laporan->num_rows>0){
			$i=0;
			foreach ($laporan->result() as $row) {
				$i++;
				echo "<tr>";
					echo "<td style='border-style: solid;border-width:1px;'>".$i."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".$row->nomor_perkara_pn."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".$row->nomor_perkara_banding."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".$row->hakim1_banding."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".$row->panitera_pengganti_banding."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".$row->pemohon_banding."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->putusan_pn)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->pemberitahuan_putusan_pn)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->permohonan_banding)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->pemberitahuan_inzage)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->pelaksanaan_inzage)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->pengiriman_berkas_banding)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->penerimaan_kembali_berkas_banding)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->putusan_banding)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_date($row->pemberitahuan_putusan_banding)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_stat($i,1)."</td>";
					echo "<td style='border-style: solid;border-width:1px;'>".parse_stat($i,2,$rekap)."</td>";
				echo "</tr>";
				
			}
			if($i<7){
				for ($x=$i+1; $x <=7; $x++) {
					echo "<tr>";
						echo "<td style='width:20px;'></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td></td>";
						echo "<td style='width:170px;border-style: solid;border-width:1px;'>".parse_stat($x,1)."</td>";
						echo "<td style='width:170px;border-style: solid;border-width:1px;'>".parse_stat($x,2,$rekap)."</td>";
					echo "</tr>";
				}
			}
		}
	}

	
	function parse_stat($x,$y,$rekap=NULL){
		if($x==1 AND $y==1){return 'REKAPITULASI';}
		elseif($x==2 AND $y==1){return 'Permohonan Banding';}
		elseif($x==3 AND $y==1){return 'Pengiriman Berkas Banding';}
		elseif($x==4 AND $y==1){return 'Putus Banding';}
		elseif($x==5 AND $y==1){return 'Belum Putus Banding';}
		elseif($x==6 AND $y==1){return 'Penerimaan Kembali Berkas Banding';}
		elseif($x==7 AND $y==1){return 'Pemberitahuan Putusan Banding';}

		elseif($x==2 AND $y==2){return $rekap[0]->masuk;}
		elseif($x==3 AND $y==2){return $rekap[0]->kirim_berkas;}
		elseif($x==4 AND $y==2){return $rekap[0]->putusan;}
		elseif($x==5 AND $y==2){return $rekap[0]->blm_putusan;}
		elseif($x==6 AND $y==2){return $rekap[0]->penerimaan_berkas;}
		elseif($x==7 AND $y==2){return $rekap[0]->pemberitahuan_putusan;}
	}
	?>
</table>
</div>
<div style="padding:15px;"></div>
<script src="resources/js/jquery.table2excel.js"></script>
<script>
$(function() {
	$(".btnExcel").click(function(){
		$(".cetakExcel").table2excel({
			exclude: ".noExl",
			name: "Excel Document Name",
			filename: "Cetak Excel"
		});
	});
});
</script>