<div style="" >
  <div>
     <table width="320" border="0">
      <tr>
        <td width="167">PART NO </td>
        <td width="8"><div align="center">:</div></td>
        <td width="204"><input type="text" name="txtbahanbakuupdatepartno" id="txtbahanbakuupdatepartno"  value="<?php echo $part_no; ?>" style="width:160px"/></td>
      </tr>
      <tr>
        <td>PART NAME </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtpartname" id="txtbahanbakuupdatepartname" value="<?php echo $part_name; ?>" style="width:160px"/></td>
      </tr>
      <tr>
        <td>PART NAME CUSTOMS </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtpartnamecustoms" id="txtbahanbakuupdatepartnamecustoms" value="<?php echo $part_name_customs; ?>" style="width:160px"/></td>
      </tr>
      <tr>
        <td>HS CODE </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txthscode" id="txtbahanbakuupdatehscode" value="<?php echo $hs_code; ?>" style="width:160px"/></td>
      </tr>
      <tr>
        <td>BM</td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtbm" id="txtbahanbakuupdatebm" value="<?php echo $bm; ?>" style="width:160px" class='numeric'/></td>
      </tr>
      <tr>
        <td>CEK PRICE </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtbahanbakuupdatecekprice" id="txtbahanbakuupdatecekprice" value="<?php echo $cek_price; ?>" style="width:160px" class='numeric'/></td>
      </tr>
      <tr>
        <td>PART NO 2 </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtpartno2" id="txtbahanbakuupdatepartno2" value="<?php echo $part_no2; ?>" style="width:160px"/></td>
      </tr>
	   <tr>
        <td>KODE BARANG </td>
        <td><div align="center">:</div></td>
        <td><input type="text" name="txtpartno2" id="txtbahanbakuupdatekode_barang" value="<?php echo $kode_barang; ?>" style="width:160px"/></td>
      </tr>
      </table>
  </div>
 </div>
 <input type="hidden" id="hdnbahanbakuid_part_hs" value="<?php echo $idx; ?>" />
 <br />
 
 <span style="padding-left:130px" /><button id="btnbahanbakuupdateparths" >Update</button><span style="padding-left:10px" /><button id="btnbahanbakuinsertparths" >Insert</button>
<?php if($this->session->userdata('DX_username') == 'admin' || $this->session->userdata('DX_username') == 'yayan' || $this->session->userdata('DX_username') == 'nurhadi' || $this->session->userdata('DX_username') == 'ojah'){ ?>
	<span style="padding-left:10px" /><button id="btnbahanbakudeleteparths" >Delete</button>
 <?php } ?>
 <script type="text/javascript">
    
    $(document).ready(function(){
		$("input.numeric").numeric();
		$("#txtbahanbakuupdatepartno").focusout(function(){
			var value = $("#txtbahanbakuupdatepartno").val(); 
			value = value.replace(/\s/g, '');
			$("#txtbahanbakuupdatepartno2").val(value);
		});
		$("#btnbahanbakuinsertparths").button().click(function(){
			var form_data = {
				part_no:$("#txtbahanbakuupdatepartno").val(),
				partname:$("#txtbahanbakuupdatepartname").val(),
				partnamecustoms:$("#txtbahanbakuupdatepartnamecustoms").val(),
				bm:$("#txtbahanbakuupdatebm").val(),
				cekprice:$("#txtbahanbakuupdatecekprice").val(),
				part_no2:$("#txtbahanbakuupdatepartno2").val(),
				hscode:$("#txtbahanbakuupdatehscode").val(),
				id:$("#hdnbahanbakuid_part_hs").val(),
			};
			
			$("#dlgbahanbakuinsertparths").dialog( "destroy" );
			$(".dlgbahanbakuinsertparths_cl").remove();
			$("body").append('<div id="dlgbahanbakuinsertparths" title="Warning" class="dlgbahanbakuinsertparths_cl"><p>Apakah anda akan melakukan insert part hs ini?!?</p><br /></div>');
			$("#dlgbahanbakuinsertparths").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/insertparths'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlgbahanbakuinsertparths").dialog("close");
								$('#dlgbahanbakuinsertparths').dialog("destroy"); 
								$(".dlgbahanbakuinsertparths_cl").remove(); 
								$("body").append('<div id="dlgbahanbakuinsertparths" title="Warning" class="dlgbahanbakuinsertparths_cl"></div>');
			

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

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

					}
				},
				close : function(){
					$('#dlgbahanbakuinsertparths').dialog("destroy"); 
					$(".dlgbahanbakuinsertparths_cl").remove(); 
					$("body").append('<div id="dlgbahanbakuinsertparths" title="Warning" class="dlgbahanbakuinsertparths_cl"><p>Apakah anda akan melakukan insert part hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		
		});
		$("#btnbahanbakuupdateparths").button().click(function(){
		
			$("#dlgbahanbakuupdateparths").dialog( "destroy" );
			$(".dlgbahanbakuupdateparths_cl").remove();
			$("body").append('<div id="dlgbahanbakuupdateparths" title="Warning" class="dlgbahanbakuupdateparths_cl"><p>Apakah anda akan melakukan update part hs ini?!?</p><br /></div>');
			var form_data = {
				part_no:$("#txtbahanbakuupdatepartno").val(),
				partname:$("#txtbahanbakuupdatepartname").val(),
				partnamecustoms:$("#txtbahanbakuupdatepartnamecustoms").val(),
				bm:$("#txtbahanbakuupdatebm").val(),
				cekprice:$("#txtbahanbakuupdatecekprice").val(),
				part_no2:$("#txtbahanbakuupdatepartno2").val(),
				hscode:$("#txtbahanbakuupdatehscode").val(),
				id:$("#hdnbahanbakuid_part_hs").val(),
				kode_barang:$("#txtbahanbakuupdatekode_barang").val(),
			};
			
			
			$("#dlgbahanbakuupdateparths").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'exim/ct_bc23_view_dtl/updateparths'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlgbahanbakuupdateparths").dialog("close");
								$('#dlgbahanbakuupdateparths').dialog("destroy"); 
								$(".dlgbahanbakuupdateparths_cl").remove(); 
								$('#tbl_parths').trigger('reloadGrid');

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

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

					}
				},
				close : function(){
					$('#dlgbahanbakuupdateparths').dialog("destroy"); 
					$(".dlgbahanbakuupdateparths_cl").remove(); 
					$("body").append('<div id="dlgbahanbakuupdateparths" title="Warning" class="dlgbahanbakuupdateparths_cl"><p>Apakah anda akan melakukan update part hs ini?!?</p><br /></div>');     
					
				},
				open: function(){
					$("body").unblock();
					
				}
			});
		
		});
		
		
		$("#btnbahanbakudeleteparths").button().click(function(){
			$("#dlgbahanbakudeleteparths").dialog( "destroy" );
			$(".dlgbahanbakudeleteparths_cl").remove();
			$(".dlgbahanbakudeleteparths_cl").html('');
			
			$("body").append('<div id="dlgbahanbakudeleteparths" title="Warning" class="dlgbahanbakudeleteparths_cl"><p>Apakah anda akan melakukan <b>DELETE</b> part hs ini?!?</p><br /></div>');
			var form_data = {
				idx:$("#hdnbahanbakuid_part_hs").val()
			};
			
			
			$("#dlgbahanbakudeleteparths").dialog({
				height: 160,
				width: 250,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url : "<?php echo base_url().'settings/ct_barangbahanbaku/delete_data_part_hs'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#dlgbahanbakudeleteparths").dialog("close");
								$('#dlgbahanbakudeleteparths').dialog("destroy"); 
								$(".dlgbahanbakudeleteparths_cl").remove(); 
								$(".dlgbahanbakudeleteparths_cl").html('');
								$('#tbl_parths').trigger('reloadGrid');

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

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

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

	});
		  	
</script>



	
	