<div style="padding:5px;min-width:1550px;">
<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:1500px;">
	<tbody>
		<tr>
			<td align="center" colspan="93" style="text-align: center;border:0px;border-top:0;font-size:14px;border-right:0px;">REKAPITULASI HAKIM <?php echo $upaya_hukum;?> PERKARA <?php echo $perkara_nama;?></td>
		</tr>
		<tr>
			<td align="center" colspan="93" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="93" style="text-align: center;border:0px;font-size:14px;border-bottom:1px solid #000000;border-right:0px;">Januari - Desember <?php echo $tahun;?></td>
		</tr>
	</tbody>
	<tr>
		<th rowspan="2">NO</th>
		<th rowspan="2" style="border-right:0px;">NAMA HAKIM</th>
		<th colspan="4" style="border-left:1px solid #000000;">Januari</th>
		<th colspan="4">Februari</th>
		<th colspan="4">Maret</th>
		<th colspan="4">April</th>
		<th colspan="4">Mei</th>
		<th colspan="4">Juni</th>
		<th colspan="4">Juli</th>
		<th colspan="4">Agustus</th>
		<th colspan="4">September</th>
		<th colspan="4">Oktober</th>
		<th colspan="4">November</th>
		<th colspan="4">Desember</th>
		<th colspan="4">Total</th>
	</tr>
	<tr>
		<?php
		for ($i=1; $i <=12 ; $i++) { 
			echo "<th>Sisa Perkara Belum Putus</th>";
			echo "<th>Terima</th>";
			echo "<th>Jumlah</th>";
			echo "<th>Putus</th>";
		}
		?>
		<th>Sisa Awal</th>
		<th>Terima</th>
		<th>Putus</th>
		<th>Sisa Akhir</th>
	</tr>
	<tr>
	<?php
		for ($i=1; $i<=54 ; $i++) { 
			echo "<th style='width:20px;'>".$i."</th>";
		}
		?>
	</tr>
	<tr>
		<?php
		for ($i=1; $i<=54 ; $i++) { 
			echo "<td style='padding:10px;'></td>";
		}
		?>
	</tr>
	<?php 
	if($rekap!=''){
		if($rekap->num_rows>0){
			$i = 1;
			foreach ($rekap->result() as $row) {
				echo "<tr>";
					echo "<td style='text-align:center;'>".$i."</td>";
					echo "<td>".$row->nama."</td>";
					echo "<td style='text-align:center;'>".$row->beban."</td>";
					echo "<td style='text-align:center;'>".$row->masuk01."</td>";
					echo "<td style='text-align:center;'>".($row->beban+$row->masuk01)."</td>";
					echo "<td style='text-align:center;'>".$row->putus01."</td>";
					$sisa01 = $row->beban+$row->masuk01-$row->putus01;
					
					echo "<td style='text-align:center;'>".$sisa01."</td>";
					echo "<td style='text-align:center;'>".$row->masuk02."</td>";
					echo "<td style='text-align:center;'>".($sisa01+$row->masuk02)."</td>";
					echo "<td style='text-align:center;'>".$row->putus02."</td>";
					$sisa02 = $sisa01+$row->masuk02-$row->putus02;

					echo "<td style='text-align:center;'>".$sisa02."</td>";
					echo "<td style='text-align:center;'>".$row->masuk03."</td>";
					echo "<td style='text-align:center;'>".($sisa02+$row->masuk03)."</td>";
					echo "<td style='text-align:center;'>".$row->putus03."</td>";
					$sisa03 = $sisa02+$row->masuk03-$row->putus03;

					echo "<td style='text-align:center;'>".$sisa03."</td>";
					echo "<td style='text-align:center;'>".$row->masuk04."</td>";
					echo "<td style='text-align:center;'>".($sisa03+$row->masuk04)."</td>";
					echo "<td style='text-align:center;'>".$row->putus04."</td>";
					$sisa04 = $sisa03+$row->masuk04-$row->putus04;

					echo "<td style='text-align:center;'>".$sisa04."</td>";
					echo "<td style='text-align:center;'>".$row->masuk05."</td>";
					echo "<td style='text-align:center;'>".($sisa04+$row->masuk05)."</td>";
					echo "<td style='text-align:center;'>".$row->putus05."</td>";
					$sisa05 = $sisa04+$row->masuk05-$row->putus05;
					echo "<td style='text-align:center;'>".$sisa05."</td>";
					echo "<td style='text-align:center;'>".$row->masuk06."</td>";
					echo "<td style='text-align:center;'>".($sisa05+$row->masuk06)."</td>";
					echo "<td style='text-align:center;'>".$row->putus06."</td>";

					$sisa06 = $sisa05+$row->masuk06-$row->putus06;
					echo "<td style='text-align:center;'>".$sisa06."</td>";
					echo "<td style='text-align:center;'>".$row->masuk07."</td>";
					echo "<td style='text-align:center;'>".($sisa06+$row->masuk07)."</td>";
					echo "<td style='text-align:center;'>".$row->putus07."</td>";

					$sisa07 = $sisa06+$row->masuk07-$row->putus07;
					echo "<td style='text-align:center;'>".$sisa07."</td>";
					echo "<td style='text-align:center;'>".$row->masuk08."</td>";
					echo "<td style='text-align:center;'>".($sisa07+$row->masuk08)."</td>";
					echo "<td style='text-align:center;'>".$row->putus08."</td>";

					$sisa08 = $sisa07+$row->masuk08-$row->putus08;
					echo "<td style='text-align:center;'>".$sisa08."</td>";
					echo "<td style='text-align:center;'>".$row->masuk09."</td>";
					echo "<td style='text-align:center;'>".($sisa08+$row->masuk09)."</td>";
					echo "<td style='text-align:center;'>".$row->putus09."</td>";

					$sisa09 = $sisa08+$row->masuk09-$row->putus09;
					echo "<td style='text-align:center;'>".$sisa09."</td>";
					echo "<td style='text-align:center;'>".$row->masuk10."</td>";
					echo "<td style='text-align:center;'>".($sisa08+$row->masuk10)."</td>";
					echo "<td style='text-align:center;'>".$row->putus10."</td>";

					$sisa10 = $sisa09+$row->masuk10-$row->putus10;
					echo "<td style='text-align:center;'>".$sisa10."</td>";
					echo "<td style='text-align:center;'>".$row->masuk11."</td>";
					echo "<td style='text-align:center;'>".($sisa10+$row->masuk11)."</td>";
					echo "<td style='text-align:center;'>".$row->putus11."</td>";

					$sisa11 = $sisa10+$row->masuk11-$row->putus11;
					echo "<td style='text-align:center;'>".$sisa11."</td>";
					echo "<td style='text-align:center;'>".$row->masuk12."</td>";
					echo "<td style='text-align:center;'>".($sisa11+$row->masuk12)."</td>";
					echo "<td style='text-align:center;'>".$row->putus12."</td>";

					$sisa12 = $sisa11+$row->masuk12-$row->putus12;
					echo "<td style='text-align:center;'>".$row->beban."</td>";
					echo "<td style='text-align:center;'>".$row->masuk_total."</td>";
					echo "<td style='text-align:center;'>".$row->putus_total."</td>";
					echo "<td style='text-align:center;'>".$sisa12."</td>";
				echo "</tr>";
				$i++;
			}
		}
	}
	?>
</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>