<?php
session_start();
require_once("../lib/dbconn.php");

/*echo "<pre>";
echo print_r($_POST);
echo "</pre>";
die();*/


$cek1 = getFromTable("select count(id) from tbl_batal_booking");
$kd = $cek1 + 1;


mysql_query("insert into tbl_batal_booking values ($kd, CURRENT_DATE, CURRENT_TIME, '".$_POST[idx]."',
			 '".$_POST[alasan]."', '".$_SESSION[nama_usr]."') ");
$id = explode("-",$_POST[idx]);

if ($id[0] == "BO"){
	mysql_query("update tbl_booking set status_booking = 'cancel' where id_booking = '".$_POST[idx]."' ");
	mysql_query("update tbl_transaksi set status_trans = 0 where no_booking = '".$_POST[idx]."' ");
} else {
	mysql_query("update tbl_banquet set status = 'cancel' where no_banquet = '".$_POST[idx]."' ");
}


echo "<script language='JavaScript'>document.location='../index2.php?p=".$_POST[p]."'</script>";


?>