<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" class="cetakExcel" border="0" cellpadding="2" cellspacing="0" style="margin:10px;">
	<tbody>
		<tr>
			<td align="center" colspan="15" 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="15" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="15" 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="31">
		<col width="43">
		<col width="60">
		<col width="33" span="2">
		<col width="57" span="10">
  <tr>
    <th rowspan="3" width="29">N O M O R</th>
    <th colspan="14" align="center"> PENYEBAB TERJADINYA  PERCERAIAN</th>
  </tr>
  <tr>
    <th width="192" rowspan="2" align="center">ZINA</th>
    <th width="87" rowspan="2" align="center">MABUK</th>
    <th width="86" rowspan="2" align="center">MADAT</th>
    <th width="50" rowspan="2" align="center">JUDI</th>
    <th width="201" rowspan="2" align="center">MENINGGALKAN    SALAH SATU PIHAK</th>
    <th width="118" rowspan="2" align="center">DIHUKUM    PENJARA</th>
    <th width="117" align="center">&nbsp;</th>
    <th width="64" rowspan="2" align="center">KDRT</th>
    <th width="86" rowspan="2" align="center">CACAT BADAN</th>
    <th width="198" rowspan="2" align="center">PESELISIHAN    DAN PERTENGKARAN TERUS MENERUS</th>
    <th width="88" rowspan="2" align="center">KAWIN PAKSA</th>
    <th width="101" rowspan="2" align="center">MURTAD</th>
    <th width="112" rowspan="2" align="center">EKONOMI</th>
    <th width="95" rowspan="2" align="center">JUMLAH</th>
  </tr>
  <tr>
    <th align="center">POLIGAMI</th>
  </tr>
<tr>	  
	  <?php for ($a=1; $a<=15;$a++){
        echo "<th style='width:20px;'>".$a."</th>";
          }
    ?>
</tr>
<?php
	if($laporan!=''){
		if($laporan->num_rows>0){
			$total_cerai=0;		
			foreach ($laporan->result() as $row) {	
			   echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>1</td>";
					echo "<td style ='text-align:center'>".$row->zina."</td>";
					echo "<td style ='text-align:center'>".$row->mabuk."</td>";
					echo "<td style ='text-align:center'>".$row->madat."</td>";
					echo "<td style ='text-align:center'>".$row->judi."</td>";
					echo "<td style ='text-align:center'>".$row->meninggalkan."</td>";
					echo "<td style ='text-align:center'>".$row->dihukum."</td>";
					echo "<td style ='text-align:center'>".$row->poligami."</td>";
					echo "<td style ='text-align:center'>".$row->kdrt."</td>";	
					echo "<td style ='text-align:center'>".$row->cacat."</td>";					
					echo "<td style ='text-align:center'>".$row->perselisihan."</td>";
					echo "<td style ='text-align:center'>".$row->kawin_paksa."</td>";	
					echo "<td style ='text-align:center'>".$row->murtad."</td>";						
					echo "<td style ='text-align:center'>".$row->ekonomi."</td>";
					echo "<td style ='text-align:center'>".($row->zina+$row->mabuk+$row->madat+$row->judi+$row->meninggalkan+$row->dihukum+$row->kdrt+$row->cacat+$row->perselisihan+$row->kawin_paksa+$row->murtad+$row->ekonomi+$row->poligami)."</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 faktor penyebab perceraian 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'>-rr</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>