<div id="container_pabean_bc41out" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
	<div class="pane-header ui-state-active" id="pabean_bc41out_bar" >   
 
	<label style="margin-right:10px;">PERIODE:</label>
			
			<select id="periode41out" name="periode41out">
			<?php
				$year = date("Y");
				$month = date("m");
				
				$bulan = array('1'=> 'Januari'
								, '2' => 'Febuari'
								, '3' => 'Maret'
								, '4' => 'April'
								, '5' => 'Mei'
								, '6' => 'Juni'
								, '7' => 'Juli'
								, '8' => 'Agustus'
								, '9' => 'September'
								, '10' => 'Oktober'
								, '11' => 'November'
								, '12' => 'Desember'
							);
							
				for($i=$year;$i>=($year-3);$i--){
					if($year != $i) {
						$month = 12;
					}
					
					for($x=$month;$x>=1;$x--){
						echo "<option value='".$i."_".$x."'>".$bulan[$x]." ".$i."</option>";
					}
				}
			?>
			</select>	
		 <button id="btnSearchpabean_bc41out" >SEARCH</button>
	
			 <button id="btnPrintpabean_bc41outXLXS" >PRINT XLSX</button>  
	</div>
	 <table id="tblpabean_bc41out"  /><div id="ptblpabean_bc41out"/> 
</div> 

<script> 
  $(document).ready(function(){ 
	$(window).bind('resize', function() {   
		 setTimeout(function(){
		 setGridHight($("#tblpabean_bc41out"),$("#container_pabean_bc41out"),$("#pabean_bc41out_bar")); 
  		},10); 
	}) ;
	
	$("#btnSearchpabean_bc41out").button();

	$("#btnPrintpabean_bc41outXLXS").button(); 
  
  

	 
	$("#btnSearchpabean_bc41out").click(function(){ 
		var	start_date 	=	$.datepicker.formatDate('yymmdd', new Date($("#txtStartpabean_bc41out").val())) ;
		var end_date	=	$.datepicker.formatDate('yymmdd', new Date($("#txtEndpabean_bc41out").val())) ; 
		var periode = $("#periode41out").val();
		var typebc = '41';
		jQuery("#tblpabean_bc41out").jqGrid('setGridParam', { postData: {periode : periode,typebc : typebc} });
		$('#tblpabean_bc41out').trigger( 'reloadGrid' );
	});
	
	function reportPrint(format){
		var	start_date 	=	$.datepicker.formatDate('yymmdd', new Date($("#txtStartpabean_bc41out").val())) ;
		var end_date	=	$.datepicker.formatDate('yymmdd', new Date($("#txtEndpabean_bc41out").val())) ;
 		var mypostdata = $('#tblpabean_bc41out').getGridParam("postData").filters;
 		var tipe_bc='';
		if(mypostdata){ 
			pabean_tipe_bc = JSON.parse(mypostdata);  
			 if (pabean_tipe_bc['rules'].length>0){
					pabean_tipe_bc['rules'].forEach(function(entry) { 
						 if (entry.field=='r1');
							tipe_bc	=entry.data 
					}); 
			 }
		}
		
		var dialog = jQuery('<div />')
					 .html('<div class="ui-layout-content ui-widget-content-panel">\
									<p >Are u want to print report?</p>\
								   </div>\
									<div class="pane-footer ui-state-default"></div>\
									<form hidden id="frmPrintPabeanOut" method="POST" action="<?php echo base_url().'reports_pabean/CT_pabean_load/xls_pabean_bc41out'; ?>"/>');  
		dialog.dialog({
				modal:true,
				width : 300,
				height : 150,
				title :'Buku Catatan Pabean BC41 Out',
				buttons: { 
					"CLOSE": function(){
						dialog.dialog("close");  
					},
					"PRINT": function() { 
					
					$("#frmPrintPabeanOut").append($("<input>").attr({"value":start_date , "name":'start_date'})); 
					$("#frmPrintPabeanOut").append($("<input>").attr({"value":end_date , "name":'end_date'})); 
					$("#frmPrintPabeanOut").append($("<input>").attr({"value":format , "name":'format'})); 
					$("#frmPrintPabeanOut").append($("<input>").attr({"value":tipe_bc , "name":'tipe_bc'})); 
 					$("#frmPrintPabeanOut").append($("<input>").attr({"value":'machine' , "name":'bc_type'})); 
					$("#frmPrintPabeanOut").append($("<input>").attr({"value":'aw' , "name":'source'})); 
 					$("#frmPrintPabeanOut").submit();  
					
					dialog.dialog("close");  
					}
				},
				close : function(){
					dialog.dialog('destroy').remove(); 
				},
				open: function(){
					$("body").unblock(); 
				}
			}); 
	
	} 

	$("#btnPrintpabean_bc41outPDF").button().click(function(){	
		reportPrint('pdf');
 	})	
 	$("#btnPrintpabean_bc41outXLX").button().click(function(){	
		reportPrint('xls');
 	})	
 	$("#btnPrintpabean_bc41outXLXS").button().click(function(){	
		reportPrint('xlsx');
 	})	
	var arr = <?php echo json_encode($rID); ?>;
	var pabean_out_invoice = ((arr.indexOf("3111")==-1) ? '0' : '1');
	jQuery("#tblpabean_bc41out").jqGrid({
	   url:'<?php echo base_url().'reports_pabean/ct_pabean_data/loaddata_bcout'; ?>',
		mtype : "post",
		postData:{'q':'1'},
		datatype: "json",
		colNames:['ID','NOMOR AJU','NOMOR', 'TANGGAL', 'JENIS','JUMLAH', 'JENIS BARANG', 'SATUAN', 'JUMLAH','BERSIH','KOTOR','JUMLAH DEVISA IMPORT','VAL','DEVISA','TANGGAL','JAM','PELABUHAN BONGKAR','KETERANGAN'],
		colModel:[
			{name:'rID',index:'rID', width:100, hidden:true},
			// {name:'r1',index:'r1', width:50},
			{name:'r1',index:'r1', width:230},  
			{name:'r2',index:'r2', width:120}, 
			{name:'r3',index:'r3', width:120},  
			{name:'r4',index:'r4', width:120},  
			{name:'r5',index:'r5', width:120},
			{name:'r6',index:'r6', width:80},
			{name:'r7',index:'r7', width:70},
			{name:'r8',index:'r8', width:100},
			{name:'r9',index:'r9', width:100},
			{name:'r10',index:'r10', width:100},
			{name:'r11',index:'r11', width:100},
			{name:'r12',index:'r12', width:100},
			{name:'r13',index:'r13', width:100},
			{name:'r14',index:'r14', width:100},
			{name:'r15',index:'r15', width:100},
			{name:'r16',index:'r16', width:100},
			{name:'r17',index:'r17', width:100},
		   
		],
		rowNum:10,
		rowList:[10,20,30],
		pager: '#ptblpabean_bc41out',
		sortname: 'r5',
	 	sortorder: "asc",
		shrinkToFit:false,
		autowidth: false,           
		width: '',
		height: 100,
 		rownumbers:true, 
		jsonReader: { repeatitems : false }, 
		viewrecords : true, 
		gridview:true
	}); 
	$("#tblpabean_bc41out").jqGrid("setColProp", "rn", {hidedlg: false});
	
	jQuery("#tblpabean_bc41out").jqGrid('setGroupHeaders', 
		{ useColSpanStyle: true, groupHeaders:[
			{startColumnName: 'r2', numberOfColumns: 2, titleText: '<em><center>NOMOR PENDAFTARAN</center></em>'}
		, {startColumnName: 'r4', numberOfColumns: 2, titleText: '<em><center>KEMASAN</center></em>'}
		, {startColumnName: 'r9', numberOfColumns: 2, titleText: '<em><center>BERAT</center></em>'}
		, {startColumnName: 'r12', numberOfColumns: 2, titleText: '<em><center>DEVISA VALUTA</center></em>'}
		, {startColumnName: 'r14', numberOfColumns: 2, titleText: '<em><center>SELESAI MASUK</center></em>'}

	] });
 
	jQuery("#tblpabean_bc41out").jqGrid('navGrid','#ptblpabean_bc41out',{edit:false,add:false,del:false,view:false, search: false});  
	jQuery("#tblpabean_bc41out").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch: 'cn', ignoreCase: false});  
	
 		 setTimeout(function(){
		 setGridHight($("#tblpabean_bc41out"),$("#container_pabean_bc41out"),$("#pabean_bc41out_bar")); 
  		},10); 
	 
	
	
});

</script> 

  