<?php require_once('../../Connections/sistem.php'); 
?>
<?php
function formatRupiah($angka){
 $rupiah=number_format($angka,0,',','.');
 return $rupiah;
}

mysql_select_db($database_sistem, $sistem);
$query_unit = "SELECT * FROM user_tb WHERE user_tb.kode_unit='$_GET[unit]'";
$unit = mysql_query($query_unit, $sistem) or die(mysql_error());
$row_unit = mysql_fetch_assoc($unit);
$totalRows_unit = mysql_num_rows($unit);

?>
<?php
$bulan=$_GET['bulan'];
$tahun=$_GET['tahun'];
$kode=$_GET['unit'];
$nama=$_GET['nama'];
?>
<style type="text/css">
#myTable {border-collapse: collapse;
  width: 100%;
  border: 0px solid #ddd;
  font-size: 12px;
}
</style>

<p>&nbsp;</p>
<table width="95%" border="0" align="center" class="form_body">
  <tr>
    <td colspan="8"><table width="100%" class="isi_tabel">
      <tr>
        <td width="100" rowspan="4"><img  alt="" name="img" width="100" height="99" id="img" src="../../images/wlha.jpg" /></td>
        <td width="207">Laporan</td>
        <td width="10">:</td>
        <td width="648">Aktivitas (Konsolidasi)</td>
      </tr>
      <tr>
        <td>Bulan/ Tahun Lapor</td>
        <td>:</td>
        <td><?php echo $bulan.'/ '.$tahun;?></td>
      </tr>
      <tr>
        <td>Unit</td>
        <td>:</td>
        <td><?php echo $nama;?></td>
      </tr>
      <tr>
        <td>Tanggal</td>
        <td>:</td>
        <td><?php echo date('d-M-Y');?></td>
      </tr>
    </table></td>
  </tr>
  <tr height="30">
    <td width="100" align="center" background="images/bg1.png">Akun</td>
    <td align="center" background="images/bg1.png">Keterangan</td>
    <td colspan="6" align="center" background="images/bg1.png">Nominal</td>
  </tr>
  <tr height="30">
    <td colspan="8" align="left">Pendapatan</td>
  </tr>
  <?php        mysql_select_db("csabrude_akurat");
					          $sql = mysql_query("SELECT * From akun_tb where kode_unit='All' and kelompok='Pendapatan' order by akun asc ");
					          $no = 1;
							
                    while ($r = mysql_fetch_array($sql)) {
                      echo "<tr>
          <td align='center'>$r[akun]</td>
          <td align='left'>$r[keterangan]</td>
          <td align='right'>Rp.</td>
          <td align='right'>";?>
  <?php 
			if($r['index']==''){
			include 'hitung_pdp_lr_konsol.php';
			}else{
				echo '';
			}
			?>
  <?php echo"</td>
          <td align='right'>Rp.</td>
          <td align='right'>";?>
  <?php 
			if($r['index']=='Ya'){
			include 'hitung_pdp_index_lr_konsol.php';
			}else{
				echo '';
			}
			?>
  <?php echo"</td>
          <td></td>
          <td></td>
        </tr>";
		 $no++;
                    }
                    ?>
  <tr height="30">
    <td colspan="2"></td>
    <td></td>
    <td></td>
    <td></td>
    <td align="right"><?php include 'hitung_ttl_pdp_lr_konsol.php';?></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td colspan="8"><hr /></td>
  </tr>
  <tr height="30">
    <td colspan="8">Pengeluaran</td>
  </tr>
  <?php        mysql_select_db("csabrude_akurat");
					          $sql = mysql_query("SELECT * From akun_tb where kode_unit='All' and kelompok='Pengeluaran' order by akun asc ");
					          $no = 1;
							
                    while ($r = mysql_fetch_array($sql)) {
                      echo "<tr>
          <td align='center'>$r[akun]</td>
          <td align='left'>$r[keterangan]</td>
          <td align='right'>Rp.</td>
          <td align='right'>";?>
  <?php 
			if($r['index']==''){
			include 'hitung_pnl_lr_konsol.php';
			}else{
				echo '';
			}
			?>
  <?php echo"</td>
          <td align='right'>Rp.</td>
          <td align='right'>";?>
  <?php 
			if($r['index']=='Ya'){
			include 'hitung_pnl_index_lr_konsol.php';
			}else{
				echo '';
			}
			?>
  <?php echo"</td>
          <td></td>
          <td></td>
        </tr>";
		 $no++;
                    }
                    ?>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right"><?php include 'hitung_ttl_pnl_lr_konsol.php';?></td>
    <td align="right"></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="8"><hr /></td>
  </tr>
  <tr>
    <td colspan="2">Sisa Hasil Usaha</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">Rp.</td>
    <td align="right"><?php 
  $lr=$ttl_pdp-$ttl_pnl;
  echo formatRupiah($lr);
  ?></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td align="right">&nbsp;</td>
    <td align="right">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="8"><table width="95%" id="myTable" border="0" align="center" cellpadding="1">
      <tr>
        <td width="30%">Mengetahui</td>
        <td width="30%">&nbsp;</td>
        <td width="30%" align="right">.....................,<?php echo date('d-M-Y');?></td>
      </tr>
      <tr>
        <td>Ketua <?php echo $nama;?></td>
        <td>&nbsp;</td>
        <td align="right">Bendahara/ Wakil Ketua <?php echo $nama;?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="right">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td align="right">&nbsp;</td>
      </tr>
      <tr>
        <td><?php echo $row_unit['direktur'];?></td>
        <td>&nbsp;</td>
        <td align="right"><?php echo $row_unit['bendahara'];?></td>
      </tr>
    </table></td>
  </tr>
</table>
<p>&nbsp;</p>
<script>
		window.print();
	</script> 
