<div style="" >
  <div>
     <table width="320" border="0">
      <tr>
        <td width="167">ITEM CODE</td>
        <td width="8"><div align="center">:</div></td>
        <td width="204"><input type="text" name="txtkodebarang" id="txtmachinecodeupdateitemcode"  style="width:160px"/></td>
      </tr>
      <tr>
        <td>MACHINE NAME </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtnamabarang" id="txtmachinecodeupdatemachinename" style="width:160px"/></td>
      </tr>
      <tr>
        <td>TYPE </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txttype" id="txtmachinecodeupdatetype" style="width:160px"/></td>
      </tr>
      <tr>
        <td>UNIT </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtsatuan" id="txtmachinecodeupdateunit" style="width:160px"/></td>
      </tr>
      </table>
  </div>
 </div>
 <br /> 
<span style="padding-left:245px" /><button id="btnmachinecodesave" >Save</button>
<script type="text/javascript">
    
    $(document).ready(function(){

		$("#btnmachinecodesave").button().click(function(){
			var form_data = {
				kodebarang:$("#txtmachinecodeupdateitemcode").val(),
				namabarang:$("#txtmachinecodeupdatemachinename").val(),
				type:$("#txtmachinecodeupdatetype").val(),
				satuan:$("#txtmachinecodeupdateunit").val(),
			};
			
			$("#dlgmachineinsertparths").dialog( "destroy" );
			$(".dlgmachineinsertparths_cl").remove();
			$("body").append('<div id="dlgmachineinsertparths" title="Warning" class="dlgmachineinsertparths_cl"><p>Are you sure want to save this machine code ?</p><br /></div>');
			$("#dlgmachineinsertparths").dialog({
				height: 200,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'pasi_settings/ct_machinecode/insertkodebarang'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlgmachineinsertparths").dialog("close");
								$('#dlgmachineinsertparths').dialog("destroy"); 
								$('#frmmachineinsert_dlg').dialog("close"); 
								$('#frmmachineinsert_dlg').dialog("destroy");
								$(".dlgmachineinsertparths_cl").remove(); 
								$('#tbl_machinecode').trigger('reloadGrid');
							} else { 
								alert(msg.sts+msg.desc); 
								$("#dlgmachineinsertparths").dialog("close");
								$('#dlgmachineinsertparths').dialog("destroy"); 
								$(".dlgmachineinsertparths_cl").remove(); 
							}
						}
					});
				},
					"CANCEL": function() {
						$( "#dlgmachineinsertparths" ).dialog( "close" );

					}
				},
				close : function(){
					$('#dlgmachineinsertparths').dialog("destroy"); 
					$(".dlgmachineinsertparths_cl").remove(); 
					$("body").append('<div id="dlgmachineinsertparths" title="Warning" class="dlgmachineinsertparths_cl"><p>Are you sure want to save this machine code ?</p><br /></div>');     	
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		
		});
	});
		  	
</script>



	
	