<div style="padding:5px;min-width:1550px;">
<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;min-width:1000px;">
	<tbody>
		<tr>
			<td align="center" colspan="93" 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="93" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
<td align="center" colspan="93" style="text-align: center;border:0px;font-size:14px;border-bottom:1px solid #000000;border-right:0px;"><?php echo "Periode : ".$periode_awal." s/d ".$periode_akhir;?></td>
		</tr>
	</tbody>
  <col width="64" />
  <col width="186" />
  <col width="64" span="28" />
    <th rowspan="4" height="81" width="64">NO.</th>
    <th rowspan="4" width="186">NAMA DILMILTI/DILMIL</th>
    <?php if($idalurperkara==120){ ?>
    <th colspan="28" width="1792">KEJAHATAN BIASA</th>
    <?php }else{ ?>
     <th colspan="20" width="1792">KEJAHATAN BIASA</th> 
    <?php } ?>
  </tr>
  <tr height="20">
    <th colspan="4" rowspan="2" height="40">SISA AWAL</th>
    <th colspan="4" rowspan="2">MASUK</th>
    <th colspan="4" rowspan="2">PUTUS</th>
    <th colspan="4" rowspan="2" width="256">DIKEMBALIKAN/DILIMPAHKAN</th>
    <?php if($idalurperkara==120){ ?>
      <th colspan="4" rowspan="2">YANG SUDAH BHT</th>
      <th colspan="4" rowspan="2">PUTUS NO</th>
    <?php } ?>
    <th colspan="4" rowspan="2">SISA AKHIR</th>
  </tr>
  <tr height="20"> </tr>
  <tr height="20">
    <th height="20">AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</th>
    <th>AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</th>
    <th>AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</th>
    <th>AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</th>
    <?php if($idalurperkara==120){ ?>
    <th>AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</th>
    
    <th>AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</th>
    <?php } ?>
    <th>AD</th>
    <th>AL</th>
    <th>AU</th>
    <th>JML</td>
  </tr>

    <tr>
    <?php 
          if($idalurperkara==120){
            for ($a=1; $a<=30;$a++){
              echo "<th style='width:20px;'>".$a."</th>";
            }
          }else{
            for ($a=1; $a<=22;$a++){
              echo "<th style='width:20px;'>".$a."</th>";
            }

          }
    ?>
    </tr>


	<?php 
	if($rekap!=''){
		if($rekap->num_rows>0){
			$i=0;
			foreach ($rekap->result() as $row) {	
				$i++;
				echo "<tr>";
					echo "<td style='width:20px;'>".$i."</td>";
					echo "<td>".$row->uraian."</td>";

					echo "<td style ='text-align:center'>".$row->sisa_ad."</td>";
					echo "<td style ='text-align:center'>".$row->sisa_al."</td>";
					echo "<td style ='text-align:center'>".$row->sisa_au."</td>";
					echo "<td style ='text-align:center'>".$row->tot_sisa."</td>";

					echo "<td style ='text-align:center'>".$row->masuk_ad."</td>";
					echo "<td style ='text-align:center'>".$row->masuk_al."</td>";
					echo "<td style ='text-align:center'>".$row->masuk_au."</td>";
					echo "<td style ='text-align:center'>".$row->tot_masuk."</td>";

					echo "<td style ='text-align:center'>".$row->putus_ad."</td>";
					echo "<td style ='text-align:center'>".$row->putus_al."</td>";
					echo "<td style ='text-align:center'>".$row->putus_au."</td>";
					echo "<td style ='text-align:center'>".$row->tot_putus."</td>";

					echo "<td style ='text-align:center'>".$row->dikembalikan_ad."</td>";
					echo "<td style ='text-align:center'>".$row->dikembalikan_al."</td>";
					echo "<td style ='text-align:center'>".$row->dikembalikan_au."</td>";
					echo "<td style ='text-align:center'>".$row->tot_dikembalikan."</td>";

          if($idalurperkara==120){
					echo "<td style ='text-align:center'>".$row->bht_ad."</td>";
					echo "<td style ='text-align:center'>".$row->bht_al."</td>";
					echo "<td style ='text-align:center'>".$row->bht_au."</td>";
					echo "<td style ='text-align:center'>".$row->tot_bht."</td>";

					echo "<td style ='text-align:center'>".$row->no_ad."</td>";
					echo "<td style ='text-align:center'>".$row->no_al."</td>";
					echo "<td style ='text-align:center'>".$row->no_au."</td>";
					echo "<td style ='text-align:center'>".$row->tot_no."</td>";
          }
					$sisa_akhir_ad=$row->sisa_ad+$row->masuk_ad-$row->putus_ad-$row->dikembalikan_ad;
					$sisa_akhir_al=$row->sisa_al+$row->masuk_al-$row->putus_al-$row->dikembalikan_al;
					$sisa_akhir_au=$row->sisa_au+$row->masuk_au-$row->putus_au-$row->dikembalikan_au;
					$tot_sisa_akhir=$sisa_akhir_ad+$sisa_akhir_al+$sisa_akhir_au;

					echo "<td style ='text-align:center'>".$sisa_akhir_ad."</td>";
					echo "<td style ='text-align:center'>".$sisa_akhir_al."</td>";
					echo "<td style ='text-align:center'>".$sisa_akhir_au."</td>";
					echo "<td style ='text-align:center'>".$tot_sisa_akhir."</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>