<div style="padding:5px;min-width:2000px;">
<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;min-width:2000px;">
	<tbody>
		<tr>
			<td align="center" colspan="28" style="text-align: center;border:0px;border-top:0;font-size:14px;border-right:0px;">LAPORAN JENIS PERKARA</td>
		</tr>
		<tr>
			<td align="center" colspan="28" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="28" style="text-align: center;border:0px;font-size:14px;border-bottom:1px solid #000000;border-right:0px;">BULAN <?php echo fetch_montd($bulan);?> TAHUN <?php echo $tahun;?></td>
		</tr>
	</tbody>
	<tr>
		<th rowspan="2">No</th>
		<th rowspan="2">Jenis Perkara</th>
		<th rowspan="2">Sisa Bulan Lalu</th>
		<th colspan="3">Perkara</th>
		<th colspan="2">Penggugat</th>
		<th colspan="2">Tergugat</th>
		<th rowspan="2">Dismissal</th>
		<th colspan="2">Perlawanan</th>
		<th colspan="6">Putusan</th>
		<th rowspan="2">Sisa Perkara Bulan Ini</th>
		<th colspan="3">Permohonan</th>
		<th rowspan="2">Eksekusi</th>
		<th colspan="3">Terima Berkas</th>
		<th rowspan="2">Keterangan</th>
	</tr>
	<tr>
		<th>Masuk</th>
		<th>Dicabut</th>
		<th>Jumlah</th>
		<th>Perorangan</th>
		<th>Badan Hukum</th>
		<th>Pusat</th>
		<th>Daerah</th>
		<th>Ditolak/Tidak Diterima</th>
		<th>Dikabulkan</th>
		<th>Gugur</th>
		<th>Dicabut</th>
		<th>Ditolak</th>
		<th>Tidak Diterima</th>
		<th>Dikabulkan</th>
		<th>Jumlah</th>
		<th>Banding</th>
		<th>Kasasi</th>
		<th>Peninjauan Kembali</th>
		<th>Banding</th>
		<th>Kasasi</th>
		<th>Peninjauan Kembali</th>
	</tr>
	<tr>
		<?php
		for ($i=1; $i<=27 ; $i++) { 
			echo "<td><div align='center'>".$i."</div></td>";
		}
		echo "<td><div align='center'>28</div></td>";
		?>
	</tr>
	<?php
	if($laporanJenisPerkara!=''){
		if($laporanJenisPerkara->num_rows>0){
			$jumlahbaris=$laporanJenisPerkara->num_rows;
			$i=0;
			$jumlahSisa = 0;
			$awalPerkara = 0;
			$perkaraCabut = 0;
			$jumlahKurang = 0;
			$jumlahPerkara = 0;
			$jmlsisa = 0;
			$jmlmasuk = 0; 
			$jmlcabut = 0;
			$jmljumlah = 0;
			$jmlpenggugatPerorangan = 0;
			$jmlpenggugatBadanHukum = 0;
			$jmltergugatPusat = 0;
			$jmltergugatDaerah = 0;
			$jmldismissal = 0;
			$jmlperlawananDitolak = 0;
			$jmlperlawananDiterima = 0;
			$jmlputusGugur = 0;
			$jmlperkaraCabut2 = 0;
			$jmlputusDitolak = 0;
			$jmlputusNO = 0;
			$jmlputusDikabulkan = 0;
			$jmljumlahPutusan = 0;
			$jmljumlahSisa = 0;
			$jumlahBanding = 0;  
			$jumlahKasasi = 0;
			$jumlahPK = 0;
			$jumlahEksekusi = 0;
			$jumlahTerimaBanding = 0;
			$jumlahTerimaKasasi = 0;
			$jumlahTerimaPK = 0;

			foreach ($laporanJenisPerkara->result() as $row) { $i++;
				$awalPerkara = $row->sisaBulanLalu + $row->masukBulanIni;
				$jumlahPerkara = $awalPerkara - $row->perkaraCabut1;
				$perkaraCabut = $row->perkaraCabut1 + $row->perkaraCabut2;
				$jumlahKurang = $perkaraCabut + $row->jumlahPutusan - $row->perkaraCabut2;
				$jumlahSisa = $jumlahPerkara - $jumlahKurang;

				$jmlsisa += $row->sisaBulanLalu;
				$jmlmasuk += $row->masukBulanIni;
				$jmlcabut  += $row->perkaraCabut1;
				$jmljumlah  += $jumlahPerkara;
				$jmlpenggugatPerorangan += $row->penggugatPerorangan;
				$jmlpenggugatBadanHukum += $row->penggugatBadanHukum;
				$jmltergugatPusat += $row->tergugatPusat;
				$jmltergugatDaerah += $row->tergugatDaerah;
				$jmldismissal += $row->jumlahDismissal;
				$jmlperlawananDitolak += $row->perlawananDitolak;
				$jmlperlawananDiterima += $row->perlawananDiterima;
				$jmlputusGugur += $row->putusGugur;
				$jmlperkaraCabut2 += $row->perkaraCabut2;
				$jmlputusDitolak += $row->putusDitolak;
				$jmlputusNO += $row->putusNO;
				$jmlputusDikabulkan += $row->putusDikabulkan;
				$jmljumlahPutusan += $row->jumlahPutusan;
				$jmljumlahSisa += $jumlahSisa;
				$jumlahBanding += $jumlahBanding;  
				$jumlahKasasi += $jumlahKasasi;
				$jumlahPK += $jumlahPK;
				$jumlahEksekusi =+ $jumlahEksekusi;
				$jumlahTerimaBanding =+ $jumlahTerimaBanding;
				$jumlahTerimaKasasi =+ $jumlahTerimaKasasi;
				$jumlahTerimaPK =+ $jumlahTerimaPK;

			?>
				<tr>
					<td style="width:40px;"><div align="center"><?php echo $i; ?></div></td>
					<td style="width:200px;"><?php echo $row->jenis_perkara_nama; ?></td>
					<td style="width:70px;"><div align="center"><?php echo $row->sisaBulanLalu; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->masukBulanIni; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->perkaraCabut1; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $jumlahPerkara; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->penggugatPerorangan; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->penggugatBadanHukum; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->tergugatPusat; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->tergugatDaerah; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahDismissal; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->perlawananDitolak; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->perlawananDiterima; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->putusGugur; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->perkaraCabut2; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->putusDitolak; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->putusNO; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->putusDikabulkan; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahPutusan; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $jumlahSisa; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahBanding; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahKasasi; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahPK; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahEksekusi; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahTerimaBanding; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahTerimaKasasi; ?></div></td>
					<td style="width:70px;"><div align="center"><?php echo $row->jumlahTerimaPK; ?></div></td>
					<td style='width:250px; vertical-align:top;'></td>
				</tr>

			<?php } 
				echo "<tr>";
				echo "<td> </td>";
				echo "<td> <div align='center'> JUMLAH </td>";
				echo "<td> <div align='center'>".$jmlsisa." </div> </td>";
				echo "<td> <div align='center'>".$jmlmasuk." </div> </td>";
				echo "<td> <div align='center'>".$jmlcabut." </div> </td>";
				echo "<td> <div align='center'>".$jmljumlah."</div> </td>";
				echo "<td> <div align='center'>".$jmlpenggugatPerorangan."</div> </td>";
				echo "<td> <div align='center'>".$jmlpenggugatBadanHukum."</div> </td >";
				echo "<td> <div align='center'>".$jmltergugatPusat."</div> </td>";
				echo "<td> <div align='center'>".$jmltergugatDaerah."</div> </td>";
				echo "<td> <div align='center'>".$jmldismissal."</div> </td>";
				echo "<td> <div align='center'>".$jmlperlawananDitolak."</div> </td>";
				echo "<td> <div align='center'>".$jmlperlawananDiterima."</div> </td>";
				echo "<td> <div align='center'>".$jmlputusGugur."</div> </td>";
				echo "<td> <div align='center'>".$jmlperkaraCabut2."</div> </td>";
				echo "<td> <div align='center'>".$jmlputusDitolak."</div> </td>";
				echo "<td> <div align='center'>".$jmlputusNO."</div> </td>";
				echo "<td> <div align='center'>".$jmlputusDikabulkan."</div> </td>";
				echo "<td> <div align='center'>".$jmljumlahPutusan."</div> </td>";
				echo "<td> <div align='center'>".$jmljumlahSisa."</div> </td>";
				echo "<td> <div align='center'>".$jumlahBanding."</div> </td>";
				echo "<td> <div align='center'>".$jumlahKasasi."</div> </td>";
				echo "<td> <div align='center'>".$jumlahPK."</div> </td>";
				echo "<td> <div align='center'>".$jumlahEksekusi."</div> </td>";
				echo "<td> <div align='center'>".$jumlahTerimaBanding."</div> </td>";
				echo "<td> <div align='center'>".$jumlahTerimaKasasi."</div> </td>";
				echo "<td> <div align='center'>".$jumlahTerimaPK."</div> </td>";
				echo "<td> </td>";
				echo "</tr>";
			} }?>
	</tbody>
</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>