Managementsys
Managementsys
S.NO DESCRIPTION
01 ACKNOWLEDGEMENT
02 INTRODUCTION
04 PROPOSED SYSTEM
05 SYSTEM REQUIREMENTS
06 SOURCE CODE
07 OUTPUT
knowledge into a real- world situation/problem and exposed the students how
against today’s merciless competition where not to wise saying “to err is human” no
longer valid, it’s outdated to rationalize your mistake. So, to keep pace with time, to
bring about the best result without malfunctioning and greater efficiency so to replace
the unending heaps of flies with a much sophisticated hard disk of the computer.
One has to use the data management software. Software has been an ascent in
markets, which have helped in making the organizations work easier and efficiently.
Data management initially had to maintain a lot of ledgers and a lot of paper work has
to be done but now software product on this organization has made their work faster
and easier. Now only this software has to be loaded on the computer and work can be
done.
This prevents a lot of time and money. The work becomes fully automated and
any information regarding the organization can be obtained by clicking the button.
Moreover, now it’s an age of computers of and automating such an organization gives
Software requirements
• Operating System: Windows 7 and later versions
(32bit,64bit)
• Language: Python
• Platform: Python IDLE 3.11
• Database: MySQL
• Database Driver: MySQL Connector
Hardware requirements
• Processor: Pentium Dual Core(min) 32bit or 64bit
• Hard Disk: 160GB (min)
• RAM: 2GB(min)
Project Overview: Bakery Management
System in Python
Our bakery’s name is Moon Pie Bakery. And we are going to build a Python
application for it. This is going to be a console-based application.
Project Working:
We will store the data (product names and their prices) of our bakery in a
database.
This data can be accessed as:
1. Admin Login:
The admin can access the data, view the items, add or delete an item, and update
the price of an item.
2. Customer login:
This will be the login for customer billing. Biller will note the items and their
quantities as per the customer’s input and generate the bill for the same.
Workflow:
1.Firstly, we are going to create a database to store the items and their prices that
we are selling in our bakery.
2.The user will have 3 choices: admin login, customer login, and exit. A while loop
will be run infinite times until the user chooses the exit option.
3.To log in as an admin, a password is needed. For the admin login, there will be
a separate function with options to: add an item, remove an item, update an item,
display the items, and exit from the section.
4.For customer login, the biller will take the customer’s name and order as inputs
and generate the bill. Here also, there will be an option to exit the section.
5.Every step will have a time gap to make the result look systematic and
readable.
The steps to create an SQLite database in Python is simple. Just establish the
connection and every time you will execute a query, execute it with a cursor
object.
connection = sqlite3.connect('menu.db')
cursor = connection.cursor()
menu will be the name of our database. Now create the table, Menu. It will
require the following three entities: product_id (primary key + autoincrement),
product_name, and product_price.
cursor.execute('''
CREATE TABLE IF NOT EXISTS Menu([product_id] INTEGER PRIMARY KEY
AUTOINCREMENT,
[product_name] TEXT,[product_price] INTEGER)''')
The keywords IF NOT EXISTS will make sure that irrespective of how much
code will be run, the database will only be created once.
Let’s insert values into the database. This can be done in two ways: you can either
run a query inside the code for that or you can manually open the database file
into SQLite studio and insert the values.
query = '''SELECT * FROM Menu'''
cursor.execute(query)
results = cursor.fetchall()
if results==[]:
cursor.execute('''
INSERT INTO Menu (product_name, product_price)
VALUES
('Cake',400),
('Bread',50),
('Cookies',100),
('Doughnuts',80),
('Pie',120)
''')
connection.commit()
Again, to make sure that the values are inserted only once, check if the Menu
table is empty.
print("-------------------------------------------------------------
--------")
print("---------------------Welcome to Moon Pie
Bakery!---------------------")
print("-------------------------------------------------------------
--------")
if choice=='1':
password = input("Enter the password: ")
if password=="MoonPie":
admin_login(connection,cursor)
else:
print("Incorrect Password!")
time.sleep(1)
elif choice=='2':
customer_login(connection,cursor)
elif choice=='3':
exit()
else:
print("Invalid Choice!")
The loop will only be broken in case the user chooses to exit.
if choice==1:
print("What you like to add?")
product_name = input("Enter product name: ")
product_price = input("Enter product price: ")
try:
query=f'''INSERT INTO Menu(product_name, product_price)
VALUES ('{product_name}','{product_price}')'''
cursor.execute(query)
connection.commit()
print("The item has been added to the list!")
except Exception as e:
print("Error occured!")
time.sleep(1)
admin_login(connection,cursor)
elif choice==2:
display_items(cursor)
print("Which item you would like to remove?")
id = int(input("Enter product id:"))
try:
query=f'''DELETE FROM Menu WHERE product_id={id}'''
cursor.execute(query)
connection.commit()
print("The item has been removed from the shop!")
except Exception as e:
print("Invalid item!")
time.sleep(1)
admin_login(connection,cursor)
elif choice==3:
display_items(cursor)
print("Which item price you would like to update?")
id=int(input("Enter product ID:"))
price=int(input("Enter the updated price:"))
try:
query=f'''UPDATE Menu SET product_price={price} WHERE
product_id={id}'''
cursor.execute(query)
connection.commit()
print("The item price has been updated!")
except Exception as e:
print("Invalid Product ID!")
time.sleep(1)
admin_login(connection,cursor)
elif choice==4:
display_items(cursor)
time.sleep(1.5)
admin_login(connection,cursor)
elif choice==5:
main()
else:
print("Invalid Choice!")
time.sleep(1)
admin_login(connection,cursor)
From the code, you can see that for the choices of update and delete we are
displaying the menu first, making it suitable for the user to input the correct id and
price.
Let’s code display_items() now.
def display_items(cursor):
query='''SELECT * FROM Menu'''
cursor.execute(query)
results=cursor.fetchall()
print("List of items: ")
print("ID","Name","Price",sep=" ")
for each in results:
print(each[0],each[1],each[2],sep=" ")
print()
total = 0
items=[]
while 1:
total += result[2]*quantity
items.append([result[1],quantity])
i=input("Anything else?Answer Y for Yes and N for No!
")
if(i=='N'):
break
except Exception as e:
print("Invalid Entry!")
print(e)
break
if(total!=0):
print()
print("---------Moon Pie Bakery--------")
print("-------Billing Details-------")
print(f"Name:{name}")
print(f"Items:")
for each in items:
print(each[0],each[1],sep=":")
print(f"Total: {total}")
print("Thank you! Have a sweet day!")
print()
time.sleep(1)
customer_login(connection,cursor)
elif choice==2:
main()
else:
print("Invalid Choice!")
time.sleep(1)
customer_login(connection,cursor)
Now, the only thing left is to call the main function and start the program
execution.
main()
OUTPUTS:
Logging screen:
C
o
l
u
m
n
3
2
1
Logging in as a customer:
Ordering an item as a customer:
An Overview of Python and SQL
Python and MySQL are two popular technologies used in software
development, especially in the context of web development and data-
driven applications. Let's provide an overview of each:
Python:
Python is a versatile and high-level programming language known for
its readability and simplicity. It has a large and active community,
making it a popular choice for various applications, including web
development, data analysis, machine learning, and more.
Key features of Python include:
• Readable Syntax: Python's syntax is designed to be easily
readable, which makes it an excellent choice for beginners and
experienced developers alike.
• Extensive Libraries: Python has a rich ecosystem of libraries and
frameworks that simplify various tasks, such as web development
(Django, Flask), data analysis (Pandas, NumPy), machine learning
(TensorFlow, PyTorch), and more.
• Cross-Platform: Python is cross-platform, meaning that code
written in Python can run on different operating systems without
modification.
• Community Support: The Python community is vast and
supportive. This means that developers can find solutions to
problems easily through online forums, documentation, and other
resources.
MySQL:
MySQL is an open-source relational database management system
(RDBMS) that uses SQL (Structured Query Language) for managing
and manipulating data. It is widely used in web applications to store and
retrieve data efficiently.
Key features of MySQL include:
• Relational Database: MySQL is a relational database, which
means it organizes data into tables with rows and columns, and it
supports relationships between these tables.
• ACID Properties: MySQL follows the ACID (Atomicity,
Consistency, Isolation, Durability) properties, ensuring data
integrity and reliability.
• Scalability: MySQL is scalable and can handle a large amount of
data and concurrent connections, making it suitable for both small
and large-scale applications.
• Security: MySQL provides robust security features, including user
authentication, access control, and encryption.