<?PHP 
$mytables = $_GET['jenis']; 
$page = $_GET["page"];
?>
<script type="text/javascript">
function printF(printData)
{
var a = window.open ('', '',"status=1,scrollbars=1, width=900,height=600");
a.document.write(document.getElementById(printData).innerHTML.replace(/<a\/?[^>]+>/gi, ''));
a.document.close();
a.focus();
a.print();
a.close();
}
</script>
<style type="text/css">
<!--
.jenisbesar {	font-size: 18px;
	font-weight: bold;
}
-->
</style>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%"  border="0" cellspacing="4" cellpadding="4">
        <tr>
          <td width="78%"><strong>EDIT / UPDATE DISPOSISI / HAPUS SURAT (DIKELOLA OLEH KEPALA URUSAN TATA USAHA) </strong></td>
          <td width="15%"><div align="center">PRINT REKAPAN </div></td>
          <td width="7%" height="50"><div align="center"><a href="#"  onClick="printF('printData')"><img src="print-icon.png" width="32" height="32" border="0"></a></div></td>
        </tr>
    </table></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']; ?>
     <div id="printData"><LINK href="../images/index.css" rel="stylesheet" type="text/css"> <table width="100%"  border="0" cellspacing="1" cellpadding="0" class="panel">
        <tr>
          <td><table width="100%"  border="0" cellspacing="2" cellpadding="2">
            <tr>
              <td width="12%"><div align="center"><span class="jenisbesar"><span class="style8"><img src="images/logo.png" width="90" height="90"> </div>                <div align="center"><span class="jenisbesar"></div>                <div align="center"><span class="jenisbesar"></div></td>
              <td width="41%"><span class="jenisbesar">
                <table width="100%"  border="0" cellspacing="2" cellpadding="2">
                  <tr>
                    <td><span class="jenisbesar"><span class="style8"><?PHP echo $satker; ?></td>
                  </tr>
                  <tr>
                    <td><?PHP echo $alamat; ?></td>
                  </tr>
                </table></td>
              <td width="47%"><div align="center"></div>                <div align="center"><span class="jenisbesar">REKAP SURAT MASUK
                      <?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";} 
?>
              </div></td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="4" cellpadding="4">
        <tr>
          <td width="100%">&nbsp;</td>
        </tr>
        <tr>
          <td>
		  <?PHP
		  $mytabler = $mytable.''.$mytables;
if(empty($action))
{
if (empty($order)) $order =  2;
if (empty($page))  $page  =  1;
if (empty($hits))  $hits  = 1000;
$start = $hits*($page-1);
$query = "SELECT * FROM $mytabler ";
$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 SURAT <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=editsuratmasuk&i=index&page=$i&jenis=$mytables\">$i</A></font> ";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytabler." ";
if(!empty($squery)) { $query .= "WHERE tu_id LIKE \"%$squery%\" ";}
$query .= "ORDER BY tu_id ASC";
$res = mysql_query($query);
print ('<table id="myTable" width="100%"  border="0" cellspacing="1" cellpadding="1" bgcolor="#B05800">
        <thead><tr>
<td width="3%"><strong>EDIT</strong></td>
<td width="3%"><strong>DEL</strong></td>
<td width="3%"><strong><center>NO</center></strong></td>
<td width="7%"><strong><center>TGL SURAT</center></strong></td>
<td width="15%"><strong><center>NO SURAT</center></strong></td>
<td width="15%"><strong><center>ASAL SURAT</center></strong></td>
<td width="39%"><strong><center>PERIHAL SURAT</center></strong></td>
<td width="17%"><strong><center>DISPOSISI</center></strong></td>
<td width="3%"><strong><center>EDIT</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'];
$hal = $row['tu_perihal'];
$asal = $row['tu_asalsrt'];
$na = $row['tu_noagenda'];
print ('<tr bgcolor=#'.$barva.'>');
echo "<td><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()\" title=\"EDIT SURAT\"><img src=\"images/doc_edit.png\" width=\"24\" height=\"24\"></a></center></td>";
echo "<td><center><a href=\"index.kaur.del.php?uid=$id&table=$mytable$mytables\" onclick=\"NewWindow(this.href,'mywin','700','350','yes','center');return false\" onfocus=\"this.blur()\" title=\"DELETE SURAT\"><img src=\"images/doc_del.png\" width=\"24\" height=\"24\"></a></center></td>";

print ('<td><center>'.$row['tu_noagenda'].'</center></td>');
print ('<td><center>'.$row['tu_tglsrt'].'</center></td>');
print ('<td>'.$row['tu_nosrt'].'</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="_blank">'.$row['tu_perihal'].'</a></td>');
print ('<td><b>');
if ($row['tu_ekspedisi'] == "") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >EDIT</a> - ";
} 
elseif ($row['tu_ekspedisi'] == "1") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasubagbin</a> - ";
} 
elseif ($row['tu_ekspedisi'] == "2") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasi Intel</a> - ";
} 
elseif ($row['tu_ekspedisi'] == "3") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasi Pidum</a> - ";

} 
elseif ($row['tu_ekspedisi'] == "4") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasi Pidsus</a> - ";
} 
elseif ($row['tu_ekspedisi'] == "5") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasi Datun</a> - ";
} 
elseif ($row['tu_ekspedisi'] == "6") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasi BB & Eksekusi</a> - ";
} 
elseif ($row['tu_ekspedisi'] == "7") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kaur TU</a> - ";
}  
elseif ($row['tu_ekspedisi'] == "8") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Kasubsi</a> - ";
}  
elseif ($row['tu_ekspedisi'] == "9") {
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" >Lainnya</a> - ";
}  
print ('</b>');
echo $row['tu_disposisi'];
print ('</td>');
print ('<td>');
echo "<a href=\"index.viewsurat.disposisi.php?uid=$id&table=$mytable$mytables&nosurat=$nosrt\" onclick=\"NewWindow(this.href,'mywin','700','430','yes','center');return false\" onfocus=\"this.blur()\" title=\"EDIT DISPOSISI\"><center><img src=\"images/doc_edit.png\" width=\"24\" height=\"24\"></center></a>";

print ('</td>');
print ('</tr>');
}
print ('</tbody></table>');
}
?>            </td>
        </tr>
        <tr>
          <td></td>
        </tr>
    </table> </div>  </td>
  </tr>
</table>
<?PHP } ?>

