$sql = "UPDATE tblreservation SET Status='Check Out' WHERE Confirmation='" . $confirmation . "'"; $conn->query($sql); if ($type == "Administrator") { header("Location: ../pages/transaction.php"); } else { header("Location: ../pages/transaction-staff.php"); } } else { echo "An error occured during the operation"; } $conn->close(); } else { echo "<script>alert('It seems you are not the one who check out the reservation. The user in charge will given a notification that the reservation has been check out.');</script>"; $message = $reservationname . " " . "was Checkout to Room" . " " . $roomtype . " " . "by " . " " . $userincharge . " " . date('Y-m-d'); $notification = new Notifier($userincharge, $user, $message); if ($notification->NotifyUser()) { $transaction = new Transaction(Reservation::GetReservationID($reservationid), Transaction::GetReservationCustomerID($confirmation), $datereservation, $datenow, $dateout, $payable, $checkout, $userincharge); if ($transaction->CheckOut(Transaction::GetReservationCustomerID($confirmation), $userincharge == 1, $confirmation)) { $sql = "UPDATE tblreservation SET Status='Check Out' WHERE Confirmation='" . $confirmation . "'"; $conn->query($sql); if ($type == "Administrator") { echo '<script>window.location="../pages/transaction.php";</script>'; } else { echo '<script>window.location="../pages/index-staff.php";</script>'; } } else { echo "An error occured during the operation"; $conn->close(); } } }