<?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'];
$page = $_GET["page"];
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page))  $page  =  1;
if (empty($hits))  $hits  = 500;
$start = $hits*($page-1);
$query = "SELECT * FROM $mytable WHERE spdp_namatsk !='0'";
$res = mysql_query("$query"); 
$xnum = mysql_num_rows($res);
$stw2 = (int)($xnum/$hits);
if ($xnum%$hits > 0) {$stw2++;}
$np = $page+1;
$pp = $page-1;
if ($page == 1) { $pp=1; }
if ($np > $stw2) { $np = $stw2;} 
echo "TOTAL PERKARA <strong>$xnum</strong> | ";
for ($i=1;$i<=$stw2;$i++) {if($page==$i){
echo "<b> HAL $i |</b> ";} 
else{echo "<a href=\"?g=daftartahanan&page=$i\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytable." ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE spdp_namatsk !='0' 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="3%"><span class="style1"><strong>NO</strong></span></td>
<td width="60%"><span class="style1"><strong>NAMA TERSANGKA</strong></span></td>
<td width="37%"><span class="style1"><strong>UPDATE EKSEKUSI</strong></span></td>
</tr></thead>');
$no=1;
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FFFFB7";$x=0;} else {$barva = "FFD8B0";$x=1;}
print ('<tr bgcolor=#'.$barva.'><td><center>'.$no++.'<center></td><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'].'');
}
print ('<br><i>'. $row['spdp_pasal'].'</i><br>Jaksa:');
$jaksa1 = $row['p16_jaksa1'];
$id = $row['uid'];
$p21tanggal = $row['berkas_tahap1p21tgl'];
 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><br>'.$row['spdp_pasal'] .'');
}
print ('</td>');;
print ('<td>');
$tsk = $row['spdp_namatsk'];
if ($row['berkas_ba20'] == "") {

echo "<a href=\"index.eksekusibb.post.tahapan.php?uid=$id&table=$mytable&do=eksekusibb&tsk=$tsk\" onclick=\"NewWindow(this.href,'mywin','800','550','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\"><b>CEK DAN UPDATE EKSEKUSI</b></a>";
}
elseif ($row['berkas_ba20'] !== "") {
echo "<a href=\"index.eksekusibb.post.tahapan.php?uid=$id&table=$mytable&do=eksekusidetail&tsk=$tsk\" onclick=\"NewWindow(this.href,'mywin','800','550','yes','center');return false\" onfocus=\"this.blur()\"><b><center>SELESAI</center></b></a>";
} 

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