You are on page 1of 31

SESSION 2020-21

INFORMATICS PRACTICES PROJECT


PYTHON
DAILY TRAVEL MANAGEMENT

NAME: KOMAL RAMPURIA


AISSCE ROLL NO:
CERTIFICATE

This is to certify that Komal Rampuria of class XII-C2 of


Sushila Birla Girls’ School has successfully completed the
project entitled “Daily Travel Management System
“Under the guidance of Mrs. Chandrima Ghosh during the
academic session of 2020-21 as per the guidelines issued by
the Central Board of Secondary Education for AISSCE 2021.

_____________ _____________
Mrs. Chandrima Ghosh EXTERNAL

(INTERNAL)
ACKNOWLEDGEMENT

I, Komal Rampuria would primarily like to thank the central


board of Secondary Education for providing me with the
opportunity to work on this project and discover so many new
things in the process of completion of this project.
I would like to thank my subject teacher, Mrs. Chandrima
Ghosh, without whose guidance and support the completion
of the said project would have been impossible.
Lastly, I would also like to express extremely heartfelt
gratitude towards my friends and family for their valuable
suggestions and unwavering support throughout the entire
duration of the making of this project.

_________ _________
Mrs. Chandrima Ghosh Student
INDEX PAGE
SERIAL TOPIC PAGE
NO. NO.
O1 INTRODUCTION

02 HARDWARE AND SOFTWARE

O3 THECNICAL DESIGN AND USER


INTERFACE
O4 SOURCE CODE

O5 OUTPUT WINDOW

06 LIMITATIONS

07 BIBLIOGRAPY

INTRODUCTION
This software is helpful to citizens, being exploring in nature
and also in urgency to go for a board towards achieving their
respective objectives. For booking the transport, this
application allows user friendly environment. The objective of
this project is to let the students apply the programming
knowledge into a real- world situation/problem and exposed
the students how programming skills helps in developing a
good software. We designed the library management system
using Tkinter module of python to make it interactive. The
project is as it helps the agency to have a record of the travel.
It is helpful towards the users as it gives them the convenience
to select the required ride and also the mode of travel.
This program also gives an insight to the status of the daily
travel by showing graphical representation of monthly
evaluation.

HARDWARE AND SOFTWARE


REQUIREMENTS
HARDWARE REQUIREMENT:
I. HP Pavilion
Processor: Intel Core i3 7th Gen
II. RAM :4.00GB
III. Canon Printer

SOFTWARE REQUIREMENTS:
I. OPERATING SYSTEM: Windows 10 and above
II. Anaconda syder (python,matplotlib and tinker module)
III. Mysql and mysql connector

TECHNICAL DESIGN AND USER


INTERFACE
The user interface used in this project is:
The tkinter function of python was mainly used to create the
graphical user interface where the user is taken to the main
menu page of the tkinter module from where they can select
their desired sub-menu. The interface is easy to understand
and we tried to make it as user.

ASKING FOR THE CAR DETAILS FROM THE ADMIN

ASKING FOR ADMINS DETAILS FOR THE BOOKING


ASKING FOR THE USER’S FEEDBACK

The technical design consists of main-menus and their


following sub-menus.
Menu Sub-Menu Function

CAR DETAILS    
  Car name Confirms the user id.
Confirms the source from were the user
  Source
will be taking the car.

  Destination Confirms the drop location of the user.

Confirms the choice of the car selected by


  Car Type
the user for the travel.
CAR BOOKING    
The user enters the name of the passenger
  Passenger Name
travelling
  Passenger Address Enters the address of the passenger
Passenger’s registered phone /contact cell
  Phone No.
No.
Ask the user to select their preference or
  Car No
choice of car for the travel

  Pickup Ask the user to enter the pickup location

Asking for the destination where the


  Drop
passenger needs to be dropped
Refers to the date when the passenger
  Travel Date
would be travelling
  Amount Refers to the total cost of travel incurred
FEEDBACK    
Refers to the name of the user writing the
  Name
feedback
  Address The address of the user
  Email The email address of the user
  Phone The cell/mobile no of the user
  Title The title of their message
The feedback of the experience of the
  Message
person.

CSv file

Date structure
FILE NAME FIELD NAMES DATA TYPE FUNCTION

Car Details      
  car_no INT To save the car id
  car_name VARCHAR To save the car name

  source VARCHAR To save the pickup addressor location

  destination VARCHAR To save the drop location

  car_type VARCHAR To save the preference of the car

Car Booking      

  Reg_no INT To save the registered entry no.

  Name VARCHAR To save the name of the passenger.

  address VARCHAR To save the address of the passenger.

  Ph_no VARCHAR To save the registered mobile no.

  emailid VARCHAR To save the email id of the passenger.

  Car_no VARCHAR To save the choice of car selected.

  pickup VARCHAR To save the pickup location.


  dropplace VARCHAR To save the drop location.
To save the date of entry or
  Entry_date VARCHAR
registration.
  pickupdate VARCHAR To save the date of travel.
To save the amount incurred on
  amount VARCHAR
travel.
Feedback      
  fbno INT To save the feedback number
  Name VARCHAR To save the name of the user

  address VARCHAR To save the address of the user

  Ph_no VARCHAR To save the phone number of the user

  emailid VARCHAR To save the Email id


  title VARCHAR To save the title of the feedback

  message VARCHAR To save the feedback given

  addedon Date To save the date of the feedback

SOURCE CODE

import tkinter as tk
from tkinter import messagebox
from tkinter import filedialog
from tkinter import ttk
import mysql.connector
from PIL import ImageTk, Image
from tkinter import *
import matplotlib.pyplot as plt

import matplotlib
matplotlib.use("TkAgg")
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg

def get_connection():
connection = mysql.connector.connect(user='root', password='root',port="3306",
host='localhost',
database='carbooking')
return connection

def close_connection(connection):
if connection:
connection.close()

#Feedback Save
def submitfeedback():

fname = nameEntryTabThree.get()
faddress = addressEntryTabThree.get()
femail = emailEntryTabThree.get()
fphno = phoneEntryTabThree.get()
ftitle = TitleEntryTabThree.get()
fmsg = MessegeEntryTabThree.get()

try:
connection = get_connection()
cursor = connection.cursor()

query='INSERT INTO feedback (name,address,ph_no,emailid,title,messege,addedon)


VALUES (%s,%s,%s,%s,%s,%s,current_date);'
my_data=(fname,faddress,fphno,femail,ftitle,fmsg)
id=cursor.execute(query,my_data)
connection.commit()
messagebox.showinfo("Alert", "Car Booking Feedback Successfully Added")
close_connection(connection)
except (Exception, mysql.connector.Error) as error:
messagebox.showinfo("Alert", error)
print("Error while getting data", error)

def submitCar():

carname = carnameEntryTabOne.get()
carsource = sourceEntryTabOne.get()
cardestination = destEntryTabOne.get()
cartypes = typeEntryTabOne.get()

try:
connection = get_connection()
cursor = connection.cursor()

query='INSERT INTO car_details (car_name,source,destination,car_type) VALUES (%s,%s,


%s,%s);'
my_data=(carname,carsource,cardestination,cartypes)
id=cursor.execute(query,my_data)
connection.commit()
messagebox.showinfo("Alert", "Car Details Successfully Added")
combo_input()
close_connection(connection)

except (Exception, mysql.connector.Error) as error:


print("Error while getting data", error)

def submitcarbooking():

pname = pasnameEntryTabTwo.get()
paddress = pasaddressEntryTabTwo.get()
pphone = pasphoneEntryTabTwo.get()
pemail = pasemailEntryTabTwo.get()
pcar = pcarEntryTabTwo.get()
ppickup = paspickupEntryTabTwo.get()
pdrop = pasdropEntryTabTwo.get()
ptravel = pastravelEntryTabTwo.get()
pamount = pasamountEntryTabTwo.get()

print(f"The name entered by you is {pname} {paddress}")


msgstr=""
try:
connection = get_connection()
cursor = connection.cursor()

query='INSERT INTO car_booking


(name,address,ph_no,emailid,car_no,pickup,dropplace,pickupdate,amount,entry_date)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,current_date);'
my_data=(pname,paddress,pphone,pemail,pcar,ppickup,pdrop,ptravel,pamount)
cursor.execute(query,my_data)

connection.commit()
id=cursor.lastrowid

select_query = """SELECT * from carbooking.car_booking where req_no= %s"""


cursor.execute(select_query,(id,))
records = cursor.fetchall()
for row in records:
msgstr="Name:"+row[1]+"\nCar No:"+row[5]+"\nPick Up
date:"+row[9]+"\nAmount:"+row[10]

messagebox.showinfo("Alert", msgstr)

#db_version = cursor.fetchone()
#print("You are connected to MySQL version: ", db_version)
close_connection(connection)
except (Exception, mysql.connector.Error) as error:
print("Error while getting data", error)

def combo_input():
connection = get_connection()
cursor = connection.cursor()

cursor.execute('SELECT car_name FROM carbooking.car_details;')

data = []

for row in cursor.fetchall():


data.append(row[0])

return data

def create_charts():
global x1
global x2
global x3
global bar1
global pie2
x1 = float(entry1.get())
x2 = float(entry2.get())
x3 = float(entry3.get())

figure1 = Figure(figsize=(4,3), dpi=100)


subplot1 = figure1.add_subplot(111)
xAxis = [float(x1),float(x2),float(x3)]
yAxis = [float(x1),float(x2),float(x3)]
subplot1.bar(xAxis,yAxis, color = 'lightsteelblue')
bar1 = FigureCanvasTkAgg(figure1, root)
bar1.get_tk_widget().pack(side=tk.LEFT, fill=tk.BOTH, expand=0)

figure2 = Figure(figsize=(4,3), dpi=100)


subplot2 = figure2.add_subplot(111)
labels2 = 'Label1', 'Label2', 'Label3'
pieSizes = [float(x1),float(x2),float(x3)]
my_colors2 = ['lightblue','lightsteelblue','silver']
explode2 = (0, 0.1, 0)
subplot2.pie(pieSizes, colors=my_colors2, explode=explode2, labels=labels2, autopct='%1.1f
%%', shadow=True, startangle=90)
subplot2.axis('equal')
pie2 = FigureCanvasTkAgg(figure2, root)
pie2.get_tk_widget().pack()

def prop(n):
return 360.0 * n / 1000
form = tk.Tk()
#form.geometry("700x400")
form.title("Car Details Entry")
form.resizable(width=False, height=False)
form.geometry('{}x{}'.format(850,600))

#path = 'online-car-booking-500x500.png'
#img=Image.open(path)
#img=img.resize((650,100))
#my_img = ImageTk.PhotoImage(img)
#panel = tk.Label(form, image = my_img)
#panel.pack(side = "top", fill = "both", expand = 0)
#form.mainloop()

tab_parent = ttk.Notebook(form)

tab1 = ttk.Frame(tab_parent)
tab2 = ttk.Frame(tab_parent)
tab3 = ttk.Frame(tab_parent)
tab4 = ttk.Frame(tab_parent)
tab5 = ttk.Frame(tab_parent)
tab6 = ttk.Frame(tab_parent)

tab_parent.add(tab1, text="Car Details Entry")


tab_parent.add(tab2, text="Car Booking")
tab_parent.add(tab3, text="Feed Back")
tab_parent.add(tab4, text="View All Booking")
tab_parent.add(tab5, text="View All Feedbacks")
tab_parent.add(tab6, text="View Statictics")

# === WIDGETS FOR TAB Add Car


carnameLabelTabOne = tk.Label(tab1, text="Car Name:", font=("Arial Bold",
10),fg="#0000FF")
sourceLabelTabOne = tk.Label(tab1, text="Source:", font=("Arial Bold", 10),fg="#0000FF")
destLabelTabOne = tk.Label(tab1, text="Destination:", font=("Arial Bold",
10),fg="#0000FF")
typeLabelTabOne = tk.Label(tab1, text="Car type:", font=("Arial Bold", 10),fg="#0000FF")

carnameEntryTabOne = tk.Entry(tab1)
sourceEntryTabOne = tk.Entry(tab1)
destEntryTabOne = tk.Entry(tab1)
typeEntryTabOne = tk.Entry(tab1)

buttonaddcar= tk.Button(tab1, text="Add Car",command=submitCar)

# === ADD WIDGETS TO GRID ON TAB Add Car


carnameLabelTabOne.grid(row=0, column=0, padx=20, pady=5,sticky="W")
carnameEntryTabOne.grid(row=0, column=1, padx=20, pady=5,sticky="W")

sourceLabelTabOne.grid(row=1, column=0, padx=20, pady=5,sticky="W")


sourceEntryTabOne.grid(row=1, column=1, padx=20, pady=5,sticky="W")

destLabelTabOne.grid(row=2, column=0, padx=20, pady=5,sticky="W")


destEntryTabOne.grid(row=2, column=1, padx=20, pady=5,sticky="W")

typeLabelTabOne.grid(row=3, column=0, padx=20, pady=5,sticky="W")


typeEntryTabOne.grid(row=3, column=1, padx=20, pady=5,sticky="W")
buttonaddcar.grid(row=4, column=1, padx=15, pady=15)

# === WIDGETS FOR TAB TWO


pasnameLabelTabTwo = tk.Label(tab2, text="Passenger Name:", font=("Arial Bold",
10),fg="#0000FF")
pasaddressLabelTabTwo = tk.Label(tab2, text="Passenger Address", font=("Arial Bold",
10),fg="#0000FF")
pasphoneLabelTabTwo = tk.Label(tab2, text="Phone No.:", font=("Arial Bold",
10),fg="#0000FF")
pasemailLabelTabTwo = tk.Label(tab2, text="Passenger Email:", font=("Arial Bold",
10),fg="#0000FF")
pcarLabelTabTwo = tk.Label(tab2, text="Car No:", font=("Arial Bold", 10),fg="#0000FF")
paspickupLabelTabTwo = tk.Label(tab2, text="Pickup:", font=("Arial Bold",
10),fg="#0000FF")
pasdropLabelTabTwo = tk.Label(tab2, text="Drop:", font=("Arial Bold", 10),fg="#0000FF")
pastravelLabelTabTwo = tk.Label(tab2, text="Travel Date:", font=("Arial Bold",
10),fg="#0000FF")
pasamountLabelTabTwo = tk.Label(tab2, text="Amount:", font=("Arial Bold",
10),fg="#0000FF")

pasnameEntryTabTwo = tk.Entry(tab2)
pasaddressEntryTabTwo = tk.Entry(tab2)
pasphoneEntryTabTwo = tk.Entry(tab2)
pasemailEntryTabTwo = tk.Entry(tab2)
n = tk.StringVar()
pcarEntryTabTwo = ttk.Combobox(tab2, textvariable = n)
pcarEntryTabTwo['values'] = combo_input()
pcarEntryTabTwo.current(0)

paspickupEntryTabTwo = tk.Entry(tab2)
pasdropEntryTabTwo = tk.Entry(tab2)
pastravelEntryTabTwo = tk.Entry(tab2)
pasamountEntryTabTwo = tk.Entry(tab2)
buttonCommit = tk.Button(tab2, text="Add Record to
Database",command=submitcarbooking)

# === ADD WIDGETS TO GRID ON TAB TWO


pasnameLabelTabTwo.grid(row=0, column=0, padx=20, pady=5,sticky="W")
pasnameEntryTabTwo.grid(row=0, column=1, padx=20, pady=5,sticky="W")

pasaddressLabelTabTwo.grid(row=1, column=0, padx=20, pady=5,sticky="W")


pasaddressEntryTabTwo.grid(row=1, column=1, padx=20, pady=5,sticky="W")

pasphoneLabelTabTwo.grid(row=2, column=0, padx=20, pady=5,sticky="W")


pasphoneEntryTabTwo.grid(row=2, column=1, padx=20, pady=5,sticky="W")

pasemailLabelTabTwo.grid(row=3, column=0, padx=20, pady=5,sticky="W")


pasemailEntryTabTwo.grid(row=3, column=1, padx=20, pady=5,sticky="W")

pcarLabelTabTwo.grid(row=4, column=0, padx=20, pady=5,sticky="W")


pcarEntryTabTwo.grid(row=4, column=1, padx=20, pady=5,sticky="W")

paspickupLabelTabTwo.grid(row=5, column=0, padx=20, pady=5,sticky="W")


paspickupEntryTabTwo.grid(row=5, column=1, padx=20, pady=5,sticky="W")

pasdropLabelTabTwo.grid(row=6, column=0, padx=20, pady=5,sticky="W")


pasdropEntryTabTwo.grid(row=6, column=1, padx=20, pady=5,sticky="W")

pastravelLabelTabTwo.grid(row=7, column=0, padx=20, pady=5,sticky="W")


pastravelEntryTabTwo.grid(row=7, column=1, padx=20, pady=5,sticky="W")
pasamountLabelTabTwo.grid(row=8, column=0, padx=20, pady=5,sticky="W")
pasamountEntryTabTwo.grid(row=8, column=1, padx=20, pady=5,sticky="W")

buttonCommit.grid(row=9, column=1, padx=20, pady=5,sticky="W")

# === WIDGETS FOR TAB Feedback


nameLabelTabThree = tk.Label(tab3, text="Name:", font=("Arial Bold", 10),fg="#0000FF")
addressLabelTabThree = tk.Label(tab3, text="Address:", font=("Arial Bold",
10),fg="#0000FF")
emailLabelTabThree = tk.Label(tab3, text="Email:", font=("Arial Bold", 10),fg="#0000FF")
phoneLabelTabThree = tk.Label(tab3, text="Phone:", font=("Arial Bold", 10),fg="#0000FF")
titleLabelTabThree = tk.Label(tab3, text="Title:", font=("Arial Bold", 10),fg="#0000FF")
msgLabelTabThree = tk.Label(tab3, text="Messege:", font=("Arial Bold",
10),fg="#0000FF")

nameEntryTabThree = tk.Entry(tab3)
addressEntryTabThree= tk.Entry(tab3)
emailEntryTabThree= tk.Entry(tab3)
phoneEntryTabThree = tk.Entry(tab3)
TitleEntryTabThree= tk.Entry(tab3)
MessegeEntryTabThree= tk.Entry(tab3)

#imgLabelTabThree= tk.Label(tab3)

buttonForward = tk.Button(tab3, text="Add Feedback",command=submitfeedback)


#buttonBack = tk.Button(tab3, text="Back")

# === ADD WIDGETS TO GRID ON TAB Feedback


nameLabelTabThree.grid(row=0, column=0, padx=20, pady=5,sticky="W")
nameEntryTabThree.grid(row=0, column=1, padx=20, pady=5,sticky="W")

addressLabelTabThree.grid(row=1, column=0, padx=20, pady=5,sticky="W")


addressEntryTabThree.grid(row=1, column=1, padx=20, pady=5,sticky="W")

emailLabelTabThree.grid(row=2, column=0, padx=10, pady=5,sticky="W")


emailEntryTabThree.grid(row=2, column=1, padx=10, pady=5,sticky="W")

phoneLabelTabThree.grid(row=3, column=0, padx=10, pady=5,sticky="W")


phoneEntryTabThree.grid(row=3, column=1, padx=10, pady=5,sticky="W")

titleLabelTabThree.grid(row=4, column=0, padx=10, pady=5,sticky="W")


TitleEntryTabThree.grid(row=4, column=1, padx=10, pady=5,sticky="W")

msgLabelTabThree.grid(row=5, column=0, padx=10, pady=5,sticky="W")


MessegeEntryTabThree.grid(row=5, column=1, padx=10, pady=5,sticky="W")

#imgLabelTabThree.grid(row=0, column=2, rowspan=3, padx=15, pady=15)

#buttonBack.grid(row=3, column=0, padx=15, pady=15)


buttonForward.grid(row=6, column=1, padx=15, pady=15,sticky="W")

# === WIDGETS FOR TAB All Booking Details

# take the data

connection = get_connection()
cursor = connection.cursor()
cursor.execute('SELECT * FROM carbooking.car_booking ;')
# take the data
lst = []
m=0

for row in cursor.fetchall():


if m==0:
list1 = ["Sl. No.","Name","Address","Mobile","Email","Car No","PickUp","Drop","PickUp
Date","Amount","Entered On"]
lst.append(list1)
list2 = [m+1,row[1],row[2],row[3],row[4],row[5],row[6],row[7],row[8],row[10],row[9]]
lst.append(list2)
m=m+1

total_rows = len(lst)
total_columns = len(lst[0])

for i in range(total_rows): #Rows


for j in range(total_columns): #Columns
b = Entry(tab4, text="",fg='blue',
font=('Arial',7,'normal'))
b.grid(row=i, column=j)
b.insert(END, lst[i][j])

close_connection(connection)

# === WIDGETS FOR TAB All Feedback Details

# take the data

connection = get_connection()
cursor = connection.cursor()
cursor.execute('SELECT * FROM carbooking.feedback ;')
# take the data
lst = []
m=0

for row in cursor.fetchall():


if m==0:
list1 = ["Sl. No.","Name","Address","Mobile","Email","Title","messege","Entered On"]
lst.append(list1)
list2 = [m+1,row[1],row[2],row[3],row[4],row[5],row[6],row[7]]
lst.append(list2)
m=m+1

total_rows = len(lst)
total_columns = len(lst[0])

for i in range(total_rows): #Rows


for j in range(total_columns): #Columns
b = Entry(tab5, text="",fg='blue',
font=('Arial',7,'normal'))
b.grid(row=i, column=j)
b.insert(END, lst[i][j])

close_connection(connection)

# === WIDGETS FOR TAB statistics Details


nameLabelTabsix = tk.Label(tab6, text="Daily Transaction Consolidated Statistics(Last
5Days):", font=("Arial Bold", 10),fg="#0000FF")

new_york = float("100")
paris = float("80")
london = float("60")
titan = float("40")
brooklyn = float("20")
pieSizes = []
labels=[]
explode=[]
k=0
connection = get_connection()
cursor = connection.cursor()
cursor.execute('SELECT DATE_FORMAT(t.entry_date, "%d/%m/%Y"),t.tot FROM (select
entry_date,SUM(amount) as tot from car_booking group by entry_date order BY entry_date
asc limit 5) t ;')

for rows in cursor.fetchall():

pieSizes.append(rows[1])
labels.append(rows[0])
explode.append(0.02)
k=k+1

figure = Figure(figsize=(4.2,4), dpi=120)


plot = figure.add_subplot(111)

#explode = [0.2, 0.2, 0.2]

plot.pie(pieSizes, explode=explode, labels=labels, autopct=lambda p:"\u20B9{:.0f}\n({:.1f})


%".format(p*sum(pieSizes)/100, p), shadow=False, startangle=90)
plot.legend( labels,title="Transaction Date", loc="upper right")

plot.axis('equal')
canvas = FigureCanvasTkAgg(figure, tab6)

nameLabelTabsix.grid(row=0, column=0, padx=220, pady=5,sticky="W")


canvas.get_tk_widget().grid(row=1, column=0, padx=220, pady=5,sticky="W")

tab_parent.pack(expand=1, fill='both')

form.mainloop()

OUTPUT
PAGE SHOWING THE ENTRY OF ALL THE BOOKINGS

PAGE SHOWING ALL THE FEEDBACK RECIEVED


PAGE SHOWING THE DAILY TRANSACTION CONSOLIDATED IN
THE LAST 5 DAYS
LIMITATIONS OF THE PROJECT

No one is perfect! Some are too tall, some too short, some
enjoy country music (nothing personal), some do not drink
coffee. The hardest part of building a software is deciding,
precisely what to build and how to build.

The limitations of this project are:


1. In this system there isn’t a proper user interface as it only
shows the entry of the travellers
2. Since the mode of payment in the current scenario has
changed a lot into online modes while this system
doesn’t specify any of that.

BIBLIOGRAPHY
1.BOOKS:
 Computer science With Python - Class XI and XII By: Sumita Arora

2. WEBSITE:
 https://pythonexamples.org/
 https://www.geeksforgeeks.org/
 https://pandas.pydata.org/
 https://stackoverflow.com/
 https://www.educative.io/edpresso

You might also like