<!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 () {
		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-Closing-Acct&Act=SEARCH';
		form.method = 'post';
		form.submit();		
		return true;
	}
	function add_click(){
		form.action ='?page=Proses-Closing-Acct&Act=ADD';
		form.method = 'post';
		form.submit();		
		return true;
	}
	function addp_click(){
		form.action ='?page=Proses-Closing-Acct&Act=ADDP';
		form.method = 'post';
		form.submit();		
		return true;
	}
</script>
<?php
	$smonth 	 = isset($_REQUEST['smonth']) ? $_REQUEST['smonth'] :substr(get_date(),5,2);
	$syear		 = isset($_REQUEST['syear']) ? $_REQUEST['syear'] :substr(get_date(),0,4);
	if($smonth==12){$smonths='01'; $syears=$syear+1;}else{$smonths=$smonth+1; $syears=$syear;}
?>
<form method="post" name="form" enctype="multipart/form-data">
<table width="100%">
	<tr>
		<th colspan="5">DATA CLOSING AKUNTANSI</th>
	</tr>
	<tr>
		<td colspan="5">&nbsp;</td>		
	</tr>
	<tr>
		<td colspan="5">
			<img src="images/btn_add.png" height="30" width="30" title="Tambah Manual" border="0" style="cursor:pointer" onclick="add_click();" />
			<img src="images/btn_add.png" height="30" width="30" title="Periode Aktif" border="0" style="cursor:pointer" onclick="addp_click();" />			
		</td>		
	</tr>
	<tr>
		<td colspan="5">
			Bulan 
			<select name="smonth">
			   <?php
				$bln = array('','Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
				for($n=1; $n<=12; $n++){
				if ($n == $smonth) {
					$cek = " selected";
				} else { $cek=""; }
			   ?>
				<option value="<?=$n;?>" <?=$cek;?>><?=$bln[$n];?></option>
			   <?php } ?>
		  </select>
		  <input type="text" name="syear" size="4" value="<?=$syear;?>">
		  <input type="button" value="CARI" style="cursor:pointer" onClick="search_click();"/>
		</td>		
	</tr>
</table>
<table id="myTables" class="display" cellpadding="0" cellspacing="0">
	<thead>	
	<tr>
		<th>No.</th>
		<th>No GL</th>
		<th>Nama GL</th>
		<th>Currency</th>
		<th>Saldo Non IDR</th>
		<th>Saldo IDR</th>
	</tr>
	</thead>
	<tbody>
     <?php		
	 	$no=0;
		$qh = mysql_query("SELECT a.*, b.* FROM stock_acct a INNER JOIN jurnal_master b ON b.j_acctno=a.sa_acctno
			  WHERE a.sa_status=10 AND MONTH(a.sa_date)='$smonths' AND YEAR(a.sa_date)='$syears' ORDER BY b.j_acctno ASC");
		while($dh=mysql_fetch_object($qh)){		
			$no++;
	?> 
    <tr>
    	<td align="center"><?=$no;?>.</td>
        <td align="left"><?=$dh->j_acctno;?></td>
		<td align="left"><?=$dh->j_name1;?></td>
		<td align="center"><?=$dh->sa_currency;?></td>
        <td align="right"><?=number_format($dh->sa_price_usd,2,'.',',');?></td>
		<td align="right"><?=number_format($dh->sa_price,2,'.',',');?></td>
    </tr>
		<?php } ?>
	 </tbody>
</table>
</form>