<table width="100%"  border="0" cellspacing="4" cellpadding="4">
  <tr>
    <td><strong>Kirim Surat / SMS Pemilik untuk Segera mengambil barang bukti yang dimiikinya. </strong></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?PHP
include("index.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$mytable = "$tahun_now";
$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 STATUS ='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 "PANGGILAN SURAT / SMS KE PEMILIK | <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 .= "WHERE STATUS ='1' ORDER BY ID 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="20%"><span class="style1"><strong>NAMA TERDAKWA</strong></span></td>
<td width="10%"><span class="style1"><strong>UKEY</strong></span></td>
<td width="31%"><span class="style1"><strong>NAMA BARANG</strong></span></td>
<td width="20%"><span class="style1"><strong>KEPADA YTH.</strong></span></td>
<td width="8%"><span class="style1"><strong>SURAT</strong></span></td>
<td width="8%"><span class="style1"><strong>SMS</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['TERDAKWA'] .'</td>');
print ('<td><a href="index.panggilan.php?ukey='.$row['UKEY'] .'&t=SURAT" target="_blank">'.$row['UKEY'] .'</a></td>');
print ('<td>'.$row['NAMABARANG'] .'</td>');
print ('<td>'.$row['NAMAPEMILIK'] .'<br>'.$row['ALAMATPEMILIK'] .'<br>'.$row['NOHPPEMILIK'] .'</td>');
 print ('<td>');
if ($row['ntfy_surat'] == "1") {print ('<center><b>OK</b></center>');
} 
elseif ($row['ntfy_surat'] == "0") {
print ('<a href="index.panggilan.php?ukey='.$row['UKEY'] .'&t=SURAT" class="menu" target="_blank">SURAT</a>');
}
print ('</td>');
print ('<td>');
if ($row['ntfy_sms'] == "1") {print ('<center><b>OK</b></center>');
} 
elseif ($row['ntfy_sms'] == "0") {
print ('<a href="index.panggilan.php?ukey='.$row['UKEY'] .'&t=SMS" ');
echo "onclick=\"NewWindow(this.href,'mywin','800','500','yes','center');return false\" onfocus=\"this.blur()\" class=\"menu\">SMS</a>";
}
print ('</td>');
print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits /Halaman";
}
?></td>
  </tr>
</table>
