web_php/hotel_booking/reserved.php

164 lines
No EOL
7.1 KiB
PHP

<?php
require('admin/components/utils.php');
require('admin/components/db_config.php');
date_default_timezone_set("America/Chicago");
session_start();
if(!(isset($_SESSION['login']) && $_SESSION['login'] == true)){
redirect('index.php');
}
if(isset($_POST['reserve_now'])){
$orderId = 'ORDS_'.$_SESSION['uerID'].random_int(11111, 9999999999);
$customerId = $_SESSION['uerID'];
$amount = $_SESSION['room']['payment'];
}
///insert data into database
$frm_data = filteration($_POST);
$query1 = "INSERT INTO `booking_order`(`user_id`, `room_id`, `check_in`, `check_out`, `order_id`) VALUES (?, ?, ?, ?, ?)";
insert($query1, [$customerId, $_SESSION['room']['id'], $frm_data['checkin'], $frm_data['checkout'], $orderId], 'issss');
$booking_id = mysqli_insert_id($con);
$query2 = "INSERT INTO `booking_detail`(`booking_id`, `room_name`, `price`, `total_pay`, `user_name`, `user_lastname`, `phone`, `address`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
insert($query2, [$booking_id, $_SESSION['room']['name'], $_SESSION['room']['price'], $amount, $frm_data['firstname'], $frm_data['lastname'], $frm_data['phone'], $frm_data['address']], 'isiissss');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reserved Room confirmation | Midtown Hotel</title>
<?php require('./components/link.php') ?>
<style>
.card-header-top, .card-header-bottom{
display: flex;
justify-content: space-between;
}
.card-header-top-left img{
width: 100px;
}
.card-header-top-right p{
font-size: 14px;
}
.card-footer p{
font-size: 14px;
}
.card-header-bottom-left p, .card-header-right p{
font-size: 16px;
}
.text-title{
font-size: 16px;
}
@media (max-width: 550px){
.card-header-top-left img{
width: 80px;
}
.card-header-top-right p{
font-size: 12px;
}
.card-footer p{
font-size: 12px;
}
.card-header-bottom{
flex-direction: column;
}
.card-header-bottom-left p, .card-header-right p{
font-size: 14px;
}
.text-title, .text-subtitle, .card-summary p{
font-size: 14px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="card" style="margin: auto; max-width: 650px; margin-top: 50px; margin-bottom: 50px;">
<div class="card-header">
<div class="card-header-top" style="margin-top: 25px;">
<div class="card-header-top-left">
<img src="./images/logo.png"/>
</div>
<div class="card-header-top-right text-end">
<p style="font-size: 16px; text-transform: uppercase; font-weight: 600;">Midtown Hotel</p>
<p>36381 Trantow Hill,</p>
<p>New Port, FL 57941</p>
<p>(123) 456-7891</p>
<p>accombooking@midtownhotel.com</p>
</div>
</div>
<?php
$booking_q = mysqli_query($con, "SELECT bo.*, bd.* FROM `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id WHERE bo.booking_status = 'pending'");
while($data = mysqli_fetch_assoc($booking_q)){
$date = date("M-d-Y", strtotime($data['datentime']));
$checkin = date("M-d-Y", strtotime($data['check_in']));
$checkout = date("M-d-Y", strtotime($data['check_out']));
$order_id = $data['order_id'];
$customer_name = $data['user_name'];
$customer_last = $data['user_lastname'];
$customer_address = $data['address'];
$customer_phone = $data['phone'];
$room_price = $data['price'];
$room_detail = $data['room_name'];
$total_pay = $data['total_pay'];
$tax = $data['total_pay'] * 0.05;
$total_amount = $tax + $total_pay;
}
?>
<div class="card-header-bottom" style="margin-top: 25px;">
<div class="card-header-bottom-left text-start">
<p style="font-weight: 600;">Bill to:</p>
<p style="text-transform: capitalize;"><?php echo $customer_name ?> <span><?php echo $customer_last ?></span></p>
<p><?php echo $customer_address ?></p>
<p><?php echo $customer_phone ?></p>
</div>
<div class="card-header-right text-start">
<p><b>Order ID:</b> <?php echo $order_id ?></p>
<p><b>Reservation date:</b> <?php echo $date ?></p>
<p><b>Due date:</b> <?php echo $checkin ?></p>
</div>
</div>
</div>
<div class="card-body">
<table class="table table-striped">
<thead>
<tr class="text-start text-title">
<th scope="col">Details</th>
<th scope="col">Check in</th>
<th scope="col">Check out</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
<tr class="text-start text-subtitle">
<td><?php echo $room_detail?></td>
<td><?php echo $checkin?></td>
<td><?php echo $checkout?></td>
<td>$<?php echo $room_price?>/night</td>
</tr>
</tbody>
</table>
</div>
<div class="card-summary text-end" style="margin: 20px;">
<p><b>Total:</b> $<?php echo $total_pay?></p>
<p><b>Sale Tax(5%):</b> $<?php echo $tax?></p>
<p><b>Total Amount:</b> $<?php echo $total_amount?></p>
</div>
<div class="card-footer">
<p><span style="color: red;">*</span> Please pay the invoice before checking-in to the room. You can pay the invoice by bringing this invoice to make a payment at the hotel reception desk. <span style="color: red;">*</span></p>
<p><span style="color: red;">**</span> Check-in time starts at 3:00 pm, but not later than 10:00 pm. Check-out time is until 11:00 am.<span style="color: red;">**</span></p>
<p><span style="color: red;">***</span> Please contact accombooking@midtownhotel.com or call (123) 456-7891 if you arrive later than 10:00 pm. Your reservation will be determinated if you do not make a payment or contact the hotel reception desk before 10:00 pm.<span style="color: red;">***</span></p>
</div>
</div>
</div>
<?php require('./components/script.php') ?>
</body>
</html>