0% found this document useful (0 votes)
9 views12 pages

Travel Agency Management System Code

The document outlines the development of a 'Travel Agency Management System' using Python and MySQL to enhance operational efficiency and customer service. It includes acknowledgments to mentors and supporters, as well as detailed code snippets for booking, updating, and canceling trips. The system aims to streamline core agency functions and reduce errors, providing a competitive advantage in the travel industry.

Uploaded by

pridhim05
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)
9 views12 pages

Travel Agency Management System Code

The document outlines the development of a 'Travel Agency Management System' using Python and MySQL to enhance operational efficiency and customer service. It includes acknowledgments to mentors and supporters, as well as detailed code snippets for booking, updating, and canceling trips. The system aims to streamline core agency functions and reduce errors, providing a competitive advantage in the travel industry.

Uploaded by

pridhim05
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

Acknowledgement

I take this opportunity to express my deep


sense of gratitude to Miss Jyoti for their
expert advice on the technical aspects of
this project. Building a bridge between a
Python interface and a MySQL backend
presented several challenges, and their
mentorship was crucial in debugging and
optimizing the system.
I am also grateful to our Principal, Miss
Sunita Joshi, for providing the necessary
laboratory facilities and a conducive
environment for learning.
Finally, I would like to thank my parents and
friends for their encouragement, which
helped me complete this project within the
stipulated time frame.
Introduction
This project introduces the "Travel Agency
Management System," a computerized
solution designed to streamline core agency
functions, including booking, customer
records, inventory, and payment processing.
The system is built using the Python
programming language for logic and
interface development, connected to a
MySQL relational database for robust data
management.
By leveraging this combined technology
stack, the system will achieve increased
operational efficiency, improved customer
service, and a significant reduction in errors,
giving the agency a competitive advantage.
Code
Table format:

Sql: desc trips;

Travel Agency System:

import [Link] as m

s=[Link](host="localhost",user="root",passwd="",database="travel")

cr=[Link]()

ch="y"

m=''

mop=0

print("*****************************Welcome to Happy Tours and


Travels*****************************")

print("If you want to book a trip, press Y")

ch=input("Enter your choice")

if ch=="y" or ch=="Y":

print("1. Book a trip")

print("2. Update your details")

print("3. Cancel trip")


i=int(input("select 1, 2, or 3"))

def book():

if i==1:

srno=int(input("enter srno"))

Cname=input("Enter your name")

Pno= int(input("enter 10 digit phone no"))

pickup=input("enter pickup place")

dest=input("enter destination")

no=int(input("enter no of passengers"))

print("Choose mode of payment")

print("Payment options:")

print("1. Credit or debit card" "2. UPI")

mop= int(input("enter mode of payment 1 or 2"))

if mop==1:

m="credit or debit card"

cno=int(input("enter card no"))

name=input("enter name on card")

cvv=int(input("enter cvv"))

expd=input("expiry date")

elif mop==2:

m="UPI"

upi=int(input("upi number"))

print("Mode of transport: 1. By flight, 2. By car, 3. By bus")

tr=int(input("enter mode of transport"))

if tr==1:

print("You have chosen flight as your mode of transport. Your flight details will be informed to you soon.
Looking forward to give you the best travelling services")

elif tr==2:

print("You have chosen car as your mode of transport. Your car details will be informed to you soon.
Looking forward to give you the best travelling services")
elif tr==3:

print("You have chosen bus as your mode of transport. Your bus details will be informed to you soon.
Looking forward to give you the best travelling services")

if mop==1:

mop="credit card"

elif mop==2:

mop="UPI"

if tr==1:

tr="By flight"

elif tr==2:

tr="By road"

add = 'insert into trips values({}, "{}" ,{}, "{}", "{}", "{}", "{}", {})'.format(srno,Cname, Pno, pickup, dest, mop,
tr, no)

[Link](add)

[Link]()

book()

Output:
def update_trip():

if i==2:

srno = int(input("Enter your trip Reference No. to update: "))

[Link]("SELECT * FROM trips WHERE srno = {}".format(srno))

for a in cr:

print(a)

print("1. Customer Name")

print("2. Phone Number")

print("3. Mode of Payment")

print("4. Mode of Transport")

choice = input("Enter the number of the information you want to update (1-4): ")

if choice == '1':

nname = input("Enter the required new name: ")

# Using string formatting as in the original code

sql ="update trips set customername='{}' where srno={}".format(nname, srno)

[Link](sql)

[Link]()

print("Customer Name successfully updated.")

elif choice == '2':


nphone = int(input("Enter the new 10 digit phone no.: "))

sql = 'UPDATE trips SET PhoneNo = {} WHERE srno = {}'.format(nphone, srno)

[Link](sql)

[Link]()

print("\n Phone Number successfully updated.")

elif choice == '3':

print("New Payment options:")

print("1. Credit or debit card")

print("2. UPI")

mop_choice = int(input("Enter new mode of payment (1 or 2): "))

if mop_choice == 1:

nmode = "credit or debit card"

elif mop_choice == 2:

nmode = "UPI"

else:

print("Invalid mode of payment choice.")

return

sql = "UPDATE trips SET modeofpayment = '{}' WHERE srno = {}".format(nmode, srno)

[Link](sql)

[Link]()

print("\n Mode of Payment successfully updated.")

elif choice == '4':

print("New Mode of transport: 1. By flight, 2. By road")

tr = int(input("Enter new mode of transport (1 or 2): "))

if tr == 1:

ntr = "By flight"


elif tr == 2:

ntr = "By road"

else:

print("Invalid mode of transport choice.")

return

sql = "UPDATE trips SET modeoftransport = '{}' WHERE srno = {}".format(ntr, srno)

[Link](sql)

print("\n Mode of Transport successfully updated.")

else:

print("\nInvalid choice. No details were updated.")

return

update_trip()
Output:

def cancel_trip(cr, s):

if i==3:

"""

Deletes a trip record from the 'trips' table based on the reference number.

cr: cursor object

s: connection object

"""
try:

srno = int(input("\nEnter your trip Reference No. to CANCEL: "))

# Check if the reference number exists first

[Link]("SELECT * FROM trips WHERE srno = {}".format(srno))

if not [Link]():

print("\n Error: No trip found with Reference No.", srno)

return

confirm = input(f"Are you sure you want to cancel trip {srno}? (Y/N): ")

if [Link]() == 'Y':

sql = "DELETE FROM trips WHERE srno = {}".format(srno)

[Link](sql)

[Link]() # Commit the deletion

print(f"\n Trip with Reference No. {srno} has been successfully CANCELLED and deleted.")

else:

print("\nCancellation aborted by user.")

except ValueError:

print("\n Invalid input. Please enter a number for the reference code.")

except [Link] as err:

print(f"\n MySQL Error: {err}")

cancel_trip(cr,s)
Output:
Bibliography
• Sumita Arora Computer
Science Book
• [Link]

You might also like