<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=100% class="cetakExcel" border="0" cellpadding="2" cellspacing="0" style="margin:10px;">
	<tbody>
		<tr>
			<td align="center" colspan="10" 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="10" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="10" 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>
 <!--  <col width="33">
  <col width="163">
  <col width="226">
  <col width="65">
  <col width="82">
  <col width="65">
  <col width="69" span="3">
  <col width="125"> -->
<tr>
    <th rowspan="3" align="center">No</th>
    <th rowspan="3" align="center">No. Perkara</th>
    <th width=30% rowspan="3" align="center">Majelis Hakim</th>
    <th colspan="4" align="center">Tanggal</th>
    <th colspan="2" rowspan="2" align="center">Sisa</th>
    <th rowspan="3" align="center">Keterangan</th>
  </tr>
  <tr>
    <th colspan="2" align="center">Putus</th>
    <th colspan="2" align="center">Minutasi</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>
  </tr>
  <tr>
    <?php for ($a=1; $a<=10;$a++){
        echo "<th style='width:20px;'>".$a."</th>";
          }
    ?>
    </tr>

<?php
	if($laporan!=''){
		if($laporan->num_rows>0){
			$i=0;
			$a=0;
			$b=0;			
			foreach ($laporan->result() as $row) {	
				$i++;
				 
				 echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>".$i."</td>";
					echo "<td style ='text-align:left'>".$row->nomor_perkara."</td>";
					echo "<td width=30% style ='text-align:left'>".$row->majelis_hakim."</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'>".$row->minutasi_g."</td>";
					echo "<td style ='text-align:center'>".$row->minutasi_p."</td>";
					if ($a<>$row->jml_sisa_g) {						 
					echo "<td style ='text-align:center'>".$row->jml_sisa_g."</td>";
				   	}
			    	  else {
			    	  	echo "<td style ='text-align:center'>&nbsp;</td>";
			    	  }
					if ($b<>$row->jml_sisa_p) {
					echo "<td style ='text-align:center'>".$row->jml_sisa_p."</td>";				
			    	}
			    	  else {
			    	  	echo "<td style ='text-align:center'>&nbsp;</td>";
			    	  }
					echo "<td style ='text-align:center'>&nbsp;</td>";											
				echo "</tr>";
				$a=$row->jml_sisa_g;
				$b=$row->jml_sisa_p;	
				}
	
		} 
		  else {
                echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>1</td>";
					echo "<td style ='text-align:left'>Tidak ada data minutasi bulan ini</td>";
					echo "<td width=30% style ='text-align:left'>-</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'>&nbsp;</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>