<?PHP include("index.db.php");
?>
<table width="100%"  border="0" cellspacing="8" cellpadding="8">
  <tr>
    <td colspan="2"><?PHP
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$mytable = $_GET["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";
$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 "DATABASE : $mytable | PANTAUAN SELURUH BARANG BUKTI | <strong>$xnum</strong> | ";
for ($i=1;$i<=$stw2;$i++) {if($page==$i){
echo "<b> HAL $i |</b> ";} 
else{echo "<a href=\"?g=rekapgudang&page=$i\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytable." ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "ORDER BY Status = '0' 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="7%"><span class="style1"><strong>UKEY</strong></span></td>
<td width="15%"><span class="style1"><strong>NAMA TERDAKWA</strong></span></td>
<td width="10%"><span class="style1"><strong>NOMOR REGISTER BARANG BUKTI</strong></span></td>
<td width="10%"><span class="style1"><strong>IJIN SITA</strong></span></td>
<td width="25%"><span class="style1"><strong>DAFTAR BARANG BUKTI</strong></span></td>
<td width="15%"><span class="style1"><strong>LOKASI</strong></span></td>
<td width="15%"><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['IJINSITA'] .'</td>');
print ('<td>'.$row['NAMABARANG'] .'</td>');
print ('<td>');
if ($row['LOKASI'] == "0") {
print ('<img src="images/b_belumproses.png" width="150" height="20">');
} 
 elseif ($row['LOKASI'] == "1") {
print ('<img src="images/b_gudang.png" width="150" height="20">');
 } 
  elseif ($row['LOKASI'] == "2") {
print ('<img src="images/b_rubasan.png" width="150" height="20">');
 } 
  elseif ($row['LOKASI'] == "3") {
print ('<img src="images/b_penitipan.png" width="150" height="20">');
 } 
   elseif ($row['LOKASI'] == "4") {
print ('<img src="images/b_lainlain.png" width="150" height="20">');
 } 
    elseif ($row['LOKASI'] == "5") {
print ('<img src="images/b_limpahpn.png" width="150" height="20">');
 } 
print ('</td>');
print ('<td>');
if ($row['STATUS'] == "0") {
print ('BLM DIEKSEKUSI');
} 
 elseif ($row['STATUS'] == "1") {
print ('KEMBALI');
 } 
  elseif ($row['STATUS'] == "2") {
print ('LELANG');
 } 
  elseif ($row['STATUS'] == "3") {
print ('MUSNAH');
 } 
   elseif ($row['STATUS'] == "4") {
print ('DIRAMPAS UNTUK NEGARA');
 } 
print ('</td>');

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

?>
</td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td width="45%" valign="top"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td colspan="2"><strong>Rekap Lokasi </strong></td>
        <td><strong>Jumlah</strong></td>
      </tr>
      <tr>
        <td width="7%"><div align="center">1.</div></td>
        <td bgcolor="#FFCCFF">Gudang</td>
        <td width="67%" bgcolor="#CCCCCC">
           <?php
		   
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where lokasi = '1'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik1 Set jumlah_a = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">2.</div></td>
        <td width="26%" bgcolor="#FFCCFF">Rubasan</td>
        <td bgcolor="#CCCCCC">
          <?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where lokasi = '2'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik1 Set jumlah_b = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">3.</div></td>
        <td bgcolor="#FFCCFF">Penitipan</td>
        <td bgcolor="#CCCCCC"><?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where lokasi = '3'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik1 Set jumlah_c = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">4.</div></td>
        <td bgcolor="#FFCCFF">Limpah PN </td>
        <td bgcolor="#CCCCCC"><?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where lokasi = '5'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik1 Set jumlah_e = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">5.</div></td>
        <td bgcolor="#FFCCFF">Lain-Lain</td>
        <td bgcolor="#CCCCCC">          <?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where lokasi = '4'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik1 Set jumlah_d = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
    </table></td>
    <td width="55%"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
      <tr>
        <td colspan="2"><strong>Rekap Status </strong></td>
        <td><strong>Jumlah</strong></td>
      </tr>
      <tr>
        <td width="8%"><div align="center">1.</div></td>
        <td bgcolor="#FFCCFF">Belum di Eksekusi </td>
        <td width="45%" bgcolor="#CCCCCC"><?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where status = '0'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik2 Set jumlah_a = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">2.</div></td>
        <td width="47%" bgcolor="#FFCCFF">Sudah Kembali </td>
        <td bgcolor="#CCCCCC">
          <?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where status = '1'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik2 Set jumlah_b = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">3.</div></td>
        <td bgcolor="#FFCCFF">Proses/Telah diLelang </td>
        <td bgcolor="#CCCCCC"><?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where status = '2'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik2 Set jumlah_c = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">4.</div></td>
        <td bgcolor="#FFCCFF">Proses/Telah diMusnahkan</td>
        <td bgcolor="#CCCCCC"><?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where status = '3'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik2 Set jumlah_d = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
      <tr>
        <td><div align="center">5.</div></td>
        <td bgcolor="#FFCCFF">Proses/Dirampas Untuk Negara </td>
        <td bgcolor="#CCCCCC"><?php
$link = mysql_connect("$server", "$username", "$password"); mysql_select_db("$database", $link);
$result1 = mysql_query("SELECT * FROM $mytable where status = '4'", $link);
$num_rows = mysql_num_rows($result1);
$query = "UPDATE barbuk_grafik2 Set jumlah_e = '$num_rows'";  
$result = mysql_query($query); 
print (''.$num_rows.'');

 ?></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2">Pengelolaan BB yang menunggak / terlewat Tahun silahkan <a href="index.php?g=rekapitulasi&tahun=<? echo $mytable; ?>"><strong>Klik disini </strong></a></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
</table>
