<div id="tabfinishgood_stockopname_c" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
	<div id="tabfinishgood_stockopname" style="height:100%;margin:0px; padding:0px;">
		<ul> 
			<li><a id="tab_rm_stockopname" href="#div_rm_stockopname">RAW MATERIAL</a></li>
			<li><a id="tab_fg_stockopname" href="#div_fg_stockopname">ASSY</a></li>
			<li><a id="tab_scrap_stockopname" href="#div_scrap_stockopname">SISA DAN SCRAP</a></li>
			<li><a id="tab_mpk_stockopname" href="#div_mpk_stockopname">MESIN DAN ALAT KANTOR</a></li>
		</ul>
		<div id="div_rm_stockopname" >
			<div class="pane-header ui-state-active" id="div_rm_stockopname_bar" >    
				<button id="btnprosesrm_sto">Proses PART Stock Opname</button>
				<?php if($this->session->userdata('DX_username') == 'admin' || $this->session->userdata('DX_username') == 'yayan' || $this->session->userdata('DX_username') == 'ojah' || $this->session->userdata('DX_username') == 'gyt' || $this->session->userdata('DX_username') == 'tri'){ ?>
					<button id="btndeletesto_part">DEL </button>
				<?php }; ?>	
			</div>
			<table id="tblrm_sto"></table> <div id="ptblrm_sto"></div>
		</div>
		<div id="div_fg_stockopname" >
			<div class="pane-header ui-state-active" id="div_fg_stockopname_bar" >    
				<button id="btnprosesassy_sto">Proses ASSY Stock Opname</button>
				<?php if($this->session->userdata('DX_username') == 'admin' || $this->session->userdata('DX_username') == 'yayan' || $this->session->userdata('DX_username') == 'ojah' || $this->session->userdata('DX_username') == 'gyt' || $this->session->userdata('DX_username') == 'tri'){ ?>
					<button id="btndeletesto_assy">DEL </button>
				<?php }; ?>	
			</div>
			<table id="tblassy_sto"></table> <div id="ptblassy_sto"></div>
			
		</div>
		<div id="div_scrap_stockopname" >
			<div class="pane-header ui-state-active" id="div_scrap_stockopname_bar" >    
				<button id="btnprosesscrap_sto">Proses SISA dan SCRAP Stock Opname</button>
				<?php if($this->session->userdata('DX_username') == 'admin' || $this->session->userdata('DX_username') == 'yayan' || $this->session->userdata('DX_username') == 'ojah' || $this->session->userdata('DX_username') == 'gyt' || $this->session->userdata('DX_username') == 'tri'){ ?>
					<button id="btndeletesto_scrap">DEL </button>
				<?php }; ?>	
			</div>
			<table id="tblss_sto"></table> <div id="ptblss_sto"></div>
			
		</div>
		<div id="div_mpk_stockopname" >
			<div class="pane-header ui-state-active" id="div_mpk_stockopname_bar" >    
				<button id="btnprosesmpk_sto">Proses Mesin dan Alat Kantor Stock Opname</button>
				<?php if($this->session->userdata('DX_username') == 'admin' || $this->session->userdata('DX_username') == 'yayan' || $this->session->userdata('DX_username') == 'ojah' || $this->session->userdata('DX_username') == 'gyt' || $this->session->userdata('DX_username') == 'tri'){ ?>
					<button id="btndeletesto_mpk">DEL </button>
				<?php }; ?>	
			</div>
			<table id="tblmpk_sto"></table> <div id="ptblmpk_sto"></div>
		</div>
	</div>
</div>
<script type="text/javascript">
    
    $(document).ready(function(){ 
		var tabfinishgood_stockopname_active_tab=0;
		$("#tabfinishgood_stockopname" ).tabs({                                                                  
            select:function(event,ui){    
			
				tabfinishgood_stockopname_active_tab=ui.index;   
				
		 		if (tabfinishgood_stockopname_active_tab==0){
					jQuery("#tblrm_sto").jqGrid('setGridParam', { 'typebahanx':function () { return 'RM' } });
					jQuery("#tblrm_sto").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblrm_sto"),$("#tabfinishgood_stockopname"),$("#div_rm_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},20); 
				}else if (tabfinishgood_stockopname_active_tab==1){
					jQuery("#tblassy_sto").jqGrid('setGridParam', { 'typebahanx':function () { return 'FG' } });
					jQuery("#tblassy_sto").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblassy_sto"),$("#tabfinishgood_stockopname"),$("#div_fg_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},20); 
				}else if (tabfinishgood_stockopname_active_tab==2){
					jQuery("#tblss_sto").jqGrid('setGridParam', { 'typebahanx':function () { return 'SS' } });
					jQuery("#tblss_sto").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblss_sto"),$("#tabfinishgood_stockopname"),$("#div_scrap_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},20); 
				}else if (tabfinishgood_stockopname_active_tab==3){
					jQuery("#tblmpk_sto").jqGrid('setGridParam', { 'typebahanx':function () { return 'MPK' } });
					jQuery("#tblmpk_sto").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblmpk_sto"),$("#tabfinishgood_stockopname"),$("#div_mpk_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},20); 
				}
			}                                                                          
         });   		
			 
			 
		$(window).bind('resize', function() {  
				if (tabfinishgood_stockopname_active_tab==0){
					setTimeout(function(){
						setGridHight($("#tblrm_sto"),$("#tabfinishgood_stockopname"),$("#div_rm_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},100); 
				}else if (tabfinishgood_stockopname_active_tab==1){
					setTimeout(function(){
						setGridHight($("#tblassy_sto"),$("#tabfinishgood_stockopname"),$("#div_fg_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},100); 
				}else if (tabfinishgood_stockopname_active_tab==2){
					setTimeout(function(){
						setGridHight($("#tblss_sto"),$("#tabfinishgood_stockopname"),$("#div_scrap_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},100); 
				}else if (tabfinishgood_stockopname_active_tab==3){
					setTimeout(function(){
						setGridHight($("#tblmpk_sto"),$("#tabfinishgood_stockopname"),$("#div_mpk_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
					},100); 
				}
		});
		  
		
		$("#btnprosesrm_sto").button().click(function(){
		
			$("#viewbahanbakustockopnamedlg").load('<?php echo base_url().'inventory/ct_stockopname/view_stockopname_bahanbaku'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewbahanbakustockopnamedlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewbahanbakustockopnamedlg').dialog("destroy"); 
					    $(".viewbahanbakustockopnamedlg_cl").remove(); 
					    $("body").append('<div id="viewbahanbakustockopnamedlg" title="STOCK OPNAME RAW MATERIAL" class="viewbahanbakustockopnamedlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		
		});
		$("#btnprosesassy_sto").button().click(function(){
			$("#viewfinishgoodstockopnamedlg").load('<?php echo base_url().'inventory/ct_stockopname/view_stockopname_finishgood'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewfinishgoodstockopnamedlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewfinishgoodstockopnamedlg').dialog("destroy"); 
					    $(".viewfinishgoodstockopnamedlg_cl").remove(); 
					    $("body").append('<div id="viewfinishgoodstockopnamedlg" title="STOCK OPNAME FINISH GOOD" class="viewfinishgoodstockopnamedlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
			
		
		});
		$("#btnprosesscrap_sto").button().click(function(){
			$("#viewsisa_scrapstockopnamedlg").load('<?php echo base_url().'inventory/ct_stockopname/view_stockopname_sisa_scrap'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewsisa_scrapstockopnamedlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewsisa_scrapstockopnamedlg').dialog("destroy"); 
					    $(".viewsisa_scrapstockopnamedlg_cl").remove(); 
					    $("body").append('<div id="viewsisa_scrapstockopnamedlg" title="STOCK OPNAME SISA DAN SCRAP" class="viewsisa_scrapstockopnamedlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		});
		$("#btnprosesmpk_sto").button().click(function(){
			$("#viewmpkstockopnamedlg").load('<?php echo base_url().'inventory/ct_stockopname/view_stockopname_mpk'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewmpkstockopnamedlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewmpkstockopnamedlg').dialog("destroy"); 
					    $(".viewmpkstockopnamedlg_cl").remove(); 
					    $("body").append('<div id="viewmpkstockopnamedlg" title="STOCK OPNAME MESIN DAN PERALATAN KANTOR" class="viewmpkstockopnamedlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		
		
		});
		
		var form_data1 = {
			'typebahan':function () { 
				alert('RM');	
				return 'RM'; 
			},
			'test':'aa'
		
		};
		
		jQuery("#tblrm_sto").jqGrid({
			url:'<?php echo base_url().'inventory/ct_stockopname/loaddatastokopname'; ?>',
			mtype : "post",
			postData:{
				'typebahanx':function () { 
					return 'RM'; 
				},
				'test':'aa'
		
			},
			datatype: "json",
			colNames:[
				'id_stock_opname'
			  ,'DATE STO'
			  ,'PART NO'
			  ,'PART NAME'
			  ,'PART NAME CUSTOMS'
			  ,'QTY'
			  ,'UNIT'
			  ,'unit_konversi'
			  ,'pengali'
			  ,'netto'
			  ,'brutto'
			  ,'typebahan'
			  ,'create date'
			  ,'create by'
			  ,'update date'
			  ,'update by'
			],
			colModel:[
				{name:'id_stock_opname',index:'id_stock_opname', width:60, hidden:true},
				{name:'date_stock_opname',index:'date_stock_opname', width:85, searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'part_no',index:'part_no', width:145},
				{name:'part_name',index:'part_name', width:157},
				{name:'part_name_customs',index:'part_name_customs', width:200, hidden:false},
				{name:'qty',index:'qty', width:113, hidden:false, align:'right', formatter: 'number', formatoptions: { decimalPlaces: 2 }},
				{name:'unit',index:'unit', width:106, hidden:false},
				{name:'unit_konversi',index:'unit_konversi', width:106, hidden:true},
				{name:'pengali',index:'pengali', width:106, hidden:true},
				{name:'netto',index:'netto', width:106, hidden:true},
				{name:'brutto',index:'brutto', width:106, hidden:true},
				{name:'typebahan',index:'typebahan', width:106, hidden:true},
				{name:'create_date',index:'create_date', width:106, hidden:true},
				{name:'create_by',index:'create_by', width:106, hidden:true},
				{name:'update_date',index:'update_date', width:106, hidden:true},
				{name:'update_by',index:'update_by', width:106, hidden:true},
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblrm_sto',
			sortname: 'id_stock_opname',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"Stock Opname Raw Material",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblrm_sto").getDataIDs(); 
				var rowData = $("#tblrm_sto").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblrm_sto'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblrm_sto").jqGrid('navGrid','#ptblrm_sto',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblrm_sto").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
 		setTimeout(function(){
				setGridHight($("#tblrm_sto"),$("#tabfinishgood_stockopname"),$("#div_rm_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
		},100); 
	 

		
		var form_data2 = {'typebahanx':function () { return 'FG'; }};
		jQuery("#tblassy_sto").jqGrid({
			url:'<?php echo base_url().'inventory/ct_stockopname/loaddatastokopname'; ?>',
			mtype : "post",
			postData:form_data2,
			datatype: "json",
			colNames:[
				'id_stock_opname'
			  ,'DATE STO'
			  ,'ASSY CODE'
			  ,'ASSY NO'
			  ,'ASSY NAME'
			  ,'QTY'
			  ,'UNIT'
			  ,'unit_konversi'
			  ,'pengali'
			  ,'netto'
			  ,'brutto'
			  ,'typebahan'
			  ,'create date'
			  ,'create by'
			  ,'update date'
			  ,'update by'
			],
			colModel:[
				{name:'id_stock_opname',index:'id_stock_opname', width:60, hidden:true},
				{name:'date_stock_opname',index:'date_stock_opname', width:85, searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'part_no',index:'part_no', width:145},
				{name:'part_name',index:'part_name', width:157},
				{name:'part_name_customs',index:'part_name_customs', width:200, hidden:false},
				{name:'qty',index:'qty', width:113, hidden:false, align:'right', formatter: 'number', formatoptions: { decimalPlaces: 2 }},
				{name:'unit',index:'unit', width:106, hidden:false},
				{name:'unit_konversi',index:'unit_konversi', width:106, hidden:true},
				{name:'pengali',index:'pengali', width:106, hidden:true},
				{name:'netto',index:'netto', width:106, hidden:true},
				{name:'brutto',index:'brutto', width:106, hidden:true},
				{name:'typebahan',index:'typebahan', width:106, hidden:true},
				{name:'create_date',index:'create_date', width:106, hidden:true},
				{name:'create_by',index:'create_by', width:106, hidden:true},
				{name:'update_date',index:'update_date', width:106, hidden:true},
				{name:'update_by',index:'update_by', width:106, hidden:true},
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblassy_sto',
			sortname: 'id_stock_opname',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"Stock Opname Assy",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblassy_sto").getDataIDs(); 
				var rowData = $("#tblassy_sto").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblassy_sto'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblassy_sto").jqGrid('navGrid','#ptblassy_sto',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblassy_sto").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		
		setTimeout(function(){
			setGridHight($("#tblassy_sto"),$("#tabfinishgood_stockopname"),$("#div_fg_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
		},100); 
		 
		
		
		jQuery("#tblss_sto").jqGrid({
			url:'<?php echo base_url().'inventory/ct_stockopname/loaddatastokopname'; ?>',
			mtype : "post",
			postData:{'typebahanx':function () { return 'SS'; }},
			datatype: "json",
			colNames:[
				'id_stock_opname'
			  ,'DATE STO'
			  ,'PART NO'
			  ,'PART NAME'
			  ,'PART NAME CUSTOMS'
			  ,'QTY'
			  ,'UNIT'
			  ,'unit_konversi'
			  ,'pengali'
			  ,'netto'
			  ,'brutto'
			  ,'typebahan'
			  ,'create date'
			  ,'create by'
			  ,'update date'
			  ,'update by'
			],
			colModel:[
				{name:'id_stock_opname',index:'id_stock_opname', width:60, hidden:true},
				{name:'date_stock_opname',index:'date_stock_opname', width:85, searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'part_no',index:'part_no', width:145},
				{name:'part_name',index:'part_name', width:157},
				{name:'part_name_customs',index:'part_name_customs', width:200, hidden:false},
				{name:'qty',index:'qty', width:113, hidden:false, align:'right', formatter: 'number', formatoptions: { decimalPlaces: 2 }},
				{name:'unit',index:'unit', width:106, hidden:false},
				{name:'unit_konversi',index:'unit_konversi', width:106, hidden:true},
				{name:'pengali',index:'pengali', width:106, hidden:true},
				{name:'netto',index:'netto', width:106, hidden:true},
				{name:'brutto',index:'brutto', width:106, hidden:true},
				{name:'typebahan',index:'typebahan', width:106, hidden:true},
				{name:'create_date',index:'create_date', width:106, hidden:true},
				{name:'create_by',index:'create_by', width:106, hidden:true},
				{name:'update_date',index:'update_date', width:106, hidden:true},
				{name:'update_by',index:'update_by', width:106, hidden:true},
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblss_sto',
			sortname: 'id_stock_opname',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"Stock Opname Scrap dan Sisa",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblss_sto").getDataIDs(); 
				var rowData = $("#tblss_sto").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblss_sto'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblss_sto").jqGrid('navGrid','#ptblss_sto',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblss_sto").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		setTimeout(function(){
			setGridHight($("#tblss_sto"),$("#tabfinishgood_stockopname"),$("#div_scrap_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
		},100); 
			 		
		var formdata={'typebahanx':function () { return 'MPK'; }};
		
		jQuery("#tblmpk_sto").jqGrid({
			url:'<?php echo base_url().'inventory/ct_stockopname/loaddatastokopname'; ?>',
			mtype : "post",
			postData:formdata,
			datatype: "json",
			colNames:[
				'id_stock_opname'
			  ,'DATE STO'
			  ,'PART NO'
			  ,'PART NAME'
			  ,'PART NAME CUSTOMS'
			  ,'QTY'
			  ,'UNIT'
			  ,'unit_konversi'
			  ,'pengali'
			  ,'netto'
			  ,'brutto'
			  ,'typebahan'
			  ,'create date'
			  ,'create by'
			  ,'update date'
			  ,'update by'
			],
			colModel:[
				{name:'id_stock_opname',index:'id_stock_opname', width:60, hidden:true},
				{name:'date_stock_opname',index:'date_stock_opname', width:85, searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({changeYear: true,showButtonPanel: true,changeMonth: true,dateFormat:'yy-mm-dd'});} }},
				{name:'part_no',index:'part_no', width:145},
				{name:'part_name',index:'part_name', width:157},
				{name:'part_name_customs',index:'part_name_customs', width:200, hidden:false},
				{name:'qty',index:'qty', width:113, hidden:false, align:'right', formatter: 'number', formatoptions: { decimalPlaces: 2 }},
				{name:'unit',index:'unit', width:106, hidden:false},
				{name:'unit_konversi',index:'unit_konversi', width:106, hidden:true},
				{name:'pengali',index:'pengali', width:106, hidden:true},
				{name:'netto',index:'netto', width:106, hidden:true},
				{name:'brutto',index:'brutto', width:106, hidden:true},
				{name:'typebahan',index:'typebahan', width:106, hidden:true},
				{name:'create_date',index:'create_date', width:106, hidden:true},
				{name:'create_by',index:'create_by', width:106, hidden:true},
				{name:'update_date',index:'update_date', width:106, hidden:true},
				{name:'update_by',index:'update_by', width:106, hidden:true},
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblmpk_sto',
			sortname: 'id_stock_opname',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"Stock Opname Peralatan Mesin dan Alat Kantor",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblmpk_sto").getDataIDs(); 
				var rowData = $("#tblmpk_sto").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblmpk_sto'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblmpk_sto").jqGrid('navGrid','#ptblmpk_sto',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblmpk_sto").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		setTimeout(function(){
			setGridHight($("#tblmpk_sto"),$("#tabfinishgood_stockopname"),$("#div_mpk_stockopname_bar"),$("#tabfinishgood_stockopname .ui-tabs-nav").height()+30); 
		},100); 
		
		
		$("#btndeletesto_part").button().click(function(){
			var id = jQuery("#tblrm_sto").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblrm_sto").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			
			$("#dlg_sto_deletepart").dialog( "destroy" );
			$(".dlg_sto_deletepart_cl").remove();
			$(".dlg_sto_deletepart_cl").html('');
			
			$("body").append('<div id="dlg_sto_deletepart" title="Warning" class="dlg_sto_deletepart_cl"><p>Apakah anda akan melakukan <b>DELETE</b> part?!?</p><br /></div>');
			var form_data = {
				
				idx:ret.id_stock_opname,
				typebahan:ret.typebahan,
				command:'DELETE'
			};
			
			
			$("#dlg_sto_deletepart").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'inventory/ct_stockopname/delete_sto'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_sto_deletepart").dialog("close");
								$('#dlg_sto_deletepart').dialog("destroy"); 
								$(".dlg_sto_deletepart_cl").remove(); 
								$(".dlg_sto_deletepart_cl").html('');
								$('#tblrm_sto').trigger('reloadGrid');

							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlg_sto_deletepart").dialog("close");
								$('#dlg_sto_deletepart').dialog("destroy"); 
								$(".dlg_sto_deletepart_cl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlg_sto_deletepart" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlg_sto_deletepart').dialog("destroy"); 
					$(".dlg_sto_deletepart_cl").remove(); 
					$("body").append('<div id="dlg_sto_deletepart" title="Warning" class="dlg_sto_deletepart_cl"><p>Apakah anda akan melakukan <b>DELETE</b> part hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		});
			
		
		
		$("#btndeletesto_assy").button().click(function(){
			var id = jQuery("#tblassy_sto").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblassy_sto").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			$(".dlg_sto_deleteassy_cl").remove();
			$(".dlg_sto_deleteassy_cl").html('');
			
			$("body").append('<div id="dlg_sto_deleteassy" title="Warning" class="dlg_sto_deleteassy_cl"><p>Apakah anda akan melakukan <b>DELETE</b> assy?!?</p><br /></div>');
			var form_data = {
				
				idx:ret.id_stock_opname,
				typebahan:ret.typebahan,
				command:'DELETE'
			};
			
			
			$("#dlg_sto_deleteassy").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'inventory/ct_stockopname/delete_sto'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_sto_deleteassy").dialog("close");
								$('#dlg_sto_deleteassy').dialog("destroy"); 
								$(".dlg_sto_deleteassy_cl").remove(); 
								$(".dlg_sto_deleteassy_cl").html('');
								$('#tblassy_sto').trigger('reloadGrid');

							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlg_sto_deleteassy").dialog("close");
								$('#dlg_sto_deleteassy').dialog("destroy"); 
								$(".dlg_sto_deleteassy_cl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlg_sto_deleteassy" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlg_sto_deleteassy').dialog("destroy"); 
					$(".dlg_sto_deleteassy_cl").remove(); 
					$("body").append('<div id="dlg_sto_deleteassy" title="Warning" class="dlg_sto_deleteassy_cl"><p>Apakah anda akan melakukan <b>DELETE</b> assy hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
			
						
		});
		
		$("#btndeletesto_scrap").button().click(function(){
			var id = jQuery("#tblss_sto").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblss_sto").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			$(".dlg_sto_deletess_cl").remove();
			$(".dlg_sto_deletess_cl").html('');
			
			$("body").append('<div id="dlg_sto_deletess" title="Warning" class="dlg_sto_deletess_cl"><p>Apakah anda akan melakukan <b>DELETE</b> ss?!?</p><br /></div>');
			var form_data = {
				
				idx:ret.id_stock_opname,
				typebahan:ret.typebahan,
				command:'DELETE'
			};
			
			
			$("#dlg_sto_deletess").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'inventory/ct_stockopname/delete_sto'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_sto_deletess").dialog("close");
								$('#dlg_sto_deletess').dialog("destroy"); 
								$(".dlg_sto_deletess_cl").remove(); 
								$(".dlg_sto_deletess_cl").html('');
								$('#tblss_sto').trigger('reloadGrid');

							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlg_sto_deletess").dialog("close");
								$('#dlg_sto_deletess').dialog("destroy"); 
								$(".dlg_sto_deletess_cl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlg_sto_deletess" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlg_sto_deletess').dialog("destroy"); 
					$(".dlg_sto_deletess_cl").remove(); 
					$("body").append('<div id="dlg_sto_deletess" title="Warning" class="dlg_sto_deletess_cl"><p>Apakah anda akan melakukan <b>DELETE</b> ss hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
			
						
		});
		
		
		$("#btndeletesto_mpk").button().click(function(){
			var id = jQuery("#tblmpk_sto").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblmpk_sto").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};	
			
			$(".dlg_sto_deletempk_cl").remove();
			$(".dlg_sto_deletempk_cl").html('');
			
			$("body").append('<div id="dlg_sto_deletempk" title="Warning" class="dlg_sto_deletempk_cl"><p>Apakah anda akan melakukan <b>DELETE</b> mpk?!?</p><br /></div>');
			var form_data = {
				
				idx:ret.id_stock_opname,
				typebahan:ret.typebahan,
				command:'DELETE'
			};
			
			
			$("#dlg_sto_deletempk").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'inventory/ct_stockopname/delete_sto'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_sto_deletempk").dialog("close");
								$('#dlg_sto_deletempk').dialog("destroy"); 
								$(".dlg_sto_deletempk_cl").remove(); 
								$(".dlg_sto_deletempk_cl").html('');
								$('#tblmpk_sto').trigger('reloadGrid');

							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlg_sto_deletempk").dialog("close");
								$('#dlg_sto_deletempk').dialog("destroy"); 
								$(".dlg_sto_deletempk_cl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlg_sto_deletempk" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlg_sto_deletempk').dialog("destroy"); 
					$(".dlg_sto_deletempk_cl").remove(); 
					$("body").append('<div id="dlg_sto_deletempk" title="Warning" class="dlg_sto_deletempk_cl"><p>Apakah anda akan melakukan <b>DELETE</b> mpk hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
						
		});
		
		
	});
		  	
</script>
<div id="viewbahanbakustockopnamedlg" title="STOCK OPNAME RAW MATERIAL" class="viewbahanbakustockopnamedlg_cl"></div>
<div id="viewfinishgoodstockopnamedlg" title="STOCK OPNAME FINISH GOOD" class="viewfinishgoodstockopnamedlg_cl"></div>
<div id="viewsisa_scrapstockopnamedlg" title="STOCK OPNAME SISA DAN SCRAP" class="viewsisa_scrapstockopnamedlg_cl"></div>
<div id="viewmpkstockopnamedlg" title="STOCK OPNAME MESIN DAN PERALATAN KANTOR" class="viewmpkstockopnamedlg_cl"></div>



	
	