<div id="container_pasi_ceisa_out_gudang" style="height:90%; margin:0px; padding:0px;overflow:'hidden'; border: 0px solid #cd0a0a">
<div class="pane-header ui-state-active" id="pasi_ceisa_gudang_out_bar" >   

<table id="pasi_ceisa_produksi_in_lot_tbl"></table> <div id="ppasi_ceisa_produksi_in_lot_tbl"></div> 

 <!--

<div style="height:100px;">
	Apakah Data Barang keluar Ini Akan di Approved?<br />
	Apabila di approved maka data akan keluar dari data stock
	<br />
	Click 'SAVE' Jika Anda Telah Yakin
	<br />
</div> -->
<br /> <!--
<table>
	<tr>
	<td>PETUGAS</td> 
	<td>:
	</td>
	<td><input type="hidden" id="PETUGAS" value=""/></td>
	</tr>
	<tr>
	<td>TANGGAL</td>
	<td>:</td>
	<td><input type="hidden" id='TANGGAL_KELUAR'  name='TANGGAL_KELUAR'    /></td>
	</tr>
 
	
</table> -->
<br />

<input type="hidden" id="id_header" value="<?php echo $id_detail ?>" />
<!--<button id="btnsimpandataapprov">SUBMIT</button> -->
<br />  
</div>

</div>

<script type="text/javascript">
    
    $(document).ready(function(){

		$(window).bind('resize', function() {  
		setTimeout(function(){
	//		setGridHight($("#pasi_ceisa_produksi_in_lot_tbl"),$("#container_pasi_ceisa_out_gudang"),$("#pasi_ceisa_gudang_out_bar")); 
		},10); 
	}); 	

		$( "#TANGGAL_KELUAR" ).datepicker({dateFormat: 'mm/dd/yy' }); 
		$("#TANGGAL_KELUAR").datepicker("setDate", new Date());
	 
		$("#btnsimpandataapprov").button().click(function(){

			var mark_id = jQuery('#pasi_ceisa_produksi_in_lot_tbl').jqGrid('getGridParam','selrow');   
					  if(!mark_id){ alert("Select Dokumen ");exit;}    
			var id = jQuery("#pasi_ceisa_produksi_in_lot_tbl").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#pasi_ceisa_produksi_in_lot_tbl").jqGrid('getRowData',id);
				
			} else {
				alert("Please dokumen");
				return false;
			};
			var form_data = {
				id_header:$("#id_header").val(),
				PETUGAS:$("#PETUGAS").val(),
				id_detail: ret.rID,
				TANGGAL_KELUAR	: getValueDate($("#TANGGAL_KELUAR"),'yymmdd'), 
 
			};
			
			$.ajax({
				url : "<?php echo base_url().'pasi_ceisa_gudang_out/ct_gudang_out_save/save_gudang_out'; ?>",
				type : 'POST',
				dataType: 'json',
				data : form_data,
				success: function(msg){
					if (msg.valid){
									alert(msg.stsmsg);  
									
								} else { alert(msg.stsno+msg.stsmsg);  }
				},
			});
			
				
			
		});
		
		jQuery("#pasi_ceisa_produksi_in_lot_tbl").jqGrid({
        url:'<?php echo base_url().'pasi_ceisa_gudang_out/ct_gudang_out_data/loaddata_gudang_out_lot'; ?>',
			mtype : "post",
			postData:{	id_detail:'<?php echo $id_detail;  ?> ',	kodebarang:'<?php echo $kodebarang;  ?> ',	namabarang:'<?php echo $namabarang;  ?> ',	itemno:'<?php echo $itemno;  ?> '},  
			datatype: "json",
			colNames:[
			'id','Nomor Lot','QTY','Satuan','Kode Barang','Nama Barang','Item No']

			,colModel:[
			{name:'rID',index:'rID', width:80, hidden:true , align :'right'}
 			,{name:'r4',index:'r4', width:200, hidden:false, align :'left'}
			,{name:'r5',index:'r5', width:100, hidden:false, align :'center'}
			,{name:'r6',index:'r6', width:60, hidden:false, align :'left'} // no faktur      stype: 'select', search:true, searchoptions:{searchhidden: true, value: '-100:All;0:DRAFT;1:SEND TO MODULE;2:MAPPING;3:FINISH;-1:CANCEL'}}
 			,{name:'r1',index:'r1', width:120, hidden:false, align :'left'}  // tanggal dokumen
			,{name:'r2',index:'r2', width:220, hidden:false, align :'left'}  // kode supp , searchoptions:{searchhidden: true,dataInit:function(el){$(el).datepicker({onSelect: function(date){jQuery("#pasi_ceisa_gudang_out_tbl")[0].triggerToolbar();},changeMonth: true,changeYear: true,dateFormat:'dd/mm/yy', showButtonPanel: true, beforeShow: function(input) {  setTimeout(function() { var buttonPane = $(input).datepicker("widget").find( ".ui-datepicker-buttonpane" );   var btn = $('<button class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" type="button">Clear</button>');   btn.unbind("click").bind("click", function () {   $.datepicker._clearDate( input );   });   btn.appendTo( buttonPane );  }, 1 );  }  });}}}	
			,{name:'r3',index:'r3', width:150, hidden:false, align :'left'}  // nama supp
  
		
			], 
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ppasi_ceisa_gudang_out_tbl',
			sortname: 'r1',
			viewrecords: true,
			sortorder: "desc",
			width: '',
			height: 280,
			//width: 950,
			//height:300,
			jsonReader: { repeatitems : false },
			caption:"PILIH LOT",
			rownumbers: true,
			loadonce: false,
			shrinkToFit: false,
			multiselect: false,
  
		}); 
		
		jQuery("#pasi_ceisa_produksi_in_lot_tbl").jqGrid('setGroupHeaders', 
            { useColSpanStyle: true, groupHeaders:[
			{startColumnName: 'r4', numberOfColumns: 3, titleText: '<em><center>LOT</center></em>'},
 			{startColumnName: 'r1', numberOfColumns: 3, titleText: '<em><center>PRODUK</center></em>'}, 
  
        ] });
		
		jQuery("#pasi_ceisa_produksi_in_lot_tbl").jqGrid('navGrid','#ppasi_ceisa_produksi_in_lot_tbl',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		jQuery("#pasi_ceisa_produksi_in_lot_tbl").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : true, defaultSearch: 'cn', ignoreCase: true});
	
	
		
//	setTimeout(function(){
//			setGridHight($("#pasi_ceisa_produksi_in_lot_tbl"),$("#container_pasi_ceisa_out_gudang"),$("#pasi_ceisa_gudang_out_bar")); 
//		},70); 


 
				
		
	});

	function getDate(){
    var today = new Date();

document.getElementById("TANGGAL_KELUAR").value = today.getFullYear() + '-' + ('0' + (today.getMonth() + 1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2);


}
		  	
</script>



	
	