 <div id="container_fgout_inv" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
	<div class="pane-header ui-state-active" id="fgout_inv_bar" >  
		<button id="btnrprosesfgout">Proses FG Out</button>
		<button id="btnviewfgout">View Detil FG Out</button>
		<button id="btnapprovedfgout">Approved FG Out</button>
	</div>
<table id="tblfgout_hdr"></table> <div id="ptblfgout_hdr"></div>
</div>
 <script type="text/javascript">
    
    $(document).ready(function(){
		$(window).bind('resize', function() {  
			setTimeout(function(){
				setGridHight($("#tblfgout_hdr"),$("#container_fgout_inv"),$("#fgout_inv_bar")); 
			},10); 
		});
		$("#btnviewfgout").button().click(function(){
			var id = jQuery("#tblfgout_hdr").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblfgout_hdr").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};
			
			var form_data ={
				id_data_out_hdr:ret.id_data_out_hdr
			
			};
			$("#frmprosesfgout_dtl__dlg").load('<?php echo base_url().'inventory/ct_fg/view_fg_out_dtl'; ?>', form_data, function() {
				$("#frmprosesfgout_dtl__dlg").dialog({
					modal:true,
					width : 900,
					height : 480,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#frmprosesfgout_dtl__dlg').dialog("destroy"); 
					    $(".frmprosesfgout_dtl__dlg_cl").remove(); 
					    $("body").append('<div id="frmprosesfgout_dtl__dlg" title="Data Detil" class="frmprosesfgout_dtl__dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
			
		});
		
		$("#btnrprosesfgout").button().click(function(){
			var form_data ={
				'a':'a'
			
			};
			$("#frmprosesfgout_dlg").load('<?php echo base_url().'inventory/ct_fg/view_fg_out_proses'; ?>', form_data, function() {
				$("#frmprosesfgout_dlg").dialog({
					modal:true,
					width : 900,
					height : 480,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#frmprosesfgout_dlg').dialog("destroy"); 
					    $(".frmprosesfgout_dlg_cl").remove(); 
					    $("body").append('<div id="frmprosesfgout_dlg" title="Data finish good yang akan di proses" class="frmprosesfgout_dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		});
		$("#btnapprovedfgout").button().click(function(){
			var id = jQuery("#tblfgout_hdr").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblfgout_hdr").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};
			
			var form_data ={
				id_data_out_hdr:ret.id_data_out_hdr,
				doc_out_no:ret.doc_out_no,
				doc_out_to_id:ret.doc_out_to_id
			
			};	
			
			$("#frmprosesfgout_approved__dlg").load('<?php echo base_url().'inventory/ct_fg/view_fg_out_approved'; ?>', form_data, function() {
				$("#frmprosesfgout_approved__dlg").dialog({
					modal:true,
					width : 400,
					height : 220,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#frmprosesfgout_approved__dlg').dialog("destroy"); 
					    $(".frmprosesfgout_approved__dlg_cl").remove(); 
					    $("body").append('<div id="frmprosesfgout_approved__dlg" title="Data finish good approved" class="frmprosesfgout_approved__dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
			
			
			
		});
		
		jQuery("#tblfgout_hdr").jqGrid({
			url:'<?php echo base_url().'inventory/ct_fg/loaddata_fg_out'; ?>',
			mtype : "post",
			postData:{'q':'1'},
			datatype: "json",
			colNames:['id_data_out_hdr', 'doc out no','doc out date', 'id_data_out_hdr_h_status','id_terkait','approved date', 'status', 'Type Out'],
			colModel:[
				{name:'id_data_out_hdr',index:'id', width:60, hidden:true},
				{name:'doc_out_no',index:'doc_out_no', width:120},
				{name:'doc_out_date',index:'doc_out_date', width:120,searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'id_data_out_hdr_h_status',index:'id_data_out_hdr_h_status', width:84,hidden:true},
				{name:'id_terkait',index:'id_terkait', width:84, hidden:true},
				{name:'approve_date',index:'approve_date', width:120,searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'status',index:'status', width:247},
				{name:'doc_out_to_id',index:'doc_out_to_id', width:62, hidden:false,stype:"select",searchoptions:{value:":ALL;2:BC30;3:BC25;4:BC41;5:BC27"}},
				
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblfgout_hdr',
			sortname: 'tbl_data_out_hdr.id_data_out_hdr',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"Data Stock Transfer",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},
			gridComplete: function(){
				var rowIDs = jQuery("#tblfgout_hdr").getDataIDs(); 
				var rowData = $("#tblfgout_hdr").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblfgout_hdr'));
					switch (rowData[i].status) {
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						
						case 'OUT INVENTORY CANCELED':
						   trElement.css({"color":"green"});
						break;
						
						case 'DATA OUT INVENTORY':
						   trElement.css({"color":"purple"});
						break;
						case 'DATA PROCESSED INVENTORY':
						   trElement.css({"color":"blue"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblfgout_hdr").jqGrid('navGrid','#ptblfgout_hdr',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblfgout_hdr").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});

		setTimeout(function(){
			setGridHight($("#tblfgout_hdr"),$("#container_fgout_inv"),$("#fgout_inv_bar")); 
		},10); 

	});
		  	
</script>

<div id="frmprosesfgout_dlg" title="Data finish good yang akan di proses" class="frmprosesfgout_dlg_cl"></div>
<div id="frmprosesfgout_dtl__dlg" title="Data Detil" class="frmprosesfgout_dtl__dlg_cl"></div>
<div id="frmprosesfgout_approved__dlg" title="Data finish good approved" class="frmprosesfgout_approved__dlg_cl"></div>

	
	