0% found this document useful (0 votes)
7 views67 pages

CS Project Synopsis - Johan

The document outlines a computer science project by Johan Sanju Sebastian, focusing on a hotel management system designed to streamline hotel booking and management processes. It includes various sections such as acknowledgments, project aims, functions and modules, and a detailed description of the system's features, including user interfaces, booking management, and database integration. The project aims to enhance guest experiences and improve hotel operations through a user-friendly software solution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views67 pages

CS Project Synopsis - Johan

The document outlines a computer science project by Johan Sanju Sebastian, focusing on a hotel management system designed to streamline hotel booking and management processes. It includes various sections such as acknowledgments, project aims, functions and modules, and a detailed description of the system's features, including user interfaces, booking management, and database integration. The project aims to enhance guest experiences and improve hotel operations through a user-friendly software solution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

COMPUTER SCIENCE PROJECT

Name: Johan Sanju Sebastian


Class: 12 D
CBSE Reg No: 27121839
INDEX
Sl No. Topic Page No.

1 Acknowledgment 3

2 Title of the project 4

3 Aim of the project 5

4 Functions and Modules 7

5 Brief Description of the project 13

6 Use of Technology 28

7 Source code 34

8 Sample Output 52

9 Merits and Demerits 61

10 Bibliography 65

2
Acknowledgement

I would like to extend my heartfelt gratitude to Mrs. Lekshmi


Sunil, my teacher, for granting me the invaluable opportunity
to undertake this Computer Science project. Her support and
guidance played an indispensable role in immersing me in
extensive research and facilitating my acquisition of a
multitude of new knowledge. Completing this project would
have been a daunting task without her unwavering
assistance.

Furthermore, I wish to express my appreciation to my friends,


who generously dedicated their time to help me resolve any
doubts, rectify errors, and ultimately assist me in successfully
finishing the project. My intention in crafting this project was
not solely to obtain good grades but also to apply the
programming skills I have acquired in school to real life
scenarios.

Once again, I extend my heartfelt thanks to all those who


contributed to the successful completion of this project.

3
Hotel
Management
System

2023-24

4
Aim of the Project

5
The aim of the "JA Hotels and Resorts Booking Gateway"
project is to provide a comprehensive and user-friendly
software solution for streamlining hotel booking and
management processes. This project primarily serves two key
objectives:

1. Enhancing Guest Experience: The project aims to offer


guests a seamless and convenient way to book rooms,
access information about the hotel's services, and manage
their bookings. By providing an intuitive and user-friendly
interface, the project seeks to improve the overall experience
for guests, making it easier for them to find, reserve, and
enjoy their stay at JA Hotels and Resorts.

2. Efficient Hotel Management: For hotel administrators and


staff, the project aims to simplify and enhance the
management of hotel operations. This includes real time
monitoring of room availability, guest checkin/checkout
processes, and administrative controls over room rates and
special offers. By automating and centralizing these
processes, the project strives to improve efficiency and
reduce the likelihood of errors in managing the daytoday
operations of the hotel.

In summary, the primary aim of the "JA Hotels and Resorts


Booking Gateway" project is to bridge the gap between guests
and hotel management by providing a digital platform that
streamlines the entire booking process and makes it more
user friendly for both parties. This results in an improved
guest experience and more efficient hotel operations,
ultimately contributing to the success and reputation of JA
Hotels and Resorts.

6
Functions and
Modules

7
Modules:
1. tkinter:
A module for creating the graphical user interface (GUI) of the
application. It provides widgets for building the user interface,
such as buttons and entry fields.

2. tkinter.font:
A module for setting custom fonts in the GUI components. It
allows you to specify fonts for text elements.

3. tkinter.ttk:
Part of the tkinter library and used for creating themed Tkinter
widgets. It enhances the appearance of GUI elements.

4. PIL (Python Imaging Library):


Used for handling image files, including opening, resizing, and
displaying images in the GUI.

5. datetime:
Provides classes for manipulating dates and times, allowing
the application to work with data related operations.

6. reportlab:
Used for generating PDF documents, particularly for creating
receipts in the hotel reservation system.

7. mysql.connector:
Provides a Python interface for communicating with a MySQL
database. It allows the system to interact with the database
for storing and retrieving reservation data.

8
Functions:
1. update_rooms_dictionary():
Updates the rooms dictionary with room numbers and their
availability status by querying a MySQL database. This
function is used to keep track of room availability.

2. welcome_screen():
Displays a welcome screen with a colorful background and a
message using the turtle library. It provides a visual greeting
to users.

3. home_page():
Creates the main GUI window for the hotel reservation
system. It displays a background image and provides buttons
for booking and contacting the hotel.

4. contact_us():
A placeholder function intended to provide contact information
for users to get in touch with the hotel.

5. admin_panel():
Creates an admin control panel with options to book, check,
update, cancel reservations, and view room availability. It
interacts with a MySQL database to perform these operations.

6. book_now_btn_command():
A function called when the "Book Now" button is clicked. It
opens the login screen for users to log in and book rooms.

7. display():
Displays the reservation data in a treeview widget in the

9
admin panel. It fetches and presents reservation information.

8. book():
Allows users to book a room. This function checks room
availability, selects an unoccupied room, and inserts the
booking data into the MySQL database.

9. check_date():
Validates the selected booking date to ensure it is in the
future.

10. clear():
Clears the input fields on the booking and checkout screens,
making it easy for users to reset their input.

11. search():
Searches for a booking by name and populates the input
fields with the booking data, helping users to find and manage
their reservations.

12. cancel():
Cancels a reservation and sets the room's availability status
back to unoccupied in the database.

13. update():
Allows users to update reservation details. This function
modifies existing reservation information in the MySQL
database.

14. room_format():
Converts the selected room type into a numeric format (0 for
suite, 1 for double, 2 for normal) for proper storage in the
database.

10
15. check():
Checks room availability and ensures that vacant rooms are
available for booking. It helps manage room occupancy.

16. colour_format():
Used to format the background color of room availability
labels in the admin panel based on their availability status.

17. stat():
Refreshes the admin panel and updates room availability,
showing the current room status.

18. booking_screen():
Creates a GUI window for the hotel booking screen, where
users can input their booking details and interact with the
reservation system.

19. login_screen():
Creates a GUI window for the login screen, allowing users to
log in with a username and password. Depending on the
credentials, users can access different parts of the system.

20. checkout():
Creates a GUI window for the checkout screen, where users
can calculate the cost of their stay and make payments. It
generates PDF receipts and updates room availability in the
database.

21. calculate_total():
Calculates the total cost for a booking based on room type
and the number of nights stayed, helping users understand
their expenses.

11
22. payment():
Handles the payment process, generates a PDF receipt for
users, and updates the room availability in the database upon
successful checkout.

12
Brief Description of
the Project

13
This project is a hotel reservation system with a graphical
user interface (GUI) that allows users to book and manage
hotel rooms. It is a comprehensive software application
designed to streamline the hotel booking process. It offers
both users and administrators a user-friendly interface for
managing room reservations and related operations. The
project consists of several key components and features,
including:

1. Welcome Screen: The system begins with a visually


appealing welcome screen that provides a friendly greeting to
users.

2. User-Friendly GUI: The primary interface of the application


is built using the tkinter library, offering an intuitive and visually
appealing design for users to interact with.

3. User Authentication: Users can log in using a username


and password, allowing for personalized bookings and
reservation management. The system distinguishes between
regular users and administrators.

4. Booking Rooms: Users can select their preferred room


type, specify booking dates, and provide their identification
details to book a room. The system verifies room availability
and performs bookings while maintaining real-time availability
status.

14
5. Reservation Management: Users can search for their
reservations, update booking details, and cancel reservations
as needed.

6. Room Availability Monitoring: Administrators have


access to an admin panel that displays room availability in
real-time. They can book rooms on behalf of customers,
update reservations, and cancel bookings.

7. Payment Processing: The system calculates the total cost


of the stay based on room type and the number of nights and
generates PDF receipts for successful payments. It handles
payment processing seamlessly.

8. Customer Support: The system offers a "Contact Us"


feature to provide customers with hotel contact information for
inquiries and assistance.

9. Database Integration: The project integrates with a


MySQL database to store and retrieve reservation data and
room availability status.

10. Future Booking Date Validation: The system ensures


that booking dates are in the future, preventing users from
making past-dated reservations.

11. Room Type Management: The project categorizes room


types (e.g., suite, double, normal) and maintains room
availability records for each type.

12. Color-Coded Room Status: The admin panel visually


represents room availability using background colors for ease
of monitoring.

15
1. welcome_screen()

The welcome_screen() function utilizes the turtle library to


construct an animated welcome screen for a hotel reservation
system. It first sets up a window with a black background and
proceeds to create a captivating background animation
composed of colorful octagonal shapes. These shapes move
outward in a spiral pattern, with each shape being randomly
colored from a predefined list. After the animated background
is generated, a welcoming message is displayed at the center
of the screen. The result is an engaging and visually
appealing welcome screen that greets users as they enter the
hotel reservation system.

16
2. home_page()

The home_page() function is the initial landing page of the


hotel reservation system's graphical user interface. It serves
as a welcoming screen for users, providing a visually
appealing introduction to the hotel. The page features a
background image of the hotel, along with its logo. Users are
greeted with a detailed description of the hotel's amenities
and its strategic location in Abu Dhabi. Additionally, there are
three images that showcase the hotel's exterior, giving
potential guests a preview of their future stay.

17
The page invites users to either "Book Now" or "Contact Us"
through prominent buttons, guiding them to take action.

The "Book Now" button, when clicked, leads users to the


booking screen for reserving a room. The "Contact Us" button
provides a means for users to inquire about the hotel's
services. Overall, the home_page() function creates an
engaging and user-friendly initial interface for guests, offering
a seamless entry into the hotel reservation system with clear
navigation options and an attractive visual presentation of the
hotel's offerings.

3. login_screen()

The login_screen() function serves as the entry point for user


authentication in the hotel reservation system. It creates a
GUI window where users are required to enter their username
and password to access the system. The window is designed
with labeled input fields for username and password, along
with buttons for login and clearing the input fields.

Upon clicking the "Login" button, the function checks if the


provided username and password match predefined values. If
the user enters "user" as both the username and password, it
grants access to the regular user interface, leading to the
booking_screen(). If the user enters "admin" as both the
username and password, it grants access to the admin control
panel by calling the admin_panel() function. Otherwise, it
shows a login denied message using messagebox.showinfo().
This login screen ensures that only authorized users or
administrators can proceed to use the hotel reservation
system based on their credentials.

18
4. booking_screen()

The booking_screen() function is a pivotal component of the


hotel reservation system's graphical user interface,
responsible for handling booking operations. It initiates a
Tkinter window where users can input their reservation
details, including their name, chosen room type, booking date,
and ID number. The function provides a clean and
user-friendly interface with appropriately labeled entry fields
and buttons for actions such as booking, clearing the input
fields, checking reservations, canceling a booking, updating
booking details, and searching for existing reservations.

Upon booking, the function connects to a MySQL database,


verifies that the selected date is in the future, assigns an
available room, updates the room's availability status, and
records the reservation data in the database. It also allows

19
users to search for and update existing bookings, cancel
reservations, and check room availability. An additional
feature, enabled through a developer mode flag, lets users
check the current room availability status. Overall, the
booking_screen() function plays a pivotal role in the hotel
reservation system, offering a comprehensive user interface
for managing bookings and reservations.

20
5. checkout()

The checkout() function in the hotel reservation system is


responsible for handling the checkout process for guests. It
provides a graphical user interface (GUI) to facilitate the
checkout procedure.

1. Data Entry and Validation: The function allows the user to


input details related to the checkout process, including the
guest's name, room type, checkout date, and booking ID. It
performs validation to ensure the date entered is valid (in the
future) by comparing it to the current date. If the date is not
valid, it shows an "Invalid Date" message using
messagebox.showinfo().

2. Cost Calculation: The function calculates the total cost of


the stay based on the selected room type and the number of
nights between the checkout date and the check-in date

21
(retrieved from the database). The cost calculation takes into
account different room rates for "Normal," "Suite," and
"Double" room types.

3. Searching and Displaying Booking Information: The


function allows users to search for a booking by the guest's
name. If a booking is found, it displays the guest's name,
selected room type, check-in date, and booking ID in the
corresponding input fields. If no booking is found, it provides a
message indicating that no such booking exists.

4. Payment and Receipt Generation: After calculating the total


cost, the user can click the "Pay" button to proceed with the
checkout. The system generates a PDF receipt that includes
the guest's name, check-in date, checkout date, and the total
cost. It also updates the room's availability status in the
database to indicate that it's now vacant. The receipt is
generated using the reportlab library, and the PDF file is
saved with a filename based on the booking ID.

This function simplifies and streamlines the checkout process


for hotel guests, ensuring accurate cost calculation and
providing a digital receipt for their records. It also updates the
database to reflect the room's availability.

22
23
6. admin_panel()

The admin_panel() function in your code is responsible for


creating an administrative control panel GUI for managing
hotel reservations. Let me explain the key features of this
function:

1. Displaying Reservation Data: When the function is called, it


creates a GUI window using Tkinter and displays an
administrative panel. The panel includes the title "ADMIN
PANEL." It uses a Treeview widget (from the ttk module) to
show reservation data in a tabular format with columns for
"NAME," "ROOM," "DATE," and "ID NO."

2. Displaying Reservation Data from the Database: It


connects to a MySQL database and fetches reservation data
using a SELECT query. The retrieved data is then displayed
in the Treeview widget.

24
3. Booking: The admin can book a room using this interface
by entering the guest's name, selecting a room type,
specifying the check-in date, and providing a unique booking
ID. When the "Book" button is clicked, it validates the check-in
date and checks for room availability. If the date is valid and a
room is available, it updates the room's availability status,
inserts the booking data into the database, and displays a
"Booking Completed" message.

4. Cancellation: The admin can cancel an existing booking by


entering the guest's name and clicking the "Cancel" button. If
confirmed, it deletes the booking from the database and
clears the input fields.

5. Updating: The admin can update an existing booking by


entering the guest's name, modifying the room type or
check-in date, and clicking the "Update" button. If confirmed, it
updates the booking data in the database.

6. Searching: The admin can search for a booking by entering


the guest's name and clicking the "Search" button. If found, it
displays the booking details in the input fields.

7. Room Availability Status: The function also displays the


availability status of each room in the hotel. The color of each
room label changes based on its availability (red for occupied
and green for vacant).

8. Refresh Button: The "Refresh" button allows the admin to


update the room availability status by recalling the
admin_panel() function.

25
26
27
Use of technology

28
1. MySQL

MySQL is a popular database management system known for


its simplicity and reliability.

1. What is MySQL?
MySQL is a type of software that helps store and manage
data. It's like a digital filing cabinet for information.

2. History of MySQL:
MySQL was created in the mid-1990s by a Swedish company
called MySQL AB. It was later acquired by Sun Microsystems
and then by Oracle Corporation. However, the original version
of MySQL remains open-source, which means it's free for
everyone to use and modify.

3. Simple to Use:
MySQL is known for its user-friendliness. It's relatively easy to
set up and use, even for beginners. You don't need to be a
computer expert to work with MySQL.

29
4. Reliability:
MySQL is highly reliable, which means it rarely crashes or
loses your data. It's like a dependable friend who never
forgets your secrets.

5. Speed and Performance:


MySQL is designed to be fast and efficient. It can quickly
retrieve and store data, making it suitable for websites and
applications that need to respond quickly.

6. Community Support:
One of MySQL's strengths is its large community of users and
developers. This community helps keep the software
up-to-date, secure, and full of useful features. It's like having a
big group of friends to help you with your database needs.

30
2. Python

1. What is Python?
Python is a programming language that helps people write
computer programs and automate tasks. It's like a versatile
tool for creating software and solving problems with code.

2. History of Python:
Python was created in the late 1980s by Guido van Rossum,
a Dutch programmer. It was officially released in 1991. Python
was designed to be easy to read and write, making it
accessible for beginners.

3. Simplicity:
Python is known for its simplicity and readability. Its code
looks a lot like everyday English, making it easier for
programmers to understand and work with. It's like writing
instructions in plain language.

4. Versatility:
Python is a versatile language that can be used for a wide
range of tasks, from web development to data analysis and

31
artificial intelligence. It's like having a toolbox with many
different tools for various jobs.

5. Large Community and Libraries:


Python has a vast community of users and a wealth of
libraries and packages. These resources provide pre-made
code for common tasks, saving time and effort. It's like a
massive library filled with books on every topic.

6. Cross-Platform Compatibility:
Python works on different operating systems like Windows,
macOS, and Linux. This means you can write code on one
type of computer and run it on others without major changes.
It's like a universal translator for computers.

32
3. Hardware & Software
Requirement
Processor Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
2.30 GHz
Installed RAM 8.00 GB (7.89 GB usable)
System type 64-bit operating system, x64-based
processor
Wi-Fi Intel(R) Dual Band Wireless-AC 7265
Disk SK hynix SC210 mSATA 256GB
GPU Intel(R) HD Graphics 5500

33
Source Code

34
import tkinter as tk
from tkinter import *
from tkinter import messagebox
import tkinter.font as font
from tkinter import ttk
from PIL import ImageTk, Image
from datetime import datetime
from reportlab.lib.pagesizes import letter
from reportlab.lib import colors
from reportlab.platypus import SimpleDocTemplate, PageTemplate, PageBreak, Frame, Spacer, Paragraph, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet
import mysql.connector

# Establish connection
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
# Create a cursor to execute SQL commands
cursor = connection.cursor()

# # Define the table schema


# create_table_query = """
# CREATE TABLE reservations (
# id INT AUTO_INCREMENT PRIMARY KEY,
# name VARCHAR(255),
# room VARCHAR(255),
# date DATE,
# booking_id VARCHAR(255)
#)
# """

# # Execute the create table query


# cursor.execute(create_table_query)

# Commit changes to the database


connection.commit()

sorted_list = {}
rooms = {}

dev_mode = 1

def update_rooms_dictionary():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

select_rooms_query = "SELECT room_number, availability FROM rooms"


cursor.execute(select_rooms_query)
rooms_data = cursor.fetchall()

for room_number, availability in rooms_data:


rooms[room_number] = availability

except Exception as e:
print("Error:", e)

finally:

35
if connection.is_connected():
cursor.close()
connection.close()

def welcome_screen():
import turtle
import random

wn = turtle.Screen()
wn.bgcolor("black")

octago = turtle.Turtle()
octago.hideturtle()
octago.speed(0)
octago.up()
octago.down()
colors = ["red", "gold", "black", "black", "white", "cyan", "pink"]

for i in range(250):
octago.color(random.choice(colors))
octago.forward(i)
octago.left(80)

octago.up()
octago.down()

turtle.color('white')
style = ('Courier', 20, 'bold')
turtle.write('WELCOME TO HOTEL RESERVATION SYSTEM!', font=style, align='center')
turtle.done()

def home_page():
def book_now_btn_command():
login_screen()

def contact_btn_command():
contact_us()

root = tk.Tk()
root.title("HMS")

#setting window size


root.geometry("850x650")
root['background'] = "#f2eee3"

head_img = Image.open("images\logo_2.jpeg")
head_img = head_img.resize((700, 600))
head_img = ImageTk.PhotoImage(head_img)
panel_1 = tk.Label(root, image = head_img)
# panel.pack(side = "bottom", fill = "both", expand = "yes")
panel_1.place(x=150,y=30,width=550,height=59)

intro_lbl=tk.Label()
ft = font.Font(family='Times',size=10)
intro_lbl["font"] = ft
intro_lbl["bg"] = "#f2eee3"
intro_lbl["fg"] = "#5065a8"
intro_lbl["justify"] = "center"
intro_lbl["text"] = "Welcome to JA Hotels, the newest and most luxurious hotel in Abu Dhabi! Our hotel offers a wide range of
facilities and amenities to \n ensure that our guests have a comfortable and enjoyable stay. Some of the facilities available at our
hotel include a full-service spa, \n a state-of-the-art fitness center, multiple dining options, and a large outdoor pool. We also offer a
range of business facilities, including \n conference rooms and a business center. Whether you're traveling for business or leisure,
JA Hotels has something for everyone."
intro_lbl.place(x=30,y=110,width=750,height=100)

book_now_btn=tk.Button()
book_now_btn["bg"] = "#5065a8"
ft = font.Font(family='Times',size=10)
book_now_btn["font"] = ft
book_now_btn["fg"] = "#f0f0f0"

36
book_now_btn["justify"] = "center"
book_now_btn["text"] = "Book Now"
book_now_btn.place(x=550,y=430,width=200,height=40)
book_now_btn["command"] = book_now_btn_command

contact_btn=tk.Button()
contact_btn["bg"] = "#5065a8"
ft = font.Font(family='Times',size=10)
contact_btn["font"] = ft
contact_btn["fg"] = "#f0f0f0"
contact_btn["justify"] = "center"
contact_btn["text"] = "Contact Us"
contact_btn.place(x=550,y=480,width=200,height=40)
contact_btn["command"] = contact_btn_command

desc_lbl=tk.Label(root)
ft = font.Font(family='Times',size=10)
desc_lbl["font"] = ft
desc_lbl["bg"] = "#f2eee3"
desc_lbl["fg"] = "#5065a8"
desc_lbl["justify"] = "center"
desc_lbl["text"] = "Located in the vibrant and dynamic city of Abu Dhabi! As the capital and largest city \n of the United Arab
Emirates, Abu Dhabi is a melting pot of cultures and traditions, offering \n something for everyone. With its modern skyline,
world-class shopping, and stunning \n beaches, Abu Dhabi is a destination that truly has it all. From visiting iconic landmarks like \n
the Sheikh Zayed Grand Mosque and the Louvre Abu Dhabi, to enjoying the city's rich \n culinary scene and exciting nightlife, there
is no shortage of things to do in Abu Dhabi. \n At JA Hotels, we are perfectly positioned to help you make the most of your stay in
this \n amazing city. We hope you will join us and experience all that Abu Dhabi has to offer!"
desc_lbl.place(x=30,y=400,width=510,height=170)

img = Image.open("images\hotel_4.png")
img = img.resize((250, 200))
img = ImageTk.PhotoImage(img)
panel = tk.Label(root, image = img)
# panel.pack(side = "bottom", fill = "both", expand = "yes")
panel.place(x=310,y=200,width=200,height=200)

img2 = Image.open("images\hotel_2.png")
img2 = img2.resize((250, 200))
img2 = ImageTk.PhotoImage(img2)
panel2 = tk.Label(root, image = img2)
# panel.pack(side = "bottom", fill = "both", expand = "yes")
panel2.place(x=60,y=200,width=210,height=200)

img3 = Image.open("images\hotel_1.png")
img3 = img3.resize((250, 200))
img3 = ImageTk.PhotoImage(img3)
panel3 = tk.Label(root, image = img3)
# panel.pack(side = "bottom", fill = "both", expand = "yes")
panel3.place(x=550,y=200,width=220,height=200)

root.mainloop()

def contact_us():
return

def admin_panel():
def display():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

root = tk.Tk()
root.geometry("1400x800")
root.title("ADMIN PANEL")

37
root['background'] = 'LightGreen'
tk.Label(root, text="ADMIN PANEL", font=("Times New Roman Bold", 20)).pack()

frame = tk.Frame(root)
frame.pack()
tree = ttk.Treeview(frame, columns=(1, 2, 3, 4), height=300, show="headings")
tree.pack(side='right')
tree.heading(1, text="NAME")
tree.heading(2, text="ROOM")
tree.heading(3, text="DATE")
tree.heading(4, text="ID NO")
tree.column(1, width=130)
tree.column(2, width=130)
tree.column(3, width=130)
tree.column(4, width=130)
scroll = ttk.Scrollbar(frame, orient="vertical", command=tree.yview)
scroll.pack(side='right', fill='y')

select_query = "SELECT name, room, date, booking_id FROM reservations"


cursor.execute(select_query)
rows = cursor.fetchall()

for row in rows:


tree.insert('', 'end', values=row)

root.mainloop()

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while displaying data.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def book():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

date_status = check_date()
if date_status:
# Find the last unoccupied room number from the database
select_unoccupied_query = "SELECT room_number FROM rooms WHERE availability = 0 ORDER BY room_number
DESC LIMIT 1"
cursor.execute(select_unoccupied_query)
unoccupied_room = cursor.fetchone()

if unoccupied_room:
room_number = unoccupied_room[0] # Get room_number
room_type = drop_down_menu.get() # Get room_type from the option menu

# Use the room column to store both room number and type
room = f"{room_number} ({room_type})"

name = name_txt.get()
date = date_txt.get()
booking_id = id_txt.get()

# Update the room status to 1 in the MySQL table


update_status_query = "UPDATE rooms SET availability = 1 WHERE room_number = %s"
cursor.execute(update_status_query, (room_number,))
connection.commit()

38
# Insert data into the MySQL table
insert_query = """
INSERT INTO reservations (name, room, date, booking_id)
VALUES (%s, %s, %s, %s)
"""
data = (name, room, date, booking_id)
cursor.execute(insert_query, data)
connection.commit()

messagebox.showinfo("Message", "Booking Completed!")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while booking.")

finally:
if connection is not None and connection.is_connected():
cursor.close()
connection.close()

def check_date():
date = date_txt.get()
checkDate = datetime.strptime(date, "%Y-%m-%d")
present = datetime.now()

if checkDate.date() > present.date():


return True
else:
# messagebox.showinfo("Message ", "Invalid Date")
return True

def clear():
name_txt.delete(0,END)
drop_down_menu.set("Normal")
date_txt.delete(0,END)
id_txt.delete(0,END)

def search():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

name = name_txt.get()
clear()

# Search for the booking in the MySQL table


select_query = "SELECT * FROM reservations WHERE name = %s"
cursor.execute(select_query, (name,))
booking = cursor.fetchone() # Fetch the first result

if booking:
messagebox.showinfo("Message", "Booking found!")
name_txt.insert(END, booking[1])
drop_down_menu.set(booking[2])
date_txt.insert(END, booking[3])
id_txt.insert(END, booking[4])
else:
messagebox.showinfo("Message", "No such booking")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while searching.")

finally:

39
if connection.is_connected():
cursor.close()
connection.close()

def cancel():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

x = messagebox.askyesno("Alert", "Are you sure you want to cancel the reservation")


regno = name_txt.get()

if x:
# Delete the booking from the MySQL table
delete_query = "DELETE FROM reservations WHERE name = %s"
cursor.execute(delete_query, (regno,))
connection.commit()

messagebox.showinfo("Message", "Booking Deleted")


clear()

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while canceling.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def update():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

x = messagebox.askyesno("Alert", "Are you sure you want to update the booking")

if x:
name = name_txt.get()
room = drop_down_menu.get()
date = date_txt.get()
booking_id = id_txt.get()

# Update the booking in the MySQL table


update_query = """
UPDATE reservations
SET room = %s, date = %s, booking_id = %s
WHERE name = %s
"""
data = (room, date, booking_id, name)
cursor.execute(update_query, data)
connection.commit()

messagebox.showinfo("ALERT", "Booking Updated")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while updating.")

finally:

40
if connection.is_connected():
cursor.close()
connection.close()

def room_format():
room = drop_down_menu.get()
room = room.lower()
if room == "suite":
return 0
elif room == "double room" or room == "doubleroom":
return 1
elif room == "normal":
return 2
else:
messagebox.showinfo("ALERT ", "Invalid Entry")
return "Invalid!"

def check():
for room in rooms:
if rooms[room] == 0:
rooms[room] = 1
return True
messagebox.showinfo("Message ", "No vacant rooms")
return False

def colour_format(integer):
if integer == 1:
return "Red"
else:
return "Green"

def stat():
root.destroy()
update_rooms_dictionary()
admin_panel()
print(rooms)

root = tk.Tk()
root.geometry("700x700")
root.title("Admin Control Panel")
root.configure(bg='#F7BF4F')

C = Canvas(root, bg ="black", height = 1000, width = 950)

# lblmenu = tk.Label(root, text ="ADMIN CONTROL PANEL", bg= '#F7BF4F',font=('Times New Roman',28,'bold'))
# lblmenu.place(x = 120, y = 20)

global title_img
title_img = Image.open("images\logo_3.png")
title_img = title_img.resize((400, 150))
title_img = ImageTk.PhotoImage(title_img)
panel_title = tk.Label(root, image = title_img)
panel_title.place(x=150,y=20,width=400,height=150)

name_lbl = tk.Label(root, text ="NAME",bg= '#F7BF4F',fg ='black',font=("Times New Roman Bold", 10) )
name_lbl.place(x = 50, y = 200)

name_txt= tk.Entry(root, width = 35,fg ='black',bg= '#F7BF4F',font=("Times New Roman Bold", 10))
name_txt.place(x = 350, y = 200, width = 300)

room_lbl = tk.Label(root, text ="ROOM TYPE",fg ='black',bg= '#F7BF4F',font=("Times New Roman Bold", 10))
room_lbl.place(x = 50, y = 250)

room_lbl_2 = tk.Label(root, text ="[SUITE / DOUBLE ROOM / NORMAL]",fg ='black',bg= '#F7BF4F',font=("Times New Roman
Bold", 10))
room_lbl_2.place(x = 50, y = 270)

drop_down_menu = StringVar(root)
drop_down_menu.set("Normal")

41
room_opt = OptionMenu(root, drop_down_menu, "Normal", "Suite", "Double")
room_opt.pack()
room_opt.place(x = 350, y = 250, width = 300)

date_lbl = tk.Label(root, text ="DATE [DD/MM/YYYY]",fg ='black',bg= '#F7BF4F',font=("Times New Roman Bold", 10) )
date_lbl.place(x = 50, y = 300)

date_txt= tk.Entry(root, width = 35,fg ='black',bg= '#F7BF4F',font=("Times New Roman Bold", 10))
date_txt.place(x = 350, y = 300, width = 300)

id_lbl = tk.Label(root, text ="ID No.",fg ='black',bg= '#F7BF4F',font=("Times New Roman Bold", 10))
id_lbl.place(x = 50, y = 350)

id_txt = tk.Entry(root, width = 35,fg ='black',bg= '#F7BF4F',font=("Times New Roman Bold", 10))
id_txt.place(x = 350, y = 350, width = 300)

btninsert = tk.Button(root, text ="Book",fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=book)
btninsert.place(x = 150, y = 400, width = 60)

btnclear = tk.Button(root, text ="Clear", fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=clear)
btnclear.place(x = 220, y = 400, width = 60)

btndisplay = tk.Button(root, text ="Check",fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=display)
btndisplay.place(x = 280, y = 400, width = 60)

btnsearch = tk.Button(root, text ="Cancel",fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=cancel)
btnsearch.place(x = 340, y = 400, width = 60)

btnupdate = tk.Button(root, text ="Update",fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=update)
btnupdate.place(x = 400, y = 400, width = 60)

btnsearch = tk.Button(root, text ="Search",fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=search)
btnsearch.place(x = 460, y = 400, width = 60)

btnsearch = tk.Button(root, text ="Refresh",fg ='red',bg= '#F7BF4F',font=("Times New Roman Bold", 10),command=stat)
btnsearch.place(x = 550, y = 600, width = 100)

hotel_room_1 = tk.Label(root, text ="Room 1",fg ='black',bg= colour_format(rooms[1]) ,font=("Times New Roman Bold", 10))
hotel_room_1.place(x = 100, y = 500)

hotel_room_2 = tk.Label(root, text ="Room 2",fg ='black',bg= colour_format(rooms[2]) ,font=("Times New Roman Bold", 10))
hotel_room_2.place(x = 150, y = 500)

hotel_room_3 = tk.Label(root, text ="Room 3",fg ='black',bg= colour_format(rooms[3]) ,font=("Times New Roman Bold", 10))
hotel_room_3.place(x = 200, y = 500)

hotel_room_4 = tk.Label(root, text ="Room 4",fg ='black',bg= colour_format(rooms[4]) ,font=("Times New Roman Bold", 10))
hotel_room_4.place(x = 250, y = 500)

hotel_room_5 = tk.Label(root, text ="Room 5",fg ='black',bg= colour_format(rooms[5]) ,font=("Times New Roman Bold", 10))
hotel_room_5.place(x = 300, y = 500)

hotel_room_6 = tk.Label(root, text ="Room 6",fg ='black',bg= colour_format(rooms[6]) ,font=("Times New Roman Bold", 10))
hotel_room_6.place(x = 350, y = 500)

hotel_room_7 = tk.Label(root, text ="Room 7",fg ='black',bg= colour_format(rooms[7]) ,font=("Times New Roman Bold", 10))
hotel_room_7.place(x = 400, y = 500)

hotel_room_8 = tk.Label(root, text ="Room 8",fg ='black',bg= colour_format(rooms[8]) ,font=("Times New Roman Bold", 10))
hotel_room_8.place(x = 450, y = 500)

hotel_room_9 = tk.Label(root, text ="Room 9",fg ='black',bg= colour_format(rooms[9]) ,font=("Times New Roman Bold", 10))
hotel_room_9.place(x = 500, y = 500)

hotel_room_10 = tk.Label(root, text ="Room 10",fg ='black',bg= colour_format(rooms[10]) ,font=("Times New Roman Bold", 10))
hotel_room_10.place(x = 550, y = 500)

root.mainloop()

def booking_screen():

42
def display():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

root = tk.Tk()
root.geometry("1400x800")
root.title("RESERVATIONS")
root['background'] = '#66a3bb'
tk.Label(root, text="RESERVATIONS", font=("Times New Roman Bold", 20)).pack()
frame = tk.Frame(root)
frame.pack()
tree = ttk.Treeview(frame, columns=(1, 2, 3), height=300, show="headings")
tree.pack(side='right')
tree.heading(1, text="NAME")
tree.heading(2, text="ROOM")
tree.heading(3, text="DATE")
tree.column(1, width=130)
tree.column(2, width=130)
tree.column(3, width=130)
scroll = ttk.Scrollbar(frame, orient="vertical", command=tree.yview)
scroll.pack(side='right', fill='y')

select_query = "SELECT name, room, date FROM reservations"


cursor.execute(select_query)
rows = cursor.fetchall()

for row in rows:


tree.insert('', 'end', values=row)

root.mainloop()

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while displaying data.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def book():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

date_status = check_date()
if date_status:
# Find the last unoccupied room number from the database
select_unoccupied_query = "SELECT room_number FROM rooms WHERE availability = 0 ORDER BY room_number
DESC LIMIT 1"
cursor.execute(select_unoccupied_query)
unoccupied_room = cursor.fetchone()

if unoccupied_room:
room_number = unoccupied_room[0] # Get room_number
room_type = drop_down_menu.get() # Get room_type from the option menu

# Use the room column to store both room number and type
room = f"{room_number} ({room_type})"

43
name = name_txt.get()
date = date_txt.get()
booking_id = id_txt.get()

# Update the room status to 1 in the MySQL table


update_status_query = "UPDATE rooms SET availability = 1 WHERE room_number = %s"
cursor.execute(update_status_query, (room_number,))
connection.commit()

# Insert data into the MySQL table


insert_query = """
INSERT INTO reservations (name, room, date, booking_id)
VALUES (%s, %s, %s, %s)
"""
data = (name, room, date, booking_id)
cursor.execute(insert_query, data)
connection.commit()

messagebox.showinfo("Message", "Booking Completed!")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while booking.")

finally:
if connection is not None and connection.is_connected():
cursor.close()
connection.close()

def check_date():
date = date_txt.get()
checkDate = datetime.strptime(date, "%Y-%m-%d")
present = datetime.now()

if checkDate.date() > present.date():


return True
else:
# messagebox.showinfo("Message ", "Invalid Date")
return True

def clear():
name_txt.delete(0,END)
drop_down_menu.set("Normal")
date_txt.delete(0,END)
id_txt.delete(0,END)

def search():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

name = name_txt.get()
clear()

# Search for the booking in the MySQL table


select_query = "SELECT name, room, date, booking_id FROM reservations WHERE name = %s"
cursor.execute(select_query, (name,))
booking = cursor.fetchone() # Fetch the first result

if booking:
messagebox.showinfo("Message", "Booking found!")
name_txt.insert(END, booking[0])
drop_down_menu.set(booking[1])

44
date_txt.insert(END, booking[2])
id_txt.insert(END, booking[3])
else:
messagebox.showinfo("Message", "No such booking")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while searching.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def cancel():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

x = messagebox.askyesno("Alert", "Are you sure you want to cancel the reservation")


regno = name_txt.get()

if x:
# Delete the booking from the MySQL table
delete_query = "DELETE FROM reservations WHERE name = %s"
cursor.execute(delete_query, (regno,))
connection.commit()

messagebox.showinfo("Message", "Booking Deleted")


clear()

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while canceling.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def update():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

x = messagebox.askyesno("Alert", "Are you sure you want to update the booking")

if x:
name = name_txt.get()
room = drop_down_menu.get()
date = date_txt.get()
booking_id = id_txt.get()

# Update the booking in the MySQL table


update_query = """
UPDATE reservations
SET room = %s, date = %s, booking_id = %s
WHERE name = %s
"""
data = (room, date, booking_id, name)

45
cursor.execute(update_query, data)
connection.commit()

messagebox.showinfo("ALERT", "Booking Updated")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while updating.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def check():
for room in rooms:
if rooms[room] == 0:
rooms[room] = 1
return True
messagebox.showinfo("Message ", "No vacant rooms")
return False

def stat():
print(rooms)

root = tk.Tk()
root.geometry("700x700")
root.title("Booking Page")
root.configure(bg='#66a3bb')

C = Canvas(root, bg ="black", height = 1000, width = 950)

lblmenu = tk.Label(root, text ="BOOKING PORTAL", bg= '#66a3bb',font=('Times New Roman',28,'bold'))


lblmenu.place(x = 180, y = 20)

global title_img_2
title_img_2 = Image.open("images\logo_4.jpeg")
title_img_2 = title_img_2.resize((500, 500))
title_img_2 = ImageTk.PhotoImage(title_img_2)
panel_title_2 = tk.Label(root, image = title_img_2)
panel_title_2.place(x=150,y=20,width=400,height=150)

name_lbl = tk.Label(root, text ="NAME",bg= '#66a3bb',fg ='black',font=("Times New Roman Bold", 10) )
name_lbl.place(x = 50, y = 200)

name_txt= tk.Entry(root, width = 35,fg ='black',bg= '#66a3bb',font=("Times New Roman Bold", 10))
name_txt.place(x = 350, y = 200, width = 300)

room_lbl = tk.Label(root, text ="ROOM TYPE",fg ='black',bg= '#66a3bb',font=("Times New Roman Bold", 10))
room_lbl.place(x = 50, y = 250)

room_lbl_2 = tk.Label(root, text ="[SUITE / DOUBLE ROOM / NORMAL]",fg ='black',bg= '#66a3bb',font=("Times New Roman
Bold", 10))
room_lbl_2.place(x = 50, y = 270)

drop_down_menu = StringVar(root)
drop_down_menu.set("Normal")

room_opt = OptionMenu(root, drop_down_menu, "Normal", "Suite", "Double")


room_opt.pack()
room_opt.place(x = 350, y = 250, width = 300)

date_lbl = tk.Label(root, text ="DATE [DD/MM/YYYY]",fg ='black',bg= '#66a3bb',font=("Times New Roman Bold", 10) )
date_lbl.place(x = 50, y = 300)

date_txt= tk.Entry(root, width = 35,fg ='black',bg= '#66a3bb',font=("Times New Roman Bold", 10))
date_txt.place(x = 350, y = 300, width = 300)

id_lbl = tk.Label(root, text ="ID No.",fg ='black',bg= '#66a3bb',font=("Times New Roman Bold", 10))
id_lbl.place(x = 50, y = 350)

46
id_txt = tk.Entry(root, width = 35,fg ='black',bg= '#66a3bb',font=("Times New Roman Bold", 10))
id_txt.place(x = 350, y = 350, width = 300)

btninsert = tk.Button(root, text ="Book",fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=book)
btninsert.place(x = 150, y = 400, width = 60)

btnclear = tk.Button(root, text ="Clear", fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=clear)
btnclear.place(x = 220, y = 400, width = 60)

btndisplay = tk.Button(root, text ="Check",fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=display)
btndisplay.place(x = 280, y = 400, width = 60)

btnsearch = tk.Button(root, text ="Cancel",fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=cancel)
btnsearch.place(x = 340, y = 400, width = 60)

btnupdate = tk.Button(root, text ="Update",fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=update)
btnupdate.place(x = 400, y = 400, width = 60)

btnsearch = tk.Button(root, text ="Search",fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=search)
btnsearch.place(x = 460, y = 400, width = 60)

if dev_mode == 1:
btnsearch = tk.Button(root, text ="Availability",fg ='red',bg= '#66a3bb',font=("Times New Roman Bold", 10),command=stat)
btnsearch.place(x = 550, y = 500, width = 100)

root.mainloop()

def login_screen():
def clear():
txtUser.delete(0,END)
txtpass.delete(0,END)
txtUser.focus()

def login():
user = txtUser.get()
passw = txtpass.get()
if user=="user" and passw=="user":
messagebox.showinfo("Login ", "Login Successful")
root.destroy()
booking_screen()
elif user=="admin" and passw=="admin":
messagebox.showinfo("Login ", "Login Successful")
root.destroy()
admin_panel()
else:
messagebox.showinfo("Login ", "Login Denied")

root = tk.Tk()
root.geometry("300x300")
root.title("JA Login Page")
C = Canvas(root, bg ="Red", height = 250, width = 300)
lbluser = tk.Label(root, text ="Username ",fg="red",font=("Times New Roman Bold", 10) )
lbluser.place(x = 50, y = 20)
txtUser = tk.Entry(root, width = 35,fg="blue",font=("Times New Roman Bold", 10))
txtUser.place(x = 150, y = 20, width = 100)
lblpass = tk.Label(root, text ="Password ",fg="red",font=("Times New Roman Bold", 10))
lblpass.place(x = 50, y = 50)
txtpass = tk.Entry(root,show="*", width = 35,fg="blue",font=("Times New Roman Bold", 10))
txtpass.place(x = 150, y = 50, width = 100)
loginbtn = tk.Button(root, text ="Login", fg ='blue', font=("Times New Roman Bold", 10),command = login)
loginbtn.place(x = 100, y = 135, width = 55)
clearbtn = tk.Button(root, text ="Clear",fg ='blue', font=("Times New Roman Bold", 10),command = clear)
clearbtn.place(x = 200, y = 135, width = 55)
root.mainloop()

def checkout():
def check_date():
date = date_txt.get()
checkDate = datetime.strptime(date, "%Y-%m-%d")

47
present = datetime.now()

if checkDate.date() > present.date():


return True
else:
messagebox.showinfo("Message ", "Invalid Date")
return True

def clear():
name_txt.delete(0,END)
drop_down_menu.set("Normal")
date_txt.delete(0,END)
id_txt.delete(0,END)
checkout_cost_txt.delete(0,END)

def search():
try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

name = name_txt.get()
clear()

# Search for the booking in the MySQL table


select_query = "SELECT name, room, date, booking_id FROM reservations WHERE name = %s"
cursor.execute(select_query, (name,))
booking = cursor.fetchone() # Fetch the first result

if booking:
messagebox.showinfo("Message", "Booking found!")
name_txt.insert(END, booking[0])
drop_down_menu.set(booking[1])
date_txt.insert(END, booking[2])
id_txt.insert(END, booking[3])
else:
messagebox.showinfo("Message", "No such booking")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while searching.")

finally:
if connection.is_connected():
cursor.close()
connection.close()

def room_cost():
room_type = room_format()
val = 0
if room_type == 0:
val = 250
return val
elif room_type == 1:
val = 500
return val
elif room_type == 2:
val = 200
return val

def calculate_total():
room_rate = room_cost()
num_nights = datetime.now() - datetime.strptime(date_txt.get(), "%Y-%m-%d")
num_nights = num_nights.days
checkout_cost_txt.insert(END, (room_rate * num_nights))

48
def room_format():
room = drop_down_menu.get()
room = room.lower()
if "suite" in room:
return 0
elif "double" in room:
return 1
elif "normal" in room:
return 2
else:
messagebox.showinfo("ALERT ", "Invalid Entry")
return "Invalid!"

def payment():
id = id_txt.get()
date = date_txt.get()
name = name_txt.get()
cost = checkout_cost_txt.get()
filename = f"{id}.pdf"

try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="adis",
database="reservation_system"
)
cursor = connection.cursor()

# Get the room field from the "reservations" table


select_room_query = "SELECT room FROM reservations WHERE booking_id = %s"
cursor.execute(select_room_query, (id,))
room_data = cursor.fetchone()

room_num = int(room_data[0][:2])

update_room_query = "UPDATE rooms SET availability = 0 WHERE room_number = %s"


cursor.execute(update_room_query, (room_num,))
connection.commit()

# Delete the reservation entry from the database


delete_query = "DELETE FROM reservations WHERE booking_id = %s"
cursor.execute(delete_query, (id,))
connection.commit()

def create_receipt_template(pdf_filename, hotel_name, name, check_in, check_out, cost):


doc = SimpleDocTemplate(pdf_filename, pagesize=letter)

# Create a page template


elements = []
styles = getSampleStyleSheet()
elements.append(Paragraph(f"{hotel_name}", styles['Title']))
elements.append(Spacer(1, 12))
elements.append(Paragraph(f"Name: {name}", styles['Normal']))
elements.append(Spacer(1, 12))
elements.append(Paragraph(f"Date of Check-in: {check_in}", styles['Normal']))
elements.append(Spacer(1, 12))
elements.append(Paragraph(f"Date of Checkout: {check_out}", styles['Normal']))
elements.append(Spacer(1, 12))
elements.append(Paragraph(f"Cost: {cost}", styles['Normal']))
elements.append(Spacer(1, 30))
elements.append(Paragraph("Thank you for choosing JA Hotels and Resorts for your stay. We hope you had a pleasant
experience with us. If you have any questions or need further assistance, please feel free to contact our front desk.", styles['Italic']))
elements.append(Spacer(1, 10))
elements.append(Paragraph("We look forward to serving you again in the future. Have a great day!", styles['Italic']))

page_template = PageTemplate(frames=[Frame(doc.leftMargin, doc.bottomMargin, doc.width, doc.height)])


doc.addPageTemplates(page_template)

49
# Build the PDF document
doc.build(elements)

create_receipt_template(filename, "JA Hotels and Resorts", name, date, datetime.today().date(), cost)


messagebox.showinfo("Message", "Receipt Generated")

except Exception as e:
print("Error:", e)
messagebox.showerror("Error", "An error occurred while generating receipt and deleting the entry.")

finally:
if connection is not None and connection.is_connected():
cursor.close()
connection.close()

root = tk.Tk()
root.geometry("700x700")
root.title("Checkout")
root.configure(bg='#0d67b5')

C = Canvas(root, bg ="black", height = 1000, width = 950)

# lblmenu = tk.Label(root, text ="ADMIN CONTROL PANEL", bg= '#F7BF4F',font=('Times New Roman',28,'bold'))
# lblmenu.place(x = 120, y = 20)

global title_img
title_img = Image.open("images\logo_5.jpeg")
title_img = title_img.resize((500, 450))
title_img = ImageTk.PhotoImage(title_img)
panel_title = tk.Label(root, image = title_img)
panel_title.place(x=150,y=20,width=400,height=150)

name_lbl = tk.Label(root, text ="NAME",bg= '#0d67b5',fg ='white',font=("Times New Roman Bold", 10))
name_lbl.place(x = 50, y = 200)

name_txt= tk.Entry(root, width = 35,fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
name_txt.place(x = 350, y = 200, width = 300)

room_lbl = tk.Label(root, text ="ROOM TYPE",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
room_lbl.place(x = 50, y = 250)

room_lbl_2 = tk.Label(root, text ="[SUITE / DOUBLE ROOM / NORMAL]",fg ='white',bg= '#0d67b5',font=("Times New Roman
Bold", 10))
room_lbl_2.place(x = 50, y = 270)

drop_down_menu = StringVar(root)
drop_down_menu.set("Normal")

room_opt = OptionMenu(root, drop_down_menu, "Normal", "Suite", "Double")


room_opt.pack()
room_opt.place(x = 350, y = 250, width = 300)

date_lbl = tk.Label(root, text ="DATE [DD/MM/YYYY]",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10) )
date_lbl.place(x = 50, y = 300)

date_txt= tk.Entry(root, width = 35,fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
date_txt.place(x = 350, y = 300, width = 300)

id_lbl = tk.Label(root, text ="ID No.",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
id_lbl.place(x = 50, y = 350)

id_txt = tk.Entry(root, width = 35,fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
id_txt.place(x = 350, y = 350, width = 300)

checkout_cost = tk.Label(root, text ="Cost",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
checkout_cost.place(x = 50, y = 400)

50
checkout_cost_txt = tk.Entry(root, width = 35,fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10))
checkout_cost_txt.place(x = 350, y = 400, width = 300)

btninsert = tk.Button(root, text ="Calculate",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold",


10),command=calculate_total)
btninsert.place(x = 150, y = 480, width = 90)

btnclear = tk.Button(root, text ="Pay", fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10),command=payment)
btnclear.place(x = 250, y = 480, width = 90)

btnsearch = tk.Button(root, text ="Clear",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10),command=clear)
btnsearch.place(x = 350, y = 480, width = 90)

btnsearch = tk.Button(root, text ="Search",fg ='white',bg= '#0d67b5',font=("Times New Roman Bold", 10),command=search)
btnsearch.place(x = 450, y = 480, width = 90)

root.mainloop()

welcome_screen()
update_rooms_dictionary()
home_page()
booking_screen()
admin_panel()
checkout()

51
Sample Output

52
53
54
55
56
57
58
59
60
Merits and
Demerits

61
Merits (Advantages):

1. User-Friendly Interface: The project offers an intuitive and


visually appealing graphical user interface (GUI) that
enhances the user experience, making it easy for both
customers and administrators to navigate and use the system.

2. Real-Time Room Availability: The system provides


real-time updates on room availability, ensuring that users and
administrators can book rooms based on accurate
information.

3. Database Integration: The integration with a MySQL


database allows for efficient storage and retrieval of
reservation data, making it easy to manage and keep track of
bookings.

4. Payment Processing: The system handles payment


processing seamlessly and generates PDF receipts, providing
users with a convenient way to complete their bookings and
payments.

5. Reservation Management: Users and administrators can


search for, update, and cancel reservations, giving them
flexibility and control over their bookings.

62
6. Authentication and User Roles: The system distinguishes
between regular users and administrators, enhancing security
and allowing administrators to manage bookings effectively.

7. Future Booking Date Validation: The project ensures that


booking dates are in the future, preventing users from making
reservations for past dates.

8. Visual Room Availability Monitoring: The use of color-coded


room status in the admin panel provides a quick and visual
way for administrators to monitor room availability.

Demerits (Disadvantages):

1. Lack of User Registration: While there's a login system,


user registration functionality is not present, potentially limiting
the system's usability.

2. Scalability and Performance: The project may face


scalability and performance challenges if it needs to handle a
large number of reservations or users simultaneously.
Optimizations may be required.

3. Lack of Administrative User Controls: While administrators


can manage reservations, more advanced administrative
controls for managing user accounts and permissions may be
needed in a production environment.

63
4. Design Customization: The project may not offer easy ways
to customize the design or theme of the GUI to match the
branding of a specific hotel.

64
Bibliography

65
To develop this project many references were used:

1. Computer Science Textbook Class 12: Sumita Arora


2. Chapter Notes
3. https://www.google.com
4. https://www.python.org
5. https://www.mysql.org
6. https://www.tutorialaicsip.com

66
Remarks

67

You might also like