<?php
mysql_select_db($database_sistem, $sistem);
$query_unit = "SELECT * FROM user_tb WHERE user_tb.`level`='Unit'";
$unit = mysql_query($query_unit, $sistem) or die(mysql_error());
$row_unit = mysql_fetch_assoc($unit);
$totalRows_unit = mysql_num_rows($unit);
?>

<script type="text/javascript" charset="utf-8">
          $(document).ready(function(){
            $('#bbkas').dataTable({
					     "oLanguage": {
						      "sLengthMenu": "Tampilkan _MENU_ data per halaman",
						      "sSearch": "Pencarian: ", 
						      "sZeroRecords": "Maaf, tidak ada data yang ditemukan",
						      "sInfo": "Menampilkan _START_ s/d _END_ dari _TOTAL_ data",
						      "sInfoEmpty": "Menampilkan 0 s/d 0 dari 0 data",
						      "sInfoFiltered": "(di filter dari _MAX_ total data)",
						      "oPaginate": {
						          "sFirst": "<<",
						          "sLast": ">>", 
						          "sPrevious": "<", 
						          "sNext": ">"
					       }
				      },
              "sPaginationType":"full_numbers",
              "bJQueryUI":true
            });
          })    
        </script>

<p>&nbsp;</p>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><h3>Tabel Data Unit</h3></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" class="form_body">
      <tr align="center">
        <td background="images/bg1.png"  height="30">kode unit</td>
        <td background="images/bg1.png">nama unit</td>
        <td background="images/bg1.png">alamat</td>
        <td background="images/bg1.png">telp</td>
        <td background="images/bg1.png">email</td>
        <td background="images/bg1.png">direktur</td>
        <td background="images/bg1.png">bendahara</td>
        <td background="images/bg1.png">nama admin</td>
      </tr>
      <tr align="center">
        <td colspan="8"><hr /></td>
      </tr>
      <?php do { ?>
      <tr align="center">
        <td><a href="?section=Report&module=show_index_pdp&amp;kodenya=<?php echo $row_unit['kode_unit'];?>"><?php echo $row_unit['kode_unit']; ?></a></td>
        <td><?php echo $row_unit['nama_unit']; ?></td>
        <td><?php echo $row_unit['alamat']; ?></td>
        <td><?php echo $row_unit['telp']; ?></td>
        <td><?php echo $row_unit['email']; ?></td>
        <td><?php echo $row_unit['direktur']; ?></td>
        <td><?php echo $row_unit['bendahara']; ?></td>
        <td><?php echo $row_unit['nama_admin']; ?></td>
      </tr>
      <tr align="center">
        <td colspan="8"><hr /></td>
      </tr>
      <?php } while ($row_unit = mysql_fetch_assoc($unit)); ?>
    </table></td>
  </tr>
  <tr>
    <td><table width="90%" align="center"  bgcolor="#FFFFFF" class="display" id="bbkas">
      <thead>
        <tr class="form_body" height="30">
          <th align="center" width="41">No</th>
          <th width="95" align="center">Akun</th>
          <th width="95" align="center">Perkiraan</th>
           <th width="60" align="center">Index</th>
          <th width="250" align="center">Keterangan</th>
          <th width="102" align="center">Subtotal</th>
          <th width="102" align="center">Total</th>
        </tr>
        </thead>
      <tbody>
      
        <?php        mysql_select_db("csabrude_akurat");
					          $sql = mysql_query("SELECT * From akun_tb where kode_unit='All' and kelompok='Pendapatan' order by perkiraan asc ");
					         $no = 1;
							
                    while ($r = mysql_fetch_array($sql)) {
		                   echo "<tr>
          <td align='center'>$no</td>
            <td align='center'>$r[akun]</td>
			<td align='center'>$r[perkiraan]</td>
			<td align='center'>$r[index]</td>
			<td align='left'>$r[keterangan]</td>
			<td align='right'>";?>
          <?php 
			if($r['index']==''){
			include 'hitung_pdp_pus_all.php';
			}else{
				echo '';
			}
			?>
			<?php echo"</td>
			<td align='right'>";?><?php 
			if($r['index']=='Ya'){
			include 'hitung_pdp_index_pus_all.php';
			}else{
				echo '';
			}
			?><?php echo"</td>
          </tr>";
                      $no++;
                    }
                    ?>
      </tbody>
      <tfoot>
        <tr>
       <th colspan="5" align="center">Total Pendapatan</th>
          <th align="right"><?php echo formatRupiah(0);?></th>
          <th align="right"><?php echo formatRupiah(0);?></th>
        </tr>
      </tfoot>
    </table></td>
  </tr>
</table>
        