FASHION
FASHION
FASHION
Purchase Table:
Stock Table:
Sales Table:
Python Code:-
import os import platform
import mysql.connector
import pandas as pd
import datetime
mycursor=mydb.cursor()
def AddProduct():
L=[]
stk=[]
L.append(pid)
L.append(IName)
L.append(brnd)
L.append(fr)
L.append(rate)
product=(L)
mydb.commit()
stk.append(pid)
stk.append(0)
stk.append("No")
st=(stk)
mycursor.execute(sql,st)
mydb.commit()
def EditProduct():
mycursor.execute(sql,ed)
res=mycursor.fetchall()
for x in res:
print(x)
print("")
sql="Update product set " + fld +"=" + val + "' where product_id='" + pid + "'" sq=sql
mycursor.execute(sql)
ed=(pid,)
mycursor.execute(sql,ed)
res=mycursor.fetchall()
for x in res:
print(x)
def DelProduct():
id=(pid,)
mycursor.execute(sql,id)
mydb.commit()
mycursor.execute(sql,id)
mydb.commit()
mycursor.execute(sql,id)
mydb.commit()
mycursor.execute(sql,id)
mydb.commit()
def ViewProduct():
x=0
if ch==1:
mycursor.execute(sql)
res=mycursor.fetchall()
for x in res:
print(x)
x=1
elif ch==2:
var='PName'
elif ch==3:
var='brand'
elif ch==4:
var='Product_for'
elif ch==5:
var='season'
elif ch==6:
var='product_id'
if x==0:
sq=sql
tp=(val,)
mycursor.execute(sq,tp)
res=mycursor.fetchall()
for x in res:
print(x)
def PurchaseProduct():
mn=""
dy=""
now=datetime.datetime.now()
purchaseID="P"+str(now.year)+str(now.month)+str(now.day)+str(now.hour)+str(now.minute)+str(now.second) L=[]
Lst=[]
L.append(purchaseID)
L.append(itemId)
L.append(itemNo)
mycursor.execute(sql,pid)
res=mycursor.fetchone()
for x in res:
print("rate is : ", x)
amount=x*itemNo
L.append(amount)
mnth=now.month
if mnth<=9:
mn="0"+str(mnth)
else:
mn=str(mnth)
day=now.day
if day<=9:
dy="0"+str(day)
else:
dy=str(day)
dt=str(now.year)+"-"+mn+"-"+dy
L.append(dt)
tp=(L)
sql="insert into
purchase(purchase_id,item_id,no_of_items,amount,Purchase_date)values(%s,%s,%s,%s,%s)"
mycursor.execute(sql,tp)
mydb.commit()
mycursor.execute(sql,pid)
res=mycursor.fetchall()
status="No"
for x in res:
print(x)
instock=x[0]+itemNo
if instock>0:
status="Yes"
Lst.append(instock)
Lst.append(status)
Lst.append(itemId)
tp=(Lst)
mycursor.execute(sql,tp)
mydb.commit()
def ViewPurchase():
sql="select
product.product_id,product.PName,product.brand,purchase.no_of_items,purchase.purchase_date,purchase.amount from
product INNER JOIN purchase ON product.product_id=purchase.item_id and product.PName=%s"
itm=(item,)
mycursor.execute(sql,itm)
res=mycursor.fetchall()
for x in res:
print(x)
def ViewStock():
sql="select product.product_id,product.PName,stock.Instock,\
stock.status from stock, product where \ product.product_id=stock.item_id and product.PName=%s"
itm=(item,)
mycursor.execute(sql,itm)
res=mycursor.fetchall()
for x in res:
print(x)
def SaleProduct():
now=datetime.datetime.now()
saleID="S"+str(now.year)+str(now.month)+str(now.day)+str(now.hour)+str(now.minute)+str(now.second)
L=[]
L.append(saleID)
L.append(itemId)
L.append(itemNo)
mycursor.execute(sql,pid)
res=mycursor.fetchall()
for x in res:
saleRate=x[0]-(x[0]*dis/100)
L.append(saleRate)
amount=itemNo*saleRate
L.append(amount)
mnth=now.month
if mnth<=9:
mn="0"+str(mnth) else:
mn=str(mnth) day=now.day
if day<=9:
dy="0"+str(day)
else:
dy=str(day)
dt=str(now.year)+"-"+mn+"-"+dy
L.append(dt)
tp=(L)
mycursor.execute(sql,tp)
mydb.commit()
mycursor.execute(sql,pid)
res=mycursor.fetchall()
for x in res:
instock=x[0]-itemNo
if instock>0:
status="Yes"
tp=(instock,status,itemId)
mycursor.execute(sql,tp)
mydb.commit()
def ViewSales():
sql="select product.product_id,
product.PName,product.brand,\ sales.no_of_item_sold,sales.date_of_sale,sales.amount \from sales, product where
product.product_id=sales.item_id \ and product.PName=%s"
itm=(item,)
mycursor.execute(sql,itm)
res=mycursor.fetchall()
for x in res:
print(x)
def MenuSet():
#Function For The SFashion Store System
#Error Message
else:print("\n")
if(userInput == 1):
AddProduct()
elif(userInput == 2):
EditProduct()
elif (userInput==3):
DelProduct()
elif (userInput==4):
ViewProduct()
elif (userInput==5):
PurchaseProduct()
elif (userInput==6):
ViewPurchase()
elif (userInput==7):
ViewStock()
elif (userInput==8):
SaleProduct()
elif
(userInput==9):
ViewSales()
else:
print("Enter
correct choice. . . ")
print("*"*80)
print("* * * *
* * * Welcome to the Project of Fashion Store * * * * * * * ")
print("* * * *
Developed by: Neha Tyagi, PGT CS, KV no. 5 Jaipur : * * * * ")
print("*"*80)
print("")
MenuSet()
def
runAgain():
runAgn =
input("\nwant To Run Again Y/n: ")
while(runAgn.lower() == 'y'):
if(platform.system() == "Windows"):
print(os.system('cls'))
else:
print(os.system('clear'))
MenuSet()
runAgain()
OUTPUT:-
(Main Menu)
(Add Product)
(Edit Product)
(Delete Product)
(View Product)
(Purchase Product)
(View Purchase)
(View Stock Details)
(Sale Item)