0% found this document useful (0 votes)
38 views41 pages

Travel Agency Management System

Uploaded by

penjamin11586
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views41 pages

Travel Agency Management System

Uploaded by

penjamin11586
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 41

ST.

JOSEPH’S RESIDENTIAL SCHOOL


SRIPERUMBUDUR, CHENNAI - 602105

AISSCE – 2025

COMPUTER SCIENCE PROJECT

"TRAVEL AGENCY MANAGEMENT SYSTEM"

DEPARTMENT OF COMPUTER SCIENCE


2024 - 2025

1
ST. JOSEPH’S RESIDENTIAL SCHOOL
SRIPERUMBUDUR, CHENNAI - 602105

DEPARTMENT OF COMPUTER SCIENCE 2024-25

BONAFIDE
CERTIFICATE
THIS IS TO CERTIFY THAT THE PROJECT ENTITLED ……………………………………………..

IS A RECORD OF BONAFIDE WORK CARRIED OUT BY ………………………………………………

REGISTER NO ……………………………….. OF CLASS-XII

SIGNATURE OF THE TEACHER SIGNATURE OF THE PRINCIPAL

IN PARTIAL FULFILLMENT OF THE REQUIREMENTS IN COMPUTER SCIENCE


(083) PRESCRIBED BY CBSE FOR ALL INDIA SENIOR SECONDARY PRACTICAL
EXAMINATION 2024-25 AT ST. JOSEPH’S RESIDENTIAL SCHOOL,
SRIPERUMBUDUR-602105

DATE:

SEAL:

INTERNAL EXAMINER EXTERNAL EXAMINER

2
TABLE OF CONTENTS

S.No DESCRIPTION PAGE NO

1. ACKNOWLEDGEMENT. 4

2. INTRODUCTION OF PYTHON. 5

3. INTRODUCTION TO DBMS. 6

4. INTRODUCTION TO SQL. 7

5. INTRODUCTION PYTHON SQL CONNECTOR. 8

6. ABSTRACT OF THE PROJECT. 10

7. EXISTING AND PROPOSED SYSTEM. 11

8. HARDWARE AND SOFTWARE REQUIREMENTS. 12

PROJECT AIM AND OBJECTIVES& BACK END, FRONT


9. 13
END DETAILS.

10. SOURCE CODE OF THE PROJECT. 17

11. SAMPLE OUTPUT /SCREEN SHOTS OF EXECUTION. 36

12. BIBLIOGRAPHY. 41

3
ACKNOWLEDGEMENT

I thank everyone who supported and helped me in completing this project

successfully.

I would like to thank my Principal Rev. Sister. Reeta Roseline and I am very

thankful to my Computer Science teacher Mr. Rajesh.B for his valuable

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.

My thanks and appreciation to my friends and the Computer Science Laboratory

Admin Mr. Arun Raja for rendering their help in developing this project and to

the people who have willingly helped me with their abilities.

4
INTRODUCTION TO PYTHON

Python is an interpreter, object-oriented, high-level programming language

with dynamic semantics. Its high-level built-in data structures, combined with

dynamic typing and dynamic binding; make it very attractive for Rapid

Application Development, as well as for use as a scripting or glue language to

connect existing components together. Python's simple, easy to learn syntax

emphasizes readability and therefore reduces the cost of program

maintenance. Python supports modules and packages, which encourages

program modularity and code reuse. The Python interpreter and the extensive

standard library are available in source or binary form without charge for all

major platforms, and can be freely distributed.

History of Python:

Python is a widely used general-purpose, high-level programming language. It was

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

allows programmers to express concepts in fewer lines of code.

5
INTRODUCTION TO DATABASE

Database is a collection of interrelated data which helps in the efficient retrieval,


insertion, and deletion of data from the database and organizes the data in the form of
tables.

INTRODUCTION TO DBMS

 It stands for "Database Management System".


 It refers to the technology for creating and managing databases. DBMS is a
software tool to organize (create, retrieve, update, and manage) data in a
database.
 Example: Oracle, MySQL, MongoDB and Microsoft SQL server etc…

Why Use DBMS ?


 To develop software applications In less time.
 Data independence and efficient use of data.
 For uniform data administration.
 For data integrity and security.
 For concurrent access to data, and data recovery from crashes.
 To use user-friendly declarative query language.

Advantages of DBMS:
i. Data independence.
ii. Efficient data access.
iii. Data Integrity and Security.

Components of Database Applications:

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).

o It is a standard language for Relational Database System. It enables a user to


create, read, update and delete relational databases and tables.

Characteristics of SQL:

 SQL is easy to learn.


 SQL is used to access data from relational database management systems.
 SQL can execute queries against the database.
 SQL is used to describe the data.
 SQL is used to define the data in the database and manipulate it when needed.
 SQL is used to create and drop the database and table.

SQL Commands Categories:


It is divided into four cateogries. They are:

SQL

DDL CREATE, ALTER, and DROP

DML INSERT, UPDATE, DELETE,


SELECT

DCL GRANT, REVOKE

TCL Roll Back, Commit, Save Point

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.

Example:pip install mysql-connector-python

 After Successful installation we must import python sql connector by using


import keyword.
 Example: import mysql.connector

Steps for creating database connectivity applications:


Step 1: Start Python: Start python editor to create your python script

Step 2: mysql.connector package

Step 3: Establishing connection to MySQL DATABASE

We need to establish a connection to a mysql database using connect() function of


mysql.connector package.

The connect statement creates a connection to the mysql server and returns a MySQL
connection object.

Syntax:

Connection object>=mysql.connectorconnect (host=<hostname>,


user=<username>, password=<password>, database=<dbname>)

Example:
import mysql.connector
con=mysql.connector.connect(host="localhost", user="root", password="root")

8
Creating a cursor Object:

It is a useful control structure of database connectivity. It will let us execute all


the queries we need. Cursor stores all the data as a temporary container of returned
data and allows traversal so that we can fetch data one row at a time from cursor.
Cursors are created by the connection.cursor() method.

Syntax:cursor object =<connectionobject> .cursor()

Example: Cursor=con.cursor()

Execute SQL query:


We can execute SQL query using execute() function

Syntax: cursor object.execute(SQL QUERY)

Example: cursor.execute("select* from data")

The above code will execute the sql query and store the retrieved records (resultset) in
the cursor object(cursor).

Extract data from Result set:

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.

(i) fetchall() (ii) fetchone() (iii) fetchmany()

Ways to retrieve data

fetchall()-Fetches all (remaining) rows of a query result. returning them as a sequence


of
sequences (e.g. a list of tuples).

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.

Some of them are Drawbacks of the Existing System:

 Increased transaction leads to increased source document and hence


maintenance becomes difficult.
 If any admin, user entry is wrongly made then the maintenance becomes very
difficult.

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.

Advantages of the Proposed System:

 Gives accurate information:


 Simplifies the manual work.
 It minimizes the documentation related work.
 Provides up to date information.
 Friendly Environment by providing warning messages.
 Traveler’s details can be provided booking confirmation notification.

11
HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARES

1. Desktop Computer / Laptop

2. Mobile Phone

SOFTWARES

1. Python (Latest Version)

2. MySQL

3. MySQL-Connector-Python,Requests,Wikipedia-API, Datetime, Pyfiglet Modules

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

can be easily booked and know the all details.

Backend Details

 To store inputs, in this project I have used Mysql.

 Interfacing python with mysql we can store and retrieve data back easily.

 The following are the details of Database and Tables:

Database Name: TRAVEL

Details of the tables used in this project:

In this project I have used the following tables:

(i) Table Name: DRIVERS

 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.

Field Name Data Type Remarks


D_ID Int Primary Key
Name Varhcar(20)
Aadhar_No Varchar(10)
Address Varchar(50)
Phonen_No Int
Status Varchar(10)

(ii) Table Name : VEHICLES


13
 This table is used to store the details of Vehicles Such as Vehicle id, Vehicle
Name, Rent, Fuel Type , Status of the vehicle whether it is Booked or Not booked.
and it has the following structure:

Field Name Data Type Remarks


V_ID Int Primary Key
VNAME Varhcar(20)
RENT Int
FUEL_TYPE Varhcar(20)
STATUS Varhcar(20)

(iii) Table Name : BOOKING

 This table is used to store the details of Customers who wants to book.

Field Name Data Type Remarks


B_ID Int Primary Key
V_ID Int
D_ID Int
NAME Varchar(20)
DIST Int
TOTAL_NO_DAY Int
S
F_TYPE Varchar(20)
MOB_NO Int
TOTAL_RENT Int

14
FRONT END DETAILS

MODULES OF TRAVEL AGENCY MANAGEMENT SYSTEM:

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

Display all Drivers

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

Display all 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()

I=int(input("ENTER THE VEHICLE_ID OF VEHICLE\t\t:"))


A1=input("ENTER THE VEHICLE NAME\t\t\t:")
K=int(input("ENTER THE RENT OF THE VEHICLE\t\t:"))
N=input("ENTER THE FUEL TYPE OF THE VEHICLE\t:")
A=input("ENTER THE STATUS(BOOKED(B)/NOT BOOOKED(NB)):")
V="INSERT INTO VEHICLES VALUES({},'{}',{},'{}','{}')".format(I,A1,K,N,A)
25
cur.execute(V)
con.commit()
print("\n Vehicle Details are Stored Successfully")
opt=input("Do you want to store another vehicle details(y/n)?:")
if opt=='y':
Add_Vehicle()
else:
Vehicle_Menu()
con.close()

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()

SCREEN SHOTS OF THE PROJECT

1. ADMIN MENU:

35
2. DRIVER CREATION MENU:

3. DISPLAYING ALL DRIVERS DETAILS:

36
4. SEARCHING DRIVER DETAILS:

5. MODIFYING DRIVER DETAILS:

6. VEHICLE DETAILS CREATION MENU:

37
7. DISPLAYING VEHICLE DETAILS:

38
8. SEARCHING VEHICLE DETAILS:

9. VEHICLE SEARCH MENU:

10. BOOKING A VEHICLE:

39
11. SHOWING BOOKED USER DETAILS:

***************************************************************************

40
BIBLIOGRAPHY

BOOKS:

 COMPUTER SCIENCE WITH PYTHON - BY SUMITA ARORA


 COMPUTER SCIENCE WITH PYTHON - BY PREETI ARORA

WEBSITES:

 www.geeksforgeeks.org
 https://docs.python.org/3/

41

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy