<LINK href="images/index.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
    function refreshAndClose() {
        window.opener.location.reload(true);
        window.close();
    }
</script>
<body onbeforeunload="refreshAndClose();">
<?php
include("index.db.php");
mysql_connect("$server", "$username", "$password");
mysql_select_db("$database");
$mytable = "$tahun_now";
$id1 = $_POST['id'];
$do1 = $_POST['do'];
$day1 = date("d");
$month1 = date("m");
$year1 = date("Y");
$tanggalexec = "$day1/$month1/$year1";
//----------STEP
if ($do1 == "keluar"){
$bbsidangpn1 = $_POST['tempat'];
$query = "UPDATE $mytable Set BBSIDANGTGL = '$tanggalexec' where ID = '$id1'";  
$result = mysql_query($query);  
$query = "UPDATE $mytable SET BBSIDANG = '1' WHERE ID = '$id1'"; //1=Keluar 2=kembali
$result = mysql_query($query); 
$query = "UPDATE $mytable SET LOKASI = '5' WHERE ID = '$id1'"; //1=Keluar 2=kembali
$result = mysql_query($query); 
$query = "UPDATE $mytable SET BBSIDANGPN = '$bbsidangpn1' WHERE ID = '$id1'";
$result = mysql_query($query); 
echo "<b>BB TELAH DILIMPAHKAN DAN DISERAHKAN KEPADA PIHAK LAIN DAN TELAH TERCATAT DALAM SISTEM SILAHKAN TUTUP JENDELA INI</b>";
}
//----------ENDSTEP
//----------STEP
if ($do1 == "kembali"){
$simpan1 = $_POST['simpan'];
$query = "UPDATE $mytable Set BBSIDANGTGL  = '$tanggalexec' where ID = '$id11'";  
$result = mysql_query($query);  
$query = "UPDATE $mytable SET BBSIDANG = '2' WHERE ID = '$id1'"; //1=Keluar 2=kembali
$result = mysql_query($query); 
$query = "UPDATE $mytable SET LOKASI = '$simpan1' WHERE ID = '$id1'";
$result = mysql_query($query); 
echo "<b>BB TELAH DITARIK KEMBALI DAN TELAH TERCATAT DALAM SISTEM SILAHKAN TUTUP JENDELA INI</b>";

}
//----------ENDSTEP
?>
