<div id="ld" style="position:fixed; top:50%; left:50%"><img src="img/ld.gif"></div>			

<?php
	include "php_class/class_mysql.php";
	include "php_class/class_agenda.php";
	
	$dataAgenda = new dataAgenda;
	
	$id = $_POST['id'];
	$tanggal = $_POST['tanggal'];
	$nosurat = $_POST['nosurat'];
	$asal = $_POST['asal'];
	$prihal = $_POST['prihal'];
	$tujuan = $_POST['tujuan'];
	$disposisi = $_POST['disposisi'];
	$beranda = $_POST['beranda'];
	$status = $_POST['status'];
	
	$fupload_name = $_FILES['dokumen']['name']; 
	$origin_file = $_FILES['dokumen']['tmp_name'];
	
	if($fupload_name != ''){	
		if (copy($origin_file,$_SERVER['DOCUMENT_ROOT']."/simadmin/dokumen/$fupload_name")) {
			unlink($origin_file);
		}

		$dataAgenda->edit_surat($id, $tanggal, $asal,  $nosurat, $prihal, $tujuan, $disposisi, $fupload_name, $beranda);
	}else{
		$dataAgenda->edit_surat_dx($id, $tanggal, $asal,  $nosurat, $prihal, $tujuan, $disposisi, $beranda);
	}
	
	echo "<script>window.location='".$base."data-surat-keluar/".$beranda."'</script>"
?>