<!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" :25
		});
	});
	function setTrColor(obj, color)
	{
		obj.style.backgroundColor=color;
		obj.onmouseout = function(){
				obj.style.backgroundColor=''; 
		}
	}
	function view_click(){
		form.action ='?page=Proses-Closing-Acct&Act=VIEW';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function save_click(){
		form.action ='?page=Proses-Closing-Acct&Act=SAVE';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function savep_click(){
		form.action ='?page=Proses-Closing-Acct&Act=SAVEP';
		form.method = 'post';
		form.submit();			
		return true;
	}
	function close_click(){
		form.action ='?page=Proses-Closing-Acct&Act=CLOSE';
		form.method = 'post';
		form.submit();			
		return true;
	}
</script>
</head>
<body>
<form action="#" method="post" name="form">
<?php if($Act=="ADD" || $Act=="VIEW"){ ?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<td colspan="12" align="center"><h1><b>PROSES CLOSING AKUNTANSI</b></h1></td>
  </tr>
  <tr>
	<td colspan="12">Periode :
	     <!--<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="view" value="LIHAT" style="cursor:pointer" onclick="view_click();">
		  <input type="button" name="save" value="SIMPAN" style="cursor:pointer" onclick="save_click();">
		  <input type="button" name="close" value="TUTUP" style="cursor:pointer" onClick="close_click();" />
	</td>		
  </tr>
</table> 
<?php }elseif($Act=="ADDP"){ ?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<td colspan="12" align="center"><h1><b>PERIODE AKTIF</b></h1></td>
  </tr>
  <tr>
	<td colspan="12">Tahun :
		  <?php
		  	$thn = mysql_fetch_array(mysql_query("select p_tahun from periode where p_status=90"));
		  ?>
	      <input type="text" name="p_tahun" size="4" value="<?=$thn['p_tahun'];?>">		 
		  <input type="button" name="save" value="SIMPAN" style="cursor:pointer" onclick="savep_click();">
		  <input type="button" name="close" value="TUTUP" style="cursor:pointer" onClick="close_click();" />
	</td>		
  </tr>
</table>   
<?php }if($Act=="VIEW"){ ?>
<table id="myTables" class="display" cellpadding="0" cellspacing="0">
	<thead>
	<tr>
		<th>No.</th>
		<th>No COA</th>
		<th>Nama COA</th>
		<th>Saldo Non IDR</th>
		<th>Saldo IDR</th>
	</tr>
	</thead>
	<tbody>
     <?php		
	 	$no=1;
		$qh = mysql_query("SELECT * FROM jurnal_master WHERE j_pclosing='Y' AND j_status=10 ORDER BY j_acctno ASC");
		while($dh=mysql_fetch_object($qh)){	
			$lastmonth1   = get_nr_lastmonth($fromdate,$todate,$dh->j_acctno);
			$curmonth1    = get_nr_curmonth($fromdate,$todate,$dh->j_acctno);
			$curyear1     = $lastmonth1+$curmonth1;
			
			$lastmonth1_usd   = get_nr_lastmonth_usd($fromdate,$todate,$dh->j_acctno);
			$curmonth1_usd    = get_nr_curmonth_usd($fromdate,$todate,$dh->j_acctno);
			$curyear1_usd     = $lastmonth1_usd+$curmonth1_usd;
		?> 	
    <tr>
    	<td align="center"><?=$no;?>.
			<input type="hidden" name="pilih[<?=$no;?>]" value="<?=$no;?>">
			<input type="hidden" name="j_acctno[<?=$no;?>]" value="<?=$dh->j_acctno;?>">
			<input type="hidden" name="sa_price[<?=$no;?>]" value="<?=$curyear1;?>">
			<input type="hidden" name="sa_price_usd[<?=$no;?>]" value="<?=$curyear1_usd;?>">
		</td>
        <td align="left"><?=$dh->j_acctno;?></td>
		<td align="left"><?=$dh->j_name1;?></td>
		<td align="right"><?=number_format($curyear1_usd,2,'.',',');?></td>
		<td align="right"><?=number_format($curyear1,2,'.',',');?></td>
    </tr>
	<?php $no++; } ?>	
	</tbody>
</table>
<?php } ?>
</form>
</body>
</html>
