Project Vasu (1)
Project Vasu (1)
SChOOl
• CERTIfICATE
• AbSTRACT
• INTRODuCTION
• ObjECTIVES
• SOuRCE CODE
• SySTEM SOuRCES
ACkNOwlEDgEMENT
Apart from the efforts by us, the success of any project depends
largely on the encouragement and guidelines of many others. I take
this opportunity to express my gratitude to the people who have
been instrumental in the successful completion of this project.
The guidance and support received from all the members who
contributed and who are contributing to this project was vital for the
success of the project. I am grateful for their constant support and
help
CERTIfICATE
This is hereby to certify that the original and
genuine work has been carried out to complete
the project work and the related codes and output
have been completed sincerely and satisfactorily
by Vasu Aggarwal of class XII-A, Mamta Modern
Sr. Sec. School, regarding her project titled
“Grocery Management”.
_____________________ ______________________
def delete():
import mysql.connector as mys
mycon=mys.connect(host='localhost',user='root',passwd='12345',database='grocery')
mycursor=mycon.cursor()
print("welcome to items record delete screen :)")
delete="y"
while delete=="y":
c=int(input("enter item_code to delete"))
query="delete from items where item_code='%s';"%(c,)
mycursor.execute(query)
mycon.commit()
print("item record deleted")
delete=input("do you want to delete more item records(y/n)")
if ch==1:
display()
elif ch==4:
insert()
elif ch==3:
update()
elif ch==2:
search()
elif ch==5:
delete()
def staff():
print("_______WELCOME TO GROCERY STORE :)________")
print(" ---------------------------------------------------------")
print("Enter 1 to display the staff record")
print(" ---------------------------------------------------------")
print("Enter 2 to search the staff record")
print(" ---------------------------------------------------------")
print("Enter 3 to update a staff record")
print(" ---------------------------------------------------------")
print("Enter 4 to insert a staff record")
print(" ---------------------------------------------------------")
print("Enter 5 to delete a staff record")
print(" ---------------------------------------------------------")
ch=int(input("enter your choice"))
def display():
import mysql.connector as mys
mycon=mys.connect(host='localhost',user='root',passwd='12345',database='grocery')
mycursor=mycon.cursor()
mycursor.execute("select * from staff")
mydata=mycursor.fetchall()
for i in mydata:
print(i)
def insert():
import mysql.connector as mys
mycon=mys.connect(host='localhost',user='root',passwd='12345',database='grocery')
mycursor=mycon.cursor()
print ("welcome to staff data entry :)")
ans="y"
bonus_points=0
while ans=="y":
staff_code=int(input("enter staff code"))
staff_name=input("enter staff name")
staff_department=input("enter staff department")
salary=int(input("enter salary"))
address=input("enter the staff address")
query="insert into staff
values({0},'{1}','{2}',{3},'{4}')".format(staff_code,staff_name,staff_department,salary,address)
mycursor.execute(query)
mycon.commit()
print("##record saved.......##")
ans=input("add more?(y/n)")
def update():
import mysql.connector as mys
mycon=mys.connect(host='localhost',user='root',passwd='12345',database='grocery')
mycursor=mycon.cursor()
print("welcome to staff record update screen :)")
staff_code=int(input("enter staff code"))
query="select * from staff where staff_code={}".format(staff_code)
mycursor.execute(query)
data=mycursor.fetchone()
if data!=None:
print("## record found- details are##")
print(data)
ans=input("are you sure to update salary: (y/n)")
if ans=="y":
s=int(input("enter new salary"))
query="update staff set salary={} where staff_code={}".format(s,staff_code)
mycursor.execute(query)
mycon.commit()
print("## record updated")
else:
print("sorry! no such customer id exists :(")
def search():
import mysql.connector as mys
mycon=mys.connect(host='localhost',user='root',passwd='12345',database='grocery')
mycursor=mycon.cursor()
print("welcome to staff record search screen :)")
staff_code=int(input("enter staff code"))
query="select * from staff where staff_code={}".format(staff_code)
mycursor.execute(query)
data=mycursor.fetchone()
if data!=None:
print("## record found- details are##")
print(data)
else:
print("sorry! no such item id exists :)")
def delete():
import mysql.connector as mys
mycon=mys.connect(host='localhost',user='root',passwd='12345',database='grocery')
mycursor=mycon.cursor()
print("welcome to staff record delete screen :)")
delete="y"
while delete=="y":
c=int(input("enter staff_code to delete"))
query="delete from staff where staff_code='%s';"%(c,)
mycursor.execute(query)
mycon.commit()
print("staff record deleted")
delete=input("do you want to delete more staff records(y/n)")
if ch==1:
display()
elif ch==4:
insert()
elif ch==3:
update()
elif ch==2:
search()
elif ch==5:
delete()
if ch==1:
customer()
elif ch==2:
staff()
elif ch==3:
item()
else:
print("incorrect id or password")
OUTPUTS
Entering into the grocery store database with the
id/password
bIblIOgRAphy
● COMPUTER SCIENCE WITH PYTHON: CLASS XII-PREETI ARORA.
● PYTHON4CSIP.COM SAMPLE PROJECTS