<div style="height:40px;">
	Periode : <input type="text" id="txtperiode_awal_searchst_ak" value="<?php echo date("Y-m-d") ?>" style="width:80px"/> sampai  <input type="text" id="txtperiode_akhir_searchst_ak" value="<?php echo date("Y-m-d") ?>" style="width:80px"/> 
	<button id="btnsearchst_mutasi_ak" >SEARCH</button>
	<button id="btndownloadst_mutasi_ak" >DL DATA</button>
	
</div>
<table id="tbl_data_per_part_ak"></table> <div id="ptbl_data_per_part_ak"></div>
<script type="text/javascript">
    
    $(document).ready(function(){
		var currentDate = new Date(); 
		var datesetopt = {
			showOn: "button",
			buttonImageOnly: true,
			buttonImage: "<?php echo base_url()."assets/images/icons/16x16/timespan.png"  ?>",
			buttonText: "Tanggalan",
			dateFormat: 'yy-mm-dd'
		};
		
		$("#txtperiode_awal_searchst_ak").datepicker(datesetopt);
		$("#txtperiode_akhir_searchst_ak").datepicker(datesetopt); 	
		
		$("#btnsearchst_mutasi_ak").button().click(function(){
		
			var form_data={
				tglawal:$("#txtperiode_awal_searchst_ak").val(), tglakhir:$("#txtperiode_akhir_searchst_ak").val()
			};
			jQuery("#tbl_data_per_part_ak").jqGrid('setGridParam', { postData:form_data });
			$("#tbl_data_per_part_ak").trigger("reloadGrid");
			
		
		});
		
		
		
		$("#btndownloadst_mutasi_ak").button().click(function(){
			document.location.href = '<?php echo base_url().'inventory/ct_stock_transfer/downloadcsvst_inv'; ?>'+'?tglawal='+$("#txtperiode_awal_searchst_ak").val()+'&tglakhir='+$("#txtperiode_akhir_searchst_ak").val()		
		});
		
		
		
		
		jQuery("#tbl_data_per_part_ak").jqGrid({
			url:'<?php echo base_url().'settings/ct_barangmesin/load_laporan_per_part'; ?>',
			mtype : "post",
			postData:{'q':'1',tglawal:$("#txtperiode_awal_searchst_ak").val(), tglakhir:$("#txtperiode_akhir_searchst_ak").val()},
			datatype: "json",
			colNames:['kodebarang', 'namabarang', 'qty_saldoawal', 'qty_in'
					,'qty_out','saldo_akhir'
					,'unit','stock_opname','selisih'],
			colModel:[
				{name:'part_no',index:'part_no', width:139, hidden:false},
				{name:'part_name',index:'part_name', width:139, hidden:false},
				{name:'stock_awal',index:'stock_awal', width:77, hidden:false, align:'right'},
				{name:'qty_in',index:'qty_in', width:77, hidden:false, align:'right'},
				{name:'qty_out',index:'qty_out', width:89, hidden:false, align:'right'},
				{name:'sisa_by_date',index:'sisa_by_date', width:89, hidden:false, align:'right'},
				{name:'unit_in',index:'unit_in', width:89, hidden:false},
				{name:'stock_opname',index:'stock_opname', width:89, hidden:false,align:'right'},
				{name:'selisih',index:'selisih', width:89, hidden:false,align:'right'}
				
			],
			rowNum:30,
			rowList:[30,50,100],
			pager: '#ptbl_data_per_part_ak',
			sortname: 'part_no',
			viewrecords: true,
			sortorder: "asc",
			width: 950,
			height:350,
			jsonReader: { repeatitems : false },
			caption:"DATA MUTASI BAHAN PENOLONG",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},
			onSelectRow: function(id){
				var stret = jQuery("#tbl_data_per_part_ak").jqGrid('getRowData',id);
				
				
			} 
		}); 
		
		jQuery("#tbl_data_per_part_ak").jqGrid('navGrid','#ptbl_data_per_part_ak',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tbl_data_per_part_ak").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		

	});
		  	
</script>



	
	