<?PHP 
$mytables = $_GET['jenis']; 
$page = $_GET["page"];
?>
<LINK href="index.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.jenisbesar {
	font-size: 18px;
	font-weight: bold;
}
body {
	background-color: #CCCCCC;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="53%" height="500" valign="top"><table width="100%"  border="0" cellspacing="4" cellpadding="4">
      <tr>
        <td><a href="index.kiri.php" class="menubin" target="_self">KEMBALI KE HALAMAN PEMANTAUAN SURAT BARU </a></td>
      </tr>
    </table>
    <table width="100%"  border="0" cellspacing="4" cellpadding="4">
      <tr>
        <td><?php mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$query = "Select * from tab_surat where s_id = '1'"; 
$result = mysql_query($query); 
if($row = mysql_fetch_array($result)){ 
$mytable = $row['s_nama'];
$edisi = $row['s_tahun'];?>          </td>
      </tr>
    </table>
      <form action="index.pencarian.php" method="get" enctype="multipart/form-data" name="form1">
        <table width="100%"  border="0" cellspacing="2" cellpadding="2">
          <tr>
            <td width="47%">Cari Judul Surat </td>
            <td width="53%"><div align="right">
                <input name="db" type="hidden" id="db" value="<?PHP echo $mytable.''.$mytables; ?>">
                <strong>
                <?PHP
if ($mytables == "1")  {echo "BIASA UMUM";} 
elseif ($mytables == "2") {echo "BIASA DALAM";} 
elseif ($mytables == "3") {echo "SPDP";} 
elseif ($mytables == "4") {echo "NOTA DINAS";} 
elseif ($mytables == "5") {echo "KEPUTUSAN";} 
elseif ($mytables == "6") {echo "SURAT PERINTAH";} 
elseif ($mytables == "7") {echo "PENGANTAR";} 
elseif ($mytables == "8") {echo "RAHASIA";} 
elseif ($mytables == "9") {echo "UNDANGAN";} 
?>
            </strong></div></td>
          </tr>
          <tr>
            <td colspan="2"><input name="query" class="baca1" id="query2" onFocus="if(this.value=='Cari Surat') this.value='';" onBlur="if(this.value=='') this.value='Cari Surat';" onKeyUp="showUser(this.value)" size="40" type="text" maxlength="255"/></td>
          </tr>
          <tr>
            <td colspan="2"><input type="submit" name="Submit" value="Search"></td>
          </tr>
          <tr>
            <td colspan="2">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="2">
              <?
		  $mytabler = $mytable.''.$mytables;
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 $mytabler where tu_disposisi = ''";
$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 "SURAT TAHUN : $edisi - <strong>$xnum</strong> | ";
for ($i=1;$i<=$stw2;$i++) {if($page==$i){
echo "Halaman <b>$i</b> ";} 
else{echo " <font size=\"2\"><a href=\"?g=viewsurat&i=index&page=$i\">$i</A></font> ";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytabler." where tu_disposisi = ''";
if(!empty($squery)) { $query .= "WHERE tu_id LIKE \"%$squery%\" ";}
$query .= "ORDER BY tu_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>N.A.</strong></span></td>
<td width="10%"><span class="style1"><strong>TGL</strong></span></td>
<td width="15%"><span class="style1"><strong>ASAL SURAT</strong></span></td>
<td width="47%"><span class="style1"><strong>LIHAT SURAT KLIK PERIHAL</strong></span></td>
<td width="25%"><span class="style1"><strong>DISPOSISI</strong></span></td>

</tr></thead><tbody>');
 $x=0;
  while($row = mysql_fetch_array($res))
  {
   $x++;
   if($x==2) {$barva = "FFFFB7";$x=0;} else {$barva = "FFD8B0";$x=1;}
$id = $row['tu_id'];
$nosrt = $row['tu_nosrt'];

print ('<tr bgcolor=#'.$barva.'>');
print ('<td>');
$na = $row['tu_noagenda'];

echo "$na";
print ('</td>');
print ('<td>'.$row['tu_tglsrt'].'</td>');
print ('<td>'.$row['tu_asalsrt'].'</td>');

print ('<td><a href="../'.$mytable.'/');
if ($mytables == "1")  {echo "BU-";} 
elseif ($mytables == "2") {echo "BD-";} 
elseif ($mytables == "3") {echo "SPDP-";} 
elseif ($mytables == "4") {echo "ND-";} 
elseif ($mytables == "5") {echo "KEP-";} 
elseif ($mytables == "6") {echo "SP-";} 
elseif ($mytables == "7") {echo "TAR-";} 
elseif ($mytables == "8") {echo "R-";} 
elseif ($mytables == "9") {echo "UND-";} 
print (''.$row['tu_noagenda'].'.pdf" target="show">'.$row['tu_perihal'].'</a></td>');
print ('<td><b>');
if ($mytables == "3"){
$hal = $row['tu_perihal'];
$asal = $row['tu_asalsrt'];
echo "<a href=\"index.print.spdp.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt&jenis=$mytables&noagenda=$na&surat=$hal&asal=$asal\" target=\"show\" class=\"menupidum\">TUNJUK JAKSA</a>";
}
elseif ($mytables !== "3"){
if ($row['tu_ekspedisi'] == "") {
echo "<a href=\"index.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt&jenis=$mytables&noagenda=$na&surat=$hal&asal=$asal\" class=\"menu\" target=\"show\">ISI DISPOSISI</a>";
} 
elseif ($row['tu_ekspedisi'] == "1") {echo "Kasubagbin: ";} 
elseif ($row['tu_ekspedisi'] == "2") {echo "Kasi Intel: ";} 
elseif ($row['tu_ekspedisi'] == "3") {echo "Kasi Pidum: ";} 
elseif ($row['tu_ekspedisi'] == "4") {echo "Kasi Pidsus: ";} 
elseif ($row['tu_ekspedisi'] == "5") {echo "Kasi Datun: ";} 
elseif ($row['tu_ekspedisi'] == "6") {echo "Kasi BB & Rampasan: ";} 
elseif ($row['tu_ekspedisi'] == "7") {echo "Kaur TU: ";} 
elseif ($row['tu_ekspedisi'] == "8") {echo "Lainnya: ";} 
print ('</b>');
if ($row['tu_disposisi'] !== "") {print (''.$row['tu_disposisi'].'');
} 
elseif ($row['tu_print'] == "") {
print ('');
}
}
print ('</td>');
print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits Surat Yang belum di disposisi";
}

?>
            </td>
          </tr>
          <tr>
            <td colspan="2"><div align="right"></div></td>
          </tr>
        </table>
    </form></td>
  </tr>
</table>
<? } ?>
