<div style="padding:5px;min-width:1700px">
<div style="padding:20px;"></div>
<div class="btn" style="width:150px;text-align:center;" onclick="tabletoExcel('view_laporan','Laporan')">Export to Excel</div>
<table id="view_laporan" border="0" cellpadding="2" cellspacing="0" style="margin:10px;">
	<tbody>
		<tr>
			<td align="center" colspan="22" 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="22" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>
		</tr>
		<tr>
			<td align="center" colspan="22" style="text-align: center;border:0px;font-size:14px;border-bottom:1px solid #000000;border-right:0px;">Tahun <?php echo $tahun;?></td>
		</tr>
	</tbody>
  <tr height="20">
    <th rowspan="3" height="60" width="64">No</th>
    <th rowspan="3" width="241">Status Mediator</th>
    <th rowspan="3" width="64">Jumlah Perkara Yang Dimediasi</th>
    <th colspan="10" width="640">Jumlah Hasil Mediasi    dan % Hasil Mediasi Terhadap Jumlah Perkara Mediasi Bulan <?php echo $nmbln ?>></th>
  </tr>
  <tr height="20">
    <th colspan="6" height="20">Berhasil</th>
    <th rowspan="2" width="64">Tidak    Berhasil</th>
    <th rowspan="2" width="64">%</th>
    <th rowspan="2" width="64">Tidak Dapat Dilaksanakan</th>
    <th rowspan="2" width="64">%</th>
  </tr>
  <tr height="20">
    <th height="20" width="64">Akta Perdamaian/Putusan</th>
    <th width="64">%</th>
    <th width="64">Berhasil    Sebagian</th>
    <th width="64">%</th>
    <th width="64">Pencabutan</th>
    <th width="64">%</th>
  </tr>


    <tr>
    <?php for ($a=1; $a<=13;$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->status."</td>";
					echo "<td>".$row->perkara_mediasi."</td>";
					echo "<td>".$row->berhasil_akta."</td>";
					echo "<td>".round($row->persen_akta)."</td>";
					echo "<td>".$row->berhasil_sebagian."</td>";
					echo "<td>".round($row->persen_sebagian)."</td>";
					echo "<td>".$row->berhasil_cabut."</td>";
					echo "<td>".round($row->persen_cabut)."</td>";
					echo "<td>".$row->tdk_berhasil."</td>";
					echo "<td>".round($row->persen_tdk_berhasil)."</td>";
					echo "<td>".$row->tdk_dpt_laksana."</td>";
					echo "<td>".round($row->persen_tdk_laksana)."</td>";
				echo "</tr>";
				
			}
		}
	}

	

	?>
</table>
</div>
<div style="padding:15px;"></div>


<script type="text/javascript">
function tabletoExcel(table, name) {
    var uri = 'data:application/vnd.ms-excel;base64,'
          , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
          , base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))); }
          , format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; }); };
        if (!table.nodeType) table = document.getElementById(table);
        var ctx = { worksheet: name || 'Worksheet', table: table.innerHTML };
        var link = document.createElement("a");
            link.download = "Laporan_Perkara_Tingkat Pertama.xls";
            link.href = uri + base64(format(template, ctx));
            link.click();
}
</script>