<form name="form1" method="post" action="index.barbuk.cari.php">
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td bgcolor="#FFCCFF"><table width="100%"  border="0" cellspacing="8" cellpadding="8">
        <tr>
          <td width="27%">Masukan UKEY atau SCAN Barcode </td>
          <td width="16%"><input name="query" type="text" id="query"></td>
          <td><input type="submit" name="Submit" value="Cari"></td>
          </tr>
      </table></td>
    </tr>
  </table>
</form>
<table width="100%"  border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td><img src="images/bb_pidum.png" width="300" height="100"></td>
  </tr>
  <tr>
    <td><?PHP
include("index.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$mytable = $_GET['tahun'];
//------end
$page = $_GET["page"];
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page))  $page  =  1;
if (empty($hits))  $hits  = 100;
$start = $hits*($page-1);
$query = "SELECT * FROM $mytable WHERE status ='0' AND BIDANG='1'";
$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=rekapitulasi&page=$i\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytable." ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE status ='0' AND BIDANG='1' 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="20%"><span class="style1"><strong>NOMOR REG. BARANG BUKTI</strong></span></td>
<td width="27%"><span class="style1"><strong>NAMA BARANG</strong></span></td>
<td width="5%"><span class="style1"><strong>FOTO</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</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['FOTO'] == ""){
//print ('<a href="index.barbukfoto.php?ukey='.$row['UKEY'] .'&jenis='.$row['jenis'] .'&bb='.$row['NAMABARANG'] .'&nama='.$row['TERDAKWA'] .'');
print ('<a href="index.barbukfoto.php?ukey='.$row['UKEY'] .'&jenis='.$row['jenis'] .'&bb='.$row['NAMABARANG'] .'&nama='.$row['TERDAKWA'] .'" ');

echo "onclick=\"NewWindow(this.href,'mywin','700','400','yes','center');return false\" onfocus=\"this.blur()\"  target=\"_blank\"><center><img src=\"./images/takepicture.png\" width=\"40\" height=\"40\"><center></a>";
}
elseif ($row['FOTO'] !== ""){
print ('<center><a href="'.$mytable.'/'.$row['FOTO'] .'" ');
echo "onclick=\"NewWindow(this.href,'mywin','700','400','yes','center');return false\" onfocus=\"this.blur()\" ><img src=\"./images/camera.png\" width=\"41\" height=\"35\" border=\"0\"></a></center>";
} 
print ('</td>');
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=kembali&bidang=pdm" ');
echo "onclick=\"NewWindow(this.href,'mywin','700','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">KEMBALI</a></td>";
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=lelang&bidang=pdm"');
echo "onclick=\"NewWindow(this.href,'mywin','600','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">LELANG</a></td>";
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=musnah&bidang=pdm" ');
echo "onclick=\"NewWindow(this.href,'mywin','600','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">MUSNAH</a></td>";
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=rampas&bidang=pdm" ');
echo "onclick=\"NewWindow(this.href,'mywin','600','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">RAMPAS</a></td>";
print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}
?></td>
  </tr>
  <tr>
    <td><img src="images/bb_pidsus.png" width="300" height="100"></td>
  </tr>
  <tr>
    <td><?PHP
include("index.db.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  = 100;
$start = $hits*($page-1);
$query = "SELECT * FROM $mytable WHERE status ='0' AND BIDANG ='2'";
$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=rekapitulasi&page=$i\"> $i |</a>";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytable." ";
if(!empty($squery)) { $query .= "LIKE \"%$squery%\" ";}
$query .= "WHERE status ='0' AND BIDANG ='2' 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="20%"><span class="style1"><strong>NOMOR REG. BARANG BUKTI</strong></span></td>
<td width="27%"><span class="style1"><strong>NAMA BARANG</strong></span></td>
<td width="5%"><span class="style1"><strong>FOTO</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</strong></span></td>
<td width="7%"><span class="style1"><strong>PROSES</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><center><a href="./'.$mytable.'/'.$row['FOTO'] .'" target="_blank"><img src="./images/camera.png" width="41" height="35" border="0"></a></center></td>');
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=kembali&bidang=pds" ');
echo "onclick=\"NewWindow(this.href,'mywin','700','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">KEMBALI</a></td>";
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=lelang&bidang=pds"');
echo "onclick=\"NewWindow(this.href,'mywin','600','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">LELANG</a></td>";
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=musnah&bidang=pds" ');
echo "onclick=\"NewWindow(this.href,'mywin','600','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">MUSNAH</a></td>";
print ('<td><a href="index.tahapan.php?ukey='.$row['UKEY'] .'&t=rampas&bidang=pds" ');
echo "onclick=\"NewWindow(this.href,'mywin','600','400','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\" target=\"_blank\">RAMPAS</a></td>";
print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}
?></td>
  </tr>
</table>

