0% found this document useful (0 votes)
17 views18 pages

Bakery ShopManagement

The document outlines a Computer Science project titled 'Bakery Shop' that integrates a MySQL database with Python to manage bakery operations. It includes functionalities for viewing, adding, updating, and deleting products, as well as handling customer transactions and billing. The project demonstrates the application of a Database Management System through various Python functions and user interactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views18 pages

Bakery ShopManagement

The document outlines a Computer Science project titled 'Bakery Shop' that integrates a MySQL database with Python to manage bakery operations. It includes functionalities for viewing, adding, updating, and deleting products, as well as handling customer transactions and billing. The project demonstrates the application of a Database Management System through various Python functions and user interactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

D

COMPUTER SCIENCE PROJECT


BAKERY SHOP

Submitted By :-
Name –
Class –
Roll No. -
CERTIFICATE
This is to certify that the project entitled
“Bakery Shop” has been prepared under
my guidance and supervision by

Name :
Roll No:
Class :

Subject : Computer Science


Session : 202-202
Submitted To :
Signature : ___________________

ACKNOWLEDGEMENT

I would like to express my


sincere thanks and gratitude to
my Computer Science teacher
M_________ for her constant
support and guidance which
helped me in developing this
project .

INTRODUCTION
This is a programme that processes the way
a shop works and has been made by
integrating the MYSQL database with Python
(My SQL connector ) which presents this
project in an easy and understandable way .
This project also shows the application of
Database Management System in python
using My SQL and My SQL connector.

This program allows the user to view the


available products , delete a product form
the menu , search the database for a
particular product , add a new product and
update the cost and id of a product .
It also performs the task of billing and
automatically stores the data in a new table
in order to keep a record of the
transactions .
Program
import mysql.connector

c=mysql.connector.connect(host="localhost",user="root",passwd="1234"
,database="BAKERY")

d=c.cursor()

def create_t():

d.execute("create table Your_Cart(Product char(10),Cost int(3), Id


int(3),Quantity int(2))")

c.commit()

def search_prod():

a=input("Enter product name to be searched for: ")

d.execute("select * from Product where Product='{}'".format(a))

print(33*'_')

print("%s%10s%3s%10s%3s%3s%3s"%('|','Item','|','Cost','|','Id','|'))

print(33*'=')

for i in d:

print("%s%10s%3s%10s%3s%3s%3s"%('|',i[0],'|',i[1],'|',i[2],'|'))

print(33*'-')

def search_cost():

f=int(input("Enter minimum cost of product: "))

d.execute("select * from product where cost>={}".format(f))

print(33*'_')

print("%s%10s%3s%10s%3s%3s%3s"%('|','Item','|','Cost','|','Id','|'))

print(33*'=')

for i in d:
print("%s%10s%3s%10s%3s%3s%3s"%('|',i[0],'|',i[1],'|',i[2],'|'))

print(33*'-')

def disp_prod():

d.execute("select * from Product")

print(33*'_')

print("%s%10s%3s%10s%3s%3s%3s"%('|','Item','|','Cost','|','Id','|'))

print(33*'=')

for i in d:

print("%s%10s%3s%10s%3s%3s%3s"%('|',i[0],'|',i[1],'|',i[2],'|'))

print(33*'-')

def customer_info():

d.execute("select*from customer")

print(105*'_')

print("%s%15s%3s%50s%3s%12s%3s%15s%3s"%('|','Customer
Id','|','Products','|','Total Qty','|','Grand Total','|'))

print(105*'=')

for i in d:

print("%s%15s%3s%50s%3s%12s%3s%15s%3s"%
('|',i[0],'|',i[1],'|',i[2],'|',i[3],'|'))

print(105*'-')

def update_cost():

cost1=int(input("Enter new cost: "))

id1=int(input('Enter id of product to update cost: '))

d.execute("update product set Cost={} where


Product_id={}".format(cost1,id1))
c.commit()

def delete_item():

d.execute("select * from Product")

print(33*'_')

print("%s%10s%3s%10s%3s%3s%3s"%('|','Item','|','Cost','|','Id','|'))

print(33*'=')

for i in d:

print("%s%10s%3s%10s%3s%3s%3s"%('|',i[0],'|',i[1],'|',i[2],'|'))

print(33*'-')

id2=int(input('Enter id of product to be deleted: '))

d.execute("delete from product where Product_id={}".format(id2))

c.commit()

def add_new_item():

P_name=input("Enter product name: ")

cost2=int(input("Enter cost of product: "))

id3=int(input("Enter id of product: "))

d.execute("insert into product values('{}',{},


{})".format(P_name,cost2,id3))

c.commit()

def bill():

all_prod=""

gt=0

qty1=0

while True:

print("1.Cake")

print("2.Pastry")
print("3.Biscuits")

print("4.Bread")

print("5.Muffin")

print("6.Donut")

t=0

ch=int(input("Enter choice: "))

d.execute("select * from product where Product_id={}".format(ch))

qty=int(input("Enter Quantity: "))

for i in d:

product=i[0]

cost=i[1]

total=qty*cost

d.execute("insert into Cart values('{}',{},{},


{})".format(product,cost,qty,total))

kk=input("Want to purchase yes or no: ")

gt=gt+total

all_prod=product+','+all_prod

qty1=qty1+qty

if kk=='no':

break

print("---------------List Of Your Products----------------")

print(52*'_')

d.execute("select * from Cart")

print("%s%15s%3s%7s%3s%10s%3s%7s%3s"%
('|','Products','|','Cost','|','Quantity','|','Total','|'))

print(52*'=')

for i in d:
print("%s%15s%3s%7s%3s%10s%3s%7s%3s"%
('|',i[0],'|',i[1],'|',i[2],'|',i[3],'|'))

print(52*'-')

print("Total Quantity: ",qty1)

print("Your Grand Total is: ",gt)

p_id=int(input('Enter customer id: '))

d.execute("insert into customer values({},'{}',{},


{})".format(p_id,all_prod,qty1,gt))

c.commit()

print('WELCOME TO THE BAKERY SHOP')

while True:

print("1.Display ")

print("2.Delete ")

print("3.Search")

print("4.Update")

print("5.Purchase")

print("6.Exit")

hh=int(input("Enter your choice: "))

if hh==1:

print("1.Display menu")

print("2.Display customer info")

dd=int(input("Enter your choice: "))

if dd==1:

disp_prod()

elif dd==2:
customer_info()

elif hh==2:

delete_item()

elif hh==3:

print("1.Search by Name")

print("2.Search by Cost")

dd=int(input("Enter ur choice: "))

if dd==1:

search_prod()

elif dd==2:

search_cost()

elif hh==4:

print("1.Update Cost")

print("2.Add new item")

df=int(input("Enter your choice: "))

if df==1:

update_cost()

elif df==2:

add_new_item()

elif hh==5:

bill()

elif hh==6:

print("Thank You for Visiting")

break

c.close()
Output
Displays Menu and Customer

Info
Deleting a Product
Searching Product by Name

and Cost
Adding new product
Updating Cost of Product
Initial Table

After updating cost


Purchasing and Billing

You might also like