<?PHP 
$mytables = $_GET['jenis']; 
$page = $_GET["page"];
?>
<style type="text/css">
<!--
.jenisbesar {
	font-size: 18px;
	font-weight: bold;
}
-->
</style>
<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'];?><form action="index.pencarian.php" method="get" enctype="multipart/form-data" name="form1">
      <table width="100%"  border="0" cellspacing="1" cellpadding="0" class="panel">
        <tr>
          <td><table width="100%"  border="0" cellspacing="2" cellpadding="2">
            <tr>
              <td><div align="left">
                <table width="100%"  border="0" cellspacing="2" cellpadding="2">
                  <tr>
                    <td colspan="2"><strong>Aturan:</strong></td>
                  </tr>
                  <tr>
                    <td width="3%"><div align="center">1.</div></td>
                    <td width="97%">YANG DITAMPILKAN DISINI ADALAH SURAT YANG SUDAH DI POSTING NAMUN BELUM DI CETAK LEMBAR DISPOSISINYA</td>
                  </tr>
                  <tr>
                    <td><div align="center">2.</div></td>
                    <td>TOMBOL EDIT AKAN MUNCUL DAN EDIT DAPAT DILAKUKAN APABILA ANDA <strong>BELUM</strong> MENCETAK LEMBAR DISPOSISI. SETELAH DIPOSISI DIAJUKAN KE ATASAN ATAU SUDAH DI PRINT MAKA EDIT TIDAK DIPERKENANKAN </td>
                  </tr>
                </table>
              </div></td>
            </tr>
          </table>
            </td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="4" cellpadding="4">
        <tr>
          <td></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="4" cellpadding="4">
        <tr>
          <td><span class="jenisbesar">
            <?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";} 
?>
</td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="4" cellpadding="4">
        <tr>
          <td width="14%">Cari Judul Surat </td>
          <td width="2%">:</td>
          <td width="23%"><input name="query" class="baca1" id="query" 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>
          <td width="19%">Dalam Database Surat </td>
          <td width="2%">:</td>
          <td width="12%">            <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></td>
          <td width="28%"><input type="submit" name="Submit" value="Search">        </td>
        </tr>
        <tr>
          <td colspan="7">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="7">
		    <?
		  $mytabler = $mytable.''.$mytables;
		  $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 $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 ASC 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%"><strong><center>Edit</center></strong></td>
<td width="3%"><strong><center>N.A.</center></strong></td>
<td width="5%"><strong><center>TGL SURAT</center></strong></td>
<td width="15%"><strong><center>NO SURAT</center></strong></td>
<td width="10%"><strong><center>ASAL SURAT</center></strong></td>
<td width="3%"><strong><center>LAMP</center></strong></td>
<td width="28%"><strong><center>PERIHAL </center></strong></td>
<td width="10%"><strong><center>EKPEDISI</center></strong></td>
<td width="8%"><strong><center>PRINT</center></strong></td>
<td width="3%"><strong><center>PDF</center></strong></td>
<td width="10%"><strong><center>Upload Nama File</center></strong></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'];
if ($row['tu_print'] == "2") {
print ('');
} 
elseif ($row['tu_print'] == "1") {

echo "<center><a href=\"index.edit.surat.php?uid=$id&table=$mytable$mytables\" onclick=\"NewWindow(this.href,'mywin','700','530','yes','center');return false\" onfocus=\"this.blur()\"><img src=\"images/doc_edit.png\" width=\"24\" height=\"24\"></a></center>";
}
print ('</td>');
print ('<td>');
echo "<center>$na</center>";
print ('</td>');
print ('<td>'.$row['tu_tglsrt'].'</td>');
print ('<td>'.$row['tu_nosrt'].'</td>');
print ('<td>'.$row['tu_asalsrt'].'</td>');
print ('<td><center>'.$row['tu_lamp'].'</center></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="_blank">'.$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\" onclick=\"NewWindow(this.href,'mywin','800','450','yes','center');return false\" onfocus=\"this.blur()\" class=\"menupidum\">TUNJUK JAKSA</a>";
}
elseif ($mytables !== "3"){
// 0 atau kosong
if ($row['tu_disposisi'] == "") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','800','450','yes','center');return false\" onfocus=\"this.blur()\"  class=\"menu\" >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 ('<td>');
if ($mytables == "3"){
print ('<a href="index.print.spdp.disposisi.plain.php?uid='.$na.'&jenis='.$mytables.'&table='.$mytable.'" target="_blank" class="menupidum" >RE PRINT</a>');
}
elseif ($mytables !== "3"){
if ($row['tu_print'] == "2") {
print ('<a href="index.viewsurat.print.php?uid='.$row['tu_id'].'&jenis='.$mytables.'&table='.$mytable.'" target="_blank" class="menupidum" >REPRINT</a>');
} 
elseif ($row['tu_print'] == "1") {
print ('<a href="index.viewsurat.print.php?uid='.$row['tu_id'].'&jenis='.$mytables.'&table='.$mytable.'" target="_blank" class="menu" >CETAK</a>');
}
}
print ('</td>');
//----------------
print ('<td>');
if ($row['tu_filesc'] == ""){
print ('');
}
elseif ($row['tu_filesc'] == "1"){
print ('<img src="images/pdf-logo.png" width="31" height="35">');
} 
print ('</td>');
//---------------
print ('<td>');
if ($row['tu_print'] == "2") {
echo "<a href=\"index.uploadsurat.php?namafile=";
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');
echo "&uid=$id&table=$mytable$mytables&nosurat=$nosrt&dir=$tabler\" onclick=\"NewWindow(this.href,'mywin','700','300','yes','center');return false\" onfocus=\"this.blur()\"  class=\"menu\" >";
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');
echo "</a>";
} 
elseif ($row['tu_print'] == "1") {
echo "<a href=\"index.uploadsurat.php?namafile=";
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');
echo "&uid=$id&table=$mytable$mytables&nosurat=$nosrt&dir=$tabler\" onclick=\"NewWindow(this.href,'mywin','700','300','yes','center');return false\" onfocus=\"this.blur()\"  class=\"menu\" >Upload</a>";
}
print ('</td>');

print ('</tr>');
}
print ('</tbody></table>');
echo "<br><br>Ditampilkan $hits Surat /Halaman";
}
?>
</td>
        </tr>
        <tr>
          <td colspan="7"><div align="right"></div></td>
        </tr>
      </table>
    </form></td>
  </tr>
</table>
<? } ?>

