<?PHP
include("index.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
//load year
$query = "Select * from barbuk_db where t_id = '1'"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){ 
 $mytable = $row['t_table'];
//------end
$page = $_GET["page"];
$do1 = $_GET["do"];
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 status ='$do1'";
$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 BARANG BUKTI MASIH DALAM PROSES | <strong>$xnum</strong> | ";
for ($i=1;$i<=$stw2;$i++) {if($page==$i){
echo "<b> HAL $i |</b> ";} 
else{echo "<a href=\"?g=daftartahanan&d=inc_op&page=$i\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytable." ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE status ='$do1' ORDER BY ID DESC LIMIT $start,$hits";
$res = mysql_query($query);
print ('<table 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="7%"><span class="style1"><strong>UKEY</strong></span></td>
<td width="17%"><span class="style1"><strong>NAMA TERDAKWA</strong></span></td>
<td width="25%"><span class="style1"><strong>NOMOR REG. BARANG BUKTI</strong></span></td>
<td width="30%"><span class="style1"><strong>NAMA BARANG</strong></span></td>
<td width="25%"><span class="style1"><strong>STATUS</strong></span></td>

</tr></thead>');
$no=1; // fungsi nomor
 $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>');
print ('<td>'.$row['UKEY'] .'</td>');
print ('<td>'.$row['TERDAKWA'] .'</td>');
print ('<td>'.$row['RB'] .'</td>');
print ('<td>'.$row['NAMABARANG'] .'</td>');
print ('<td>');
if ($row['STATUS'] == "0") {
print ('BLM DIEKSEKUSI');
} 
 elseif ($row['STATUS'] == "1") {
print ('TELAH DIKEMBALIKAN KEPADA NAMA '.$row['NAMAPEMILIK'] .' PADA TANGGAL :'.$row['TGLEKSEKUSI'] .'');
 } 
  elseif ($row['STATUS'] == "2") {
print ('SUDAH DILELANG/ PROSES LELANG');
 } 
  elseif ($row['STATUS'] == "3") {
print ('DIMASUKKAN DALAM DAFTAR PEMUSNAHAN');
 } 
   elseif ($row['STATUS'] == "4") {
print ('DIRAMPAS UNTUK NEGARA');
 } 
print ('</td>');
print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}}
?>
