You are on page 1of 13
File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py OIRO RWNP 14 15 16 17 18 a9 20 21 22 23 24 25 26 27 28 29 30 31 import pandas as pd import mysql.connector as sql from tkinter import * from tkinter import messagebox def Login(): username=entry1.get() password=entry2.get() if(username=="" and password==""): messagebox.showinfo("", "Blank Not Allowed") elif (username=="Guru" and password==" passenger"): messagebox.showinfo("", "Login success ") else: messagebox.showinfo("", "Incorrect username and password") root=Tk() root.title("Login") root.geometry ("500x300") global entry1 global entry2 Label (root, text="username") .place(x= Label (root, text="Password") .place(x=20, y=70) entry1=Entry (root, bd=10) entry1.place(x=140, y=20) Page 1of13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 54 55 56 57 58 59 entry2=Entry (root, bd=10) entry2.place(x=140, y=70) Button(root, text="Login", command=Login, height =3,width=13, bd=6) .place(x=100, y=120) root.mainloop() conn=sql.connect(host='Localhost',user='root' ,passwd='Guru212003$' , database='airline') if conn.is_connected(): print('successfully connected') def menu(): printQ) print( KKK KKK KKK KKK KKK KKK KEK EKER EKER EKER EKER ERE REE FEISS HII SOI ESOS IO TIE II IIR I IOI IRR IK Kk KK print( " AIRLINE RESERVATION SYSTEM ".center( 126) .Create Table Passenger") print("2.Add new Passenger Detail") print("3.Create Table Classtype") .Add new Classtype Detail") -Create Table Food") :Add Food Item Detail") print("7.Show Food Menu") Page 20f13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 719 80 print("8.Search By Food Item Name") print("9.Delete Food Item Detail if no more available") print("10.Revise Rates of Food Items ") print("11.Create Table Luggage") print("12.Add New Charges For More Weights") print("13.Show ALL Types of Seats and their Ticket Price") print("14.Show Types of Seats Passenger has chosen and its Ticket Price") print("15.If Extra Luggage then its Bill" ) print("16.If Food Item ordered then its Bill") print( "KKK KKK KKK KKK AKIRA ERIK IER IRI ER ERI KKRKKEKKKRERERERERERERERERERERERERERERERERERERER KAKI KAKI KAKI KE print("*"*126) menu() def create_passenger(): c1=conn.cursor() cl.execute('create table if not exists passenger(id INT AUTO_INCREMENT PRIMARY KEY, name varchar(255) NOT NULL,address varchar( 255) NOT NULL,rdate DATE NOT NULL, source varchar(255) NOT NULL,destination varchar(255 ) NOT NULL)') print('table passenger created') Page d0f13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 81 82 83 84 def add_passenger(): 85 cl=conn.cursor() 86 df=pd.read_sql("select * from passenger" ,conn) 87 print (df) 88 L=[] 89 id=input("ENTER ID:") 90 L.append(id) 91 name=input ("ENTER NAME:") 92 L.append(name) 93 address=input("ENTER ADDRESS:") 94 L.append(address) 95 rdate=input ("ENTER RESERVATION DATE:") 96 L.append(rdate) 97 source=input ("ENTER SOURCE 98 L.append(source) 99 destination=input ("ENTER DESTINATION:") 100 L.append(destination) 101 pas=(L) 102 sql="insert into passenger(id,name, address, rdate, source, destination) values (%s ,% S,%S,%S,%S,%S)" 103 cl.execute(sql,pas) 104 conn. commit () 105 print('Record of Passenger inserted') 106 107 108 def create_classtype(): 109 cl=conn.cursor() 110 cl.execute('create table if not exists classtype(sno int,classtype varchar(25),rate int)') Pages ofi3 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 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 print('table classtype created') def add_classtype(): cl=conn.cursor() df=pd.read_sql("select * from classtype" ,conn) ") print (df) L=[] sno=input("ENTER SERIAL NO.:") L.append(sno) classtype=input ("ENTER NAME OF CLASSTYPE L.append(classtype) rate=input("ENTER RATE PER TICKET:") L.append(rate) ct=(L) sql="insert into classtype(sno,classtype ,rate)values(%s,%S,%S)" cl.execute(sql,ct) conn.commit() print('Record inserted in classtype') def create_food(): cl=conn.cursor() cl.execute('create table if not exists food(sno int,itemname varchar(25),rate int)' ) print('table food created') Page Sof13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 def 2") add_food(): df=pd.read_sql("select * from food",conn print (df) L=(] sno=input("Enter Serial No.:") L.append(sno) itemname=input("ENTER NAME OF FOOD ITEM L.append(itemname) rate=input("ENTER RATE OF FOOD ITEM PER PIECE:") L.append(rate) f=(L) sql="insert into food(sno,itemname,rate) values (%s ,%S,%S)" def def cl.execute(sql, f) conn.commit() print('Record inserted in food') showfoodmenu() : print('ALL FOOD ITEMs available') df=pd.read_sql("select * from food",conn print (df) search_byfooditem(): print('ALL FOOD ITEMs available') df=pd.read_sql("select * from food",conn print (df) print('Search Rate of Food by entering Page 6 of13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 FOOD ITEM NO.') ») a,) def a=float(input("Enter Food Item NO. : " qry="select * from food where sno=%s;"%( df=pd.read_sql(qry, conn) print (df) delete_food(): print('Before any changes in Food Menu') df=pd.read_sql("select * from food",conn print (df) printQ) printQ) mc=conn.cursor() me.execute("delete from food where itemname='SAMOSA'") def print("Record Deleted") df=pd.read_sql("select * from food",conn print (df) #conn.commit() revise_foodrate(): print('Before any Changes in the Rates') df=pd.read_sql("select * from food",conn print (df) me=conn.cursor() mc.execute("update food set rate =rate+ 10 where itemname='COFFEE'") #conn.commit() df=pd.read_sql("select * from food",conn Page Tof3 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 196 print (df) 197 198 199 200 201 def create_luggage(): 202 cl=conn.cursor() 203 cl.execute('create table if not exists luggage(sno int,weight varchar(20),rate int d") 204 print('table Luggage created') 205 206 207 def add_luggage(): 208 cl=conn.cursor() 209 df=pd.read_sql("select * from Luggage", conn) 210 print (df) 241 L=[] 212 sno=input("ENTER Serial No.: ") 213 L.append(sno) 214 weight=input("ENTER WEIGHT OF LUGGAGE 2") 215 L. append(weight) 216 rate=input("ENTER RATE OF LUGGAGE: ") 217 L.append(rate) 218 Lug=(L) 219 sql="insert into Luggage(sno,weight, rate values (%s,%s,%s)" 220 cl.execute(sql, lug) 221 conn. commit () 222 print('Record inserted in luggage') 223 224 225 def showticketprice(): Page 8 of13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 print('ALl records of Types of Seats available’) df=pd.read_sql("select * from classtype" ,conn) print (df) def ticketreservation(): print("WE HAVE THE FOLLOWING SEAT TYPES FOR YOU:-") print("1. FIRST CLASS RS 6000 Per PERSON ") print("2.BUSINESS CLASS RS 11000 Per PERSON") print("3.ECONOMY CLASS RS 5000 Per PERSON") print("4.KING ROOM RS 6000 Per PERSON") xsint(input("ENTER YOUR CHOICE OF TICKET PLEASE->")) n=int(input("HOW MANY TICKETS YOU NEED:" ) if (x==1): print("YOU HAVE CHOSEN FIRST CLASS") s=6000*n elif (x==2): print("YOU HAVE CHOSEN BUSINESS CLASS") s=11000%n elif (x==3): print("YOU HAVE CHOSEN ECONOMY CLASS s=5000«n elif (x==4): print("YOU HAVE CHOSEN KING ROOM") Page 9 of13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 s=6000«n else: print("PLEASE CHOOSE A ROOM") print("your TOTAL TICKET PRICE is =", s , "\n") def lLuggagebill(): xsint(input ("ENTER SERIAL NO. OF WEIGHT OF EXTRA LUGGAGE")) if (x==1): print("YOU have 20 kg Extra") s=2000 elif (x==2): print("YOU have 25 kg Extra") s=3500 30 kg Extra") s=4000 elif (x==4): print("YOU have 35 KG EXTRA") s=5000 elif (x==5): print("YOU have 40 KG EXTRA") s=6000 else: print("PLEASE CHOOSE A CORRECT SERIAL NO.") print("your cost of Extra Luggage is", s Page 10of 13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 282, "\n") 283 284 285 286 287 def foodbill(): 288 289 print('ALL Food Items available') 290 df=pd.read_sql("select * from food",conn ) 291 print (df) 292 293 c = int(input("Order your ITEM No.:")) 294 d = int(input("Enter the quantity:")) 295 if (c == 1): 296 s=20*d 297 elif(c == 2): 298 s=30%*d 299 elif(c == 3): 300 s= 60*d 301 elif(c == 4): 302 s=40*d 303 elif(c == 5): 304 s=50*d 305 elif(c== 6): 306 s=45*d 307 else: 308 print("Invalid option") 309 310 print("Total food Bill=Rs", s, "\n") 311 312 313 314 315 Page 11 of 13 File -C:\Users\USER\PycharmProjects\Aitines Reservation system\Airlines reservation. py 316 opt="" 317 opt= int input (renter your choice : ")) 318 if opt 319 create _passenger() 320 elif opt==2: 321 add_passenger() 322 elif opt==3: 323 create_classtype() 324 elif opt==4: 325 add_classtype() 326 elif opt== 327 create_food() 328 elif opt==6: 329 add_food() 330 elif opt==7: 331 showfoodmenu() 332 elif opt==8: 333 search_byfooditem() 334 elif opt==9: 335 delete_food() 336 elif opt==10: 337 revise_foodrate() 338 elif opt==11: 339 create_luggage() 340 elif opt==12: 341 add_luggage() 342 elif opt==13: 343 showticketprice() 344 elif opt==14: 345 ticketreservation() 346 elif opt==15: 347 Luggagebill() 348 elif opt==16: 349 Foodbill() 350 else: Page 120f 13 File - C:\Users\USERIPycharmProjects\Aines Reservation system\Ailines reservation py 351 print('invalid option') 352 Page 130f 13

You might also like