<!---- 
    Author 	: Wahyu
    Tanggal : 06-08-2014	
    Revisi 	:
-->
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'north',border:false" style="height:30px">
		<div style="padding:2px">
			<a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-reload'" onclick="$('#t_account_balance').datagrid('reload',{})">Refresh</a>
			<a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-print'" onClick="parent.tab_add('Print Account Balance', '<?php echo"list/account_balance"; ?>', 'icon-bank', 'to_preview')">Print preview</a>
		</div>
	</div>	
	<div data-options="region:'west',split:true,border:true" title="Filter"style="width:190px; background-color:#CCCCFF;">
			<div style="padding:5px">
				<form class="form-filter">
                <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td style="padding-bottom:8px;">
                        <b>Find</b>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="txt_IDNumber" name="txt_IDNumber"  placeholder="< Account Number >" style="margin:2px 0px 3px;width:172px;height:22px;border:1px solid #CCC">
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="txt_Description" name="txt_Description"  placeholder="< Account Name >" style="margin:2px 0px 3px;width:172px;height:22px;border:1px solid #CCC">
                    </td>
                </tr>
                <tr><td><div class="tr-divider"></div></td></tr>
                 <tr>
                    <td width="283" align="left" colspan="2" style="padding-bottom:8px;">
                        <b>Account Type</b>
                    </td>
                </tr>

                <tr>
                    <td width="283" align="left" colspan="2">
                        <select class="easyui-combogrid" name="account_type" id="account_type" style="width:175px;height:24px;" 
                            data-options="
                                panelWidth:270,
                                idField:'AccountSubTypeID',
                                textField:'AccountTypeName',
                                url:'<?php echo base_url(); ?>custom/get_data/accountsubtype_with_bsstatus',
                                columns:[[
                                    {field:'AccountTypeName',title:'Account Type Name',width:250}
                                ]]
                            ">
                        </select>
                    </td>
                </tr>
                
				<tr><td><div class="tr-divider"></div></td></tr>
				
				
				
				
				
				<!--copy dari sini untuk button reset dan search-->
				<tr>
					<td height="38"><div style="float:right;"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onClick="location.reload();" >Reset</a> <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onClick="searching_data();" >Search</a></div></td>
				</tr>
				<!--end-------------------------->
                </table>
                </form>
			</div>
		</div>	
	<div data-options="region:'center',border:true,iconCls:'icon-ok'">
        <table id="grid" class="easyui-datagrid" 
        	title="" iconCls="icon-edit" 
            singleSelect="true" rowNumbers="true" 
            pageSize="150" 
            fitColumns="true" remoteSort="false" 
            url="<?=base_url('list/account_balance/get_akun')?>" 
            style="width:auto;height:560px" 
            data-options = "border:false,view:scrollview,autoRowheight:false"
        >
            <thead>
            <tr>
             
                <th field="AccountNumber" 	halign="center" align="left" sortable="true" rowspan="2" width="220" hidden>Acoount Number</th>	
                <th field="BranchCode" 	halign="center" align="left" sortable="true" rowspan="2" width="220" hidden>Acoount Number</th>	
                <th field="BranchName" 	halign="center" align="left" sortable="true" rowspan="2" width="220" hidden>Acoount Number</th>	
                <th field="AccountName" 	formatter="format_acc" halign="center" align="left" sortable="true" rowspan="2" width="220" >Acoount Name</th>				
                <!--<th field="Year" 			halign="center" align="center" sortable="true">Year</th>-->
                <th field="GLSaldoActual" 	halign="center" align="right" sortable="true" formatter="formatRp" rowspan="2">Opng. Balance</th>
                <th field="GLSaldoBSheet" 	halign="center" align="right" sortable="true" formatter="formatRp" rowspan="2">Blnc. Sheet</th>
                <th colspan="12">Periode</th>
            </tr>
            <tr>   
               
                <th field="GLSaldoBalance1" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80">1</th>				
                <th field="GLSaldoBalance2" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 2</th>
                <th field="GLSaldoBalance3" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 3</th>
                <th field="GLSaldoBalance4" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 4</th>
                <th field="GLSaldoBalance5" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 5</th>	
                <th field="GLSaldoBalance6" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 6</th>	
                <th field="GLSaldoBalance7" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 7</th>
                <th field="GLSaldoBalance8" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 8</th>
                <th field="GLSaldoBalance9" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 9</th>
                <th field="GLSaldoBalance10" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 10</th>
                <th field="GLSaldoBalance11" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 11</th>	
                <th field="GLSaldoBalance12" halign="center" align="right" sortable="true" formatter="formatRp_bank" width="80"> 12</th>												
            </tr>
            </thead>
        </table>   		
        
	</div>
</div>	
<script type="text/javascript">
/*
	jangan lupa ini ditaro dibawah di setaip list untuk search
	taro di luar documen ready jangan didalam doc ready
	jangan lupa hapus fungsi on key up di setiap find
	jangan lupa cek id gridnya
	ini contoh untuk master by company
	created by : fachri 
*/
$(document).ready(function(){
	$('#grid').datagrid({
            onDblClickRow:function(rowIndex, rowData){
                CompanyCode = '<?=$this->session->userdata('branch')?>';
                //if(status_privelage_edit == 1){
					if(CompanyCode.indexOf('HO') !== -1){				  
						parent.tab_edit('Edit Account', 'list/coa', 'icon-edit', 'edit', rowData.AccountNumber + '_' + rowData.BranchCode + '_' + rowData.BranchName);
					}
				//}
            }
	});
	
	grid_navigation('Balance','list/coa');
});

function searching_data(){
	searchParameter = {};
	/*
		disini masing masing form list berbeda cek find diatas bisa by name by code
	*/
	searchParameter['txt_IDNumber'] = $('#txt_IDNumber').val();
	searchParameter['txt_Description'] = $('#txt_Description').val();
	//-----------------end--------------------------------------------------------
	
	/*
		disini hanya ada dua search, pakai company atau branch
	*/
	searchParameter['account_type'] = $('#account_type').combobox('getValue');
	
	$('#grid').datagrid('load',{
		param: searchParameter
	});
			
}
//------------------end--------------------------------------

//Fungsi untuk tampilan menjorok
function format_acc(val,row){
return '<span style="padding-left:'+row.AccountLevel+'em;">'+val+'</span>';	
}
</script>