<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_sistem, $sistem);
$query_unit = "SELECT * FROM user_tb where level='Unit' group by kode_unit order by kode_unit asc";
$unit = mysql_query($query_unit, $sistem) or die(mysql_error());
$row_unit = mysql_fetch_assoc($unit);
$totalRows_unit = mysql_num_rows($unit);


?>

<table id="myTable1" width="90%" border="0" align="center" cellpadding="5" cellspacing="5">
  <tr>
    <td colspan="2">Nama Unit</td>
    <td width="150"><img src="images/kas.png" width="40" height="40"></td>
    <td width="150"><img src="images/arus_kas.png" width="40" height="40"></td>
    <td width="150"><img src="images/laba_rug.png" width="40" height="40"></td>
    <td width="150"><img src="images/banks.png" width="40" height="40"></td>
    <td width="150"><img src="images/neraca.png" width="40" height="40" /></td>
  </tr>
  <tr>
    <td colspan="7"><hr></td>
  </tr>
  <?php do { ?>
    <tr>
      <td width="100" align="center"><?php echo $row_unit['kode_unit'];?></td>
      <td align="center"><?php echo $row_unit['alamat'];?></td>
      <td align="center"><a href="?section=Report&module=kas_unit&kodenya=<?php echo $row_unit['kode_unit'];?>&nama=<?php echo $row_unit['nama_unit'];?>">Laporan Kas</a></td>
      <td align="center"><a href="?section=Report&module=akb_unit&kodenya=<?php echo $row_unit['kode_unit'];?>&nama=<?php echo $row_unit['nama_unit'];?>">Laporan Arus Kas &amp; Bank</a></td>
      <td align="center"><a href="?section=Report&module=labarug_unit&kodenya=<?php echo $row_unit['kode_unit'];?>&nama=<?php echo $row_unit['nama_unit'];?>">Laba Rugi</a></td>
      <td align="center"><a href="?section=Report&module=bank_unit&kodenya=<?php echo $row_unit['kode_unit'];?>&nama=<?php echo $row_unit['nama_unit'];?>">Laporan Bank</a></td>
      <td align="center"><a href="?section=Report&amp;module=neraca_unit&amp;kodenya=<?php echo $row_unit['kode_unit'];?>&amp;nama=<?php echo $row_unit['nama_unit'];?>">Laporan Neraca</a></td>
    </tr>
    <?php } while ($row_unit = mysql_fetch_assoc($unit)); ?>
    <tr>
      <td colspan="7" align="center"><hr /></td>
    </tr>
    
</table>
<p>
  <?php
mysql_free_result($unit);
?></p>
