<?PHP 
$mytables = $_GET['jenis']; 
$filter = $_GET['filter']; 
?>
<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;
}
.style1 {
	font-size: 14px;
	font-weight: bold;
}
.style2 {font-size: 18px}
.style3 {font-size: 12px}
.style8 {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%">&nbsp;</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><? 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"></center> </center></div>                <div align="center"><span class="jenisbesar"></center></div>                <div align="center"><span class="jenisbesar"></center></div></td>
              <td width="41%"><span class="jenisbesar"></center>
                <table width="100%"  border="0" cellspacing="2" cellpadding="2">
                  <tr>
                    <td><span class="jenisbesar"><span class="style8"><?PHP echo $satker; ?></center></center></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 KELUAR
                      <?PHP
if ($mytables == "bk")  {echo "BIASA";} 
elseif ($mytables == "rk") {echo "RAHASIA";} 
elseif ($mytables == "sk") {echo "SURAT KEPUTUSAN";} 
elseif ($mytables == "sp") {echo "SURAT PERINTAH";} 
?>
              </center></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 where tu_jenissurat = '$filter'";
$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=viewsurat&i=index&page=$i\">$i</A></font> ";}}
print ('<br><br>');
$query  = "SELECT * FROM ".$mytabler." where tu_jenissurat = '$filter'";
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%"><center><strong>NO</strong></center></td>
<td width="7%"><center><strong>NAMA FILE</strong></center></td>
<td width="7%"><center><strong>TGL SURAT</strong></center></td>
<td width="19%"><center><strong>NO SURAT</strong></center></td>
<td width="19%"><center><strong>KEPADA</strong></center></td>
<td width="45%"><center><strong>PERIHAL / ISI SURAT</strong></center></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><center>'.$row['tu_noagenda'].'</center></td>');
print ('<td><a href="'.$mytable.'/');
if ($mytables == "bk")  {echo "BK-";} 
elseif ($mytables == "bd") {echo "BD-";} 
elseif ($mytables == "r") {echo "RK-";} 
elseif ($mytables == "b") {echo "BK-";} 
elseif ($mytables == "sp") {echo "SP-";} 
elseif ($mytables == "sk") {echo "SK-";} 
elseif ($mytables == "tar") {echo "KTAR-";} 
print (''.$row['tu_noagenda'].'.pdf" target="_blank">');
if ($mytables == "bk")  {echo "BK-";} 
elseif ($mytables == "bd") {echo "BD-";} 
elseif ($mytables == "r") {echo "RK-";} 
elseif ($mytables == "b") {echo "BK-";} 
elseif ($mytables == "sp") {echo "SP-";} 
elseif ($mytables == "sk") {echo "SK-";} 
elseif ($mytables == "tar") {echo "KTAR-";} 
print (''.$row['tu_noagenda'].'.pdf</a></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 == "bk")  {echo "BK-";} 
elseif ($mytables == "bd") {echo "BD-";} 
elseif ($mytables == "r") {echo "RK-";} 
elseif ($mytables == "b") {echo "SB-";} 
elseif ($mytables == "sp") {echo "SP-";} 
elseif ($mytables == "sk") {echo "SK-";} 
print (''.$row['tu_noagenda'].'.pdf" target="_blank">'.$row['tu_perihal'].'</a></td>');
print ('</tr>');
}
print ('</tbody></table>');
}
?>            </td>
        </tr>
        <tr>
          <td></td>
        </tr>
    </table> </div>  </td>
  </tr>
</table>
<? } ?>

