-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminWin_PackageBooking.py
More file actions
152 lines (121 loc) · 5.07 KB
/
AdminWin_PackageBooking.py
File metadata and controls
152 lines (121 loc) · 5.07 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
from tkinter import*
from tkinter.ttk import Combobox
from tkinter import messagebox
from PIL import ImageTk, Image
import DataAccess
allBookings = DataAccess.Get_AllTrourBookings()
def ShowAllBookings():
ClearAllFromTreeView()
i=0
for bkn in allBookings:
tv.insert(parent='', index=i, iid=i, values=(bkn[1], bkn[2], bkn[3], bkn[4], bkn[5], bkn[6], bkn[7], bkn[8], bkn[9]))
i=i+1
tv.pack()
def ShowAllBookingsBySearch():
month = monthchoosen.get()
year = yearchoosen.get()
ptype = typechoosen.get()
ShowFilteredData(month,year,ptype)
def ShowFilteredData(month,year,ptype):
ClearAllFromTreeView()
monthIndex=0
yearIndex=0
ptypeIndex=0
i=0
for bkn in allBookings:
if month!='':
monthIndex = bkn[3].find(month)
if year!='':
yearIndex = bkn[3].find(year)
if ptype!='':
ptypeIndex = bkn[2].find(ptype)
if monthIndex>-1 and yearIndex>-1 and ptypeIndex>-1:
tv.insert(parent='', index=i, iid=i, values=(bkn[1], bkn[2], bkn[3], bkn[4], bkn[5], bkn[6], bkn[7], bkn[8], bkn[9]))
i=i+1
tv.pack()
def ShowAllBookingsByMonthYear(month,year):
ClearAllFromTreeView()
i=0
for bkn in allBookings:
m=bkn[3].find(month)
y=bkn[3].find(year)
if m>-1 and y>-1:
tv.insert(parent='', index=i, iid=i, values=(bkn[1], bkn[2], bkn[3], bkn[4], bkn[5], bkn[6], bkn[7], bkn[8], bkn[9]))
i=i+1
tv.pack()
def ShowAllBookingsByYear(year):
ClearAllFromTreeView()
i=0
for bkn in allBookings:
y=bkn[3].find(year)
if y>-1:
tv.insert(parent='', index=i, iid=i, values=(bkn[1], bkn[2], bkn[3], bkn[4], bkn[5], bkn[6], bkn[7], bkn[8], bkn[9]))
i=i+1
tv.pack()
def ShowAllBookingsByMonth(month):
ClearAllFromTreeView()
i=0
for bkn in allBookings:
m=bkn[3].find(month)
if m>-1:
tv.insert(parent='', index=i, iid=i, values=(bkn[1], bkn[2], bkn[3], bkn[4], bkn[5], bkn[6], bkn[7], bkn[8], bkn[9]))
i=i+1
tv.pack()
def ClearAllFromTreeView():
for item in tv.get_children():
tv.delete(item)
#Window settings
root = Tk()
#getting screen width and height of display
Wwidth= root.winfo_screenwidth()
Wheight= root.winfo_screenheight()
#setting tkinter window size
root.geometry("%dx%d" % (Wwidth, Wheight))
root.title("Admin Console")
root.config(bg="light blue")
lbl_heading=Label(root, text="Package Booking Information",fg="black",bg="light green",font=("Impact",25),relief="ridge",pady=10,border=10).pack(fill='x')
label_01=Label(root, text="Select Month",fg="Black", bg="light green", font=("ARIAL 10 bold"))
label_01.place(x=980, y=17)
monthchoosen=Combobox(root, width = 5)
#monthchoosen['values'] = ('January','February','March','April','May','June','July','August','September','October','November','December')
monthchoosen['values'] = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
monthchoosen.place(x=1070, y=17)
monthchoosen.current(0)
label_02=Label(root, text="Year",fg="Black", bg="light green", font=("ARIAL 10 bold"))
label_02.place(x=1120, y=17)
yearchoosen=Combobox(root, width = 5)
yearchoosen['values'] = ('2021','2022','2023','2024','2025')
yearchoosen.place(x=1152, y=17)
yearchoosen.current(1)
label_1=Label(root, text="Package Type",fg="Black", bg="light green", font=("ARIAL 10 bold"))
label_1.place(x=983, y=40)
typechoosen=Combobox(root, width = 19)
typechoosen['values'] = ('Family','Group','Solo')
typechoosen.place(x=1070, y=40)
typechoosen.current(1)
Button(root, text="Filter", width=6, bg='light blue', fg='black',command=ShowAllBookingsBySearch).place(x=1210, y=25)
Button(root, text="Show All", width=6, bg='light blue', fg='black',command=ShowAllBookings).place(x=1265, y=25)
tv = ttk.Treeview(root, columns=(1, 2, 3, 4, 5, 6, 7, 8, 9), show='headings', height=25)
tv.pack()
#tv.place(x=200,y=1000)
tv.heading(1, text="Packgae Name", anchor=W)
tv.heading(2, text="Packgae Type", anchor=CENTER)
tv.heading(3, text="Journey Date", anchor=CENTER)
tv.heading(4, text="Visitor Name", anchor=W)
tv.heading(5, text="Age", anchor=CENTER)
tv.heading(6, text="Sex", anchor=CENTER)
tv.heading(7, text="Mobie No", anchor=CENTER)
tv.heading(8, text="Email_ID", anchor=W)
tv.heading(9, text="Address", anchor=W)
tv.column(1, width=260)
tv.column(2, width=80, anchor=CENTER)
tv.column(3, width=100, anchor=CENTER)
tv.column(4, width=170)
tv.column(5, width=55, anchor=CENTER)
tv.column(6, width=60, anchor=CENTER)
tv.column(7, width=100, anchor=CENTER)
tv.column(8, width=170)
tv.column(9, width=350)
#bookings = DataAccess.Get_Bookings()
ShowAllBookings()
#ShowAllBookingsByMonthYear(bookings,"Mar","2022")