Hotel Management System Documentation
Hotel Management System Documentation
Overview
The Hotel Management System is a graphical user interface (GUI) application built using
Tkinter and SQLite in Python. It allows hotel administrators to manage guest bookings,
perform check-ins and check-outs, export booking details, and manage user authentication.
Features
1. Guest Management
o Add new guests with name, room number, check-in, and check-out dates.
o Display all guests currently checked into the hotel.
o Check out guests and remove them from the database.
2. Export Bookings
o Export all booking details to a text file for record keeping.
3. User Management
o Secure login system with username and password authentication.
o Ability to create new user accounts for hotel administrators.
Modules
1. Main Module: hotel_management.py
Functionality:
o Establishes a connection to SQLite database (hotel_management.db).
o Defines GUI elements using Tkinter for guest management, booking export,
and user authentication.
o Implements functions to interact with the database (add, delete guests) and
handle user login/authentication.
Tables:
o guests: Stores guest information including id, name, room_number,
check_in_date, and check_out_date.
GUI Components
Dark Theme Colors
Widgets
Labels, Entries, Buttons, and Listbox widgets are styled using the defined dark theme
colors to provide a visually cohesive user interface.
Usage
1. Login
oLaunch the application and enter valid credentials to access the main interface.
oCreate new user accounts if necessary using the provided interface.
2. Main Interface
o Add guests by filling in the required fields and clicking the "Check-In" button.
o View current guests, perform check-outs, and export bookings as needed.
Dependencies
Python Libraries:
o sqlite3: Database interaction.
o tkinter: GUI development.
o datetime: Handling date inputs and comparisons.
o os: File and directory operations.
Known Issues
No known issues at the time of documentation.
Future Enhancements
Implement data validation for date inputs (e.g., valid date formats, range checks).
Enhance user interface with additional features such as room status visualization and
booking statistics.
Author
Author Names: Aditya Mishra, Vedant Vasaikar
Version: 1.0
Date:
import sqlite3
import tkinter as tk
import os
import datetime
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''
name TEXT,
room_number INTEGER,
check_in_date DATE,
check_out_date DATE
''')
def add_guest():
try:
name = name_entry.get()
room_number = int(room_entry.get())
check_in_date_str = check_in_entry.get()
check_out_date_str = check_out_entry.get()
# Basic validation
return
return
current_date = datetime.date.today()
return
conn.commit()
name_entry.delete(0, tk.END)
room_entry.delete(0, tk.END)
check_in_entry.delete(0, tk.END)
check_out_entry.delete(0, tk.END)
display_guests()
except ValueError:
except sqlite3.Error as e:
messagebox.showerror("Database Error", f"Error inserting guest: {e}")
except Exception as e:
def display_guests():
try:
guests = cursor.fetchall()
guest_list.delete(0, tk.END)
except sqlite3.Error as e:
def check_out_guest():
try:
selected = guest_list.get(tk.ACTIVE)
if not selected:
return
conn.commit()
display_guests()
except sqlite3.Error as e:
try:
if not file_path:
return
guests = cursor.fetchall()
except IOError as e:
except sqlite3.Error as e:
def create_user():
try:
new_username = new_username_entry.get()
new_password = new_password_entry.get()
return
file.write(f"{new_username}:{new_password}\n")
new_username_entry.delete(0, tk.END)
new_password_entry.delete(0, tk.END)
except IOError as e:
messagebox.showerror("Error", f"Error writing to login credentials file: {e}")
def login():
try:
username = username_entry.get()
password = password_entry.get()
credentials = file.readlines()
show_main_window()
return
username_entry.delete(0, tk.END)
password_entry.delete(0, tk.END)
except IOError as e:
def show_main_window():
global window
window = tk.Tk()
global name_entry
global room_entry
global check_in_entry
global check_out_entry
display_frame.pack(padx=10, pady=10)
guest_list_label.pack()
global guest_list
guest_list = tk.Listbox(display_frame, width=50, bg=ENTRY_BG_COLOR, fg=FG_COLOR)
guest_list.pack(pady=5)
action_frame.pack(padx=10, pady=10)
display_guests()
window.mainloop()
def show_login_window():
global login_window
login_window = tk.Tk()
login_window.title("Login")
login_window.configure(bg=BG_COLOR)
username_label.pack(pady=5)
global username_entry
username_entry.pack(pady=5)
password_label.pack(pady=5)
global password_entry
password_entry.pack(pady=5)
create_user_frame.pack(pady=10)
global new_username_entry
global new_password_entry
login_window.mainloop()
show_login_window()