<div style="" >
  <div>
     <table width="320" border="0">
      <tr>
        <td width="167">KODE BARANG</td>
        <td width="8"><div align="center">:</div></td>
        <td width="204"><input type="text" name="txtkodebarang" id="txtfgcodeupdatekodebarang"  value="<?php echo $kd_brg; ?>" style="width:160px"/></td>
      </tr>
      <tr>
        <td>NAMA BARANG </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtnamabarang" id="txtfgcodeupdatenamabarang" value="<?php echo $nama_barang; ?>" style="width:160px"/></td>
      </tr>
      <tr>
        <td>SATUAN </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtsatuan" id="txtfgcodeupdatesatuan" value="<?php echo $satuan; ?>" style="width:160px"/></td>
      </tr>
      </table>
  </div>
 </div>
 <input type="hidden" id="idfinishgoodcode" value="<?php echo $idx; ?>" />
 <br />
 <span style="padding-left:245px" /><button id="btnfinishgoodcodeupdateparths" >Update</button>
<script type="text/javascript">
    
    $(document).ready(function(){
		$("input.numeric").numeric();
		$("#txtfgcodeupdatekodebarang").focusout(function(){
			var value = $("#txtfgcodeupdatekodebarang").val(); 
			value = value.replace(/\s/g, '');
			$("#txtfgcodeupdatekodebarang2").val(value);
		});
		$("#btnfinishgoodcodeupdateparths").button().click(function(){
		
			$("#dlgfgupdateparths").dialog( "destroy" );
			$(".dlgfgupdateparths_cl").remove();
			$("body").append('<div id="dlgfgupdateparths" title="Warning" class="dlgfgupdateparths_cl"><p>Apakah anda akan melakukan update kode barang ini?!?</p><br /></div>');
			var form_data = {
				kodebarang:$("#txtfgcodeupdatekodebarang").val(),
				namabarang:$("#txtfgcodeupdatenamabarang").val(),
				satuan:$("#txtfgcodeupdatesatuan").val(),
				id:$("#idfinishgoodcode").val(),
			};
				
			$("#dlgfgupdateparths").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'pasi_settings/ct_finishgoodcode/updatekodebarang'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlgfgupdateparths").dialog("close");
								$('#dlgfgupdateparths').dialog("destroy"); 
								$(".dlgfgupdateparths_cl").remove(); 
								$('#tbl_finishgoodcode').trigger('reloadGrid');

							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlgfgupdateparths").dialog("close");
								$('#dlgfgupdateparths').dialog("destroy"); 
								$(".dlgfgupdateparths_cl").remove(); 

							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlgfgupdateparths" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlgfgupdateparths').dialog("destroy"); 
					$(".dlgfgupdateparths_cl").remove(); 
					$("body").append('<div id="dlgfgupdateparths" title="Warning" class="dlgfgupdateparths_cl"><p>Apakah anda akan melakukan update part hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		
		});

	});
		  	
</script>



	
	