0% found this document useful (0 votes)
32 views10 pages

Project 2-Roll Number 14 To 26

Project

Uploaded by

rajeshnayak8854
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
32 views10 pages

Project 2-Roll Number 14 To 26

Project

Uploaded by

rajeshnayak8854
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
Project 2: Term Term Parking Management System ‘The student c ‘he student can create the frontend and its functionality using Python. can create the backend using MySql and connect it with the frontend to plete the project Project Tith Parking Management System Problem Definitior Parking Management System's major goal is to manage parking spaces, parking types, parking fees. and soo Tat aie rolest was created to allow administrators or service providers to easily manage their Perninement for eee £8 2 Computer system. Due to Covid-19, this method was created to mect the requirement for paperless parking. This experiment might be expanded by requiring consumers to enter an OTP on their mobile phones in order to park their cars, and parking spaces could be assigned. Objective of the Project: Admin of Parking Space can perform the following operations : ‘Add New Parking Type ‘Add New Parking Slot Modify Parking Type Record Modify Parking Slot Record Vehicle Login Vehicle Logout Report menu +++ Search menu +tete Close application Database Creation: 1. Creating database mysql> CREATE Database parking_system; Creating Login Table mysql> CREATE TABLE login (id int, name VARCHAR(255), password VARCHAR(255)) 3. Inserting records in the Login Table mysql> insert into login (id, name, pwd) VALUES ( 1, ‘dummy’, ‘try'); 4. Creating Parking Type Table mysql> CREATE TABLE Parking Type (id int, namé VARCHAR(255), price float(7, 2)); Inserting records in the Parking ‘Type table mysql> INSERT INTO Parking_Type (id, name, price) VALUES (1,‘truck', 350.0), (2, trolly’,'450.0"), (3, ‘cycle’ ,20.0)5 6. Creating Parking_Space Table mysql> CREATE TABLE Parking_Space (id int , type_id int, status VARCHAR(255)); 7. Inserting records in the Parking_Space Table mysql> INSERT INTO Parking Space (id, type_id, status) VALUES (1,1, ‘Full’), (2,1, empty’), (3,2, ‘Full’); 8. Creating Transaction Table mysql> CREATE TABLE Transaction (id int, vehicle_id char(20), parking_id int(a1), entry date date, exit_date date, amount float (10, 2)3 9. Python Program Cod Weroject on Parking Management Systen import mysql. connector import time From datetime import date global conn, cursor conn = mysqi.connector.connect(host = ‘localhost’ » cursor = conn.cursor() def clear(): for _ def display_parking_type_records(): cursor.execute('select * from parking types) records = cursor. fetchall() for row in records: def login(): while True: Inserting records mysql> INSERT INTO Transaction (1d, vehLele. amount) VALUES (1, dliacb-1007, 1, 2021-03-08, arkingid, entry_dote, exit date, Ad, pa ble 2021-03-08, 3075 the Transaction user = ‘root", password = akshaj", database = "parking_system') in range(6s): print() print(rew) clear() uname = input(‘enter your id :*) upass = input(‘Enter your Password :') cursor.execute('select * from login where name = “{}" and password format (uname, upass)) cursor. fetchall() rows = cursor.rowcount if rows! = 1: print(‘Invalid Login details..... Try again’) els: print(‘You are eligible for operating this system.. print(‘\n\n\n") print(‘Press any key to continue.........+e0+0+") break def add_parking_type_record(): > clear() name = input(‘enter Parking Type( 1. Two wheelar 2. Car 3. Bus 4. Truck 5. Trolly y price amputC’Enter Parking Price per day ; *) sae or ceert Ant parking_type(name,price) values("{}",{})i' -format(name, price) cursor. execute(sq1) prane(*\n\n New Parking Type added....*) jexecute( select max(id) from parking_type") nto = cursor. Fetchone() print( wait = "New Parking Type 1 4s : () \n\n\n"-format(nofe])) AAPUEC'\n\n\nPress any key to continue. . : def add_parking_slot_record(): clear( parking type_id = input( “en status sql = print( print( display wait = > Ser Parking Type( 1. two wheelar 2. Car 3. Bus 4. Truck 5. Trolly ) TainPutC Enter current status ( Open/Full ) 2") ‘Ansert into parking_space(type_id, status) values \ CO", "0")5" Format (parking_type_id, status) sexecute(sq2) “\n\n New Parking Space Record added. > vexecute('select max(id) from parking_space; ursor.fetchone() “Your Parking ID is : {} \n\n\n‘.format(no[@})) y_parking_type_records() input("\n\n\nPress any key to continue. def modify_parking_type_record(): clear() print(; MODIFY PARKING TYPE SCREEN‘) print(*-"*10@) print('1. Parking Type Name \n‘*) print('2. Parking Price \n') choice = int(input('enter your choice :')) field = '* if choice == 1: #ield='name' if choice == 2: field = ‘price’ park_id = input(‘Enter Parking Type ID value = input(‘Enter new values :*) sql = ‘update parking type set ‘+ field +" = “' + value +'" where id ='+ park_id cursor.execute(sql) print(‘Record updated successfully......... display_parking_type_records() wait = input('\n\n\nPress any key to continue... def modify _parking_space_record(): clear() prant(' MODIFY PARKING SPACE print(*-"*100) Print(‘a. Parking Type TO(1-Two Wheelar, 2: Car 3.Bus etc Di ') print('2. status \n") choice = int(input(‘enter your choice :')) RECORD") field = Af choice == 1: field = ‘type_id’ if choice field = ‘status’ print(*\n\n\n") crime_id = input(‘enter Parking Space ID :') value = input(‘Enter new values :") sql = ‘update parking_space set ' + field + \ ‘= "t+ value + ' where id =" + crime_id + cursor-execute(sql) print(‘Record updated successfully... wait = input('\n\n\nPress any key to continue. def add_new_vehicle( clear() print( ‘Vehicle Login screen print('-'*1@0) vehicle id = input(‘Enter Vehicle Number :* ) parking_id = input(‘enter parking 1D :") entry_date = date.teday() sql = ‘insert into transaction(vehicle_id,parking_id,entry_date) values \ COO "O")5 format (vehicle_id, parking_id, entry_date) cursor. execute(sq1) cursor.execute( ‘update parking_space set status ="full” where id ={}'. format (parking id) print(‘\n\n\n Record added successfully...........05 wait= input('\n\n\nPress any key to continue. def remove_vehicle(): elear() print(‘Vehicle Logout Screen‘) print('-"*260) vehicle_id = input(‘Enter vehicle No :*) exit_date = date-today( sql = ‘select parking_id,price,entry date from transaction tr,parking space 5 parking_type pt \ where tr.parking_id = ps.id and ps.type_id = pt.id and \ vehicle ta = cursor-execute¢sal) record» cursor. fetchone() days = (exit date-recontts}) sdays if days ==0: Se days = daysea amount = record{1} days tvehicle_id+'" and exit_date 4s NULLS" clear() print(‘Logout Details *) print(*-"*100) print( ‘Parking 1D : (}'.format(record[@])) print('Vehicle 1D : {}*.Format(vehicle_id)) prant( ‘Parking Date : ()'.format(record(2])) print(‘Current Date : (}'.format(exit_date)) Print (‘Amount Payable : (}'.format(amount) ) wait = input('press any key to continue...--+") update transaction and parking space tables sali = ‘update transaction set exit_date = "{}" , amount = {) where vehicle_id = “{}" \ and exit_date is NULL;*.format(exit_date, amount, vehicle_id) sql2 = ‘update parking_space set status = “open” where id = {}'.format(record[o]) cursor. execute(sqi1) cursor.execute(sq12) wade, 5 input( Vehicle out from our system Successfully. \n Press any key to def search_menu(): clear() print() SEARCH PARKING MENU‘) prant(‘2. Parking ID \n‘) print('2. Vehicle Parked \n') print("3. Free Space \n') choice = int(input('Enter your choice :*)) field if choice field = ‘id’ if choice == 2: field = ‘vehicle No" if choice == 3: field = ‘status’ value = input(‘Enter value to search :*) if choice == 1 or choice sql = ‘select ps.id, name, price, status \ from parking_space ps, parking_type pt where ps.id format (value) a: pt-id AND ps.id ={}". else: sql = ‘select id, vehicle id, parking id, entry_date from transaction wnene exit_date is NULLS cursor.execute(sql) results = cursor.fetchal1() records = cursor.rowcount for row in results: print(row) af records < a: PrAnt(*Record not Found \n\n\n*) wait = input('\n\a\nPress any key to continue... +++") def parking status(status): clear() print( ‘Parking status :*,status) print( sql = cursor. execute(sql) *100) elect * from parking_space where status ='{}'".format(status) records = cursor.fetchal1() for row in records print(row) wait = input(*\n\n\nPress any key to continue oo) def vehicle_status_report( clear() print( ‘Vehicle Status - Currently Parked") print(‘-"*1e) sql = ‘select * from transaction where exit_date is NULL;* cursor.execute(sq1) records = cursor.fetchall() for row in records: print(row) wait = input("\n\n\nPress any key to continue... def money_collected(): clear() start_date = input( ‘enter start Date(yyyy-mm-dd): end_date = input(‘Enter End Date(yyyy-mm-dd): *) sql = “select sum(amount) from transaction where \ entry_date cursor.execute(sql) {()' and exit_date ='{}'".format(start_date,end_date) result = cursor. fetchone() clear() print(‘Total money Collected from {} to {)*.format(start_date,end_date)) get report_menu(): print('-'*2100) print(result[a}) wait = AMPUEC'\M\n\npross any key to conti, continue, while True: clear() print('Parking space System +) print('-'*1@9) print("1. Parking types \n') print('2. Free space \n') Print('3. Ocupied space \n'y print('4. Vehicle status \n'y prank(’S. Money coltected \n") Print("6. Exit \nsy choice = int(input( ‘Enter your choice :*)) field = ++ if choice a: display_parking_t, Af choice == 2: Parking_status(" if choice == 3: parking_status("fu11") if choice == 4: vehicle_status_report() if choice == 5: money_collected() if choice == 6: break -yPe_records() pen") def main_menu(): clear() login() clear() while True: clear() / print() PARKING MANAGEMENT SYSTEM") print('*'*100) | print("\n1. Add New Parking Type’ print ("\n2. Add New Parking slot") print(‘\n3. Modify Parking Type Record") print(‘\n4. Modify Parking Slot Record") print('\n5. Vehicle Login *) print('\né. Vehicle Logout’) print("\n7. Search menu") print("\ng. Report menu’) print(*\n9. Close application’) print(‘\n\n") choice = int(input(‘Enter your choice - Af choice add_parking_type_record() Af choice == 2: add_parking_slot_record() Af choice == 3: modify_parking_type_record() Lf choice <= 4: modi fy_parking_space_record() 4 choice == 5: add_new_vehicle() if choice == 6: remove_vehicle() if choice == 7: search_menu() if choice == 8: report_menu() if choice == 9: break main_menu() Output Screens: Screen 4 aad Mew Parking sige Ib. NOaLEY PAEKING Type necorg | Je. MOALEY FREKING S108 nace Jp. venicte togin lg. ventcte ogous |). search menu Report mem | ene: | application _ Mow Parking Type addea..., | ‘Screan 5 fentez Parking Type( i. wo wae Enter current Status { oron/fesity 22,68" 8. bus 4, Bruck S) Feohly ) 72 New Parking space Record a Your Parking 2D ia rg) “##e@--. (Gy ttwo wheetar', 30.0) (2) tenet) 's0-0) (3) theses 28000) (2) tezacks; 380,09 (2) sezoiay’, 450.0) (3) teyeie’, ‘20:05 & e bezking Bype I(-awo whesise, Enter your choice :2 fEotex Parking space 1D: Record updated succesfully. e.-.0++ PARKING 1. Parking Types 2. Free Space 3. Ocupied space 4, Vehicle status 5. Money Collected 6. Exit Enter your choice :2 REPORTS Screen 6 Parking Status : open (4, 9, topen") (Wone, 2, ‘open') press any key to continue. Screen 7

You might also like