<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td><?PHP
include("../index.cma.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$query = "Select * from tab_dataperkara where t_id = '1'"; 
$result = mysql_query($query); 
if($row2 = mysql_fetch_array($result)){ 
$mytable = $row2['t_table'];
$edisi = $row2['t_tahun'];
$page2 = $_GET["page2"];
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page2))  $page2  =  1;
if (empty($hits))  $hits  = 500;
$start = $hits*($page2-1);
$query = "SELECT * FROM $mytable WHERE berkas_tahap1p21tgl !='' && berkas_p20 ='' ORDER BY uid DESC";

$res = mysql_query("$query"); 
$xnum = mysql_num_rows($res);
$stw2 = (int)($xnum/$hits);
if ($xnum%$hits > 0) {$stw2++;}
$np = $page2+1;
$pp = $page2-1;
if ($page2 == 1) { $pp=1; }
if ($np > $stw2) { $np = $stw2;} 
echo "PENCATATAN EKSEKUSI $edisi SEBANYAK <strong>$xnum</strong> TERSANGKA | ";
for ($i=1;$i<=$stw2;$i++) {if($page2==$i){
echo "<b> HAL $i |</b> ";} 
else{echo "<a href=\"?g=tuthome&d=inc_op&page2=$i#tab1\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM $mytable ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE p16_jaksa1 !='0' && berkas_p20 ='' ORDER BY uid DESC LIMIT $start,$hits";
$res = mysql_query($query);
print ('<table id="myTable" width="100%"  border="0" cellspacing="1" cellpadding="1" bgcolor="#B05800">
        <thead><tr>
<td width="25%"><strong>NAMA TERSANGKA/SURAT DARI/PASAL</strong></td>
<td width="27%"><strong>TAP SIDANG & MAJELIS</strong></td>
<td width="12%"><strong>TUNTUTAN</strong></td>
<td width="12%"><strong>PUTUSAN</strong></td>
<td width="12%"><strong>UPAYA HUKUM</strong></td>
<td width="12%"><strong>P48</strong></td>

</tr></thead><tbody>');
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FF6600";$x=0;} else {$barva = "FFFFCC";$x=1;}
print ('<tr bgcolor=#'.$barva.'><td><b>'.$row['spdp_namatsk'] .'</b><br>');
$polisi1 = $row['spdp_dari'];
 mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$sql=mysql_query("select * from tab_polisi where p_nomor = '$polisi1'");
while ($data=mysql_fetch_array($sql)){
print(''.$data['p_nama'].'');
}
$id = $row['uid'];

print ('<br><i>'. $row['spdp_pasal'].'</i><br>Jaksa:<b>');

$jaksa1 = $row['p16_jaksa1'];
 mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$sql=mysql_query("select * from tab_personil where daftar_pegid = '$jaksa1'");
while ($data=mysql_fetch_array($sql)){
print('<b>'.$data['daftar_nama'].'</b>');
}
print ('</b></td>');
print ('<td>');
if ($row['berkas_limpahp31tgl'] !== "" && $row['berkas_taptglsidang'] == "") {
echo "<a href=\"index.eksekusi.post.tahapan.php?uid=$id&table=$mytable&do=tapsidang\" onclick=\"NewWindow(this.href,'mywin','600','320','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>TAP TGL SIDANG & MAJELIS HAKIM</b></a>";
}
elseif ($row['berkas_limpahp31tgl'] == "" && $row['berkas_taptglsidang'] == "") {
print ('<center>BELUM LIMPAH<center>');
} 
elseif ($row['berkas_taptglsidang'] !== "" && $row['berkas_taptglsidang'] !== "") {
print ('<center>'.$row['berkas_taptglsidang'].'<br>'.$row['berkas_tapnomor'].'<br>'.$row['berkas_taphakim'].'<center>');
} 
print ('</td>');
print ('<td>');
if ($row['berkas_taptglsidang'] !== "" && $row['berkas_tuttgl'] == "") {
echo "<a href=\"index.eksekusi.post.tahapan.php?uid=$id&table=$mytable&do=tuntutan\" onclick=\"NewWindow(this.href,'mywin','600','300','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>ISI TUNTUTAN</b></a>";
}
elseif ($row['berkas_taptglsidang'] == "" && $row['berkas_tuttgl'] == "") {
print ('<center>BELUM ADA TAP SIDANG<center>');
} 
elseif ($row['berkas_taptglsidang'] !== "" && $row['berkas_tuttgl'] !== "") {


print ('<center>'.$row['berkas_tuttgl'].'<br>'.$row['berkas_tutpasal'].'<br>'.$row['berkas_tutpidana'].'<center>');
} 
print ('</td>');

print ('<td>');
if ($row['berkas_tuttgl'] !== "" && $row['berkas_ptstgl'] == "") {
echo "<a href=\"index.eksekusi.post.tahapan.php?uid=$id&table=$mytable&do=putusan\" onclick=\"NewWindow(this.href,'mywin','600','350','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>PUTUSAN</b></a>";
}
elseif ($row['berkas_tuttgl'] == "" && $row['berkas_ptstgl'] == "") {
print ('<center>BELUM TUNTUTAN<center>');
} 
elseif ($row['berkas_tuttgl'] !== "" && $row['berkas_ptstgl'] !== "") {
print ('<center>'.$row['berkas_ptstgl'].'<br>'.$row['berkas_putpasal'].'<br>'.$row['berkas_amarput'].'<center>');
} 
print ('</td>');



print ('<td>');
if ($row['berkas_tuttgl'] !== "" && $row['berkas_ptstgl'] !== "" && $row['berkas_p48tgl'] == "") {
print ('Banding:'.$row['berkas_tglbanding'].'<br>');
print ('Kasasi:'.$row['berkas_tglkasasi'].'<br>');
echo "<a href=\"index.eksekusi.post.tahapan.php?uid=$id&table=$mytable&do=upayahukum\" onclick=\"NewWindow(this.href,'mywin','600','300','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>UPAYA HUKUM</b></a>";
}
elseif ($row['berkas_tuttgl'] == "" && $row['berkas_ptstgl'] == "" && $row['berkas_p48tgl'] == "") {
print ('<center>BELUM TUT/PUTUS<center>');
} 
elseif ($row['berkas_tuttgl'] !== "" && $row['berkas_ptstgl'] !== "" && $row['berkas_p48tgl'] !== "") {
print ('<center>Telah Eksekusi Badan<center>');
} 
print ('</td>');
//Eksekusi
print ('<td>');
if ($row['berkas_tuttgl'] !== "" && $row['berkas_ptstgl'] !== "" && $row['berkas_p48tgl'] == "") {

echo "<a href=\"index.eksekusi.post.tahapan.php?uid=$id&table=$mytable&do=eksekusi\" onclick=\"NewWindow(this.href,'mywin','600','350','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>EKSEKUSI BADAN</b></a>";
}
elseif ($row['berkas_tuttgl'] == "" && $row['berkas_ptstgl'] == "" && $row['berkas_p48tgl'] == "") {
print ('<center>BELUM TUT/PUTUS<center>');
} 
elseif ($row['berkas_tuttgl'] !== "" && $row['berkas_ptstgl'] !== "" && $row['berkas_p48tgl'] !== "") {
print ('<center>'.$row['berkas_p48tgl'].'<br>SDH EKSEKUSI BADAN<center>');
} 
print ('</td>');



print ('</tr>');} 
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}
}
?></td>
  </tr>
</table>
