<div style="height:40px;">
	<span style="color:#f8073e;font-weight: bold;">PERHATIAN!! MOHON SETELAH DI SEND, DI MODUL CEISA DISAVE DULU HEADERNYA (UBAH KEMUDIAN SAVE), KALO TIDAK DATABASE AKAN ERROR!!!</span>
	<input type="hidden" id="id_bc23_hdr_ceisa" value="<?php echo $id_bc_in_hdr; ?>" />
	<br /> NO. INVOICE : <br /><?php echo $no_inv; ?>
	<br />
	Aju Terakhir : <?php echo $last_car; ?> 
	<br />
	Aju Selanjutnya : <?php echo$next_car; ?> 
	<button id="bc23_send_ceisa">SEND CEISA</button>&nbsp;&nbsp;<br />
	<span id="get_ceisa_bc23"><?php echo $car; ?></span><button id="bc23_get_ceisa">GET CEISA</button> 
</div>
<script type="text/javascript">
    
    $(document).ready(function(){
		$("#bc23_send_ceisa").button().click(function(){
			var id = jQuery("#tblbc23hdr").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc23hdr").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};
						
			if ($.trim(ret.CAR).length > 4){
				alert('car sudah ada');
			    return false;
			}	
			var form_data = {
				
				id_bc_in_hdr:ret.id_bc_in_hdr 
			
			};
			
			
			$("#bc23_proses_send_ceisa").dialog( "destroy" );
			$(".bc23_proses_send_ceisacl").remove();
			$(".bc23_proses_send_ceisacl").html('');
			$("body").append('<div id="bc23_proses_send_ceisa" title="Warning" class="bc23_proses_send_ceisacl"><p>Apakah anda akan melakukan Kirim Data Ceisa?</div>');
			$("#bc23_proses_send_ceisa").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23/proses_bc23_ceisa'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc + " ID =" + msg.insert_id);
								$("#bc23_proses_send_ceisa").dialog("close");
								$('#bc23_proses_send_ceisa').dialog("destroy"); 
								$(".bc23_proses_send_ceisacl").remove(); 
								$(".bc23_proses_send_ceisacl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
							
							} else { 
								alert(msg.sts+msg.desc);
								$("#bc23_proses_send_ceisa").dialog("close");
								$('#bc23_proses_send_ceisa').dialog("destroy"); 
								$(".bc23_proses_send_ceisacl").remove(); 		

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

					}
				},
				close : function(){
					$('#bc23_proses_send_ceisa').dialog("destroy"); 
					$(".bc23_proses_send_ceisacl").remove(); 
					$("body").append('<div id="bc23_proses_send_ceisa" title="Warning" class="bc23_proses_send_ceisacl"><p>Apakah anda akan melakukan Update Terhadap no BL ini?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');     
					$(".bc23_proses_send_ceisacl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});		
		
			
		});
		
		$("#bc23_get_ceisa").button().click(function(){
			var id = jQuery("#tblbc23hdr").jqGrid('getGridParam','selrow');
			if (id) { 
				var ret = jQuery("#tblbc23hdr").jqGrid('getRowData',id);
				
			} else {
				alert("Please Select Row");
				return false;
			};
						
			
			var form_data = {
				
				id_bc_in_hdr:ret.id_bc_in_hdr 
			
			};
			
			
			$("#bc23_proses_get_ceisa").dialog( "destroy" );
			$(".bc23_proses_get_ceisacl").remove();
			$(".bc23_proses_get_ceisacl").html('');
			$("body").append('<div id="bc23_proses_get_ceisa" title="Warning" class="bc23_proses_get_ceisacl"><p>Apakah anda akan melakukan Tarik <b>No Daftar</b> Data Ceisa?</div>');
			$("#bc23_proses_get_ceisa").dialog({
				height: 200,
				width: 350,
				modal: true,
				hide: 'Slide',
				autoOpen: 'false',
				buttons: {
					"CONFIRM": function() {
					$.ajax({
						url :"<?php echo base_url().'exim/ct_bc23/proses_get_bc23_ceisa'; ?>",
						type : 'POST',
						dataType: 'json',
						data : form_data,
						success: function(msg){
							if (msg.sts == '00'){
								alert(msg.desc);
								$("#bc23_proses_get_ceisa").dialog("close");
								$('#bc23_proses_get_ceisa').dialog("destroy"); 
								$(".bc23_proses_get_ceisacl").remove(); 
								$(".bc23_proses_get_ceisacl").html('');
								$('#tblbc23hdr').trigger('reloadGrid');
							
							} else { 
								alert(msg.sts+msg.desc);
								$("#bc23_proses_get_ceisa").dialog("close");
								$('#bc23_proses_get_ceisa').dialog("destroy"); 
								$(".bc23_proses_get_ceisacl").remove(); 		

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

					}
				},
				close : function(){
					$('#bc23_proses_get_ceisa').dialog("destroy"); 
					$(".bc23_proses_get_ceisacl").remove(); 
					$("body").append('<div id="bc23_proses_get_ceisa" title="Warning" class="bc23_proses_get_ceisacl"><p>Apakah anda akan melakukan Update Terhadap no BL ini?</p><br />Harap Periksa Baik2 karena perubahan hanya satu kali</div>');     
					$(".bc23_proses_get_ceisacl").html('');
				},
				open: function(){
					$("body").unblock();
					
				}
			});	
			
		});

	});
		  	
</script>



	
	