-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_booked_seats.py
75 lines (51 loc) · 2.95 KB
/
check_booked_seats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from tkinter import *
from tkinter import messagebox
import sqlite3
root = Tk()
root.state('zoomed')
bus_logo = PhotoImage(file=".\\images\\Bus_for_project.png")
Label(root, image=bus_logo).grid(row=0, column=5, columnspan=10)
Label(root, text="Online Bus Booking System", bg="Light Blue",
fg="Red", font="Arial 20").grid(row=1, column=5, columnspan=10)
Label(root, text="Check Your Booking", bg="Light Green",
font="Arial 10").grid(row=2, column=5, pady=15, columnspan=10)
Label(root, text="Enter Your Mobile Number: ").grid(row=3, column=1, pady=15)
mobile_number = Entry(root)
mobile_number.grid(row=3, column=2)
def check_booking():
if mobile_number.get() == "":
messagebox.showerror("Error", "Please <Enter Your Mobile Number>")
else:
con = sqlite3.Connection("Bus_database")
cur = con.cursor()
cur.execute(
'''select b.Passenger_name, b.Gender, b.No_of_passenger, b.Phone, b.Age, Fare, Name, b.Date,b.Booking_ref,b.Boarding_station,b.Journey_date from Operator_details as o,Booking_history as b, Bus_details bus, Running_details as r,Route_details as t where b.B_Id=r.B_Id and bus.Op_Id=o.Op_Id and bus.B_Id=b.B_Id and bus.R_Id=t.R_Id and b.Phone=? ''', [mobile_number.get()])
f = cur.fetchall()
for i in f:
Label(root, text="Passengers:").grid(row=4, column=10)
Label(root, text=i[0]).grid(row=4, column=11)
Label(root, text="Gender:").grid(row=4, column=14)
Label(root, text=i[1]).grid(row=4, column=15)
Label(root, text="No of Seats:").grid(row=5, column=10)
Label(root, text=i[2]).grid(row=5, column=11)
Label(root, text="Phone:").grid(row=5, column=14)
Label(root, text=i[3]).grid(row=5, column=15)
Label(root, text="Age:").grid(row=6, column=10)
Label(root, text=i[4]).grid(row=6, column=11)
Label(root, text="Fare Rs:").grid(row=6, column=14)
Label(root, text=int(i[2])*int(i[5])).grid(row=6, column=15)
Label(root, text="Booking Ref:").grid(row=7, column=10)
Label(root, text=i[8]).grid(row=7, column=11)
Label(root, text="Bus Detail:").grid(row=7, column=14)
Label(root, text=i[6]).grid(row=7, column=15)
Label(root, text="Travel On:").grid(row=8, column=10)
Label(root, text=i[10]).grid(row=8, column=11)
Label(root, text="Booked On:").grid(row=8, column=14)
Label(root, text=i[7]).grid(row=8, column=15)
Label(root, text="No of Seats:").grid(row=9, column=10)
Label(root, text=i[2]).grid(row=9, column=11)
Label(root, text="Boarding Point:").grid(row=9, column=14)
Label(root, text=i[9]).grid(row=9, column=15)
con.close()
Button(root, text='Check Booking', command=check_booking).grid(row=3, column=3)
root.mainloop()