<div style="padding:5px;width:1024px;">
<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="width:1024px;">
	<tbody>
		<tr>
			<td align="center" colspan="18" style="text-align: center;border:0px;border-top:0;font-size:14px;border-right:0px;">REKAPITULASI PERKARA <?php echo $perkara_nama;?></td>
		</tr>
		<tr>
			<td align="center" colspan="18" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>

		</tr>
		<tr>
			<td align="center" colspan="18" 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>
	<tbody>
    <tr>
      <th rowspan="1">NO</th>
      <th rowspan="1">BULAN</th>
      <th colspan="1">SISA BULAN LALU YANG BELUM DIMINUTASI</th>
      <th rowspan="1">MASUK</th>
      <th rowspan="1">BEBAN BULAN INI</th>
      <th rowspan="1">PUTUS</th>
      <th rowspan="1">BELUM PENUNJUKAN MAJELIS HAKIM</th>
      <th rowspan="1">PUTUS SAMPAI BULAN INI</th>
      <th rowspan="1">MINUTASI BULAN INI</th>
      <th rowspan="1">PUTUS BELUM MINUTASI</th>
      <th rowspan="1">SISA AKHIR PERKARA</th>
      <th rowspan="1">JUMLAH TERDAKWA</th>
      <th rowspan="1">JUMLAH TERPIDANA</th>
    </tr>

		<tr>
			<?php
			for ($i=1; $i<=13 ; $i++) { 
				echo "<th style='text-align:center;'>".$i."</th>";
			}?>
		</tr>
		<tr>
			<?php
			for ($i=1; $i<=13 ; $i++) { 
				echo "<td style='padding:10px;'></td>";
			}?>
		</tr>

	<?php
	if($rekap!=''){
		if($rekap->num_rows>0){
			$i=0;
			$tot_masuk=0;
			$tot_putus=0;
			$tot_minut_blnini=0;
			$tot_terdakwa=0;
			$tot_terpidana=0;
			foreach ($rekap->result() as $row) {	
				$i++;
				echo "<tr>";
					echo "<td style='width:20px;'>".$i."</td>";
					echo "<td>".$row->name_id."</td>";
					echo "<td>".($row->BelumPutusBulanLalu+$row->BelumMinutasiBulanLalu)."</td>";
					echo "<td>".$row->MasukBulanIni."</td>";
					echo "<td>".($row->BelumPutusBulanLalu+$row->BelumMinutasiBulanLalu+$row->MasukBulanIni)."</td>";
					echo "<td>".$row->PutusBulanIni."</td>";
					echo "<td>".$row->BelumPenetapan."</td>";
					echo "<td>".($row->BelumMinutasiBulanLalu+$row->PutusBulanIni)."</td>";
					echo "<td>".$row->MinutasiBulanIni."</td>";
					echo "<td>".(($row->BelumMinutasiBulanLalu+$row->PutusBulanIni)-$row->MinutasiBulanIni)."</td>";
					echo "<td>".(($row->BelumPutusBulanLalu+$row->BelumMinutasiBulanLalu+$row->MasukBulanIni)-$row->MinutasiBulanIni)."</td>";
					echo "<td>".$row->JumlahTerdakwa."</td>";
					echo "<td>".$row->JumlahTerpidana."</td>";

				echo "</tr>";
			$tot_masuk=$tot_masuk+$row->MasukBulanIni;
			$tot_putus=$tot_putus+$row->PutusBulanIni;
			$tot_minut_blnini=$tot_minut_blnini+$row->MinutasiBulanIni;
			$tot_terdakwa=$tot_terdakwa+$row->JumlahTerdakwa;
			$tot_terpidana=$tot_terpidana+$row->JumlahTerpidana;

			}
				echo "<tr>";
					echo "<td colspan='2'>Total</td>";
					echo "<td></td>";
					echo "<td>".$tot_masuk."</td>";
					echo "<td></td>";
					echo "<td>".$tot_putus."</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td>".$tot_minut_blnini."</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td>".$tot_terdakwa."</td>";
					echo "<td>".$tot_terpidana."</td>";
					
					
				echo "</tr>";				

		}
	}

	

	?>
</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>