<style type="text/css">
th.vertical-text {
  /* Something you can count on */
  height: 200px;
  white-space: nowrap;
}

th.vertical-text > div {
  transform: 
    /* Magic Numbers */
    translate(10px, 30px)
    /* 45 is really 360 - 45 */
    rotate(-90deg);
  width: 30px;
  white-space: nowrap;
}
th.vertical-text > div > span {
  padding: 5px 10px;
  white-space: nowrap;
}
</style>
<div style="padding:5px;min-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="margin:10px;">
	<tbody>
		<tr>
			<td align="center" colspan="20" 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="20" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="20" 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="4" align="center">Nomor</th>
	    <th rowspan="2" colspan="6" align="center">JENIS PERKARA</th>
	    <th class="vertical-text" rowspan="4" align="center"><div><span>Jumlah</span></div></th>
	    <th rowspan="2" colspan="3" align="center">DIPUTUS</th>
	    <th class="vertical-text" rowspan="4" align="center"><div><span>Jumlah</span></div></th>
	    <th rowspan="2" colspan="3" align="center">SISA</th>
	    <th class="vertical-text" rowspan="4" align="center"><div><span>Jumlah</span></div></th>
	    <th rowspan="1" colspan="4" align="center">PERKARA YANG DIPUTUS</th>
  	</tr>
  	<tr>
  		<th style="border-left: 0px;" colspan="2" align="center">PENGGUGAT/</br>PEMOHON</th>
  		<th colspan="2" align="center">TERGUGAT/</br>TERMOHON</th>
 	</tr>
 	<tr>
  		<th class="vertical-text" style="border-left: 0px;" colspan="2" align="center"><div style="border-left: 0px; transform: translate(38px, 84px) rotate(-90deg);"><span>Izin Poligami</span></div></th>
  		<th class="vertical-text" colspan="2" align="center"><div style="transform: translate(38px, 84px) rotate(-90deg);"><span>Cerai Talak</span></div></th>
  		<th class="vertical-text" colspan="2" align="center"><div style="transform: translate(38px, 84px) rotate(-90deg);"><span>Cerai Gugat</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Izin Poligami</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Cerai Talak</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Cerai Gugat</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Izin Poligami</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Cerai Talak</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Cerai Gugat</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Ada Izin Pejabat</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Tidak Ada Izin Pejabat</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Ada Keterangan Pejabat</span></div></th>
  		<th class="vertical-text" rowspan="2" align="center"><div style="transform: translate(9px, 98px) rotate(-90deg);"><span>Tidak Ada Keterangan Pejabat</span></div></th>
 	<tr>
 		<th style="border-left: 0px;" width="50" align="center">Sisa</th>
  		<th width="50" align="center">Terima</th>
  		<th width="50" align="center">Sisa</th>
  		<th width="50" align="center">Terima</th>
  		<th width="50" align="center">Sisa</th>
  		<th width="50" align="center">Terima</th>
  	</tr>
	  <?php
	echo "<tr>";
		for ($a=1; $a<=20;$a++){
	    	echo "<th style='width:50px;'>".$a."</th>";
		}
    echo "</tr>";
	if($laporan!=''){
		if($laporan->num_rows>0){
			foreach ($laporan->result() as $row) {
				$poligami_sisa 	= $row->sisa_poligami;
				$poligami_masuk = $row->masuk_poligami;
				$poligami_putus = $row->putus_poligami;
				$talak_sisa  	= $row->sisa_talak;
				$talak_masuk 	= $row->masuk_talak;
				$talak_putus 	= $row->putus_talak;
				$gugat_sisa  	= $row->sisa_gugat;
				$gugat_masuk 	= $row->masuk_gugat;
				$gugat_putus 	= $row->putus_gugat;

			}
		}
	}
	if($data_tambahan!=''){
		if($data_tambahan->num_rows>0){
			foreach ($data_tambahan->result() as $row) {
				$pemohonizin = $row->pemohonizin;
				$pemohontidakizin = $row->pemohontidakizin;
				$termohonizin = $row->termohonizin;
				$termohontidakizin = $row->termohontidakizin;

			}
		}
	}
	echo "<tr>";
		echo "<td style='text-align:center;'>1</td>";
		echo "<td style='text-align:center;'>".number_format($poligami_sisa,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($poligami_masuk,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($talak_sisa,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($talak_masuk,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($gugat_sisa,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($gugat_masuk,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format(($poligami_sisa+$poligami_masuk+$talak_sisa+$talak_masuk+$gugat_sisa+$gugat_masuk),0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($poligami_putus,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($talak_putus,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($gugat_putus,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format(($poligami_putus+$talak_putus+$gugat_putus),0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format(($poligami_sisa+$poligami_masuk-$poligami_putus),0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format(($talak_sisa+$talak_masuk-$talak_putus),0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format(($gugat_sisa+$gugat_masuk-$gugat_putus),0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format((($poligami_sisa+$poligami_masuk-$poligami_putus)+($talak_sisa+$talak_masuk-$talak_putus)+($gugat_sisa+$gugat_masuk-$gugat_putus)),0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($pemohonizin,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($pemohontidakizin,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($termohonizin,0,',','.')."</td>";
		echo "<td style='text-align:center;'>".number_format($termohontidakizin,0,',','.')."</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>