<div style="padding:5px;min-width:1900px">
<div style="padding:20px;"></div>
<button class="btn btnExcel" style="width:150px;text-align:center;">Export Excel</button></div>
<table id="view_laporan" width=80% class="cetakExcel" border="0" cellpadding="2" cellspacing="0" style="margin:10px;">
	<col  width="3%" />
    <col  width="27%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <col  width="5%" />
    <tbody>
		<tr>
			<td align="center" colspan="16" style="text-align: center;border:0px;border-top:0;font-size:14px;border-right:0px;"><?php echo $perkara_nama;?></td>
		</tr>
		<tr>
			<td align="center" colspan="16" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="16" 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="2" align="center">No. </th>
    <th width="250" rowspan="2" align="center">Nama Hakim/Majelis</th>
    <th colspan="2" align="center">Sisa bulan lalu</th>
    <th colspan="2" align="center">Tambah bulan ybs</th>
    <th colspan="2" align="center">Jumlah</th>
    <th colspan="2" align="center">Diputus</th>
    <th colspan="2" align="center">Sisa bulan ybs</th>
    <th colspan="2" align="center">Jumlah yang diminutir</th>
    <th colspan="2" align="center">Sisa yang belum diminutir</th>
  </tr>
  <tr>
    <th align="center">G</th>
    <th align="center">P</th>
    <th align="center">G</th>
    <th align="center">P</th>
    <th align="center">G</th>
    <th align="center">P</th>
    <th align="center">G</th>
    <th align="center">P</th>
    <th align="center">G</th>
    <th align="center">P</th>
    <th align="center">G</th>
    <th align="center">P</th>
    <th align="center">G</th>
    <th align="center">P</th>
  </tr>
  
  <tr>
    <?php for ($a=1; $a<=16;$a++){
        echo "<th >".$a."</th>";
          }
    ?>
    </tr>

<?php
	if($laporan!=''){
		if($laporan->num_rows>0){
			$total_sisa_lalu_g=0;
			$total_sisa_lalu_p=0;
			$total_daftar_bulan_ini_g=0;
			$total_daftar_bulan_ini_p=0;
			$total_jmlpkr_g=0;
			$total_jmlpkr_p=0;
			$total_putus_g=0;
			$total_putus_p=0;
			$total_sisapkr_g=0;
			$total_sisapkr_p=0;
			$total_sudah_minutasi_g=0;
			$total_sudah_minutasi_p=0;
			$total_belum_minutasi_g=0;
			$total_belum_minutasi_p=0;
            $i=0; 
			foreach ($laporan->result() as $row) {	
				$i++;
				$jumlahpkr_bulanini_g=$row->sisa_lalu_g+$row->daftar_bulanini_g;
				$jumlahpkr_bulanini_p=$row->sisa_lalu_p+$row->daftar_bulanini_p;
				$sisapkr_g=$jumlahpkr_bulanini_g-$row->putus_g;
				$sisapkr_p=$jumlahpkr_bulanini_p-$row->putus_p;
				 // if ($row->majelis_hakim_text<>'n') {
				  echo "<tr>";
				    echo "<td style='text-align:center;width:20px;'>".$i."</td>";
				    echo "<td style ='text-align:left'>".$row->majelis_hakim_text."</td>";
					echo "<td style ='text-align:center'>".$row->sisa_lalu_g."</td>";
					echo "<td style ='text-align:center'>".$row->sisa_lalu_p."</td>";
					echo "<td style ='text-align:center'>".$row->daftar_bulanini_g."</td>";
					echo "<td style ='text-align:center'>".$row->daftar_bulanini_p."</td>";
					echo "<td style ='text-align:center'>".$jumlahpkr_bulanini_g."</td>";
					echo "<td style ='text-align:center'>".$jumlahpkr_bulanini_p."</td>";
					echo "<td style ='text-align:center'>".$row->putus_g."</td>";
					echo "<td style ='text-align:center'>".$row->putus_p."</td>";
					echo "<td style ='text-align:center'>".$sisapkr_g."</td>";
					echo "<td style ='text-align:center'>".$sisapkr_p."</td>";
					echo "<td style ='text-align:center'>".$row->sudah_minutasi_g."</td>";
					echo "<td style ='text-align:center'>".$row->sudah_minutasi_p."</td>";
					echo "<td style ='text-align:center'>".$row->belum_minutasi_g."</td>";
					echo "<td style ='text-align:center'>".$row->belum_minutasi_p."</td>";												
				  echo "</tr>";	
                    $total_sisa_lalu_g=$total_sisa_lalu_g+$row->sisa_lalu_g;
					$total_sisa_lalu_p=$total_sisa_lalu_p+$row->sisa_lalu_p;
					$total_daftar_bulan_ini_g=$total_daftar_bulan_ini_g+$row->daftar_bulanini_g;
					$total_daftar_bulan_ini_p=$total_daftar_bulan_ini_p+$row->daftar_bulanini_p;
					$total_jmlpkr_g=$total_jmlpkr_g+$jumlahpkr_bulanini_g;
					$total_jmlpkr_p=$total_jmlpkr_p+$jumlahpkr_bulanini_p;
					$total_putus_g=$total_putus_g+$row->putus_g;
					$total_putus_g=$total_putus_p+$row->putus_p;
					$total_sisapkr_g=$total_sisapkr_g+$sisapkr_g;
					$total_sisapkr_p=$total_sisapkr_p+$sisapkr_p;
					$total_sudah_minutasi_g=$total_sudah_minutasi_g+$row->sudah_minutasi_g;
					$total_sudah_minutasi_p=$total_sudah_minutasi_p+$row->sudah_minutasi_p;
					$total_belum_minutasi_g=$total_belum_minutasi_g+$row->belum_minutasi_g;
					$total_belum_minutasi_p=$total_belum_minutasi_p+$row->belum_minutasi_p;
				 // }               


				}
			
                  echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>&nbsp</td>";
					echo "<td style ='text-align:center; font-weight:bold'>JUMLAH</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_sisa_lalu_g,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_sisa_lalu_p,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_daftar_bulan_ini_g,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_daftar_bulan_ini_p,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_jmlpkr_g,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_jmlpkr_p,0,',','.')."</td>";					
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_putus_g,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_putus_p,0,',','.')."</td>";	
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_sisapkr_g,0,',','.')."</td>";						
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_sisapkr_p,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_sudah_minutasi_g,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_sudah_minutasi_p,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_belum_minutasi_g,0,',','.')."</td>";
					echo "<td style ='text-align:center; font-weight:bold'>".number_format($total_belum_minutasi_p,0,',','.')."</td>";
                   echo "</tr>";

			
		} 
		  else {

                echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>1</td>";
					echo "<td style ='text-align:left'>Tidak ada data kegiatan hakim bulan ini</td>";
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";					
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";					
					echo "<td style ='text-align:center'>-</td>";	
					echo "<td style ='text-align:center'>-</td>";	
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</td>";
					echo "<td style ='text-align:center'>-</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>