<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="function/dataTables/media/css/demo_page.css">
<link rel="stylesheet" href="function/dataTables/media/css/demo_table_jui.css">
<link rel="stylesheet" href="function/dataTables/media/themes/smoothness/jquery-ui-1.8.4.custom.css">
<script type="text/javascript" src="function/dataTables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript">
	$(document).ready(function(){ 
		$("#fromdate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready(function(){
		$("#todate").datepicker({
			dateFormat : "yy-mm-dd",
			changeMonth : true,
			changeYear : true,
		});
	});
	$(document).ready( function () {
		var oTable = $('#myTables').dataTable( {
			 "sDom": 'R<"H"lfr>t<"F"ip>',
			 "bJQueryUI": true,
			 "sPaginationType": "full_numbers",
			 "iDisplayLength" :10
		});
	});
	function setTrColor(obj, color)
	{
		obj.style.backgroundColor=color;
		obj.onmouseout = function(){
				obj.style.backgroundColor=''; 
		}
	}
	function search_click(){
		form.action ='?page=Data-Neraca&Act=CARI';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function excel_click(){
		form.action ='./transaksi/akuntansi/export_neraca.php';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function pdf_click(){
		form.action ='./transaksi/akuntansi/pdf_neraca.php';
		form.method = 'post';
		form.submit();			
		return true;
	}
</script>
<?php
if(isset($_REQUEST['Act'])=="CARI"){
	 $bulan	 	= isset($_REQUEST['bulan']) ? $_REQUEST['bulan'] : substr(get_date(),5,2);
	 $tahun     = isset($_REQUEST['tahun']) ? $_REQUEST['tahun'] : substr(get_date(),0,4);
 }else{
	 $bulan 	= substr(get_date(),5,2);
 	 $tahun		= substr(get_date(),0,4);	
}
#Aktiva Lancar	
$t_kasbsr    = get_nr_kas($bulan,$tahun); #Kas Besar	
$t_kaskcl    = 0; #Kas Kecil   
$t_kasbank   = get_nr_bank($bulan,$tahun); #Kas Bank
$t_tracct    = 0; #Transit Account
$t_piutang   = get_nr_piutang(); #Piutang
$t_piutang_empl   = 0; #Piutang
$t_ssewa     = 0; #Sisa Sewa
$t_saldo     = get_nr_perbarang($bulan,$tahun); #Persediaan Barang		   
$t_aktv_lncr = $t_kasbsr+$t_kaskcl+$t_kasbank+$t_tracct+$t_piutang+$t_piutang_empl+$t_ssewa+$t_saldo;

#Kewajiban Lancar
$t_hutdag   = get_nr_hutang(); #Hutang Dagang
$t_hutbia   = 0; #Hutang Biaya
$t_hutbank  = 0; #Hutang Bank
$t_hutdir   = 0; #Hutang Direksi
$t_ump	    = 0; # Uang Muka Penjualan
$t_kew_lncr = $t_hutdag + $t_hutbia + $t_hutbank + $t_hutdir + $t_ump;

#Aktiva Tetap
$t_biu			= get_nr_mpenyusutan(1);
$t_kend			= get_nr_mpenyusutan(2);
$t_perker		= get_nr_mpenyusutan(3);
$t_perkan		= get_nr_mpenyusutan(4);		   
$t_akte		 	= $t_biu + $t_kend + $t_perker + $t_perkan;	
$t_susut		= get_nr_penyusutan();	  
$t_nbakte		= $t_akte - $t_susut; 

#Modal dan Profit
$t_modal    	= get_nr_modal($tahun);
$t_prive	   	= 0;
$t_profyearold 	= 0;
$t_profyear 	= get_nr_thnbrjln($tahun);		   
$t_modprof  	= $t_modal - $t_prive + $t_profyearold + $t_profyear;

#Grand total Aktiva
$gt_aktva = $t_aktv_lncr + $t_nbakte;
$gt_pasva = $t_kew_lncr + $t_modprof;
$selisih  = $gt_aktva - $gt_pasva;
?>
</head>
<body>
<form action="#" method="post" name="form">
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<td colspan="10" align="center"><h1><b>DATA NERACA</b></h1></td>
  </tr>
  <tr>
	<td colspan="10">Tahun :
	     <!--<select id="bulan" name="bulan">
		   <?php
			$bln = array('','Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
			for($n=1; $n<=12; $n++){
			if ($n == $bulan) {
				$cek = " selected";
			} else { $cek=""; }
		   ?>
		   	<option value="<?=$n;?>" <?=$cek;?>><?=$bln[$n];?></option>
		   <?php } ?>
		  </select>-->
		  <input type="text" id="tahun" name="tahun" size="4" value="<?=$tahun;?>">
		  <!--<input type="text" id="fromdate" name="fromdate" size="9" value="<?=$fromdate;?>" style="border-collapse:inherit"  readonly="true">&nbsp;s/d&nbsp;
	      <input type="text" id="todate" name="todate" size="9" value="<?=$todate;?>" style="border-collapse:inheri" readonly="true">-->
	      <input type="button" name="cari" value="CARI" style="cursor:pointer" onclick="search_click();">
		  <input type="button" name="export" value="Export to Excel" style="cursor:pointer" onClick="excel_click();" />
		  <!--<input type="button" name="pdf" value="Export to PDF" style="cursor:pointer" onClick="pdf_click();"/>-->
	</td>		
  </tr>
</table>  
<table id="myTables" class="display" cellpadding="0" cellspacing="0">
  <tr>
    <th width="32%">AKTIVA</th>
    <th width="15%">NILAI</th>
	<th width="6%">&nbsp;</th>
    <th width="32%">PASSIVA</th>
    <th width="15%">NILAI</th>
  </tr>
  <tr>
		<td align="left"><b>AKTIVA LANCAR</b></td>
		<td align="right">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="left"><b>KEWAJIBAN LANCAR</b></td>
		<td align="right">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="left">Kas Besar</td>
		<td align="right"><?=number_format($t_kasbsr,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Hutang Dagang</td>
		<td align="right"><?=number_format($t_hutdag,2,',','.');?></td>
	  </tr>
	  <tr>
		<td align="left">Kas Kecil</td>
		<td align="right"><?=number_format($t_kaskcl,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Hutang Biaya</td>
		<td align="right"><?=number_format($t_hutbia,2,',','.');?></td>
	  </tr>
	  <tr>
		<td align="left">Bank</td>
		<td align="right"><?=number_format($t_kasbank,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Hutang Bank</td>
		<td align="right"><?=number_format($t_hutbank,2,',','.');?></td>
	  </tr>
	  <tr>
		<td align="left">Transit Account</td>
		<td align="right"><?=number_format($t_tracct,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Hutang Direksi</td>
		<td align="right"><?=number_format($t_hutdir,2,',','.');?></td>
	  </tr>
	  <tr>
		<td align="left">Piutang</td>
		<td align="right"><?=number_format($t_piutang,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Uang Muka Penjualan</td>
		<td align="right"><?=number_format($t_ump,2,',','.');?></td>
	  </tr>
	  <tr>
		<td align="left">Piutang Karyawan</td>
		<td align="right"><?=number_format($t_piutang_empl,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="left">Sewa Bayar Di Muka</td>
		<td align="right"><?=number_format($t_ssewa,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="left">Persediaan Barang</td>
		<td align="right"><?=number_format($t_saldo,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr>
	  <tr id="total">
		<td align="left">TOTAL AKTIVA LANCAR</td>
		<td align="right"><?=number_format($t_aktv_lncr,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">TOTAL KEWAJIBAN LANCAR</td>
		<td align="right"><?=number_format($t_kew_lncr,2,',','.');?></td>
	  </tr>	
	   <tr>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr>  
	  <tr>
		<td align="left"><b>AKTIVA TETAP</b></td>
		<td align="right">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="left"><b>MODAL DAN PROFIT</b></td>
		<td align="right">&nbsp;</td>
	  </tr>
	   <tr>
		<td align="left">Bangunan dan Ijin Usaha</td>
		<td align="right"><?=number_format($t_biu,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Modal</td>
		<td align="right"><?=number_format($t_modal,2,',','.');?></td>
	  </tr>
	   <tr>
		<td align="left">Kendaraan</td>
		<td align="right"><?=number_format($t_kend,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Prive</td>
		<td align="right"><?=number_format($t_prive,2,',','.');?></td>
	  </tr>
	   <tr>
		<td align="left">Peralatan Kerja</td>
		<td align="right"><?=number_format($t_perker,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Laba/(Rugi) Tahun Lalu</td>
		<td align="right"><?=number_format($t_profyearold,2,',','.');?></td>
	  </tr>
	   <tr>
		<td align="left">Perlatan Kantor</td>
		<td align="right"><?=number_format($t_perkan,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">Laba/(Rugi) Tahun Berjalan</td>
		<td align="right"><?=number_format($t_profyear,2,',','.');?></td>
	  </tr>
	  <tr id="total">
		<td align="left">Total Aktiva Tetap</td>
		<td align="right"><?=number_format($t_akte,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr>
	   <tr>
		<td align="left">Penyusutan</td>
		<td align="right"><?=number_format($t_susut,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr>
	  <tr id="total">
		<td align="left">NILAI BUKU AKTIVA TETAP</td>
		<td align="right"><?=number_format($t_nbakte,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">TOTAL MODAL & PROFIT</td>
		<td align="right"><?=number_format($t_modprof,2,',','.');?></td>
	  </tr>	
	  <tr>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="left">&nbsp;</td>
		<td align="right">&nbsp;</td>
	  </tr> 
	   <tr id="grand_total">
		<td align="left">GRAND TOTAL AKTIVA</td>
		<td align="right"><?=number_format($gt_aktva,2,',','.');?></td>
		<td align="left">&nbsp;</td>
		<td align="left">GRAND TOTAL PASIVA</td>
		<td align="right"><?=number_format($gt_pasva,2,',','.');?></td>
	  </tr>
	   <tr id="grand_total">
		<td align="left" colspan="4">SELISIH</td>
		<td align="right"><?=number_format($selisih,2,',','.');?></td>
	  </tr>
</table>
</form>
</body>
</html>
