<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="17" 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="17" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="17" 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="65" rowspan="2" align="center">Kode</th>
    <th width="222" rowspan="2" align="center">Jenis perkara</th>
    <th width="185" colspan="3" align="center">Banyaknya    perkara</th>
    <th width="456" colspan="7" align="center">Dicabut    dan diPutus bulan ini</th>
    <th width="64" rowspan="2" align="center">Sisa akhir bulan 5-11)</th>
    <th width="61" rowspan="2" align="center">Banding</th>
    <th width="61" rowspan="2" align="center">Kasasi</th>
    <th width="61" rowspan="2" align="center">PK</th>
    <th width="81" rowspan="2" align="center">Ket. </th>
  </tr>
 <tr>
    <th width="64" align="center">Sisa bulan lalu</th>
    <th width="64" align="center">Diterima    bulan ini</th>
    <th width="57" align="center">Jumlah</th>
    <th width="57" align="center">Dicabut</th>
    <th width="75" align="center">Dikabulkan</th>
    <th width="57" align="center">Ditolak</th>
    <th width="57" align="center">Tidak    Diterima</th>
    <th width="86" align="center">Digugurkan</th>
    <th width="60" align="center">Dicoret    dari register</th>
    <th width="64" align="center">Jumlah    lajur 6 s/d 10</th>
  </tr>
	  <?php for ($a=1; $a<=17;$a++){
        echo "<th style='width:20px;'>".$a."</th>";
          }
    ?>

    <?php
	if($laporan!=''){
		if($laporan->num_rows>0) {
			$i=0;
			$total_sisalalu=0;
			$total_diterima_bulan_ini=0;
			$total_jumlahpkr=0;
			$total_dicabut=0;
			$total_dikabulkan=0;
			$total_ditolak=0;
			$total_tidak_dapat_diterima=0;
			$total_digugurkan=0;
			$total_dicoret_dari_register=0;
			$total_putus=0;
			$total_sisaakhir=0;

			foreach ($laporan->result() as $row) {	
				$i++;
				$jumlahpkr=$row->sisa_lalu+$row->diterima_bulan_ini;
                $jml_jputus=$row->dicabut+$row->dikabulkan+$row->ditolak+$row->tidak_dapat_diterima+$row->digugurkan+$row->dicoret_dari_register;
				$sisa_akhir=$jumlahpkr-$jml_jputus;				 
				echo "<tr>";
					echo "<td style='text-align:center;width:20px;'>".$i."</td>";
					echo "<td style ='text-align:'>".$row->jenis_perkara."</td>";
					echo "<td style ='text-align:right'>".number_format($row->sisa_lalu,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($row->diterima_bulan_ini,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($jumlahpkr,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($row->dicabut,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($row->dikabulkan,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($row->ditolak,0,',','.')."</td>";							
					echo "<td style ='text-align:right'>".number_format($row->tidak_dapat_diterima,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($row->digugurkan,0,',','.')."</td>";	
					echo "<td style ='text-align:right'>".number_format($row->dicoret_dari_register,0,',','.')."</td>";							
					echo "<td style ='text-align:right'>".number_format($jml_jputus,0,',','.')."</td>";
					echo "<td style ='text-align:right'>".number_format($sisa_akhir,0,',','.')."</td>";
					echo "<td style ='text-align:right'>0</td>";
					echo "<td style ='text-align:right'>0</td>";
					echo "<td style ='text-align:right'>0</td>";
					echo "<td style ='text-align:right'></td>";													
				echo "</tr>";	
				$total_sisalalu=$total_sisalalu+$row->sisa_lalu;
				$total_diterima_bulan_ini=$total_diterima_bulan_ini+$row->diterima_bulan_ini;
				$total_jumlahpkr=$total_jumlahpkr+$jumlahpkr;
				$total_dicabut=$total_dicabut+$row->dicabut;
				$total_dikabulkan=$total_dikabulkan+$row->dikabulkan;
				$total_ditolak=$total_ditolak+$row->ditolak;
				$total_tidak_dapat_diterima=$total_tidak_dapat_diterima+$row->tidak_dapat_diterima;
				$total_digugurkan=$total_digugurkan+$row->digugurkan;
				$total_dicoret_dari_register=$total_dicoret_dari_register+$row->dicoret_dari_register;
				$total_putus=$total_putus+$jml_jputus;
				$total_sisaakhir=$total_sisaakhir+$sisa_akhir;	
							
			}
			

            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:right; font-weight:bold'>".number_format($total_sisalalu,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_diterima_bulan_ini,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_jumlahpkr,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_dicabut,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_dikabulkan,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_ditolak,0,',','.')."</td>";					
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_tidak_dapat_diterima,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_digugurkan,0,',','.')."</td>";	
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_dicoret_dari_register,0,',','.')."</td>";						
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_putus,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>".number_format($total_sisaakhir,0,',','.')."</td>";
					echo "<td style ='text-align:right; font-weight:bold'>0</td>";
					echo "<td style ='text-align:right; font-weight:bold'>0</td>";
					echo "<td style ='text-align:right; font-weight:bold'>0</td>";
					echo "<td style ='text-align:right; font-weight:bold'></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>