<link href="_lib/search.css" rel="stylesheet" type="text/css">
<link href="_lib/gradient.css" rel="stylesheet" type="text/css">
<a class="button" onclick="window.open('data:application/msexcel,'+document.getElementById('export').outerHTML.replace(/ /g, '%20'));">Export Data ke Excel</a>&nbsp;<a class="button" onclick="window.open('data:application/msword,'+document.getElementById('export').outerHTML.replace(/ /g, '%20'));">Export Data ke Word</a>
<?php
include 'config/koneksi.php';
include '_lib/fungsi_indotgl.php';	

//menampilkan data
$posisi  = 0;
$hasil = mysql_query("SELECT a.perkara_id,
a.nomor_perkara,
a.pihak1_text,
a.jenis_perkara_text,
a.proses_terakhir_text,
b.tanggal_putusan_sela, 
b.amar_sela, 
b.amar_sela_dok,
c.nama_gelar AS nama_ketua_majelis,
d.nama_gelar AS nama_pp
FROM perkara a, perkara_putusan_sela b, hakim_pn c, panitera_pn d, perkara_panitera_pn e, perkara_hakim_pn f
WHERE (b.amar_sela_dok IS NULL OR b.amar_sela_dok = '')
AND b.tanggal_putusan_sela IS NOT NULL
AND a.perkara_id = b.perkara_id
AND f.perkara_id = a.perkara_id 
AND e.perkara_id = a.perkara_id 
AND f.hakim_id = c.id 
AND e.panitera_id = d.id 
AND f.urutan = 1
AND f.aktif='Y' 
AND e.aktif='Y'
ORDER BY b.tanggal_putusan_sela DESC") or die("Query failed with error: ".mysql_error());
echo "<div id='export'>";
echo "<h2>Daftar Perkara yang Belum Upload Putusan Sela</h2><br>";
echo "<table align=center><tr>
    <th width='2%'>No.</th>
	<th width='14%'>No. Perkara</th>	
	<th width='16%'>Pihak Penggugat / Pemohon</th>
	<th width='18%'>Jenis Perkara</th>
	<th width='13%'>Ketua Majelis</th>
	<th width='13%'>Panitera Pengganti</th>
	<th width='10%'>Tanggal Putusan Sela</th>	
	<th>Status Perkara</th></tr>";
	
$no = $posisi+1;
$totalperkara = mysql_num_rows($hasil);
echo "<p align=left>Total Putusan : <b>$totalperkara</b> Perkara</p><br>";
while($r=mysql_fetch_array($hasil)){
$tanggal1  = tgl_indo($r['tanggal_putusan_sela']);
  echo "<tr>
  <td align='center'>$no</td>
  <td>$r[nomor_perkara]</td>
  <td>$r[pihak1_text]</td>
  <td>$r[jenis_perkara_text]</td>
  <td>$r[nama_ketua_majelis]</td>
  <td>$r[nama_pp]</td> 
  <td>$tanggal1</td>
  <td align='center'>$r[proses_terakhir_text]</td></tr>";
  $no++;
  }
echo "</table><br>";
?>