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

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

$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]."' ");
} else {
	mysql_query("update tbl_banquet set status = 'cancel' where no_banquet = '".$_POST[idx]."' ");
}

if ($_POST[down_paymen] > 0){
	echo "<script language='JavaScript'>document.location='../index2.php?p=casher_retur&idx=".$_POST[idx]."'</script>";
} else {
	echo "<script language='JavaScript'>document.location='../index2.php?p=".$_POST[p]."'</script>";
}


?>