<style>

</style>

<div style="height:10px;" id="alatkantor_set_bar" >    
</div>

<div style="height:10px;"  > 
<table id="tbl_bahanpenolong_memo_scrap_dtl"></table> <div id="ptbl_bahanpenolong_memo_scrap_dtl"></div>   

</div>

<script type="text/javascript">
    
	
    $(document).ready(function(){
		
		
		jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid({
			url:'<?php echo base_url().'settings/ct_barangbahanpenolong/data_bahanpenolong_memo_scrap'; ?>',
			mtype : "post",
			postData:{'q':'1', id_memo_bp:function(){ return '<?php echo $id_memo; ?>' },fill:function(){ return 'SCRAP' } },
			datatype: "json",
			colNames:[
			'id_bp_out_dtl' 
			,'kode_scrap'
			,'nama_scrap'
			,'qty_scrap'
			,'bruto scrap'
			,'netto scrap'
			,'harga'
			,'jm kemas'
			,'jn kemas'
			,'id_memo'
			,'part_no'
			,'part_name' 
			,'qty'
			,'uom'
			],
			colModel:[
				{name:'id_bp_out_dtl',index:'id_bp_out_dtl', width:60, hidden:true},
				{name:'kode_scrap',index:'kode_scrap', width:105,hidden:false},
				{name:'nama_scrap',index:'nama_scrap', width:105,hidden:false},
				{name:'qty_scrap',index:'qty_scrap', width:105,hidden:false},
				{name:'bruto_scrap',index:'bruto_scrap', width:105,hidden:false},
				{name:'netto_scrap',index:'netto_scrap', width:105,hidden:false},
				{name:'harga_scrap',index:'harga_scrap', width:105,hidden:false},
				{name:'jmkemas_scrap',index:'jmkemas_scrap', width:105,hidden:false},
				{name:'jnkemas_scrap',index:'jnkemas_scrap', width:105,hidden:false},
				{name:'id_memo_bp',index:'id_memo_bp', width:105,hidden:true},
				{name:'part_no',index:'part_no', width:99},
				{name:'part_name',index:'part_name', width:120},
				{name:'qty',index:'qty', width:90, hidden:false, align:'right'},
				{name:'uom',index:'uom', width:80,hidden:false},
				
				],
			rowNum:20,
			rowList:[20,50,100],
			pager: '#ptbl_bahanpenolong_memo_scrap_dtl',
			sortname: 'tbl_bahanpenolong_out.id_bp_out_dtl',
			viewrecords: true,
			sortorder: "desc",
			width: 800,
			height:240,
			jsonReader: { repeatitems : false },
			caption:"Data Bahan Penolong Scrap",
			rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			},			
			gridComplete: function(){
				var rowIDs = jQuery("#tbl_bahanpenolong_memo_scrap_dtl").getDataIDs(); 
				var rowData = $("#tbl_bahanpenolong_memo_scrap_dtl").getRowData();
			
				for (var i = 0; i < rowData.length; i++) 
				{
				   var trElement = jQuery("#"+ rowIDs[i],jQuery('#tbl_bahanpenolong_memo_scrap_dtl'));
				   
					switch (rowData[i].status_data) {
						
						//case 'PROSESEXIM':
						 //  trElement.css({"color":"green"});
						//break;
						//case 'PROCESSEDBC':
						//   trElement.css({"color":"red"});
						//break;
						
					}
				}
				$("#tbl_bahanpenolong_memo_scrap_dtl").setSelection(1, true);
				var colSum1 = jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('getCol', 'qty_scrap', false, 'sum');
				var colSum2 = jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('getCol', 'bruto_scrap', false, 'sum');
				var colSum3 = jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('getCol', 'netto_scrap', false, 'sum');
				jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('footerData', 'set', { 'qty_scrap': colSum1, 'bruto_scrap':colSum2, 'netto_scrap':colSum3});

			},
			onSelectRow: function(id){
				var grididpr = jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('getGridParam','selrow');
				 if(grididpr){
					var ret = jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('getRowData',grididpr);
					$("#id_memo_scrap_name").html(" PART NO : <b>" + ret.kode_scrap + " </b><br />PART NAME : <b> " + ret.nama_scrap + "</b> <BR /> QTY :<b> " + ret.qty + "</b>")	
					$("#kode_scrap").val(ret.kode_scrap);
					$("#nama_scrap").val(ret.nama_scrap) ;
					$("#qty_scrap").val(ret.qty_scrap) ;
					$("#jmkemas_scrap").val(ret.jmkemas_scrap);
					$("#jnkemas_scrap").val(ret.jnkemas_scrap);
					$("#netto_scrap").val(ret.netto_scrap);
					$("#bruto_scrap").val(ret.bruto_scrap);
					$("#harga_scrap").val(ret.harga_scrap);
				 }
			},
			footerrow : true
		}); 
			
                        
		jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('navGrid','#ptbl_bahanpenolong_memo_scrap_dtl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
		jQuery("#tbl_bahanpenolong_memo_scrap_dtl").jqGrid('bindKeys', {"onEnter":function( rowid ) { 
			//alert("You enter a row with id:"+rowid)
			} 
		});
		
	});
		  	
</script>
<div id="frm_create_memo_bahanpenolong" title="BAHAN PENOLONG MEMO" class="frm_create_memo_bahanpenolong_cl"></div>

	
	