<div id="tabfinishgood_adjusment_c" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
	<div id="tabfinishgood_adjusment" style="height:100%;margin:0px; padding:0px;"> 
		<ul>
			<li><a id="tab_rm_adjusment" href="#div_rm_adjusment">RAW MATERIAL</a></li>
			<li><a id="tab_fg_adjusment" href="#div_fg_adjusment">ASSY</a></li>
			<li><a id="tab_scrap_adjusment" href="#div_scrap_adjusment">SISA DAN SCRAP</a></li>
			<li><a id="tab_mpk_adjusment" href="#div_mpk_adjusment">MESIN DAN ALAT KANTOR</a></li>
		</ul>
		<div id="div_rm_adjusment" >
			<div class="pane-header ui-state-active" id="div_rm_adjusment_bar" >    
				<button id="btnprosesrm_adj">Proses PART adjusment</button>
			</div>
			<table id="tblrm_adj"></table> <div id="ptblrm_adj"></div>
		</div>
		<div id="div_fg_adjusment" >
			<div class="pane-header ui-state-active" id="div_fg_adjusment_bar" >    
				<button id="btnprosesassy_adj">Proses ASSY adjusment</button>
			</div>
			<table id="tblassy_adj"></table> <div id="ptblassy_adj"></div>
			
		</div>
		<div id="div_scrap_adjusment" >
			<div class="pane-header ui-state-active" id="div_scrap_adjusment_bar" >    
				<button id="btnprosesscrap_adj">Proses SISA dan SCRAP adjusment</button>
			</div>
			<table id="tblss_adj"></table> <div id="ptblss_adj"></div>
			
		</div>
		<div id="div_mpk_adjusment" >
			<div class="pane-header ui-state-active" id="div_mpk_adjusment_bar" >    
				<button id="btnprosesmpk_adj">Proses Mesin dan Alat Kantor adjusment</button>
			</div>
			<table id="tblmpk_adj"></table> <div id="ptblmpk_adj"></div>
		</div>
	</div>
</div>
<script type="text/javascript">
    
    $(document).ready(function(){
	 	
		var tabfinishgood_adjusment_active_tab=0;
		$("#tabfinishgood_adjusment" ).tabs({                                                                  
            select:function(event,ui){    
				
				tabfinishgood_adjusment_active_tab=ui.index;   
				
		 		if (tabfinishgood_adjusment_active_tab==0){
					jQuery("#tblrm_adj").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblrm_adj"),$("#tabfinishgood_adjusment"),$("#div_rm_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},20); 
				}else if (tabfinishgood_adjusment_active_tab==1){
					jQuery("#tblassy_adj").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblassy_adj"),$("#tabfinishgood_adjusment"),$("#div_fg_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},20); 
				}else if (tabfinishgood_adjusment_active_tab==2){
					jQuery("#tblss_adj").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblss_adj"),$("#tabfinishgood_adjusment"),$("#div_scrap_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},20); 
				}else if (tabfinishgood_adjusment_active_tab==3){
					jQuery("#tblmpk_adj").trigger("reloadGrid");
					setTimeout(function(){
						setGridHight($("#tblmpk_adj"),$("#tabfinishgood_adjusment"),$("#div_mpk_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},20); 
				}
			}                                                                          
         });   		
			 
			 
		$(window).bind('resize', function() {  
				if (tabfinishgood_adjusment_active_tab==0){
					setTimeout(function(){
						setGridHight($("#tblrm_adj"),$("#tabfinishgood_adjusment"),$("#div_rm_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},100); 
				}else if (tabfinishgood_adjusment_active_tab==1){
					setTimeout(function(){
						setGridHight($("#tblassy_adj"),$("#tabfinishgood_adjusment"),$("#div_fg_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},100); 
				}else if (tabfinishgood_adjusment_active_tab==2){
					setTimeout(function(){
						setGridHight($("#tblss_adj"),$("#tabfinishgood_adjusment"),$("#div_scrap_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},100); 
				}else if (tabfinishgood_adjusment_active_tab==3){
					setTimeout(function(){
						setGridHight($("#tblmpk_adj"),$("#tabfinishgood_adjusment"),$("#div_mpk_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
					},100); 
				}
		}); 
		
		$("#btnprosesrm_adj").button().click(function(){
		
			$("#viewbahanbakuadjusmentdlg").load('<?php echo base_url().'inventory/ct_reject_processing/view_adjusment_bahanbaku'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewbahanbakuadjusmentdlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewbahanbakuadjusmentdlg').dialog("destroy"); 
					    $(".viewbahanbakuadjusmentdlg_cl").remove(); 
					    $("body").append('<div id="viewbahanbakuadjusmentdlg" title="adjusment RAW MATERIAL" class="viewbahanbakuadjusmentdlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		
		});
		$("#btnprosesassy_adj").button().click(function(){
			$("#viewfinishgoodadjusmentdlg").load('<?php echo base_url().'inventory/ct_reject_processing/view_adjusment_finishgood'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewfinishgoodadjusmentdlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewfinishgoodadjusmentdlg').dialog("destroy"); 
					    $(".viewfinishgoodadjusmentdlg_cl").remove(); 
					    $("body").append('<div id="viewfinishgoodadjusmentdlg" title="adjusment FINISH GOOD" class="viewfinishgoodadjusmentdlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
			
		
		});
		$("#btnprosesscrap_adj").button().click(function(){
			$("#viewsisa_scrapadjusmentdlg").load('<?php echo base_url().'inventory/ct_reject_processing/view_adjusment_sisa_scrap'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewsisa_scrapadjusmentdlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewsisa_scrapadjusmentdlg').dialog("destroy"); 
					    $(".viewsisa_scrapadjusmentdlg_cl").remove(); 
					    $("body").append('<div id="viewsisa_scrapadjusmentdlg" title="adjusment SISA DAN SCRAP" class="viewsisa_scrapadjusmentdlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		});
		$("#btnprosesmpk_adj").button().click(function(){
			$("#viewmpkadjusmentdlg").load('<?php echo base_url().'inventory/ct_reject_processing/view_adjusment_mpk'; ?>',  {parmeter:'parameter'}, function() {
				$("#viewmpkadjusmentdlg").dialog({
					modal:true,
					width : 900,
					height : 499,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#viewmpkadjusmentdlg').dialog("destroy"); 
					    $(".viewmpkadjusmentdlg_cl").remove(); 
					    $("body").append('<div id="viewmpkadjusmentdlg" title="adjusment MESIN DAN PERALATAN KANTOR" class="viewmpkadjusmentdlg_cl"></div>'); 
						
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});
		
		
		});
		
		var form_data1 = {
			'typebahan':'RM',
			'test':'aa'
		
		};
		
		jQuery("#tblrm_adj").jqGrid({
			url:'<?php echo base_url().'inventory/ct_reject_processing/loaddataadjusment'; ?>',
			mtype : "post",
			postData:form_data1,
			datatype: "json",
			colNames:[
				'id_adjusment'
			  ,'DATE ADJ'
			  ,'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_adjusment',index:'id_adjusment', width:60, hidden:true},
				{name:'date_adjusment',index:'date_adjusment', width:85, searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({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'},
				{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_adj',
			sortname: 'id_adjusment',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"adjusment Raw Material",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblrm_adj").getDataIDs(); 
				var rowData = $("#tblrm_adj").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblrm_adj'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblrm_adj").jqGrid('navGrid','#ptblrm_adj',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblrm_adj").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true}); 
		setTimeout(function(){
			setGridHight($("#tblrm_adj"),$("#tabfinishgood_adjusment"),$("#div_rm_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
		},100); 
			
		
		
		var form_data2 = {typebahan:'FG'};
		jQuery("#tblassy_adj").jqGrid({
			url:'<?php echo base_url().'inventory/ct_reject_processing/loaddataadjusment'; ?>',
			mtype : "post",
			postData:form_data2,
			datatype: "json",
			colNames:[
				'id_adjusment'
			  ,'DATE adj'
			  ,'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_adjusment',index:'id_adjusment', width:60, hidden:true},
				{name:'date_adjusment',index:'date_adjusment', 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'},
				{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_adj',
			sortname: 'id_adjusment',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"adjusment Assy",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblassy_adj").getDataIDs(); 
				var rowData = $("#tblassy_adj").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblassy_adj'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblassy_adj").jqGrid('navGrid','#ptblassy_adj',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblassy_adj").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});

		setTimeout(function(){
			setGridHight($("#tblassy_adj"),$("#tabfinishgood_adjusment"),$("#div_fg_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
		},100); 
			 
		
		
		jQuery("#tblss_adj").jqGrid({
			url:'<?php echo base_url().'inventory/ct_reject_processing/loaddataadjusment'; ?>',
			mtype : "post",
			postData:{'typebahan':'SS'},
			datatype: "json",
			colNames:[
				'id_adjusment'
			  ,'DATE adj'
			  ,'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_adjusment',index:'date_adjusment', 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'},
				{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_adj',
			sortname: 'id_adjusment',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"adjusment Scrap dan Sisa",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblss_adj").getDataIDs(); 
				var rowData = $("#tblss_adj").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblss_adj'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblss_adj").jqGrid('navGrid','#ptblss_adj',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblss_adj").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		setTimeout(function(){
			setGridHight($("#tblss_adj"),$("#tabfinishgood_adjusment"),$("#div_scrap_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
		},100); 
 							
		var formdata={'typebahan':'MPK'};
		
		jQuery("#tblmpk_adj").jqGrid({
			url:'<?php echo base_url().'inventory/ct_reject_processing/loaddataadjusment'; ?>',
			mtype : "post",
			postData:formdata,
			datatype: "json",
			colNames:[
				'id_adjusment'
			  ,'DATE adj'
			  ,'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_adjusment',index:'id_stock_opname', width:60, hidden:true},
				{name:'date_adjusment',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'},
				{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_adj',
			sortname: 'id_adjusment',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height:100,
			jsonReader: { repeatitems : false },
			caption:"adjusment Peralatan Mesin dan Alat Kantor",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tblmpk_adj").getDataIDs(); 
				var rowData = $("#tblmpk_adj").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tblmpk_adj'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
			
                        
		jQuery("#tblmpk_adj").jqGrid('navGrid','#ptblmpk_adj',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblmpk_adj").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		setTimeout(function(){
			setGridHight($("#tblmpk_adj"),$("#tabfinishgood_adjusment"),$("#div_mpk_adjusment_bar"),$("#tabfinishgood_adjusment .ui-tabs-nav").height()+30); 
		},100); 	
	});
		  	
</script>
<div id="viewbahanbakuadjusmentdlg" title="adjusment RAW MATERIAL" class="viewbahanbakuadjusmentdlg_cl"></div>
<div id="viewfinishgoodadjusmentdlg" title="adjusment FINISH GOOD" class="viewfinishgoodadjusmentdlg_cl"></div>
<div id="viewsisa_scrapadjusmentdlg" title="adjusment SISA DAN SCRAP" class="viewsisa_scrapadjusmentdlg_cl"></div>
<div id="viewmpkadjusmentdlg" title="adjusment MESIN DAN PERALATAN KANTOR" class="viewmpkadjusmentdlg_cl"></div>



	
	