Utkarsh Store by Utkarsh Mishra - Utkarsh Mishra
Utkarsh Store by Utkarsh Mishra - Utkarsh Mishra
PROJECT
CERTIFICATE
This is to certify that the project
entitled ‘Utkarsh Store’ is prepared
under my guidance and supervision
by :
PROGRAM
#----------FUNCTIONS----USED----IN----THIS----
BINARY__FILE----PROGRAM---------------
f=open("attendance.csv","w")
f.close()
def addition():
f=open("store.dat","ab")
n=input("enter product name:")
p=eval(input("enter price:"))
r=int(input("enter product number:"))
pickle.dump([r,n,p],f)
f.close()
def disp():
f=open("store.dat","rb")
while True:
try:
print(pickle.load(f))
except:
break
f.close()
def sear():
f=open("store.dat","rb")
def delete():
f=open("store.dat","rb")
f1=open("temp.dat","wb")
n=int(input("enter product name for deletion"))
while True:
try:
t=pickle.load(f)
if t[1]!=n:
pickle.dump(t,f1)
except:
break
f.close()
f1.close()
os.remove("store.dat")
os.rename("temp.dat","store.dat")
def calculation():
f=open("store.dat","rb")
disp()
n=input("enter product name for purchase")
while True:
try:
t=pickle.load(f)
if t[1]==n:
q=t[2]
except:
break
r=q
z=int(input("enter the quantity"))
total=r*z
print("Your total raises to:",total,"Rs")
print("dont forget to take the bill :) ")
f.close()
#------FUNCTIONS-----USED------IN-----THIS-----CSV__FILE----
PROGRAM-------
import csv
def add():
f=open("attendance.csv","a")
r=csv.writer(f,lineterminator='\n')
i=int(input("how many records do u want to enter:"))
for n in range(i):
d=input("enter the date in format(dd-mm-yyyy):")
na=input("enter the name:")
a=input("please enter whether the employee wass present or
absent(P/A):")
p=[d,na,a]
r.writerow(p)
f.close()
def dele():
f=open("attendance.csv",'r')
q=csv.reader(f)
t=[]
all=[]
c=0
for i in q:
if c==0:
t.append(list(i))
else:
all.append(list(i))
c=c+1
z=[]
s=input("enter employee name which u want to delete")
for i in all:
if i[1]!=s:
z.append(list(i))
f.close()
f=open("attendance.csv",'w')
t=csv.writer(f)
t.writerow(['DATE','NAME','ATTENDANCE'])
for i in z:
t.writerow(i)
def up():
f=open("attendance.csv",'r')
q=csv.reader(f)
t=[]
e=[]
c=0
for i in q:
if c==0:
t.append(list(i))
else:
e.append(list(i))
c=c+1
print(e)
z=[]
s=input("enter employee name which u want to update")
for i in e:
if i[1]==s:
i[0]=input("enter date")
i[2]=input("whether absent or present(P/A)")
z.append(list(i))
else:
z.append(list(i))
f.close()
f=open("attendance.csv",'w',newline="")
t=csv.writer(f)
t.writerow(['DATE','NAME','ATTENDANCE'])
for i in z:
t.writerow(i)
def display():
f1=open("attendance.csv","r")
r=csv.reader(f1)
next(r)
for i in r:
print(i)
f1.close()
def search():
f=open("attendance.csv","r")
g=csv.reader(f)
q=input("on which basis do you want to search the
attendance(name/date):")
next(g)
if q=='name':
n=input("enter the name:")
for i in g:
if i[1]==n:
print(i)
elif q=='date':
d=input("enter the date in (dd-mm-yyyy) format:")
for i in g:
if i[0]==d:
print(i)
else:
print("enter valid choice *_*")
#-----------------------------------------------------------------------------
import pickle
n=input("please tell us whether you are the owner or customer:")
#--------------------------------------------------------CUSTOMER------
if n=="customer":
d=0
while True:
print("_"*30)
print("----- welcome to my store -----")
print("_"*30)
print("|1.| search any product ")
print("_"*30)
print("|2.| display all products ")
print("_"*30)
print("|3.| purchase any product ")
print("_"*30)
print("|4.| get your bill and exit ")
print("_"*30)
#e=input("pls tell whether u are using this program first
time(y/n):")
#if e=='y':
#for i in range(1):
f=open("store.dat","wb")
pickle.dump([1,"pen",10],f)
pickle.dump([2,"pencil",5],f)
pickle.dump([3,"notebook",50],f)
pickle.dump([4,"eraser",5],f)
pickle.dump([5,"sharpener",5],f)
pickle.dump([6,"glue",15],f)
pickle.dump([7,"scale",5],f)
pickle.dump([8,"ball pen refill",3],f)
pickle.dump([9,"gel pen refill",5],f)
f.close()
ch=int(input("enter ur choice"))
if ch==1:
sear()
elif ch==2:
disp()
elif ch==3:
calculation()
elif ch==4:
d=1
break
#-----------------------------------------------------------OWNER-----------
elif n=="owner":
p=int(input("enter the password:"))
if p==384168:
print("Welcome to the store Sir/Ma'am:")
o=input("Sir/Ma'am please tell me with what i may help
you( store or attendance of employees):")
if o=="store":
n=0
while True:
print("|1.| add new product ")
print("|2.| update records ")
print("|3.| delete records ")
print("|4.| display products ")
print("|5.| exit from the program")
ch=int(input("enter the option sir/ma'am:"))
if ch==1:
addition()
elif ch==2:
updation()
elif ch==3:
delete()
elif ch==4:
display()
elif ch==5:
n=1
break
else:
print("sorry sir/ma'am *_*")
print("we could not find it")
print("sir/ma'am please enter valid option:")
elif o=="attendance":
n=0
while True:
print("|1.| add records ")
print("|2.| update records ")
print("|3.| search records ")
print("|4.| display records")
print("|5.| delete records")
print("|6.| exit from the program")
elif ch==6:
n=1
break
else:
print("please enter valid choice")
else:
print("incorrect password *_*")
OUTPUT
1. CUSTOMER MODE
a) search any product:-
b) display products:-
c) purchase products:-
2. OWNER MODE:--
a. STORE MODE:-
A) add new product:-
B) update products:-
C) delete products:-
D) Display products:-
b. Attendance mode:-
A) add records:-
B) update records:-
C) Search records:-
D)Display records:-
E) Delete records:-
END OF THE
PROJECT…………
………………..
THANK YOU!!