<div id="balance_sheet_wh" style="height:95%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
	<div class="pane-header ui-state-active" id="balance_sheet_wh_bar" >   
		PERIODE: <select id="balance_sheet_wh_month_periode" style="height:20px" >
						<option value="">-</option>
						<option value="01">JAN</option>
						<option value="02">FEB</option>
						<option value="03">MAR</option>
						<option value="04">APR</option>
						<option value="05">MEI</option>
						<option value="06">JUN</option>
						<option value="07">JUL</option>
						<option value="08">AGS</option>
						<option value="09">SEP</option>
						<option value="10">OKT</option>
						<option value="11">NOV</option>
						<option value="12">DES</option>
					</select>
					<select id="balance_sheet_wh_year_periode" style="height:20px" >
						<?php   
							for($index=date('Y');$index > date('Y')-10;$index-=1) {	
						?>
							<option value="<?php echo $index;  ?>"><?php echo $index;  ?></option>
						
						<?php
							}
						?>
					</select>
		<button type="button" id="search_balance_sheet_wh_periode">Search</button> 
		<button type="button" id="xl_balance_sheet_wh_periode">EXCEL</button> 
		<button type="button" id="xl_balance_sheet_wh_periode_data">DATA XLS</button> 
	</div>
	<div id="div_balance_sheet_wh_periode" ></div>
	<table id="tblv_acc_bs_pl"></table> <div id="ptblv_acc_bs_pl"></div> 
</div> 

<script type="text/javascript">
	$(document).ready(function(){
		setTimeout(function(){
				setGridHight($("#tblv_acc_bs_pl"),$("#balance_sheet_wh"),$("#balance_sheet_wh_bar")); 
			},10); 
		$(window).bind('resize', function() {  
			setTimeout(function(){
				setGridHight($("#tblv_acc_bs_pl"),$("#balance_sheet_wh"),$("#balance_sheet_wh_bar")); 
			},10); 
		});
		
		
		$("#search_balance_sheet_wh_periode").button().click(function(){
			
			var form_data = {
				periode:$("#balance_sheet_wh_year_periode").val()+$("#balance_sheet_wh_month_periode").val()
			};
			jQuery("#tblv_acc_bs_pl").jqGrid('setGridParam', { postData:form_data });
			$('#tblv_acc_bs_pl').trigger('reloadGrid');
			
			
			/*  var form_data = {
				filename:'balance_sheet_wh.xls',
				
			 };
			 $.ajax({
				url: "<?php echo base_url().'accounting_report/ct_accounting_report/balance_sheet_view_xls'; ?>",
				type: "POST",
				data: form_data,
				success:function(result){
					$("#div_balance_sheet_wh_periode").html(result);
				 }
				
			}); */
			
		});
		
		jQuery("#tblv_acc_bs_pl").jqGrid({
			url:'<?php echo base_url().'accounting_report/ct_accounting_report/data_v_acc_bs_pl'; ?>',
			mtype : "post",
			postData:{'q':'1'},
			datatype: "json",
			colNames:
			[
			'id_bs_pl', 
			'GL ACC',
			'GL NAME', 
			'PERIOD',
			'AMOUNT'
			, 'section1'
			,'section2'
			,'group1'
			,'group2'
			
			
			
			],
			colModel:[
				{name:'id_bs_pl',index:'id_bs_pl', width:60, hidden:true},
				{name:'GL_ACC',index:'GL_ACC', width:120},
				{name:'GL_NAME',index:'GL_NAME', width:200},
				{name:'PERIOD',index:'PERIOD', width:70, hidden:false},
				{name:'AMOUNT',index:'AMOUNT', width:150,hidden:false, align:'right', formatter:'number'},
				{name:'section1',index:'section1', width:120,hidden:false, summaryType:'sum'},
				{name:'section2',index:'section2', width:150,hidden:false},
				{name:'target_group1',index:'target_group1', width:150,hidden:false},
				{name:'target_group2',index:'target_group2', width:150,hidden:false},
				
				],
			rowNum:20,
			rowList:[20,50,100],
			pager: '#ptblv_acc_bs_pl',
			sortname: 'GL_ACC',
			viewrecords: true,
			sortorder: "asc",
			width: '',
			height:300,
			jsonReader: { repeatitems : false },
			caption:"Data Balance Sheet",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblv_acc_bs_pl").getDataIDs(); 
				var rowData = $("#tblv_acc_bs_pl").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblv_acc_bs_pl'));
				   
					switch (rowData[i].status_data) {
						
						case 'PROSESEXIM':
						   trElement.css({"color":"green"});
						break;
						case 'PROCESSEDBC':
						   trElement.css({"color":"blue"});
						break;
						
						
					}
				}
			},
			
			footerrow: true, // set a footer row
			userDataOnFooter: true,
		}); 
			
                        
		jQuery("#tblv_acc_bs_pl").jqGrid('navGrid','#ptblv_acc_bs_pl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblv_acc_bs_pl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		$("#xl_balance_sheet_wh_periode").button().click(function(){
			
			//alert($("#balance_sheet_wh_year_periode").val() + $("#balance_sheet_wh_month_periode").val() );
			document.location.href = '<?php echo base_url().'accounting_report/ct_accounting_report/bs_excel'; ?>'+'?periode='+$("#balance_sheet_wh_year_periode").val()+$("#balance_sheet_wh_month_periode").val()
		
		});
		
		$("#xl_balance_sheet_wh_periode_data").button().click(function(){
			
			//alert($("#balance_sheet_wh_year_periode").val() + $("#balance_sheet_wh_month_periode").val() );
			document.location.href = '<?php echo base_url().'accounting_report/ct_accounting_report/bs_excel_data'; ?>'+'?periode='+$("#balance_sheet_wh_year_periode").val()+$("#balance_sheet_wh_month_periode").val()
		
		});
	
	
	});
</script>
	