Colony Welfare Society Management With MySQL
Colony Welfare Society Management With MySQL
Signature
Signature
1
Gulshan Sir Dr.
Urmila Vajpai
( PGT Computer Science )
( Principal )
Acknowledgement
2
At last I shall heartily thank to my
parents & for their love, care, concern & lots of
inspirations.
Sudhanshu Juneja
Class : 12th – D
Sacred Hearts Sr. Sec.
Public School
3
Introduction to Project
The Car Rental Management System is a comprehensive software solution designed to automate
and manage the end-to-end operations of a car rental business. From customer reservations and vehicle
tracking to billing and reporting, the system integrates various functionalities to ensure a seamless and
organized workflow.
It caters to the dynamic requirements of the industry, providing real-time insights and control over
the fleet, bookings, and financial aspects of the business.
OBJECTIVE
4
During the past several decades’ personnel function has been transformed from a relatively obscure
record keeping staff to central and top level management function. There are many factors that have
influenced this transformation like technological advances, professionalism, and general
recognition of human beings as most important resources.
A computer based “Car Rental Management System” is designed to handle the primary
activities of the Car Rental Management System to maintain the records of the MEMBERS in an
efficient way which save the time.
This project intends to introduce more user friendliness in the various activities such as addition
of records, editing the information and updation, maintenance, and searching the records.
Similarly, record maintenance and updation can also be accomplished by using the
identification of the MEMBER with all the details being automatically generated. These details are
also being promptly automatically updated in the master file thus keeping the record absolutely up-
to-date.
The entire information has maintained in the database or Files and whoever wants to retrieve
can’t retrieve, only authorization user can retrieve the necessary information which can be easily be
accessible from the file.
ADVANTAGE:
I have designed the given proposed system in the Python to automate the process of “Car
Rental Management System” because it is an Object Oriented Language and good for application
softwares. This project is useful for the maintaining the records of the Car Rental Management.
The following steps that give the detailed information of the need of proposed system are:
Performance: During past several decades, the records are supposed to be manually
handled for all activities. The manual handling of the record is time consuming and highly prone to
error. To improve the performance of the “Car Rental Management System”, the computerized
system is to be undertaken. This project is fully computerized and user friendly.
Efficiency: The basic need of this software is efficiency. The software should be efficient so that
whenever a user performs his/her work the records are updated automatically. This record will be
useful for other transactions instantly.
5
Security: Security is the main criteria for the proposed system. Since illegal access may corrupt the
database. So security has to be given in this project.
This project can be used in the Car Rental Management System after adding some more useful
modules in the project.
So there are many things for future enhancement of this project. The future enhancements that
are possible in the project are as follows.
Hardware Required
6
Memory
64 MB Minimum; 128 MB Recommended
(RAM)
Hard disk 1 GB for the database and the client software. This
space requirement may increase with the increase in records.
Pointing
Microsoft Mouse or compatible
device
Software Required
Software Description
Operating
Microsoft Windows or DOS or Linux or Unix
System
Python
Anaconda / Python 3.7
Interpreter
MS – Office /
Word Processor for Documentation
Open Office
7
Introduction to Python Programming
Python is a high-level, interpreted, interactive and object oriented-scripting language. Python was
designed to be highly readable which uses English keywords frequently where as other languages use
punctuation and it has fewer syntactical constructions than other languages.
Python is interpreted: This means that it is processed at runtime by the interpreter and
you do not need to compile your program before executing it. This is similar to PERL and PHP.
8
Python is Interactive: This means that you can actually sit at a Python prompt and
interact with the interpreter directly to write your programs.
Python is Beginner's Language: Python is a great language for the beginner programmers
and supports the development of a wide range of applications, from simple text processing to
WWW browsers to games.
History of Python:
Python was developed by Guido van Rossum in the late eighties and early nineties ( February 1991 ) at
the National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68,
SmallTalk, and UNIX shell and other scripting languages.
Python is now maintained by a core development team at the institute, although Guido van
Rossum still holds a vital role in directing its progress.
Easy-to-read: Python code is much more clearly defined and visible to the eyes.
A broad standard library: One of Python's greatest strengths is the bulk of the library is
very portable and cross-platform compatible on UNIX, Windows, and Macintosh.
Interactive Mode: Support for an interactive mode in which you can enter results from a
terminal right to the language, allowing interactive testing and debugging of snippets of code.
Portable: Python can run on a wide variety of hardware platforms and has the same interface
on all platforms.
Extendable: You can add low-level modules to the Python interpreter. These modules enable
programmers to add to or customize their tools to be more efficient.
GUI Programming: Python supports GUI applications that can be created and ported to many
system calls, libraries, and windows systems, such as Windows MFC, Macintosh, and the X
Window system of Unix.
Scalable: Python provides a better structure and support for large programs than shell
scripting.
9
Apart from the above mentioned features, Python has a big list of good features, few are listed below:
It can be used as a scripting language or can be compiled to byte-code for building large
applications.
Very high-level dynamic data types and supports dynamic type checking.
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
MySQL
MySQL is an open-source relational database management system (RDBMS). Its name is a combination of
"My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured
Query Language.
MySQL is free and open-source software under the terms of the GNU General Public License, and is also
available under a variety of proprietary licenses. MySQL was owned and sponsored by
the Swedish company MySQL AB, which was bought by Sun Microsystems (now Oracle Corporation). In
2010, when Oracle acquired Sun, Widenius forked the open-source MySQL project to create MariaDB.
Sometime, it is important to store the information entered by the user into the database for further use.
After storing the information into the database, later we can retrieve those information from that
database. The latest version of MySQL is one of the world’s most popular databases. It is open source,
reliable, compatible with all major hosting providers, cost-effective, and easy to manage. Many
organizations are leveraging the data security and strong transactional support offered by MySQL to
secure online transactions and enhance customer interactions. However, enterprises using MySQL are
presented with several challenges when their apps experience exponential growth and they need
additional scale.
Along with understanding why MySQL is the go-to solution for high-growth environments, it is equally
important to understand the challenges that can cripple your business operations. Here are 5 major reasons
to use MySQL along with its most common challenges:
10
On-Demand Scalability
MySQL comes with the advantage of unmatched flexibility that facilitates efficient management of deeply
embedded applications, even in gigantic data centers that stack tremendous amounts of mission-critical
information. It enables complete customization to cater to the unique requirements of eCommerce businesses
with a much smaller footprint.
High Availability
Consistent availability is the stalwart feature of MySQL – enterprises that deploy it can enjoy round-the-
clock uptime. MySQL comes with a wide variety of cluster servers and master-slave replication
configurations that enable instant failover for uninterrupted access.
Rock-Solid Reliability
Protecting sensitive business information is the primary concern of every enterprise. MySQL ensures data
security with exceptional data protection features. Powerful data encryption prevents unauthorized viewing
of data and SSH and SSL supports ensure safer connections. It also features a powerful mechanism that
restricts server access to authorized users and has the ability to block users even at the man-machine level.
Finally, the data backup feature facilitates point-in-time recovery.
Quick-Start Capability
You can go from software download to complete installation in just 15 minutes. MySQL is exceptionally
quick, regardless of the underlying platform. It features self-management capabilities like auto restart, spass
expansion and automatic configuration changes for ease of management. MySQL enables real-time
performance monitoring for timely troubleshooting of operational issues from a single workstation.
Replication
MySQL servers often run into replication conflicts during a manual failover when multi-master setups are
involved.
Query Caches
MySQL server query cache is of little help when handling a high volume of workload, because cache
invalidation cannot be controlled.
11
Modules Imported in the Projects
12
And Their Functions
Other than Python Standard Library modules, some other modules are imported in the
project to perform some specific task. These are :
random
randint() – To access random value
os
remove( ) – To remove a file
rename( ) – To rename a file
datetime
today( ) – To return current system date
sys
exit( ) – To terminate execution of the program
13
# ************** Project on Car Rental Management System *****************
import sys
import os
import datetime
import random
import mysql.connector as mc
14
#print text slowly
def print_slow(t,s=0.03):
for y in t:
sys.stdout.write(y)
sys.stdout.flush()
time.sleep(s)
print('')
#display title
def title(t):
col,lin=os.get_terminal_size()
print('\n' + '='*(col+30) + '\n' +
' '*int((col-len(t)-31)/4)+
'DATE : '+datetime.datetime.now().strftime("%d-%m-%y")+
' '*int((col-len(t)-31)/4)+
'# '+t+' #'+
' '*int((col-len(t)-31)/4)+
'TIME - '+ datetime.datetime.now().strftime("%H:%M")+
' '*int((col-len(t)-31)/4)+
'\n' + '='*(col+30)+'\n')
#=================================================================
============
#MAIN MENU
def main_menu():
os.system('cls')
title(com_name)
heading('MAIN MENU')
print('''\
\t1 --> Admin Portal
\t2 --> Customer Portal
\t3 --> Credits
\n\tEnter --> Exit
''')
ch=input('\n\tEnter the choice: ')
if ch=='1':
15
admin_authentication()
elif ch=='2':
customer_portal()
elif ch=='3':
credit()
main_menu()
else:
program_end()
return
#CUSTOMER PORTAL
def customer_portal():
os.system('cls')
title(com_name)
heading('CUSTOMER PORTAL')
print('''\
\t1 --> View Cars
\t2 --> Rent Cars
\t3 --> Return Cars
\n\tEnter --> Back
''')
ch=input('\tEnter the choice: ')
if ch=='1':
view_cars_customer()
elif ch=='2':
rent_cars()
elif ch=='3':
return_cars()
else:
main_menu()
return
#RENT CARS
def rent_cars():
os.system('cls')
title(com_name)
heading('CUSTOMER PORTAL')
heading('RENT CARS')
16
z=z+'-'*(y+1)+'+'
print(z)
time.sleep(0.03)
print('| ',cut('CAR_NO',15),'| ',\
cut('CAR_CLASS',15),'| ',\
cut('MODEL_NAME',20),'| ',\
cut('CAR_COLOR',15),'| ',\
cut('CAPACITY',15),'| ',\
cut('DAILY_RENT',15),'| ',sep="")
time.sleep(0.03)
print(z)
time.sleep(0.03)
for y in range(0,len(l)):
print('| ',end='')
for x in range(0,len(l[y])):
print(cut(l[y][x],sp[x]),end='')
print('| ',end='')
print('')
time.sleep(0.03)
print(z)
cur=cn.cursor() #car_nos
cur.execute("select car_no from cars where car_status='AVAILABLE'")
l=cur.fetchall()
while True:
cars=input('\tEnter the car_nos of the cars you wish to rent \
separated by "," with no spaces: ')
cars=cars.split(',')
z='valid'
for y in cars:
x=(int(y),)
if x not in l:
z='invalid'
if z=='invalid':
print_slow("\n\tPlease enter valid and available car_nos...\n")
continue
break
17
break
print_slow('\n\tPlease enter valid answer...\n')
#dates
rent_date=datetime.datetime.now()
return_date = rent_date + datetime.timedelta(days=days)
rent_date=rent_date.strftime("%d-%m-%y")
return_date=return_date.strftime("%d-%m-%y")
os.system('cls')
title(com_name)
heading('CUSTOMER PORTAL')
heading('RECEIPT TABLE')
print('\n')
col,lin=os.get_terminal_size()
L=[]
n=30
print(' '*n+'+'+'='*(col-2*n-2)+'+')
L.append(com_name+' : RENT RECEIPT')
L.append('='*(col-2*n-2))
L.append('RENT-ID : '+str(rent_id))
L.append('CUSTOMER NAME: '+cust_name.upper())
L.append('-'*(col-2*n-2))
L.append('RENT DATE: '+rent_date)
L.append('RETURN DATE: '+return_date)
L.append('DAYS RENTED: '+str(days))
L.append('-'*(col-2*n-2))
L.append('-:PROJECTED RENT:-')
car_and_rent=[]
total=0
for car_no in cars:
cur=cn.cursor()
cur.execute('select daily_rent from cars where car_no={};'\
.format(car_no))
x=cur.fetchall()
x=x[0][0]
rent=x*days
total=total+(x*days)
18
L.append('CAR NO.'+str(y)+' --> '+str(x)+' * '+str(days)+' = '+\
str(x*days))
if driver=='y':
L.append('DRIVER --> 500 * '+str(days)+' = '+str(days*500))
rent=rent+(days*500)
total=total+(days*500)
car_and_rent.append({'car_no':car_no,'rent':rent})
L.append('-'*(col-2*n-2))
L.append('TOTAL :- Rs.'+str(total))
L.append('-'*(col-2*n-2))
L.append('Please print this receipt and take it to our')
L.append(com_name+' shop to get the cars')
L.append('-'*(col-2*n-2))
L.append('(: HAVE A NICE DAY :)')
for y in L:
sp=' '*n
d1=' '*int((col-2*n-len(y)-2)/2)
d2=' '*( col-2*n-2-len(y) - int((col-2*n-len(y)-2)/2) )
print(sp+'|'+d1+y+d2+'|')
time.sleep(0.03)
print(' '*n+'+'+'='*(col-2*n-2)+'+')
print('')
#confirmation
print_slow('\n\tEnter y when you have shown this receipt and taken \
the cars')
print_slow('\tEnter n to cancel the renting')
an=input('\tAnswer : ')
if an=='y':
pass
else:
print_slow('\n\tRenting Cancelled....')
print_slow('\n\tRedirecting to Customer Portal.... Press Enter')
input()
customer_portal()
return
#important note
19
os.system('cls')
title(com_name)
heading('CUSTOMER PORTAL')
heading('IMPORTANT NOTE')
print('')
print_slow('''
\t\tTHE CUSTOMER HAS TO TAKE THE RECEIPT TO THE OFFICE TO GET THE
CARS!
\t\tTHE PRICE OF FUEL IS NOT INCLUDED IN THE RECEIPT!
#RETURN CARS
def return_cars():
os.system('cls')
title(com_name)
heading('CUSTOMER PORTAL')
heading('RETURN CARS')
rent_id=int(input('\n\tEnter the RENT_ID : '))
#validating
cur=cn.cursor()
cur.execute('select rent_id from rentings;')
l=cur.fetchall()
x=(rent_id,)
if x not in l:
print_slow('\n\tThis RENT_ID does not exist, enter again...')
time.sleep(0.5)
return_cars()
print_slow('\tRedirecting to Bill Table.... Press Enter')
input()
#bill table
os.system('cls')
title(com_name)
heading('CUSTOMER PORTAL')
heading('BILL TABLE')
20
cust_name=l[0][0]
driver=l[0][3]
phone=l[0][4]
#dates
rent_date = datetime.datetime.strptime(l[0][2],'%d-%m-%y')
return_date = datetime.datetime.now()
days = return_date-rent_date
days = days.days+1
rent_date = rent_date.strftime('%d-%m-%y')
return_date = return_date.strftime('%d-%m-%y')
#rent
car_and_drent=[]
for y in l:
for x in range(0,len(y)):
if x==1:
car_no=y[x]
cur=cn.cursor()
cur.execute('select daily_rent from cars where car_no={};'\
.format(car_no))
rent=(cur.fetchall())[0][0]
t={'car_no':car_no,'rent':rent}
car_and_drent.append(t)
del t
print(' '*n+'+'+'='*(col-2*n-2)+'+')
L.append(com_name+' : BILL')
L.append('='*(col-2*n-2))
L.append('RENT-ID : '+str(rent_id))
L.append('CUSTOMER NAME: '+cust_name.upper())
L.append('-'*(col-2*n-2))
L.append('RENT DATE: '+rent_date)
L.append('RETURN DATE: '+return_date)
L.append('DAYS RENTED: '+str(days))
L.append('-'*(col-2*n-2))
L.append('-:RENT TO BE PAID:-')
for y in car_and_drent:
L.append('CAR NO.'+str(y['car_no'])+' --> '+str(y['rent'])\
+' * '+str(days)+' = '+str(y['rent']*days))
total = total + y['rent']*days
if driver=='y':
L.append('DRIVER --> 500 * '+str(days)+' = '+str(days*500))
total = total + days*500
L.append('-'*(col-2*n-2))
L.append('TOTAL :- Rs.'+str(total))
21
L.append('-'*(col-2*n-2))
L.append('Kindly pay this amount')
L.append('And return the cars back')
L.append('-'*(col-2*n-2))
L.append('THANK YOU FOR CHOOSING US')
for y in L:
sp=' '*n
d1=' '*int((col-2*n-len(y)-2)/2)
d2=' '*( col-2*n-2-len(y) - int((col-2*n-len(y)-2)/2) )
print(sp+'|'+d1+y+d2+'|')
time.sleep(0.03)
print(' '*n+'+'+'='*(col-2*n-2)+'+')
print('')
#confirmation
print_slow('\n\n\tEnter y when you have paid the bill & completed the \
return')
print_slow('\tEnter n to cancel the return')
an=input('\tAnswer : ')
if an!='y':
print_slow('\tReturn Cancelled....')
prin_slow('\tRedirecting to Customer Portal.... Press Enter')
input()
customer_portal()
return
#returning
cur=cn.cursor()
cur.execute('delete from rentings where rent_id={};'.format(rent_id))
cur=cn.cursor()
cur.execute("update cars set car_status='{}', rent_id={} where \
rent_id={};".format('AVAILABLE','NULL',rent_id))
cn.commit()
print_slow('\tCARS RETURNED....')
print_slow('\tRedirecting to Customer Portal.... Press Enter')
input('')
customer_portal()
return
22
title(com_name)
heading('CUSTOMER PORTAL')
heading('VIEW CARS')
cur=cn.cursor()
cur.execute('select car_class,model_name,car_color,\
capacity,daily_rent,car_status from cars order by Car_Class;')
l=cur.fetchall()
if len(l)==0:
print_slow('\n\tNo cars available in the store! Press enter to go \
back!')
input()
customer_portal
return
#printing table
print('')
sp=[15,20,15,15,15,15]
z='+'
for y in sp:
z=z+'-'*(y+1)+'+'
print(z)
time.sleep(0.03)
print('| ',cut('CAR_CLASS',15),'| ',\
cut('MODEL_NAME',20),'| ',\
cut('CAR_COLOR',15),'| ',\
cut('CAPACITY',15),'| ',\
cut('DAILY_RENT',15),'| ',\
cut('CAR_STATUS',15),'| ',sep="")
time.sleep(0.03)
print(z)
time.sleep(0.03)
for y in range(0,len(l)):
print('| ',end='')
for x in range(0,len(l[y])):
print(cut(l[y][x],sp[x]),end='')
print('| ',end='')
print('')
time.sleep(0.03)
print(z)
input('\n\tPress ENTER to go back')
customer_portal()
return
#ADMIN AUTHENTICATION
def admin_authentication():
os.system('cls')
title(com_name)
heading('ADMIN AUTHENTICATION')
Pass=getpass.getpass("\tEnter Password: ")
#password
cur=cn.cursor()
cur.execute('select * from admins')
23
l=cur.fetchall()
passwd=l[0][0]
if passwd==Pass:
print_slow('\n\tAccess Granted ..... Press Enter')
input('')
admin_portal()
else:
print_slow('\n\tAccess Denied ..... Press Enter')
input('')
main_menu()
return
#ADMIN PORTAL
def admin_portal():
os.system('cls')
title(com_name)
heading('ADMIN PORTAL')
print('''\
\t1 --> Open Garage
\t2 --> View Current Rentings
\t3 --> View Sales Table
\n\tEnter --> Back
''')
ch=input('\tEnter the choice: ')
if ch=='1':
garage()
elif ch=='2':
view_current_rentings()
elif ch=='3':
sales_table()
else:
main_menu()
return
cur=cn.cursor()
cur.execute('select * from rentings order by return_date;')
l=cur.fetchall()
if len(l)==0:
print_slow('\n\tNo cars rented currently!, Press enter to go back')
input()
admin_portal()
return
#printing table
sp=[10,20,15,10,15,15,10,10]
z='+'
for y in sp:
24
z=z+'-'*(y+1)+'+'
print(z)
time.sleep(0.03)
print('| '+cut('RENT_ID',10)+\
'| '+cut('CUSTOMER_NAME',20)+\
'| '+cut('PHONE NUMBER',15)+\
'| '+cut('CAR_NO',10)+\
'| '+cut('DATE_RENTED',15)+\
'| '+cut('RETURN_DATE',15)+\
'| '+cut('DRIVER',10)+\
'| '+cut('TOTAL_RENT',10)+\
'| ',sep='')
time.sleep(0.03)
print(z)
time.sleep(0.03)
for y in range(0,len(l)):
print('| ',end='')
for x in range(0,len(l[y])):
print(cut(l[y][x],sp[x]),end='')
print('| ',end='')
print('')
time.sleep(0.03)
print(z)
input('\n\tPress ENTER to go back')
admin_portal()
return
#SALES TABLE
def sales_table():
os.system('cls')
title(com_name)
heading('ADMIN PORTAL')
heading('SALES TABLE')
cur=cn.cursor()
cur.execute('select * from sales order by return_date;')
l=cur.fetchall()
if len(l)==0:
print_slow('\n\tNo sales to show!, Press enter to go back')
input()
admin_portal()
return
#printing table
sp=[15,15,20,15,15,15]
z='+'
for y in sp:
z=z+'-'*(y+1)+'+'
print(z)
time.sleep(0.03)
print('| '+cut('RENT_ID',15)+\
'| '+cut('CAR_NO',15)+\
'| '+cut('CUST_NAME',20)+\
'| '+cut('PHONE_NUMBER',15)+\
25
'| '+cut('RETURN_DATE',15)+\
'| '+cut('SALES',15)+\
'| ',sep='')
time.sleep(0.03)
print(z)
time.sleep(0.03)
for y in range(0,len(l)):
print('| ',end='')
for x in range(0,len(l[y])):
print(cut(l[y][x],sp[x]),end='')
print('| ',end='')
print('')
time.sleep(0.03)
print(z)
input('\n\tPress ENTER to go back')
admin_portal()
return
#GARAGE
def garage():
os.system('cls')
title(com_name)
heading('ADMIN PORTAL')
heading('GARAGE')
print('''\
\t1 --> View Cars
\t2 --> Add Car
\t3 --> Remove Car
\n\tEnter --> Back
''')
ch=input('\tEnter the choice: ')
if ch=='1':
view_cars_admin()
elif ch=='2':
add_car()
elif ch=='3':
remove_car()
else:
admin_portal()
return
cur=cn.cursor()
cur.execute('select * from cars order by Car_Class;')
l=cur.fetchall()
if len(l)==0:
print_slow('\n\tGarage empty! Press enter to go back!')
26
input()
garage()
return
#printing table
print('')
sp=[10,15,20,15,10,15,15,10]
z='+'
for y in sp:
z=z+'-'*(y+1)+'+'
print(z)
time.sleep(0.03)
print('| ',cut('CAR_NO',10),'| ',\
cut('CAR_CLASS',15),'| ',\
cut('MODEL_NAME',20),'| ',\
cut('CAR_COLOR',15),'| ',\
cut('CAPACITY',10),'| ',\
cut('DAILY_RENT',15),'| ',\
cut('CAR_STATUS',15),'| ',\
cut('RENT_ID',10),'| ',sep="")
time.sleep(0.03)
print(z)
time.sleep(0.03)
for y in range(0,len(l)):
print('| ',end='')
for x in range(0,len(l[y])):
print(cut(l[y][x],sp[x]),end='')
print('| ',end='')
print('')
time.sleep(0.03)
print(z)
input('\n\tPress ENTER to go back to Garage')
garage()
return
#ADD CAR
def add_car():
os.system('cls')
title(com_name)
heading('ADMIN PORTAL')
heading('GARAGE')
heading('ADD CAR')
#fetching details
car_no=int(input('\tEnter the car number: '))
cur=cn.cursor()
cur.execute('select car_no from cars;')
l=cur.fetchall()
x=(car_no,)
if x in l:
print_slow('\n\tThe car_no you entered is already in use..Enter again')
time.sleep(0.5)
add_car()
car_class=input('\tEnter the car class: ')
27
model_name=input('\tEnter the model name: ')
car_color=input('\tEnter the car color: ')
capacity=int(input('\tEnter the capacity: '))
daily_rent=int(input('\tEnter the daily rent: '))
#adding
q="insert into cars(car_no,car_class,model_name,car_color,capacity,\
daily_rent) values('{}','{}','{}','{}','{}','{}');".format(car_no,\
car_class.upper(),model_name.upper(),car_color.upper(),capacity,daily_rent)
cur=cn.cursor()
cur.execute(q)
print_slow('\n\tCAR ADDED..... \n')
cn.commit()
print_slow('\n\tRedirecting to Garage.... Press Enter')
input('')
garage()
return
#REMOVE CAR
def remove_car():
os.system('cls')
title(com_name)
heading('ADMIN PORTAL')
heading('GARAGE')
heading('REMOVE CAR')
#printing cars
print("\t You can only remove the cars which are'nt rented\n")
cur=cn.cursor()
cur.execute('select car_no,car_class,model_name,car_color,\
capacity, daily_rent, car_status from cars order by Car_Class;')
l=cur.fetchall()
print('')
sp=[15,15,20,15,15,15,15]
z='+'
for y in sp:
z=z+'-'*(y+1)+'+'
print(z)
time.sleep(0.03)
print('| ',cut('CAR_NO',15),'| ',\
cut('CAR_CLASS',15),'| ',\
cut('MODEL_NAME',20),'| ',\
cut('CAR_COLOR',15),'| ',\
cut('CAPACITY',15),'| ',\
cut('DAILY_RENT',15),'| ',\
cut('CAR_STATUS',15),'| ',sep="")
time.sleep(0.03)
print(z)
time.sleep(0.03)
for y in range(0,len(l)):
print('| ',end='')
for x in range(0,len(l[y])):
print(cut(l[y][x],sp[x]),end='')
print('| ',end='')
28
print('')
time.sleep(0.03)
print(z)
#validating car_no
cur=cn.cursor()
cur.execute("select car_no from cars where car_status='AVAILABLE';")
l=cur.fetchall()
if len(l)==0:
print_slow('\n\tNo cars can be removed currently!, Press enter to go\
back')
input()
garage()
return
c_no=input('\n\tEnter the car_no of the car to be remove: ')
x=(int(c_no),)
if x not in l:
print_slow('\n\tPlease enter valid car_no...')
time.sleep(0.5)
remove_car()
#confirmation
s=input('\tPlease confirm if you want to delete this car (y/n): ')
if s=='y':
pass
else:
print_slow('\n\tRedirecting to Garage....Press Enter')
input()
garage()
return
#removing
cur=cn.cursor()
q='delete from cars where Car_no={};'.format(c_no)
cur.execute(q)
print_slow('\n\tCAR DELETED.....')
cn.commit()
print_slow('\n\tRedirecting to Garage....Press Enter')
input()
garage()
#=================================================================
===========
#PRINT CREDITS
def credit():
os.system('cls')
x=input('\tPRESS ENTER TO READ LICENSE & ACKNOWLEDGEMENT OR
ENTER ANYTHIG \
TO GO BACK: ')
if x=='':
os.system('cls')
time.sleep(0.5)
print_slow(
29
'''
''',0.005)
input('\n\tPress Enter to go back')
os.system('cls')
return
sp=' '*int((l-len(a4)-len(w3))/2)
w1=sp+w1+sp
w2=sp+w2+sp
w3=sp+w3+sp
w4=sp+w4+sp
n=int((row-9)/2)-1
for y in range(0,l+1):
os.system('cls')
for x in range(n):
print(s[:y])
print("")
print("")
print(w1[0:y]+a1)
print(w2[0:y]+a2)
print(w3[0:y]+a3)
print(w4[0:y]+a4)
30
print("="*l)
print("")
print("")
for x in range(n):
print(s[:y])
time.sleep(0.02)
input('')
os.system('cls')
return
sp=' '*(int((l-len(a4)-len(w3))/2)-2)
w1=sp+w1+sp
w2=sp+w2+sp
w3=sp+w3+sp
w4=sp+w4+sp
ws=' '*len(w3)
n=int((row-9)/2)-1
for y in range(l,-1,-1):
os.system('cls')
for x in range(n):
print(s[:y])
print("")
print('')
print(ws[0:y]+a1+w1[y:])
print(ws[0:y]+a2+w2[y:])
print(ws[0:y]+a3+w3[y:])
print(ws[0:y]+a4+w4[y:])
print("="*l)
print("")
print('')
for x in range(n):
31
print(s[:y])
time.sleep(0.02)
input('')
os.system('cls')
return
#=================================================================
============
#PROGRAM END
def program_end():
cn.commit()
cn.close()
#end screen
end(com_name)
return
#PROGRAM START
os.system('mode con lines=200 cols=200')
os.system('COLOR 70')
#START SCREEN
com_name='CAR RENTALS'
start(com_name)
try:
cn=mc.connect(host='localhost',user='root',passwd=paas,database='CAR')
except:
print_slow('\n\t\tConnection Failed... Enter password again..',0.02)
time.sleep(0.5)
continue
break
main_menu()
32
Enter Password of Your MySQL Client : pass
--------------------------------------------------------------------------------------------------------------
*********************** W E L C O M E **************************
DEVELOPED BY:
Sudhanshu Juneja
XII-D
Bareilly
3 --> Credits
33
-----\ ADMIN AUTHENTICATION /-----
Enter Password:1289
CAR ADDED.....
CAR DELETED.....
35
---\ GARAGE /---
37
Press ENTER to go back
---\ CUSTOMER PORTAL /---
AVAIABLE CARS:
Enter the car_nos of the cars you wish to rent separated by "," with no spaces: 1304
Enter the no. of days you wish to borrow the car including today (max 15): 3
Will you need a driver (y/n) [ Rs. 500 per day per car ]: y
38
---\ RECEIPT TABLE /---
Enter y when you have shown this receipt and taken the cars
Enter n to cancel the renting
Answer : y
Enter y when you have paid the bill & completed the return
Enter n to cancel the return
Answer : y
CARS RETURNED....
Redirecting to Customer Portal.... Press Enter
41
Bibliography
42
Books Referred
www.google.com
www.studytonight.com
www.pythonprogramming.com
43