<div id="container_pasi_ceisa_gudang_in_barang_detail" style="height:100%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
  <table class ="tablefixed"   border="0">
	<!--	  <tr  class="tr70">
			<td  class="tdauto" valign="top"> 
			    <div class="pane-header ui-state-active" >INPUT LOT</div>

			</td>
		  </tr> -->
		  <tr class="trauto" id="pasi_bc23_tab_container" > 
			<td class="tdauto"  >	
			 		<div id="pasi_bc23_tab"   style="height:100%;margin-bottom:10px">
						<ul>
							<li><a id="pasi_bc23_tab_list" href="#pasi_bc23_tab_list_container">LIST</a></li>
						 
						</ul> 
						<div   id="pasi_bc23_tab_list_container" >
									<table id="pasi_ceisa_gudang_item_detail_tbl"></table> <div id="ppasi_ceisa_gudang_item_detail_tbl"></div>
									<div class="pane-header ui-state-active" id="pasi_ceisa_gudang_in_tbl_item_lot_list_bar" > TOTAL
									<input type="text" id="pasi_ceisa_gudang_in_tbl_item_lot_list_totalitem" name="pasi_ceisa_gudang_in_tbl_item_lot_list_totalitem" style="width: 100px; text-align: center;margin-left:20px" readonly />
									</div>						 
						 </div>
						<div  id="pasi_bc23_tab_current_container">
									<table id="pasi_ceisa_gudang_item_detail_tbl_current"></table> <div id="ppasi_ceisa_gudang_item_detail_tbl_current"></div>
							
						</div>
					</div> 
 			</td>
		  </tr>
		  <tr  class="tr80">
			<td  class="tdauto" valign="top">
		<!--	    <div class="pane-header ui-state-active" >::MAPPING TO</div>
				 <div  class="ui-layout-content ui-widget-content-panel">
				 <label class="lbfield55">TYPE</label><label class="lbcolon">:</label><input id="pasi_bc23_mapping_item_type"name="pasi_bc23_mapping_item_type" type="text" value="" style="width:200px" readonly />
				 <label class="lbfield55">CODE</label><label class="lbcolon">:</label><input id="pasi_bc23_mapping_item_code"name="pasi_bc23_mapping_item_code" type="text" value="" style="width:120px" readonly />
				 <label class="lbfield55">ITEM NO</label><label class="lbcolon">:</label><input id="pasi_bc23_mapping_item_no"name="pasi_bc23_mapping_item_no" type="text" value="" style="width:120px" readonly /><br \>
				 <label class="lbfield55">NAME</label><label class="lbcolon">:</label><input id="pasi_bc23_mapping_item_name"name="pasi_bc23_mapping_item_name" type="text" value="" style="width:600px" readonly />
				</div> 
		-->	</td>
		  </tr>
		</table>  
</div> 

<script type="text/javascript">
    
    $(document).ready(function(){
	
		$("#pasi_ceisa_gudang_in_delete_lot").button(); 
		$pasi_bc23_tab_select=0;
		
		$("#pasi_bc23_tab" ).tabs({ heightStyle: "fill"});
		$("#pasi_bc23_tab div.ui-tabs-panel").css('height', $("#fragment-1").height());
 
		$("#pasi_bc23_tab").tabs("select", 0); 
	   // $('#pasi_bc23_tab').resizable({
			 // handles: 's',
			 // alsoResize: '.ui-tabs-panel'
		 // });
	 
		
		
	$(window).bind('resize', function() {  
		setTimeout(function(){
			setGridHight($("#pasi_ceisa_gudang_item_detail_tbl"),$("#pasi_bc23_tab_container"),$('#pasi_bc23_tab ul.ui-tabs-nav').outerHeight(true)); 
	},10); 
	
	}); 
	
	// $('body').on('resize', function () {
        // $("#pasi_bc23_tab" ).tabs('refresh');
    // });
	
   
	jQuery("#pasi_ceisa_gudang_item_detail_tbl").jqGrid({
			url:'<?php echo base_url().'pasi_ceisa_gudang_in/ct_gudang_in_data/loaddata_gudang_in_lot'; ?>',
			mtype : "post",
			postData:{id_detail:'<?php echo $id_detail;  ?>',kodebarang:'<?php echo $kodebarang;  ?>',namabarang:'<?php echo $namabarang;  ?>'},
			datatype: "json",
			colNames:[
				'ID','NAMA LOT','NOMOR LOT','QTY','SATUAN'
			
			]
			,colModel:[
				{name:'rID',index:'rID', width:80, hidden:true, align :'right', key:true}
				,{name:'r1',index:'r1', width:120, hidden:true, align :'left'} //barcode
				,{name:'r2',index:'r2', width:120, hidden:false, align :'left', editable: true} // kode
				,{name:'r3',index:'r3', width:120, hidden:false,align :'right', editable: true} // nama
				,{name:'r4',index:'r4', width:120, hidden:false, align: "center"}

			],
			rowNum:100,
			rowList:[50,100],
			pager: '#ppasi_ceisa_gudang_item_detail_tbl',
			sortname: 'r1',
			viewrecords: true,
			sortorder: "asc",
			width: '',
			height: 100,
			//datatype: 'local',
			//width: 950,
			//height:300,
			datatype: 'json',
            data:[],
			jsonReader: { repeatitems : true }, 
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false,
			multiselect: true,
			cellEdit: true,
			cellsubmit: 'clientArray',
			afterInsertRow: function(rowid, aData){
				/*switch (aData.statusdok) {
					case 'DATA SENT':
						jQuery("#pasi_bc23_tbl").jqGrid('setCell',rowid,'statusdok','',{color:'green'});
					break;
					case '2':
						jQuery("#pasi_bc23_tbl").jqGrid('setCell',rowid,'statusdok','',{color:'red'});
					break;
					case '1':
						jQuery("#pasi_bc23_tbl").jqGrid('setCell',rowid,'statusdok','',{color:'blue'});
					break;
					
				} */
			},		    
			onSelectRow: function(id){  
				var ret = jQuery("#pasi_ceisa_gudang_item_detail_tbl").jqGrid('getRowData',id);    
					$("#pasi_bc23_mapping_item_type").val(ret.r6);
 					$("#pasi_bc23_mapping_item_code").val(ret.r1);
 					$("#pasi_bc23_mapping_item_no").val(ret.r4);
 					$("#pasi_bc23_mapping_item_name").val(ret.r2) ;
				},
			onSelectCell: function (rowID, celname, value, iRow, iCol) { 
			
				var rowData = $("#pasi_ceisa_gudang_item_detail_tbl").getRowData(rowID); 
				if (rowData.rID =='-1'){
				//		 $("#pasi_ceisa_bc_in_bc23 _po_tbl_item_list").jqGrid('setColProp', 'ru', {editable:false});	 
				}
				else{
					$("#pasi_ceisa_gudang_item_detail_tbl").jqGrid('setColProp', 'r3', {editable:true});
				}
			
			},	
			afterSaveCell: function (rowid, cellname, value, iRow, iCol) {  
				  if(cellname=='r3') {
					   var trElement = jQuery("#"+ rowid,jQuery('#pasi_ceisa_gudang_item_detail_tbl'));
					   if (value!='0'){
						   if (value>0){
								trElement.css({"color":"blue"});
 							}else{
							trElement.css({"color":"black"});
							}		 
					   }else{
						   trElement.css({"color":"black"}); 
					   }
					 			  
				  }
			 	jQuery('#pasi_ceisa_gudang_in_tbl_item_lot_list_totalitem').val(total_mat());
		 },
		 loadComplete: function (data) { 
					var ids = jQuery("#pasi_ceisa_gudang_item_detail_tbl").jqGrid('getDataIDs');
					if (ids) { 
						for (var i=0;i<ids.length;i++) { 
						 jQuery("#pasi_ceisa_gudang_item_detail_tbl").jqGrid('setCell',ids[i],"r3","",{'background':'yellow'}); 
						}
					}
			 	jQuery('#pasi_ceisa_gudang_in_tbl_item_lot_list_totalitem').val(total_mat());

		 },
			gridComplete: function(){
				 
			},
		}); 
		
		function total_mat(){
							var total=0;
							var qty=0;

 
				 			var rowsData = $("#pasi_ceisa_gudang_item_detail_tbl").jqGrid("getGridParam", "selarrrow");
							for (var i = 0; i < rowsData.length; i++) 
							{
								var idx = rowsData[i];
								var rowData = $("#pasi_ceisa_gudang_item_detail_tbl").getRowData(idx);
								if ( $.isNumeric(''+rowData.r3)==true){
									if (parseFloat(rowData.r3)>0){
										total = total + parseFloat(rowData.r3); //['r2'] ; //[i]['r3'];
							//		total=qty;
									}
								}
											  
							} 
							return total;
		}
	              
		jQuery("#pasi_ceisa_gudang_item_detail_tbl").jqGrid('navGrid','#ppasi_ceisa_gudang_item_detail_tbl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#pasi_ceisa_gudang_item_detail_tbl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
	

		setTimeout(function(){
		 	setGridHight($("#pasi_ceisa_gudang_item_detail_tbl"),$("#pasi_bc23_tab_container"),$("#pasi_bc23_tab .ui-tabs-nav"),20); 
	 	},100);
	 
	});
		  	
</script>

	
	