From d2fe12c1eaa9becc0d4fa4b8b95c102daa13fd62 Mon Sep 17 00:00:00 2001 From: Juthatip McDevitt Date: Fri, 28 Jun 2024 17:04:50 -0500 Subject: [PATCH] created invoice pdf --- hotel_booking/admin/ajax/booking_record.php | 10 +- hotel_booking/admin/generate_invoice.php | 116 ++++++++++++++++++++ hotel_booking/reserved.php | 12 +- 3 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 hotel_booking/admin/generate_invoice.php diff --git a/hotel_booking/admin/ajax/booking_record.php b/hotel_booking/admin/ajax/booking_record.php index 95e55ff..ddfd979 100644 --- a/hotel_booking/admin/ajax/booking_record.php +++ b/hotel_booking/admin/ajax/booking_record.php @@ -8,7 +8,7 @@ if(isset($_POST['get_booking'])){ $frm_data = filteration($_POST); - $query = "SELECT bo.*, bd.* FROM `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id WHERE (bo.order_id LIKE ? OR bd.phone LIKE ? OR bd.user_name LIKE ? OR bd.user_lastname LIKE ?) AND (bo.booking_status ='pending' OR bo.booking_status ='cancel') ORDER BY bo.booking_id ASC"; + $query = "SELECT bo.*, bd.* FROM `booking_order` bo INNER JOIN `booking_detail` bd ON bo.booking_id = bd.booking_id WHERE (bo.order_id LIKE ? OR bd.phone LIKE ? OR bd.user_name LIKE ? OR bd.user_lastname LIKE ?) AND ((bo.booking_status ='pending' AND bo.arrival = 1) OR bo.booking_status ='cancel') ORDER BY bo.booking_id ASC"; $res = select($query, ["%$frm_data[search]%", "%$frm_data[search]%", "%$frm_data[search]%", "%$frm_data[search]%"], 'ssss'); $i = 1; $table_data = ""; @@ -26,11 +26,11 @@ if($data['booking_status'] == 'pending'){ $status_bg = 'bg-success'; $status = 'Booked'; - } else if($data['booking_status'] == 'cancel'){ + $invoice = ""; + } else{ $status_bg = 'bg-danger'; $status = 'Cancelled'; - } else{ - $status_bg = 'bg-warning text-dark'; + $invoice = ''; } $table_data .= " @@ -50,7 +50,7 @@ $status - + $invoice "; diff --git a/hotel_booking/admin/generate_invoice.php b/hotel_booking/admin/generate_invoice.php new file mode 100644 index 0000000..79645a6 --- /dev/null +++ b/hotel_booking/admin/generate_invoice.php @@ -0,0 +1,116 @@ + +
+
+
+
+ +
+
+

Midtown Hotel

+

36381 Trantow Hill,

+

New Port, FL 57941

+

(123) 456-7891

+

accombooking@midtownhotel.com

+
+
+
+
+

Bill to:

+

Name: $data[user_name] $data[user_lastname]

+

Adress: $data[address]

+

Phone: $data[phone]

+
+
+

Order ID: $data[order_id]

+

Invoice date: $checkin

+
+
+
+
+ + + + + + + + + + + + + + + + + +
DetailsCheck inCheck outPrice
$data[room_name]$checkin$checkout$data[price]/night
+
+

Total: $$total_pay

+

Sale Tax(0.5%): $$tax

+

Total Amount: $$total_amount

+
+
+ +
+ + "; + echo $table_data; + + } else{ + header('location: dashboard.php'); + } + +?> + \ No newline at end of file diff --git a/hotel_booking/reserved.php b/hotel_booking/reserved.php index 4750073..9561991 100644 --- a/hotel_booking/reserved.php +++ b/hotel_booking/reserved.php @@ -45,14 +45,12 @@ } .card-header-top-right p{ font-size: 14px; - line-height: 10px; } .card-footer p{ font-size: 14px; } .card-header-bottom-left p, .card-header-right p{ font-size: 16px; - line-height: 12px; } .text-title{ font-size: 16px; @@ -63,7 +61,6 @@ } .card-header-top-right p{ font-size: 12px; - line-height: 5px; } .card-footer p{ font-size: 12px; @@ -73,7 +70,6 @@ } .card-header-bottom-left p, .card-header-right p{ font-size: 14px; - line-height: 10px; } .text-title, .text-subtitle, .card-summary p{ font-size: 14px; @@ -111,6 +107,8 @@ $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; } ?>
@@ -122,7 +120,7 @@

Order ID:

-

Invoice date:

+

Reservation date:

Due date:

@@ -148,7 +146,9 @@
-

Total: $

+

Total: $

+

Sale Tax(0.5%): $

+

Total Amount: $