<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="11" 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="11" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="11" 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 width="59" rowspan="2" align="center">NO</th>
    <th width="71" rowspan="2" align="center">SISA PERKARA LALU</th>
    <th width="71" rowspan="2" align="center">PERKARA DITERIMA BULAN    INI</th>
    <th width="101" rowspan="2" align="center">JUMLAH PERKARA YANG    TIDAK BISA DIMEDIASI</th>
    <th width="81" rowspan="2" align="center">JUMLAH PERKARA YANG    DIMEDIASI</th>
    <th width="271" colspan="3" align="center">LAPORAN    PENYELESAIAN MEDIASI</th>
    <th width="79" rowspan="2" align="center">MASIH DALAM PROSES    MEDIASI</th>
    <th width="72" rowspan="2" align="center">SISA PERKARA</th>
    <th width="85" rowspan="2" align="center">KETERANGAN</th>
  </tr>
  <tr>
    <th align="center">TIDAK BERHASIL</th>
    <th align="center">BERHASIL</th>
    <th width="72" align="center">GAGAL</th>
  </tr>
  
  <tr>
    <?php for ($a=1; $a<=11;$a++){
        echo "<th style='width:20px;'>".$a."</th>";
          }
    ?>
    </tr>

<?php
	if($laporan!=''){
		if($laporan->num_rows>0){
			$i=0;
				foreach ($laporan->result() as $row) {	
				$i++;
				$berhasil=$row->berhasil_sebagian+$row->berhasil_akta+$row->berhasil_cabut;
				$sisa_perkara=($row->sisa_lalu+$row->diterima_bulan_ini)-$row->putus_bulan_ini;
				$tidak_mediasi=($row->sisa_lalu+$row->diterima_bulan_ini)-$row->perkara_mediasi;
				 echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>".$i."</td>";
					echo "<td style ='text-align:center'>".$row->sisa_lalu."</td>";
					echo "<td style ='text-align:center'>".$row->diterima_bulan_ini."</td>";
					echo "<td style ='text-align:center'>".$tidak_mediasi."</td>";
					echo "<td style ='text-align:center'>".$row->perkara_mediasi."</td>";
					echo "<td style ='text-align:center'>".$row->tidak_berhasil."</td>";
					echo "<td style ='text-align:center'>".$berhasil."</td>";
					echo "<td style ='text-align:center'>".$row->gagal."</td>";
					echo "<td style ='text-align:center'>".$row->perkara_proses_mediasi ."</td>";
					echo "<td style ='text-align:center'>".$sisa_perkara."</td>";
					echo "<td style ='text-align:center'></td>";														
				echo "</tr>";	
				}
 
	
		} 
		  else {
		  	     echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>1</td>";
					echo "<td style ='text-align:center'>Tidak ada perkara mediasi untuk 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 "</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>