Travel Agency Management System
Travel Agency Management System
AISSCE – 2025
1
ST. JOSEPH’S RESIDENTIAL SCHOOL
SRIPERUMBUDUR, CHENNAI - 602105
BONAFIDE
CERTIFICATE
THIS IS TO CERTIFY THAT THE PROJECT ENTITLED ……………………………………………..
DATE:
SEAL:
2
TABLE OF CONTENTS
1. ACKNOWLEDGEMENT. 4
2. INTRODUCTION OF PYTHON. 5
3. INTRODUCTION TO DBMS. 6
4. INTRODUCTION TO SQL. 7
12. BIBLIOGRAPHY. 41
3
ACKNOWLEDGEMENT
successfully.
I would like to thank my Principal Rev. Sister. Reeta Roseline and I am very
guidance rendered which has sustained my efforts in all the stages of this
project work.
I would also like to thank my parents for their continuous support and
encouragement.
Admin Mr. Arun Raja for rendering their help in developing this project and to
4
INTRODUCTION TO PYTHON
with dynamic semantics. Its high-level built-in data structures, combined with
dynamic typing and dynamic binding; make it very attractive for Rapid
program modularity and code reuse. The Python interpreter and the extensive
standard library are available in source or binary form without charge for all
History of Python:
initially designed by "Guido van Rossum" in 1991 and developed by Python Software
Foundation. It was mainly developed for emphasis on code readability, and its syntax
5
INTRODUCTION TO DATABASE
INTRODUCTION TO DBMS
Advantages of DBMS:
i. Data independence.
ii. Efficient data access.
iii. Data Integrity and Security.
6
INTRODUCTION TO SQL
o SQL stands for Structured Query Language. It is used for storing and managing
data in relational database management system (RDMS).
Characteristics of SQL:
SQL
7
Python MySQL Connector
It is a Python driver that helps to integrate Python and MySQL. This Python MySQL
library allows the conversion between Python and MySQL data types. MySQL Connector
API is implemented using pure Python and does not require any third-party library.
Installation
To install the mysql-connector-python module, one must have Python and PIP,
preinstalled on their system.
The connect statement creates a connection to the mysql server and returns a MySQL
connection object.
Syntax:
Example:
import mysql.connector
con=mysql.connector.connect(host="localhost", user="root", password="root")
8
Creating a cursor Object:
Example: Cursor=con.cursor()
The above code will execute the sql query and store the retrieved records (resultset) in
the cursor object(cursor).
The records retrieved from the database using SQL select query has to be extracted as
record from the result set. We can extract data from the result set using the following
fetch() function.
fetchone()-Fetches the next row of a query result set, returning a single sequence or
None when no more data is available
fetchmany (size)-Fetches the next set of rows of a query result, returning a sequence
of
sequences. It will return number of rows that matches to the size
argument.
9
ABSTRACT
Travel Agency management system is used to book a tour from anywhere in the world
by a single application which will help the user to know all about the Drivers and Vehicle
details in a single application. The admin can add Drivers and Vehicle details to the
application from a certain travel agents. Then the users can sign in and book each
project, they can be confirmed by the admin in their booking page. The user can see
the confirmation in their booking page. It is a easiest platform for all travelers which can
be easily booked and know the all details. It is also called travel technology solution for
agencies & tour operation. I have used Python programming as front end and MySQL as
back end.
10
EXISTING SYSTEM
In the existing system, each task is carried out manually and processing is also a
tedious job. In previous system travelers were maintaining time table details manually
in pen and paper, which was time taking and costly. The travelers are not able to
achieve its need in time and also the results may not accurate. Because of the manual
maintenance there are number of difficulties and drawbacks exist in the system.
PROPOSED SYSTEM
The proposed system is designed to be more efficient than the manual system. It
invokes all base tasks that are now carried out manually, such as the forms transactions
and reports which is added advantage. The proposed System is completely computer-
based application. Thousands of records can searched and displayed without taking any
significant time.
11
HARDWARE AND SOFTWARE REQUIREMENTS
HARDWARES
2. Mobile Phone
SOFTWARES
2. MySQL
12
PROJECT AIM AND OBJECTIVES
This project "TRAVEL AGENCY MANAGEMENT" is used to automate all process of the
travel and which deals with creation, booking and confirmation and user details. The
project is designed Python as front end and MySQL 8.0 as backend which works in any
operating system. Travel management system is used to book a Vehicle from anywhere
in the world by a single application which will help the user to know all about the places
and tour details in a single application. Then the users can sign in and book each
project, they can be confirmed by the admin in their booking page. The user can see
the confirmation in their booking page. It is an easiest platform for all travelers which
Backend Details
Interfacing python with mysql we can store and retrieve data back easily.
This table is used to store the details of Drivers Such as Driver Id, Driver Name,
Aadhar No, Address, Phone Number, Status of booking of the driver.. It has the
following structure.
This table is used to store the details of Customers who wants to book.
14
FRONT END DETAILS
In this part, I would like to discuss various modules inside the project Travel Agency
Management System.
1. Main Menu:
The Main Menu contains one option.
Main Menu
Admin
2. Admin Menu:
The Admin is the authorized after entering correct user name and password
he/she can to create database, to Create and see the details of Places and
Customers. This module contains the following sub modules.
Admin Menu
Create Database
Driver Menu
Vehicle Menu
Booking Menu
15
3. Drivers Menu:
The Drivers module will help to create new Driver details, display, and search,
modify and delete Driver details. It contains the following sub modules.
Drivers Menu
Create Driver
Search Driver
Modify Driver
Delete Driver
4. Vehicles Menu:
The Vehicles module will help to create new Vehicles details, display, and
search,
modify and delete Vehicle details. It contains the following sub modules.
Vehicles Menu
Create Vehicle
Search Vehicle
Modify Vehicle
Delete Vehicle
5. Booking Menu
This module will help to Book various places by the existing Users.
Booking Menu
New Booking
Show Booking
16
SOURCE CODE
import mysql.connector
from tabulate import tabulate
def Database():
con=mysql.connector.connect(host='localhost',user='root',password='root')
if con.is_connected():
opt=input("Are you creating Database first time(y/n):")
if opt=='y':
cur=con.cursor()
q="CREATE DATABASE TRAVEL"
cur.execute(q)
Tables()
print("\n")
print("Database is created Successfully")
print("Drivers table is created Successfully")
print("Vehicles table is created Successfully")
print("Booking table is created Successfully")
else:
con.close()
Main_Menu()
con.close()
Main_Menu()
def Tables():
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
DRIVER="CREATE TABLE DRIVERS(D_ID INT PRIMARY KEY,NAME\
VARCHAR(20),AADHAR_NO INT, ADDRESS VARCHAR(50),PHONE_NO\
INT,STATUS VARCHAR(10))"
VEHICLE="CREATE TABLE VEHICLES(V_ID INT PRIMARY KEY,VNAME\
VARCHAR(20),RENT INT,FUEL_TYPE\
VARCHAR(20),STATUS VARCHAR(20))"
17
BOOKING="CREATE TABLE BOOKING(B_ID INT PRIMARY KEY,D_ID INT,V_ID\
INT,NAME VARCHAR(20),DIST INT,DOT DATE,TOTAL_NO_DAYS\
INT,F_TYPE VARCHAR(20),MOB_NO INT,TOTAL_RENT INT)"
cur.execute(DRIVER)
cur.execute(VEHICLE)
cur.execute(BOOKING)
print("Tables are created Successfully")
con.close()
def Main_Menu():
print("\n")
print("*"*40)
print("WELCOME TO TRAVEL MANAGEMENT SYSTEM")
print("*"*40)
Admin_Menu()
def Admin_Menu():
print("\n")
print('*'*35)
print("WELCOME TO ADMIN MENU")
print('*'*35)
User=input("Enter the Username:")
Pwd=input("Enter the Password:")
if User=='admin' and Pwd=='admin@123':
print("1.To Create Database")
print("2.Driver")
print("3.Vehicle")
print("4.Booking")
print("5.Exit")
ch=int(input("Enter your choice:"))
if ch==1:
Database()
elif ch==2:
Driver_Menu()
elif ch==3:
Vehicle_Menu()
elif ch==4:
18
Booking_Menu()
elif ch==5:
exit()
def Driver_Menu():
print("\n")
print('*'*30)
print("WELCOME TO DRIVERS MENU")
print('*'*30)
print("1. New Driver Registration")
print("2. Display all Drivers")
print("3. Search Drivers")
print("4. Modify Drivers Information")
print("5. Delete Drivers Information")
print("6. To Go back to Admin menu")
print("7. Exit")
ch=int(input("Enter your choice:"))
if ch==1:
Reg_Driver()
elif ch==2:
Disp_Driver()
elif ch==3:
Search_Driver()
elif ch==4:
Modify_Driver()
elif ch==5:
Delete_Driver()
elif ch==6:
Admin_Menu()
elif ch==7:
exit()
else:
print("Invalid Option.Try Again!!!")
def Reg_Driver():
print("\n")
19
print('*'*40)
print("WELCOME TO DRIVER DETAILS CREATION MENU")
print('*'*40)
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
H1=int(input("ENTER THE DRIVER ID\t\t\t\t:"))
I=input("ENTER THE NAME OF THE DRIVER\t\t\t:")
A=int(input("ENTER THE AADHAR NUMBER OF DRIVER\t\t:"))
S=input("ENTER THE ADDRESS OF THE DRIVER\t\t\t:")
N=int(input("ENTER THE PHONE NUMBER OF THE DRIVER\t\t:"))
H=input("ENTER THE STATUS(BOOKED(B)/NOT BOOKED(NB))\t:")
V="INSERT INTO DRIVERS VALUES({},'{}',{},'{}',{},'{}')".format(H1,I,A,S,N,H)
cur.execute(V)
con.commit()
print("\nTHE DRIVER DETAILS HAVE BEEN ENTERD SUCCESSFULLY")
opt=input("Do you want to create another driver details(y/n):")
if opt=='y':
Reg_Driver()
else:
Admin_Menu()
con.close()
def Disp_Driver():
print("\n")
print('*'*40)
print("WELCOME TO DRIVER DETAILS DISPLAY MENU")
print('*'*40)
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
q="SELECT * FROM DRIVERS"
cur.execute(q)
S1=[]
H1=['Driver Id','Dname','Aadhar','Address','Phone_No','Status']
try:
20
d1=cur.fetchall()
for i in range(len(d1)):
S1.append(list(d1[i]))
print(tabulate(S1,headers=H1,tablefmt='psql'))
except:
pass
con.close()
Driver_Menu()
def Search_Driver():
print("\n")
print("*"*35)
print("WELCOME TO DRIVER SEARCH MENU")
print("*"*35)
print("\n")
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
no=int(input("Enter the Driver id you want to search:"))
q="SELECT * FROM DRIVERS WHERE D_ID={}".format(no)
cur.execute(q)
S=[]
H=['Driver Id','Dname','Aadhar','Address','Phone_No','Status']
try:
d=cur.fetchall()
for i in range(len(d)):
S.append(list(d[i]))
print(tabulate(S,headers=H,tablefmt='psql'))
except:
pass
con.close()
Driver_Menu()
def Modify_Driver():
print('*'*30)
print("Welcome to Driver Details modification menu")
print('*'*30)
21
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
no=int(input("Enter the Driver Id that you want to modify:"))
Q1="SELECT D_ID FROM DRIVERS WHERE D_ID={}".format(no)
cur.execute(Q1)
try:
D=cur.fetchall()
for i in D:
if no==i[0]:
print("Choose any one of the options given below to modify")
print("1.To modify the Driver Id")
print("2.To modify the Driver name")
print("3.To modify the Aadhar Number")
print("4.To modify the Address of the driver")
print("5.To modify the Phone Number")
ch=int(input("Enter your choice:"))
if ch==1:
New_code=int(input("Enter the New Driver Id:"))
Q2="UPDATE DRIVERS SET D_ID={} WHERE\
D_ID={}".format(New_code,no)
cur.execute(Q2)
elif ch==2:
New_name=input("Enter the New Driver Name:")
Q2="UPDATE DRIVERS SET NAME='{}' WHERE D_ID={}".format
(New_name,no)
cur.execute(Q2)
elif ch==3:
New_Aadhar=int(input("Enter the New Aadhar number that you want
to
modify:"))
22
Q2="UPDATE DRIVERS SET AADHAR_NO={} WHERE\
D_ID={}".format(New_Aadhar,no)
cur.execute(Q2)
elif ch==4:
New_Address=input("Enter the New Address of the Driver :")
Q2="UPDATE DRIVERS SET Address='{}' WHERE\
D_ID={}".format(New_Address,no)
cur.execute(Q2)
elif ch==5:
New_Phone=int(input("Enter the new phone number of the driver:"))
Q2="UPDATE DRIVERS SET PHONE_NO={} WHERE\
D_ID={}".format(New_Phone,no)
cur.execute(Q2)
con.commit()
print("\nModified Successfully")
opt=input("\nDo you want to modify another Driver details(y/n):")
if opt=='y':
Modify_Driver()
else:
con.close()
Driver_Menu()
else:
print("The Driver Id is not available")
except:
con.close()
pass
con.close()
Driver_Menu()
def Delete_Driver():
print('*'*40)
print("Welcome to Driver Details deletion menu")
print('*'*40)
23
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
print("1.To delete driver details based on Driver Id")
print("2.To delete the driver details based on Booking Status")
ch=int(input("Enter your choice:"))
if ch==1:
no=int(input("Enter the Driver Id Which You Want TO Delete:"))
Q="DELETE FROM DRIVERS WHERE D_ID={}".format(no)
cur.execute(Q)
elif ch==2:
no=input("Enter Which Booking Status You want to delete Booking(B)/Not
Booking(NB):")
if no.lower()=='b'or 'nb':
Q="DELETE FROM DRIVERS WHERE STATUS='{}'".format(no)
cur.execute(Q)
con.commit()
print("\n Driver Details are deleted successfully")
opt=input("\nDo you want to delete another Driver details(y/n):")
if opt=='y':
Delete_Driver()
else:
con.close()
Driver_Menu()
con.close()
Driver_Menu()
def Vehicle_Menu():
print("*"*30)
print("WELCOME TO VEHICLE MENU")
print("*"*30)
24
print("1. Add Vehicle")
print("2. Show vehicle")
print("3. Search Vehicle")
print("4. Modify Vehicle")
print("5. Delete Vehicle")
print("6. To Go back to Admin menu")
ch=int(input("Enter your choice:"))
if ch==1:
Add_Vehicle()
elif ch==2:
Disp_Vehicle()
elif ch==3:
Search_Vehicle()
elif ch==4:
Modify_Vehicle()
elif ch==5:
Delete_Vehicle()
elif ch==6:
Admin_Menu()
else:
print('Invalid Option. Try Again!!!')
Vehicle_Menu()
def Add_Vehicle():
print("*"*30)
print("WELCOME TO VEHICLE DETAILS CREATION MENU")
print("*"*30)
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
def Disp_Vehicle():
print("\n")
print('*'*30)
print("WELCOME TO VEHICLE DETAILS DISPLAY MENU")
print('*'*30)
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
q="SELECT * FROM VEHICLES"
cur.execute(q)
S=[]
H=['Vehicle Id','Vname','Rent','Fuel Type','Status']
try:
d=cur.fetchall()
for i in range(len(d)):
S.append(list(d[i]))
print(tabulate(S,headers=H,tablefmt='psql'))
except:
pass
con.close()
Vehicle_Menu()
def Search_Vehicle():
print("\n")
print("*"*35)
print("WELCOME TO VEHICLE DETAILS SEARCH MENU")
print("*"*35)
print("\n")
26
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
print("1.Search Based on Vehicle Id")
print("2.Search Based on Vehicle Booking Status")
opt=int(input("Enter your choice:"))
if opt==1:
no=int(input("Enter the Vehicle id you want to search:"))
q1="SELECT * FROM VEHICLES WHERE V_ID={}".format(no)
cur.execute(q1)
S=[]
H=['Vehicle Id','Vname','Rent','Fuel Type','Status']
try:
d=cur.fetchall()
for i in range(len(d)):
S.append(list(d[i]))
print(tabulate(S,headers=H,tablefmt='psql'))
except:
pass
elif opt==2:
ch1=input("Searc Based on Booking(B)/Not-Booking(NB)?:")
if ch1.lower()=='b' or ch1.lower()=='nb':
q1="SELECT * FROM VEHICLES WHERE STATUS='{}'".format(ch1)
cur.execute(q1)
S1=[]
H1=['Vehicle Id','Vname','Rent','Fuel Type','Status']
try:
d1=cur.fetchall()
for i in range(len(d1)):
S1.append(list(d1[i]))
print(tabulate(S1,headers=H1,tablefmt='psql'))
except:
pass
con.close()
Vehicle_Menu()
27
def Modify_Vehicle():
print('*'*30)
print("Welcome to Driver Details modification menu")
print('*'*30)
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
no=int(input("Enter the Vehicle Id that you want to modify:"))
Q1="SELECT V_ID FROM VEHICLES WHERE V_ID={}".format(no)
cur.execute(Q1)
try:
D=cur.fetchall()
for i in D:
if no==i[0]:
print("Choose any one of the options given below to modify")
print("1.To modify the Vehicle Id")
print("2.To modify the Vehicle name")
print("3.To modify the Rent of the vehicle")
print("4.To modify the Fuel_Type")
print("5.To modify the Status")
ch=int(input("Enter your choice:"))
if ch==1:
New_code=int(input("Enter the New Vehicle Id:"))
Q2="UPDATE VEHICLES SET V_ID={} WHERE\
V_ID={}".format(New_code,no)
cur.execute(Q2)
elif ch==2:
New_name=input("Enter the New Vehicle Name:")
Q2="UPDATE VEHICLES SET VNAME='{}' WHERE V_ID={}".format
(New_name,no)
cur.execute(Q2)
elif ch==3:
New_Rent=int(input("Enter the New Rent that you want to modify:"))
28
Q2="UPDATE VEHICLES SET RENT={} WHERE\
V_ID={}".format(New_Rent,no)
cur.execute(Q2)
elif ch==4:
New_Fuel=input("Enter the New Fuel Type :")
Q2="UPDATE VEHICLES SET FUEL_TYPE='{}'WHERE\
V_ID={}".format(New_Fuel,no)
cur.execute(Q2)
elif ch==5:
New_Status=input("Enter the current status of the Vehicle
Booked(B)/Not Booked(NB):")
Q2="UPDATE VEHICLES SET STATUS='{}' WHERE\
V_ID={}".format(New_Status,no)
cur.execute(Q2)
con.commit()
print("\nModified Successfully")
opt=input("\nDo you want to modify another Driver details(y/n):")
if opt=='y':
Modify_Vehicle()
else:
con.close()
Vehicle_Menu()
else:
print("The Driver Id is not available")
except:
con.close()
pass
con.close()
Vehicle_Menu()
def Delete_Vehicle():
print('*'*40)
print("Welcome to Driver Details deletion menu")
print('*'*40)
con=mysql.connector.connect(host='localhost',user='root',password='root',database
='TRAVEL')
if con.is_connected():
cur=con.cursor()
29
print("1.To delete Vehicle details based on Vehicle Id")
print("2.To delete the Vehicle details based on Booking Status")
ch=int(input("Enter your choice:"))
if ch==1:
no=int(input("Enter the Vehicle Id Which You Want TO Delete:"))
Q="DELETE FROM VEHICLES WHERE V_ID={}".format(no)
cur.execute(Q)
elif ch==2:
no=input("Enter Which Booking Status You want to delete Booking(B)/Not
Booking(NB):")
if no.lower()=='b'or 'nb':
Q="DELETE FROM VEHICLES WHERE STATUS='{}'".format(no)
cur.execute(Q)
con.commit()
print("\nVehicle Details are deleted successfully")
opt=input("\nDo you want to delete another Vehicle details(y/n):")
if opt=='y':
Delete_Driver()
else:
con.close()
Vehicle_Menu()
con.close()
Vehicle_Menu()
def Booking_Menu():
print("*"*30)
print("WELCOME TO BOOKING MAIN MENU")
print("*"*30)
print("1. NEW BOOKING")
print("2. SHOW BOOKING")
print("3. RETURN TO ADMIN MENU")
ch=int(input("Enter your choice:"))
if ch==1:
New_Booking()
30
elif ch==2:
Show_Booking()
elif ch==3:
Admin_Menu()
else:
print("Invalid Choice,Try Again!!!")
Booking_Menu()
def New_Booking():
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
print("\n")
print("*"*30)
print("\nThe Current Status of Vehicles")
print("*"*30)
q1="SELECT * FROM VEHICLES"
cur.execute(q1)
S=[]
H=['Vehicle Id','Vname','Rent','Fuel Type','Status']
try:
d=cur.fetchall()
for i in range(len(d)):
S.append(list(d[i]))
print(tabulate(S,headers=H,tablefmt='psql'))
except:
pass
print("\n")
print("*"*30)
print("\nThe Current Status of Drivers")
print("*"*30)
q2="SELECT * FROM DRIVERS"
cur.execute(q2)
S2=[]
H2=['Driver Id','Dname','Aadhar','Address','Phone_No','Status']
try:
d2=cur.fetchall()
for i in range(len(d2)):
31
S2.append(list(d2[i]))
print(tabulate(S2,headers=H2,tablefmt='psql'))
except:
pass
a=int(input("\nEnter the Vehicle id that you want to book:"))
q3="SELECT V_ID FROM VEHICLES"
cur.execute(q3)
try:
d3=cur.fetchall()
#print(d3)
if d3==[]:
print("Vehicle Id not found")
else:
for i in d3:
if i[0]==a:
q4="SELECT STATUS FROM VEHICLES WHERE V_ID={}".format(a)
cur.execute(q4)
d4=cur.fetchall()
for i in d4:
if i[0]=='NB':
b=int(input("\nEnter the Driver id that you want to book:"))
q5="SELECT D_ID FROM DRIVERS"
cur.execute(q5)
d5=cur.fetchall()
if d5==[]:
print("Driver Id Not found")
else:
for i in d5:
if i[0]==b:
q6="SELECT STATUS FROM DRIVERS WHERE\
D_ID={}".format(b)
cur.execute(q6)
d6=cur.fetchall()
for i in d6:
if i[0]=='NB':
B_Id=int(input("ENTER THE BOOKING ID:"))
CName=input("ENTER THE CUSTOMER NAME:")
Dist=int(input("ENTER THE DISTANCE:"))
32
DOT=input("ENTER THE DATE OF TRAVEL:")
No_of_Days=int(input("ENTER THE NO OF DAYS:"))
F_Type=input("ENTER THE FUEL TYPE:")
Mob=int(input("ENTER THE MOBILE NO:"))
Rent="SELECT RENT FROM VEHICLES WHERE\
V_ID={}".format(a)
cur.execute(Rent)
d7=cur.fetchall()
for i in d7:
Tot_Rent=i[0]*No_of_Days
q7="INSERT INTO BOOKING\
VALUES({},{},{},'{}',{},'{}',{},'{}',{},
{})".format(B_Id,b,a,
CName,Dist,DOT,No_of_Days,_Type,Mob,Tot_Rent)
cur.execute(q7)
q8="UPDATE VEHICLES SET STATUS='B' WHERE
V_ID={}".format(a)
cur.execute(q8)
q9="UPDATE DRIVERS SET STATUS='B' WHERE\
D_ID={}".format(b)
cur.execute(q9)
con.commit()
print("\nYou have to pay R.s",Tot_Rent)
Show_Booking(B_Id,a,b)
Break
else:
print("Sorry!!! The driver chosen by you is booked by
other customer")
break
else:
print("Sorry!!! The vehicle chosen by you is booked by other
customer")
except:
pass # print("Sorry you can't Book the Vehicle")
con.close()
opt=input("Do you want to Book another vehicle(y/n)?:")
33
if opt=='y':
New_Booking()
else:
Booking_Menu()
def Show_Booking(BID=0,VID=0,DID=0):
print("\n")
print('*'*40)
print("WELCOME TO BOOKING CUSTOMER DETAILS DISPLAY MENU")
print('*'*40)
con=mysql.connector.connect(host='localhost',user='root',password='root',
database='TRAVEL')
if con.is_connected():
cur=con.cursor()
if BID==0 and VID==0 and DID==0:
Q1="SELECT B_ID,V_ID,D_ID FROM BOOKING"
cur.execute(Q1)
D=cur.fetchall()
S1=[]
H1=['B_ID','V_NAME','D_NAME','CUST_NAME','DIST','DOT','NO.OF_DAYS',
'TYPE','MOB_NO','TOT_RENT']
if D==[]:
print("No one is booked yet")
else:
for j in D:
a=j[0]#B_id
b=j[1]#V_Id
c=j[2]#D_id
Q2="SELECT B.B_ID,V.VNAME,D.NAME,B.NAME,B.DIST,B.DOT,\
B.TOTAL_NO_DAYS,B.F_TYPE,B.MOB_NO,B.TOTAL_RENT\
FROM DRIVERS D,VEHICLES V,BOOKING B WHERE B.B_ID={} AND
V.V_ID={} AND D.D_ID={}".format(a,b,c)
cur.execute(Q2)
try:
34
d1=cur.fetchall()
for i in range(len(d1)):
S1.append(list(d1[i]))
except:
pass
print(tabulate(S1,headers=H1,tablefmt='psql'))
else:
q="SELECT B.B_ID,V.VNAME,D.NAME,B.NAME,B.DIST,B.DOT,\
B.TOTAL_NO_DAYS,B.F_TYPE,B.MOB_NO,B.TOTAL_RENT\
FROM DRIVERS D,VEHICLES V,BOOKING B WHERE B.B_ID={} AND
V.V_ID={} AND D.D_ID={}".format(a,b,c)
cur.execute(q)
S=[]
H=['B_ID','V_NAME','D_NAME','CUST_NAME','DIST','DOT','NO.OF_DAYS',
'TYPE','MOB_NO','TOT_RENT']
try:
d=cur.fetchall()
for i in range(len(d)):
S.append(list(d[i]))
print(tabulate(S,headers=H,tablefmt='psql'))
print("Booked Successfully")
except:
pass
con.close()
Admin_Menu()
#Main Program
Main_Menu()
1. ADMIN MENU:
35
2. DRIVER CREATION MENU:
36
4. SEARCHING DRIVER DETAILS:
37
7. DISPLAYING VEHICLE DETAILS:
38
8. SEARCHING VEHICLE DETAILS:
39
11. SHOWING BOOKED USER DETAILS:
***************************************************************************
40
BIBLIOGRAPHY
BOOKS:
WEBSITES:
www.geeksforgeeks.org
https://docs.python.org/3/
41