Electronic Store Management System Project
Electronic Store Management System Project
SavaniChaitanyaVidyaSankul,CBSE Sub:
Computer Science
“ ”
Session 2025-2026
Standard: XII SCI
Submitted by:
Page1of51
Certificate
This is to certify that Computer Science project title “ ” has been successfully
completed by .KrishSutariya of classXII Science bearing Roll No _________
under the guidance of Shaikh Nilofar as prescribed by the SSCE course during the
academic year 2025-26.
The project is found worthy of acceptance as final project for the subject of
CS of class XII. He/she has prepared this project under my guidance.
Page2of51
ACKNOWLEDGEMENT
I would like to express my special thanks of gratitude to my Computer
TeacherShaikh Nilofar for her able guidance and support in completing
this project.
Page3of51
INDEX
Page4of51
LibraryandPurpose
[Link] mysqlconnector -for connecting Python
with Mysql
2. import tabulate–for printing data in table format.
Page6of51
General description of the project
Page7of51
Flowchart
Level0 DFD
Available_it
ems
Staff_details
Page8of51
Prior Database
1. Available_items
2. Staff_details
3. Sell_rec
Page9of51
4. Signup
Page10of51
SourceCode
#CSfinalBYKRISHSUTARIYA,MEETSUTARIYA,MONIKBAGADIYA
[Link]
fromdatetimeimportdatetime
import locale
fromtabulateimporttabulate
mydb=[Link](host="localhost",user="root",password="78619269
92")
print("+-----------------------------------------+")
print("|PP Savani Chaitanya Vidhya Sankul
----------------------------------------------------|")print("+
----------------------------------------------------+")
print("|Electronic Store Management System
----------------------------------------------------|")print("+
----------------------------------------------------+")
print("|AcademicYear:2022-2023|")print("+
----------------------------------------------------+")
print("|Class : XII Sci-A|")print("+------+")
print("| CreatedAndMaintainedBy |")
tab2=[["Krish","HareshBhai","Sutariya"],["Meet","SanjayBhai","Sutariya"],
["Monik","Ajit Bhai","Bagadia"]]
print((tabulate(tab2,headers=["FirstName","MiddleName","LastName"],tablefmt=
"pretty")))
print("""
+-------------------------------+
|WelcomeToKmsquareElectronics|
+-------------------------------+
""")
tab5=[["Contact No : 7845748569 / 9584764845"],
["Email :kmsqaurelect@[Link]"],
["Address:DhanoraTankRoad,BehindSupreme Hotel"],["Paldi Village,
Surat,Gujarat-391510"]]print(tabulate(tab5,tablefmt="double_outline"))
print("""
Page11of51
""")
#CREATINGDATABASEANDTABLE
mycursor=[Link](buffered=True)[Link](
"createdatabaseifnotexistscsproject")
[Link]("use csproject")
[Link]("createtableifnotexistssignup(usernamevarchar(20) primary
key,password varchar(20))")
aaa='y'
whileaaain"yY":cho=
"x"
tabce=[["1 : Customer"],["2 :
Employee"]]print(tabulate(tabce,tablefmt="grid"),"\
n")cho=input("Enter Choice :")
print("")
whilecho=="2":
tabce=[["1 : Signup"],["2 :
Login"]]print(tabulate(tabce,tablefmt="grid"),"\
n")ch=int(input("Enter Choice :"))
print("")
#SIGNUP
if ch==1:
username=input("Username:")
[Link]('selectusernamefromsignup')
data = [Link]()
usernameIsUnique=True
for i in range(len(data)) :
if username == data[i][0] :
usernameIsUnique=False
ifusernameIsUnique:
Page12of51
pw=input("Password :")
[Link]("insertintosignup
values('"+username+"','"+pw+"')")
[Link]()
else:
print("""
+---------------------------+
|UsernameAlreadyExists|
+---------------------------+""")
#LOGIN
elif ch==2:
username=input("Username:")
[Link]("selectusernamefromsignupwhereusername='"+username
+"'")
p=[Link]()i
f p is not None:
pw=input("Password:")
[Link]("selectpasswordfromsignupwherepassword='"+pw+"'")
a=[Link]()
ifaisnotNone:print("""
+--------------------+
|LoginSuccesfull|
+--------------------+""")
[Link]("createtableifnotexistsAvailable_items(item_id
varchar(20),itemname varchar(30) primary key,Categoryvarchar(20),Quantity
int(5),Brand varchar(20),Price int(6))")
[Link]("create table if not exists Sell_rec(item_id
varchar(20),CustomerNamevarchar(20),PhoneNumberchar(10),itemname
varchar(30),Quantity int(100),Price int(6))")
Page13of51
[Link]("create table if not exists Staff_details(Name
varchar(30),Gendervarchar(10),Ageint(3),PhoneNumberchar(10)uniquekey,
Address varchar(100))")
[Link]()whi
le True:
print("""
+--------------------------+
| KMSQUAREELECTRONICS |
+-------+------------------+
| No.| Action |
+-------+------------------+
| 1.| AddItems |
| 2.|SearchItems |
| 3.|StaffRecord |
| 4.| SellRecord |
| 5.|AvailableItems|
| 6.|TotalIncome |
| 7.|DeleteItems |
| 8.| Update |
| 9.| Exit |
+-------+------------------+\n""")
a=int(input("Enteryourchoice:"))pri
nt("")
#ADDitems
ifa==1:
b=[ ]
tup=('',)
tabp=[["Please Fill All The
Details"]]print(tabulate(tabp,tablefmt="double_
Page14of51
outline"))
Page15of51
[Link]("selectitem_idfromAvailable_itemsorderbyt=
item_id")
[Link]()
result = [ ]
result1=[ ]
for tupint:
for x in
tup:[Link]
d(x)
#print(result)
a1=len(result)
ifa1==0:a
1=1
elifa1==1:a1=2
else:
print("")
foriinrange(1,a1+2):iid='id_'+str(i)
if iid not in
result:[Link](iid)
break
else:
continue
item=str(input("EnterItemName:"))
Page16of51
print("")
Category=str(input("Category:"))
print("")
quantity=int(input("Enterquantity:"))pri
nt("")
Brand=str(input("EnterBrandname:"))pr
int("")
price=int(input("Entertheprice:"))print("
")
[Link]("select*fromAvailable_itemswhereitemname='"+
item+"'")
r=[Link]()
ifris notNone:
[Link]("update Available_items set
quantity=quantity+'"+str(quantity)+"'whereitemname='"+item+"'")
[Link]()
print("""
+--------------------+
| ItemAdded |
+--------------------+""")
else:
[Link]("insert
intoAvailable_items(item_id,itemname,Category,quantity,Brand,price)
values('"+result1[0]+"','"+item+"','"+Category+"','"+str(quantity)+"','"+Bran
d+"','"+str(price)+"')")
[Link]()
print("""
+---------------------+
Page17of51
|SuccesfullyAdded|
+---------------------+""")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#SEARCHitemsONTHEBASISOFGIVENOPTIONS
elifa==2:
l=[["[Link]"],["[Link]"],["[Link] Brand"],
["[Link] By Category"]]
print(tabulate(l,tablefmt="grid"))
j=int(input("Searchby:"))
#BY itemname
ifj==1:
o=input("Enteritemtosearch:")
[Link]("select*fromAvailable_itemswhereitemname='
"+o+"'")
tree=[Link]()tab
=[ ]
if tree!
=[ ]:'''print(
"""
+--------------------+
|ItemIsInStock|
+--------------------+""")'''
Page18of51
for iinrange(len(tree)):
Page19of51
[Link]([tree[i][0],tree[i][1],tree[i][2],tree[i][3],tree[i][4],tree[i][5]],)
print((tabulate(tab,
headers=["ID","ITEM","CATEGORY","QUANTITY","BRAND","PRICE"],t
ablefmt="simple_grid",stralign="left")))
else:
print("""
+------------------------+
|ItemIs NotInStock|
+------------------------+""")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#BYId
elifj==2:
g=input("EnterIdtosearch:")g="id_"+g
[Link]("select*fromAvailable_itemswhere
item_id='"+g+"'")
poll=[Link]()
tab=[]
if poll!
=[ ]:'''print(
"""
+--------------------+
|ItemIsInStock|
+--------------------+""")'''
for iinrange(len(poll)):
[Link]([poll[i][0],poll[i][1],poll[i][2],poll[i][3],poll[i][4],poll[i][5]],)
Page20of51
print((tabulate(tab,
headers=["ID","ITEM","CATEGORY","QUANTITY","BRAND","PRICE"],t
ablefmt="simple_grid",stralign="left")))
else:
print("""
+------------------------+
|ItemIs NotInStock|
+------------------------+""")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#BYBrandNAME
elifj==3:
au=input("EnterBrandtosearch:")
[Link]("select*fromAvailable_itemswhereBrand='"+a
u+"'")
home=[Link]()ta
b=[ ]
if home!
=[ ]:'''print(
"""
+--------------------+
|ItemIsInStock|
+--------------------+""")'''
for iinrange(len(home)):
[Link]([home[i][0],home[i][1],home[i][2],home[i][3],home[i][4],home[i][5]],)
print((tabulate(tab,
headers=["ID","ITEM","CATEGORY","QUANTITY","BRAND","PRICE"],t
Page21of51
ablefmt="simple_grid",stralign="left")))
Page22of51
else:
print("""
+------------------------+
|ItemIs NotInStock|
+------------------------+""")
#ByCategory
elifj==4:
g=input("EnterCategorytosearch:")
[Link]("select*fromAvailable_itemswherecategory='"
+g+"'")
poll=[Link]()
tab=[]
if poll!
=[ ]:'''print(
"""
+--------------------+
|ItemIsInStock|
+--------------------+""")'''
for iinrange(len(poll)):
[Link]([poll[i][0],poll[i][1],poll[i][2],poll[i][3],poll[i][4],poll[i][5]],)
print((tabulate(tab,
headers=["ID","ITEM","CATEGORY","QUANTITY","BRAND","PRICE"],t
ablefmt="simple_grid",stralign="left")))
else:
print("""
+------------------------+
Page23of51
|ItemIs NotInStock|
Page24of51
+------------------------+""")
else:
print("""
+------------------------+
|!!EnterValidChoice!!|
+------------------------+""")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#STAFFDETAILS
elif
a==3:print(""
"
+-------+---------------------------+
| No.| Action |
+-------+---------------------------+
| 1.| NEWSTAFFENTRY |
| 2.| REMOVESTAFFENTRY |
| 3.| EXISTINGSTAFFRECORD |
+-------+---------------------------+""")
ch=int(input("Enteryourchoice:"))
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#NEWSTAFFENTRY
ifch==1:
fname=str(input("Enter
Fullname:"))gender=str(input("Gender(
M/F/O):"))while gender not
in"MmFfOo":
print("""
+------------------------+
Page25of51
|!!EnterValidChoice!!|
+------------------------+""")
Page26of51
gender=str(input("Gender(M/F/O):"))
continue
age=str(input("Age:"))
[Link]()!
=True:print("""
+------------------------+
|!!EnterValidChoice!!|
+------------------------+""")
age=str(input("Age:"))
continue
phno=int(input("Staffphoneno.:"))add=
str(input("Address:"))
[Link]("insert
intoStaff_details(name,gender,age,phonenumber,address)
values('"+fname+"','"+gender+"','"+age+"','"+str(phno)+"','"+add+"')")
print("""
+------------------------------+
|STAFFISSUCCESFULLYADDED|
+------------------------------+""")
[Link]()
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#REMOVESTAFF
elifch==2:
nm=str(input("Enter staff name to remove:"))
[Link]("selectnamefromstaff_detailswhere
name='"+nm+"'")
toy=[Link]()i
Page27of51
[Link]("deletefromstaff_detailswhere
name='"+nm+"'")
print("""
+--------------------------------+
|STAFFISSUCCESFULLYREMOVED|
+--------------------------------+""")
[Link]()
else:
print("""
+------------------------------+
| STAFFDOESNOTEXIST |
+------------------------------+""")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#EXISTINGSTAFFDETAILS
elifch==3:
[Link]("select*fromStaff_details")run=[Link]
all()
tab=[]
if runis notNone:
for i in range(len(run)):[Link]([run[i][0],run[i][1],run[i]
[2],run[i][3],run[i][4]])
print((tabulate(tab,
headers=["NAME","GENDER","AGE","PHONE
NUMBER","ADDRESS"],tablefmt="simple_grid",stralign="left")))
else:
print("""
+------------------------------+
| STAFFDOESNOTEXIST |
+------------------------------+""")
Page28of51
[Link]()
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#SELLHISTORY
elif
a==4:print(""
"
+-------+---------------------------+
| No.| Action |
+-------+---------------------------+
| 1.| SELLHISTORYDETAILS |
| 2.| RESETSELLHISTORY |
+-------+---------------------------+""")
t=int(input("Enteryourchoice:"))
if t==1:
tab1=[]
[Link]("select*fromsell_recorderbyitem_id")data=my
[Link]()
for i in range(len(data)):[Link]([data[i][1],data[i][2],data[i]
[3],data[i][4],data[i][5]])
print((tabulate(tab1,headers=["CUSTOMER
NAME","PHONE
NO","ITEM","QUANTITY","PRICE"],tablefmt="simple_grid")))
elift==2:
b=input("Areyousure(Y/N):") if
b in"Yy":
[Link]("truncatetablesell_rec")m
[Link]()
elifb=="N":pas
s
else:
print("EnterValidChoice")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
Page29of51
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
Page30of51
#AVAILABLEitems
elifa==5:
[Link]("select*fromAvailable_itemsorderby
item_id")
data=[Link]()table=
[]
ifdata==[]:print("""
+------------------------------+
| ItemsNotAvailable |
+------------------------------+""")
else:
for i in range(len(data)):[Link]([data[i][0],data[i][1],data[i]
[2],data[i][3],data[i][4],data[i][5]],)
print((tabulate(table,
headers=["ID","ITEM","CATEGORY","QUANTITY","BRAND","PRICE"],t
ablefmt="simple_grid",stralign="left")))
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#TOTALINCOMEAFTERLATESTUPDATE
elifa==6:
[Link]("selectsum(price*quantity)fromsell_rec")data=m
[Link]()
ifdata[0][0]is notNone:
print("TotalIncome:₹",float((data[0][0])))else:
print("""
+-----------------+
Page31of51
| NoIncome |
+-----------------+""")
elifa==7:
[Link]("select*fromavailable_items")s1=[Link]
all()
iflen(s1)==1:
[Link]("truncatetableavailable_items")[Link](
)
print("""
+--------------------------------+
|ItemISSUCCESFULLYREMOVED |
+--------------------------------+""")
else:
nm=str(input("EnterItemIdtoremove:"))nm="i
d_"+nm
[Link]("selectitemnamefromavailable_items
where item_id='"+nm+"'")
toy=[Link]()
print(str(toy[0]))
if toyis notNone:
[Link]("deletefromavailable_itemswhereitemname=
'"+str(toy[0])+"'")
print("""
+--------------------------------+
|ItemISSUCCESFULLYREMOVED |
+--------------------------------+""")
[Link]()else
:
print("""
+------------------------------+
| ItemDOESNOTEXIST |
Page32of51
+------------------------------+""")
elifa==8:
mn=str(input("EnterItemIdToUpdate"))mn="id_
"+mn
print("""
+-------+------------------+
| No.| Action |
+-------+------------------+
| 1.|UpdateItemname|
| 2.|UpdateCategory|
| 3.|UpdateQuantity|
| 4.| UpdateBrand |
| 5.| UpdatePrice |
+-------+------------------+""")
n=int(input("EnterChoice:")) if
n==1:
it=str(input("Enter new item name:"))
[Link]("updateAvailable_itemsset
itemname='"+it+"'whereitem_id='"+mn+"'")
[Link]()
print("Done")
elifn==2:
it=str(input("Enter new category name:"))
[Link]("Updateavailable_itemsset
category='"+it+"'whereitem_id='"+mn+"'")
print("ItemCAtegoryupdated")
elif n==3:
it=str(input("Enter new quantity name:"))
[Link]("Updateavailable_itemsset
quantity='"+it+"'whereitem_id='"+mn+"'")
print("Itemquantityupdated")
elif n==4:
it=str(input("Enternewbrandname:"))
Page33of51
[Link]("Updateavailable_itemsset
brand='"+it+"'where item_id='"+mn+"'")
print("Itemquantityupdated")
elif n==5:
it=str(input("Enter new quantity price:"))
[Link]("Updateavailable_itemsset
price='"+it+"'whereitem_id='"+mn+"'")
print("Itemquantityupdated")el
se:
print("error")
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#EXIT
elif a==9:
cho='y'br
eak
elif
a>9:print("""
+------------------------------+
| InvalidChoice |
+------------------------------+""")
cho='y'br
eak
#-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----x-----
x-----x-----x-----x-----x-----x-----x----x----x----x-----x-
#LOGINELSEPART
else:
print("""
+----------------------+
|INCORECTPASSWORRD|
+----------------------+""")
else:
print("""
+--------------------+
Page34of51
|INVALIDUSERNAME|
+--------------------+""")
else:
break
whilecho=="1":
f1=[ ]
p=[]
q=[]
s=[]
it=[ ]su
m1=0
ch=input("DoYouWishTOBuySomething(Y/N):")f=1
if ch in"Yy":
print("Availableitems:")
[Link]("select*fromAvailable_itemsorderbyitem_id")data=mycur
[Link]()
table=[]
for i inrange(len(data)):
[Link]([data[i][0],data[i][1],data[i][2],data[i][3],data[i][4],data[i][5]])
print((tabulate(table,
headers=["IDNO","ITEM","CATEGORY","QUANTITY","BRAND","PRICE
"],tablefmt="simple_grid")))cusname=str(input("E
nterYourName:"))
tab3=[["Hello"+cusname+"!"],["WelcomeToKmsquare Electronics"],
["Please Enter The Following Details"]]
print(tabulate(tab3,tablefmt="double_outline"))pho
neno=str(input("Enter Phone Number :")) while
True:
iflen(phoneno)!
=10:print("""
+---------------------------+
Page35of51
|InValidPhoneNumber |
+---------------------------+""")
phoneno=str(input("EnterPhoneNumber:"))els
e:
break
else:
break
while ch in"yY":
idno=str(input("Enteritemid:"))idno
="id_"+idno
[Link]("SelectitemnameFromAvailable_itemswhereitem_id='"+id
no+"'")
m=[Link]()n=int(input("En
terquantity:"))
[Link]("SelectQuantityFromAvailable_itemswhereitem_id='"+idn
o+"'")
k=[Link]()
[Link]("SelectpriceFromAvailable_itemswhereitem_id='"+idno+"
'")
j=[Link]()
[Link]("Selectitem_idFromAvailable_itemswhereitem_id='"+idno
+"'")
s1=[Link]()
if max(k)<n:
print(n,"itemsArenotavailable")brea
k
else:
[Link]("selectitemnamefromavailable_itemswhereitem_id='"+i
dno+"'")
log=[Link]()i
f log is not None:
[Link]("insert into
Sell_recvalues('"+s1[0]+"','"+cusname+"','"+ str(phoneno)+"','"+m[0]+"','"+str(n)
+"','"+str(j[0])+"')")
Page36of51
[Link]("updateAvailable_itemssetquantity=quantity-'"+str(n
)+"'where item_id='"+idno+"'")
[Link]()
[Link](f)
[Link](m[0])
[Link](int(j[0]))
[Link](n)
[Link](s1[0])
sum1=sum1+(n*(int(j[0
else:
print("itemISNOTAVAILABLE!!!!!!!")
f=f+1
ch=input("Doyouwishtocontinueshopping(Y/N):") if
ch in"nN":
v=49
now=[Link]()
date_time_str=[Link]("%Y-%m-%d%H:%M:
%S")print("+-------------------------------------------------------+")
print("|Kmsquare Electronics|")print("+---------------------+")
print("| CustomerName:",cusname,(v-19-(len(cusname)))*"
","|") print("+---------------------------------------------------------------+")
print("| PhoneNumber:",phoneno,(v-18-(len(phoneno)))*"
","|") print("+---------------------------------------------------------------+")
print("| Date Of Shopping",date_time_str,"
|")tab=[ ]
for i in range(0,f-
1,1):[Link]([f1[i],s[i],it[i],p[i],q[i]])
print((tabulate(tab,headers=["No.","IdNo"," ItemName ","
Price","Quantity"],tablefmt="pretty")))
print("| TotalAmount=₹",sum1,(v-20-(len(str(sum1))))*"
","|")
Page37of51
print("+---------------------------------------------------------------+\n\n")
tab4=[["Thanks"+cusname+"ForVisitingKmsquare Electronics"],["Please
Do Visit Again"]]
print(tabulate(tab4,tablefmt="double_outline"))
break
aaa=input('DoYouWantToStartAgain?(Y/N)') while
aaa not in"Yy":
print("-----X-----X-----X-----X-----X-----X-----X-----X-----X-----X-----X-----X-----
X-----X-----X-----X-----X-----X-----X-----X-----X")
break
Page38of51
OUTPUT
1. Introduction
2. Signup/Login
Page39of51
3. AddItems
4. SearchByName/Id/Brand/Category
Page40of51
Page34of43
5. StaffEntry
Page35of51
6. SellRecord
7. TotalIncome
Page36of51
8. AvailableItems
Bibliography
Page37of51
9. UpdateItems
Page38of51
gg
Page39of51
10. Customer
Page40of51
11. Customer
12. Exit
Page41of51
BackendGeneratedData
1. Available_items
Mmm
2. Staff_details
3. Sell_rec
Page42of51
4. Signup
Page43of51