
<div id="tabbc25_scr_dtl" style="height:460px">
	<ul>
		<li><a id="idtabbc25sascr_dtl" href="#divtabbc25sascr_dtl">BC25 SCRAP</a></li>
		<li><a id="idtabbc25sascr_dtl_in" href="#divtabbc25sascr_dtl_in">DATA IN</a></li>
		<li><a id="idtabbc25sascr_dtl_out" href="#divtabbc25sascr_dtl_out">DATA OUT</a></li>
	</ul>
	<div id="divtabbc25sascr_dtl" >
		<div style="height:35px;">
	
		</div>
		<table id="tblscrapviewbc25_dtl"></table> <div id="ptblscrapviewbc25_dtl"></div>
	</div>
	<div id="divtabbc25sascr_dtl_in" >
		<div style="height:35px;">
	
		</div>
		<table id="tbl_scrap_bahanbaku_bc25"></table> <div id="ptbl_scrap_bahanbaku_bc25"></div>
	</div>
	<div id="divtabbc25sascr_dtl_out" >
		<div style="height:35px;">
	
		</div>
		<table id="tbl_scrap_bahanbaku_out_view"></table> <div id="ptbl_scrap_bahanbaku_out_view"></div>
	</div>

</div>
<script type="text/javascript">
	$(document).ready(function(){
		$( "#tabbc25_scr_dtl" ).tabs();	
		
		var form_datax = {
			param_not:'KG'
		}
		
		var  typebahan_bc25 = 'SCRAPBB';
		var form_data_bc25 = {
			'typebahanx':typebahan_bc25,
			'test':'aa'
		
		};
		
		jQuery("#tblscrapviewbc25_dtl").jqGrid({
			url:'<?php echo base_url().'inventory/ct_scrap/loaddata_bc25_gettassy_dtl'; ?>',
			mtype : "post",
			postData:form_datax,
			datatype: "json",
			colNames:['ID','id_sa_hdr', 'CAR','NO BC','TGL BC','NPWP PEMBELI', 'NAMA PEMBELI', 'KD BRG',
					'NAMA BRG', 'QTY', 'SATUAN', 'JML KEMAS', 'GROSS WEIGHT', 'SATUAN', 'NETWEIGHT', 'SATUAN',
					'create date','create by','update date','update by'
					],
			colModel:[
				{name:'id_sa',index:'id_sa', width:60, hidden:true},
				{name:'id_sa_hdr',index:'id_sa_hdr', width:160, hidden:true},
				{name:'BC25NAJU',index:'BC25NAJU', width:190,stype:"text",searchoptions:{}},
				{name:'BC25No',index:'BC25No', width:90,stype:"text",searchoptions:{}},
				{name:'BC25Tg',index:'BC25Tg', width:90,stype:"text",searchoptions:{}},
				{name:'NPWP_PEMBELI',index:'NPWP_PEMBELI', width:119},
				{name:'NAMA_PEMBELI',index:'NAMA_PEMBELI', width:205},
				{name:'ASSY_CODE',index:'ASSY_CODE', width: 87, hidden:false},
				{name:'ASSY_NO',index:'ASSY_NO', width:179, hidden:false},
				{name:'TOTAL_SET',index:'TOTAL_SET', width:106, hidden:false},
				{name:'SATUAN',index:'SATUAN', width:106, hidden:false},
				{name:'JUMLAH_COLI',index:'JUMLAH_COLI', width:106, hidden:false},
				{name:'GROSSWEIGHT',index:'GROSSWEIGHT', width:93, hidden:false, align:'right'},
				{name:'SATUANGROSS',index:'SATUANGROSS', width:106, hidden:false},
				{name:'NETWEIGHT',index:'NETWEIGHT', width:106, hidden:false, align:'right'},
				{name:'SATUANNET',index:'SATUANNET', width:86, hidden:false},
				{name:'create_date',index:'create_date', width:106, hidden:false},
				{name:'create_by',index:'create_by', width:106, hidden:false},
				{name:'update_date',index:'update_date', width:106, hidden:false},
				{name:'update_by',index:'update_by', width:106, hidden:false},
				
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblscrapviewbc25_dtl',
			sortname: 'id_sa',
			viewrecords: true,
			sortorder: "asc",
			width: 940,
			height:280,
			jsonReader: { repeatitems : false },
			caption:"Data BC25",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				
			},
		}); 
		
		
		jQuery("#tblscrapviewbc25_dtl").jqGrid('navGrid','#ptblscrapviewbc25_dtl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tblscrapviewbc25_dtl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch: 'cn', ignoreCase: true});
		
		jQuery("#tbl_scrap_bahanbaku_bc25").jqGrid({
			url:'<?php echo base_url().'inventory/ct_scrap/loaddatascrap'; ?>',
			mtype : "post",
			postData:form_data_bc25,
			datatype: "json",
			colNames:[
				'id_scrap'
			  ,'DATE SCRAP'
			  ,'KODE BARANG'
			  ,'NAMA BARANG SCRAP'
			  ,'PART NAME CUSTOMS'
			  ,'QTY'
			  ,'UNIT'
			  ,'unit_konversi'
			  ,'pengali'
			  ,'netto'
			  ,'brutto'
			  ,'typebahan'
			  ,'create date'
			  ,'create by'
			  ,'update date'
			  ,'update by'
			  ,'status'
			],
			colModel:[
				{name:'id_scrap',index:'id_scrap', width:60, hidden:true},
				{name:'date_scrap',index:'date_scrap', 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:true},
				{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:false},
				{name:'update_date',index:'update_date', width:106, hidden:false},
				{name:'update_by',index:'update_by', width:106, hidden:true},
				{name:'status',index:'status', width:186, hidden:false}
				],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptbl_scrap_bahanbaku_bc25',
			sortname: 'id_scrap',
			viewrecords: true,
			sortorder: "desc",
			width: 940,
			height:280,
			jsonReader: { repeatitems : false },
			caption:"scrap masuk",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tbl_scrap_bahanbaku_bc25").getDataIDs(); 
				var rowData = $("#tbl_scrap_bahanbaku_bc25").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tbl_scrap_bahanbaku_bc25'));
				   
					switch (rowData[i].status) {
						
						case 'DATA PROCESSED OUT':
						   trElement.css({"color":"green"});
						break;
						case 'APPROVED':
						   trElement.css({"color":"red"});
						break;
					}
				}
			},
		}); 
		 	
        jQuery("#tbl_scrap_bahanbaku_bc25").jqGrid('navGrid','#ptbl_scrap_bahanbaku_bc25',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tbl_scrap_bahanbaku_bc25").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});	
         
		jQuery("#tbl_scrap_bahanbaku_out_view").jqGrid({
			url:'<?php echo base_url().'inventory/ct_scrap/loaddata_scrap_out'; ?>',
			postData:{a:'a'},
			mtype : "post",
			datatype: "json",
			width: 940,
			height:280,
			colNames:[
				'id_scrap_out'
				,'No. Dok Out'
			  ,'date'
			  ,'Kode Barang'
			  ,'Nama Barang'
			  ,'part_name_customs'
			  ,'qty'
			  ,'unit'
			  ,'unit_konversi'
			  ,'pengali'
			  ,'netto'
			  ,'brutto'
			  ,'typebahan'
			  ,'create_date'
			  ,'create_by'
			  ,'update_date'
			  ,'update_by'
			  
			  ,'id_scrap'
			],
			colModel:[
				{name:'id_scrap_out',index:'id_scrap_out', width:60, sorttype:"int", hidden:true},
				{name:'no_dok_out',index:'no_dok_out', width:106, hidden:false},
				{name:'date_scrap',index:'date_scrap', width:85, hidden:false,searchoptions:{sopt:['eq','cn','gt','lt'],dataInit:function(el){$(el).datepicker({dateFormat:'yy-mm-dd'});} }},
				{name:'part_no',index:'part_no', width:76},
				{name:'part_name',index:'part_name', width:191},
				{name:'part_name_customs',index:'part_name_customs', width:200, hidden:true},
				{name:'qty',index:'qty', width:126, hidden:false, align:'right'},
				{name:'unit',index:'unit', width:132, 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},
				{name:'id_scrap',index:'id_scrap', width:106, hidden:true}
				
			],
			pager: '#ptbl_scrap_bahanbaku_out_view',
			rowNum:10,
			rowList:[10,40,100],
			sortname: 'id_scrap_out',
			sortorder: 'desc',
			jsonReader: { repeatitems : false },
			viewrecords: true,
			shrinkToFit: false,
			multiselect: false,
			caption: "Selected Data Out"
		});
		jQuery("#tbl_scrap_bahanbaku_out_view").jqGrid('navGrid','#ptbl_scrap_bahanbaku_out_view',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tbl_scrap_bahanbaku_out_view").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});	
        
		 
		 
	});
</script>

