<div style="height:40px;">
	<button id="btnsendtoinventory" >Send To Inventory</button><span style="padding-left:10px;" />
	<button id="btncanceltoinventory" >Cancel To Inventory</button><span style="padding-left:10px;" />
	<button id="btnviewpartnumberbc271move" >View Part Number</button><span style="padding-left:10px;" />
	<select type="text" id="slcmovedatabc271" style="width:130px" value='-' >
		 <option value="-"></option>
		 <option value="1">MOVE TO BC262</option>
		 <option value="2">MOVE TO BC23</option>
		 <option value="3">MOVE TO BC40</option>
	</select>
	<button id="btnmovedatabc271" >MOVE DATA</button>
	
</div>
<table id="tblbc271detilitemsmove"></table> <div id="ptblbc271detilitemsmove"></div>
<input type="hidden" id="idhdrbc271move" value="<?php echo $idhdrbc23; ?>" />
<input type="hidden" id="inv_hdr_idbc271move" value="<?php echo $id_inv_hdr; ?>" />
<input type="hidden" id="bc271noinvmove" value="<?php echo $noinv; ?>" />
<input type="hidden" id="hdnnobc271" value="<?php echo $nobc23; ?>" />

<script type="text/javascript">
    
    $(document).ready(function(){
		$("#btncanceltoinventory").button().click(function(){
			var form_data = {
				id_hdr:$("#idhdrbc271move").val(),
				doc_in_from_id:4
				
			};
			
			$("#dlg_movebc271_data_to_inv_cancel").dialog( "destroy" );
			$(".dlg_movebc271_data_to_inv_cancel_cl").remove();
			$("body").append('<div id="dlg_movebc271_data_to_inv_cancel" title="Warning" class="dlg_movebc271_data_to_inv_cancel_cl"><p>Apakah anda yakin akan membatalkan data bc271 ini menjadi data inventory incoming dengan nomor bc271 '+ $("#hdnnobc271").val() +'..?</p><br />Mohon diperiksa kembali datanya.</div>');
			$("#dlg_movebc271_data_to_inv_cancel").dialog({
				height: 200,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'exim/ct_bc23_view_dtl/movedatabc23_to_inventory_cancel'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_movebc271_data_to_inv_cancel").dialog("close");
								$('#dlg_movebc271_data_to_inv_cancel').dialog("destroy"); 
								$(".dlg_movebc271_data_to_inv_cancel_cl").remove(); 
								$("body").append('<div id="dlg_movebc271_data_to_inv_cancel" title="Warning" class="dlg_movebc271_data_to_inv_cancel_cl"></div>');
			
								
							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlg_movebc271_data_to_inv_cancel").dialog("close");
								$('#dlg_movebc271_data_to_inv_cancel').dialog("destroy"); 
								$(".dlg_movebc271_data_to_inv_cancel_cl").remove(); 
								
							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlg_movebc271_data_to_inv_cancel" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlg_movebc271_data_to_inv_cancel').dialog("destroy"); 
					$(".dlg_movebc271_data_to_inv_cancel_cl").remove(); 
					$("body").append('<div id="dlg_movebc271_data_to_inv_cancel" title="Warning" class="dlg_movebc271_data_to_inv_cancel_cl"><p>Apakah anda yakin akan membatalkan data bc271 ini menjadi data inventory incoming dengan nomor bc271 '+ $("#hdnnobc271").val() +'..?</p><br />Mohon diperiksa kembali datanya.</div>.</div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		
		});
		$("#btnsendtoinventory").button().click(function(){
			var form_data = {
				id_hdr:$("#idhdrbc271move").val(),
				doc_in_from_id:4
			};
			
					
			$("#dlg_movebc271_data_to_inv").dialog( "destroy" );
			$(".dlg_movebc271_data_to_inv_cl").remove();
			$(".dlg_movebc271_data_to_inv_cl").html('');
			$("body").append('<div id="dlg_movebc271_data_to_inv" title="Warning" class="dlg_movebc271_data_to_inv_cl"><p>Apakah anda yakin akan mengirim data bc271 ini menjadi data inventory incoming dengan nomor bc271 '+ $("#hdnnobc271").val() +'..?</p><br />Mohon diperiksa kembali datanya.</div>');
			$("#dlg_movebc271_data_to_inv").dialog({
				height: 200,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'exim/ct_bc23_view_dtl/movedatabc23_to_inventory'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlg_movebc271_data_to_inv").dialog("close");
								$('#dlg_movebc271_data_to_inv').dialog("destroy"); 
								$(".dlg_movebc271_data_to_inv_cl").remove(); 
								$(".dlg_movebc271_data_to_inv_cl").html('');
								$("body").append('<div id="dlg_movebc271_data_to_inv" title="Warning" class="dlg_movebc271_data_to_inv_cl"></div>');
			
							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlg_movebc271_data_to_inv").dialog("close");
								$('#dlg_movebc271_data_to_inv').dialog("destroy"); 
								$(".dlg_movebc271_data_to_inv_cl").remove(); 
								$(".dlg_movebc271_data_to_inv_cl").html('');
								
							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlg_movebc271_data_to_inv" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlg_movebc271_data_to_inv').dialog("destroy"); 
					$(".dlg_movebc271_data_to_inv_cl").remove(); 
					$("body").append('<div id="dlg_movebc271_data_to_inv" title="Warning" class="dlg_movebc271_data_to_inv_cl"><p>Apakah anda yakin akan mengirim data bc271 ini menjadi data inventory incoming  nomor bc271 '+ $("#hdnnobc271").val() +'..?</p><br />Mohon diperiksa kembali datanya.</div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
		
		});
		$("#btnmovedatabc271").button().click();
		
		$("#btnviewpartnumberbc271move").button().click(function(){
			var form_data = {
				id_hdr:$("#idhdrbc271move").val()
			}; 
			$("#frmpartnumberbc271_move_dlg").load('<?php echo base_url().'exim/ct_bc23_view_dtl/view_bc23_move_partnumber'; ?>',  {parmeter:'parameter', id_inv_hdr:$("#inv_hdr_idbc271move").val(), 'noinv':$("#bc271noinvmove").val(), idhdrbc271:$("#idhdrbc271move").val()}, function() {
				$("#frmpartnumberbc271_move_dlg").dialog({
					modal:true,
					width : 1000,
					height : 530,
					buttons: {
                        "Close": function() {  
							$(".ui-dialog-titlebar-close").trigger('click');  
							
						}
                    },
					close : function(){
						$('#frmpartnumberbc271_move_dlg').dialog("destroy"); 
					    $(".frmpartnumberbc271_move_dlg_cl").remove(); 
					    $("body").append('<div id="frmpartnumberbc271_move_dlg" title="PART NUMBER" class="frmpartnumberbc271_move_dlg_cl"></div>'); 
	
					},
					open: function(){
						$("body").unblock();
						
					}
				});
			});	
		
		
		
		});
		
		jQuery("#tblbc271detilitemsmove").jqGrid({
			url:'<?php echo base_url().'exim/ct_bc23_view_dtl/loaddata'; ?>',
			mtype : "post",
			postData:{'q':'1', idhdrbc23:$("#idhdrbc271move").val()},
			datatype: "json",
			colNames:['id_bc_in_dtl', 'id_hdr', 'CAR','Serial', 'JnsBarangDtl', 'TujuanKirimDtl', 'NoHs', 'SeriTrp', 'BrgUrai'
					,'Merk','Tipe','SpfLain','KdBrg','Penggunaan','KemasJn','KemasJm','KdFasDtl','BrgAsal','DNilInv','KdSat','JmlSat','NettoDtl'
					,'SatBmJm','SatCukJm','DtlOk','create_date','create_by','update_date','update_by'
					],
			colModel:[
				{name:'id_bc_in_dtl',index:'id_bc_in_dtl', width:30, hidden:true},
				{name:'id_hdr',index:'id_hdr', width:30, hidden:true},
				{name:'CAR',index:'CAR', width:30, hidden:true},
				{name:'Serial',index:'Serial', width:30, hidden:false},
				{name:'JnsBarangDtl',index:'JnsBarangDtl', width:30, hidden:true},
				{name:'TujuanKirimDtl',index:'TujuanKirimDtl', width:30, hidden:true},
				{name:'NoHs',index:'NoHs', width:94, hidden:false},
				{name:'SeriTrp',index:'SeriTrp', width:30, hidden:true},
				{name:'BrgUrai',index:'BrgUrai', width:149, hidden:false},
				{name:'Merk',index:'Merk', width:30, hidden:true},
				{name:'Tipe',index:'Tipe', width:30, hidden:true},
				{name:'SpfLain',index:'SpfLain', width:30, hidden:true},
				{name:'KdBrg',index:'KdBrg', width:89, hidden:false},
				{name:'Penggunaan',index:'Penggunaan', width:30, hidden:true},
				{name:'KemasJn',index:'KemasJn', width:30, hidden:true},
				{name:'KemasJm',index:'KemasJm', width:30, hidden:true},
				{name:'KdFasDtl',index:'KdFasDtl', width:30, hidden:true},
				{name:'BrgAsal',index:'BrgAsal', width:30, hidden:true},
				{name:'DNilInv',index:'DNilInv', width:129, hidden:false, align:'right', formatter:'number'},
				{name:'KdSat',index:'KdSat', width:60, hidden:false},
				{name:'JmlSat',index:'JmlSat', width:91, hidden:false, align:'right', formatter:'number'},
				{name:'NettoDtl',index:'NettoDtl', width:30, hidden:true},
				{name:'SatBmJm',index:'SatBmJm', width:30, hidden:true},
				{name:'SatCukJm',index:'SatCukJm', width:30, hidden:true},
				{name:'DtlOk',index:'DtlOk', width:30, hidden:true},
				{name:'create_date',index:'create_date', width:30, hidden:true},
				{name:'create_by',index:'create_by', width:30, hidden:true},
				{name:'update_date',index:'update_date', width:30, hidden:true},
				{name:'update_by',index:'update_by', width:30, hidden:true},
				
			],
			rowNum:10,
			rowList:[10,20,30],
			pager: '#ptblbc271detilitemsmove',
			sortname: 'id_bc_in_dtl',
			viewrecords: true,
			sortorder: "asc",
			width: 950,
			height:290,
			jsonReader: { repeatitems : false },
			caption:"Detil Barang",
			//rownumbers: true,
			shrinkToFit: false,
			afterInsertRow: function(){
				
				
			}	
		
		});
		
		jQuery("#tblbc271detilitemsmove").jqGrid('navGrid','#ptblbc271detilitemsmove',{del:false,add:false,edit:false},{},{},{},{multipleSearch:false});
		
	});
		  	
</script>
<div id="frmpartnumberbc271_move_dlg" title="PART NUMBER" class="frmpartnumberbc271_move_dlg_cl"></div>


	
	