0% found this document useful (0 votes)
126 views

Cs Project Mysql

The document describes a Python project for fashion store management. It includes requirements like hardware, software, and databases needed. Python is used for the front-end and MySQL is used as the back-end database. The project allows adding, editing, deleting and viewing products. It also allows purchasing products and updates the stock. Various functions are defined to manage products, purchases, and stock in the database.

Uploaded by

Rajat Upadhyay
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)
126 views

Cs Project Mysql

The document describes a Python project for fashion store management. It includes requirements like hardware, software, and databases needed. Python is used for the front-end and MySQL is used as the back-end database. The project allows adding, editing, deleting and viewing products. It also allows purchasing products and updates the stock. Various functions are defined to manage products, purchases, and stock in the database.

Uploaded by

Rajat Upadhyay
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/ 22

COMPUTER SCIENCE

PROJECT FILE
FASHION STORE
MANAGEMENT

PROJECT PREPARED BY:


RAJAT RAJESH UPADHYAY- XII
CERTIFICATE

Class: XII Year:2022-23

This is to certify that Mr. Rajat Rajesh Upadhyay, a


student of class 12th (science), Exam Seat No._________
of Mahatma Gandhi Mission Primary and Secondary
School (Eng. Med.), Sec-8, Phase-II, Nerul, Navi
Mumbai has successfully completed her Project File of
subject Computer Science, Topic: - Fashion Store
Management during the academic session 2022-23 as
per the guidelines issued by Central Board of Secondary
Education.

Principal's External Examiner Internal Examiner


Sign (Subject Teacher)
INDEX

1. Hardware Requirements
2. Software Requirements
3. Summary about Python
4. Summary about MySQL
5.Introduction to the
project
6. Creating SQL Tables
7. Coding
8.0utput
HARDWARE REQUIREMENTS

1. Printer, to print the required documents of


the project.
2. Installed RAM: 8 GB
3. Processor: AMD Ryzen 5 5000U with
Radeon Graphics
SOFTWARE REQUIREMENTS

1. Operating System: Windows 11

2. Python 3.9.7 as Front-end Development Environment.

3.MySQL 8.0 as Back-end server for storing Data.


SUMMARY ABOUT PYTHON

Python is a high-level, interpreted, interactive and object-oriented


scripting language. Python is designed to be highly readable.
It supports functional and structured programming methods as well
as OOP. It can be used as a scripting language or can be compiled
to byte-code for building large applications. It provides very high-
level dynamic data types and supports dynamic type checking. It
supports automatic garbage collection. It can be easily integrated
with C, C++, COM, ActiveX, CORBA, and Java.
Python is the perfect language to learn if you want to pursue a
programming career. It is compatible with a wide range of
computing packages and offers developers a user-friendly
environment to work in.
Modules and packages are supported by Python, which facilitates
software customization and reusability.
Python utilizes integrated data structures, along with dynamic typing
and dynamic linking, which are ideal for rapid application
development.
SUMMARY ABOUT MYSOL

MySQL is a fast, easy-to-use RDBMS being used for many small


and big businesses. MySQL is developed, marketed and supported
by MySQL AB, which is a Swedish company. MySQL is becoming
so popular because of many good reasons -
MySQL is released under an open-source license. So you have
nothing to pay to use it.
MySQL is a very powerful program in its own right. It handles a
large subset of the functionality of the most expensive and powerful
database packages.
MySQL uses a standard form of the well-known SQL data
language.
MySQL works on many operating systems and with many
Vlanguages including PHP, PERL, C, C++, JAVA, etc.
MySQL works very quickly and works well even with large data
sets.
MySQL is very friendly to PHP, the most appreciated language
for web development.
MySQL supports large databases, up to 50 million rows or more
in a table. The default file size limit for a table is 4GB, but you
can increase this (if your operating system can handle it) to a
theoretical limit of 8 million terabytes (TB).
MySQL is customizable. The open-source GPL license allows
programmers to modify the MySQL software to fit their own
specific environments.
INTRODUCTION TO THE
PROJECT

The main objective of the python project on fashion store


management is to manage the details of sales, discounts,
payments, products, and inventory
digitally. The project is totally built at administrative end
and only administrator is guaranteed the access.
The purpose of the project is to build an application
program to reduce the manual work for managing the
sales, discounts, stock, and payments.
It tracks all the details about stocks, products, and
inventory; it also prints various reports as per input given
by the user.
Source code screening…

DBMS: MySQL
Host: local host
User: root
Pass: root
Database: fashion
Table Structure: (Images Bellow)

1. Product table

2. Purchase table

Note: In Purchase table take the purchase ID as varchar (16)

3. Stock table
4. Purchase table

Note: In Purchase table take the sale_id as varchar (16)

Python code:
import os
import platform
import mysql.connector
import pandas as pd
import datetime

mydb=mysql.connector.connect(host="localhost",\
user="root",\
passwd="root",\
database="fashion")
mycursor=mydb.cursor()

def AddProduct():
L=[]
stk=[]
pid=input("Enter the Product ID : ")
L.append(pid)
IName=input("Enter the Product Name : ")

L.append(IName)
brnd=input("Enter the Product Brand Name : ")
L.append(brnd)
fr=input("Enter Male/Female/Kids : ")
L.append(fr)
sn=input("Enter Winter/Summer : ")
L.append(sn)
rate=int(input("Enter the Rates for Product :"))
L.append(rate)
product=(L)
sql="Insert into product (product_id,PName,brand,Product_for,Season,rate)values(%s,%s,
%s,%s,%s,%s)"
mycursor.execute(sql,product)
mydb.commit()
stk.append(pid)
stk.append(0)
stk.append("No")
st=(stk)
sql="insert into stock(item_id, Instock, status) values(%s,%s,%s)"
mycursor.execute(sql,st)
mydb.commit()
print("One Product inserted ")

def EditProduct():
pid=input("Enter product ID to be edited : ")
sql="select * from product where product_id=%s"
ed=(pid,)
mycursor.execute(sql,ed)
res=mycursor.fetchall()
for x in res:
print(x)
print("")
fld=input("Enter the field which you want to edit : ")
val=input("Enter the value you want to set : ")
sql="Update product set " + fld +"='" + val + "' where product_id='" + pid + "'"
sq=sql
mycursor.execute(sql)
print("Editing Don : ")
print("After correction the record is : ")
sql="select * from product where product_id=%s"
ed=(pid,)
mycursor.execute(sql,ed)
res=mycursor.fetchall()
for x in res:
print(x)
mydb.commit()

def DelProduct():
pid=input("Enter the Product)id to be deleted : ")
sql="delete from sales where item_id=%s"
id=(pid,)
mycursor.execute(sql,id)
mydb.commit()
sql="delete from purchase where item_id=%s"
mycursor.execute(sql,id)
mydb.commit()
sql="delete from stock where item_id=%s"
mycursor.execute(sql,id)
mydb.commit()
sql="delete from product where product_id=%s"
mycursor.execute(sql,id)
mydb.commit()
print("One Item Deleted")

def ViewProduct():
print("Display Menu: Select the category to display the data")
print("1. All Details")
print("2. Product Name:")
print("3. Product Brand:")
print("4. Product For:")
print("5. Product Season:")
print("6. Product ID:")
x=0
ch=int(input("Enter your choice to display : "))
if ch==1:
sql="select * from product"
mycursor.execute(sql)
res=mycursor.fetchall()
for x in res:
print(x)
x=1
elif ch==2:
var='PName'
val=input("Enter the name of Product : ")
elif ch==3:
var='brand'
val=input("Enter the name of Brand : ")
elif ch==4:
var='Product_for'
val=input("Enter Male/Femal/Kids : ")
elif ch==5:
var='season'

val=input("Enter the Season : ")


elif ch==6:
var='product_id'
val=input("Enter the Product_id : ")
if x==0:
sql="select * from product where " + var + " = %s"
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)
itemId=input("Enter Product ID : ")
L.append(itemId)
itemNo=int(input("Enter the number of Items : "))
L.append(itemNo)
sql="select rate from product where product_id=%s"
pid=(itemId,)
mycursor.execute(sql,pid)
res=mycursor.fetchone()
for x in res:
print("rate is : ", x)
amount=x*itemNo
print("Amount is :", amount)
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()
sql="Select Instock from stock where item_id=%s"
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)
sql="update stock set instock=%s,status=%s where item_id=%s"
mycursor.execute(sql,tp)
mydb.commit()
print("1 Item purchased and saved in Database")

def ViewPurchase():
item=input("Enter Product Name : ")
sql="select product.product_id,
product.PName,product.brand,purchase.no_of_items,purchase.purchase_date,purchase.am
ount 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():
item=input("Enter Product Name : ")
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)
itemId=input("Enter Product ID : ")
L.append(itemId)
itemNo=int(input("Enter the number of Items : "))
L.append(itemNo)
sql="select rate from product where product_id=%s"
pid=(itemId,)
mycursor.execute(sql,pid)
res=mycursor.fetchall()
for x in res:
print("The rate of item is :",x)
dis=int(input("Enter the discount : "))
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)
sql="insert into sales (sale_id, item_id,no_of_item_sold,\
sale_rate,amount,date_of_sale) values(%s,%s,%s,%s,%s,%s)"
mycursor.execute(sql,tp)
mydb.commit()
sql="Select Instock from stock where item_id=%s"
mycursor.execute(sql,pid)
res=mycursor.fetchall()
for x in res:
print("Total Items in Stock are : ",x)
instock=x[0]-itemNo
if instock>0:
status="Yes"
tp=(instock,status,itemId)
sql="update stock set instock=%s,status=%s where item_id=%s"
print("Remaining Items in Stock are : ",instock)
mycursor.execute(sql,tp)
mydb.commit()
def ViewSales():
item=input("Enter Product Name : ")
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


print("Enter 1 : To Add Product ")
print("Enter 2 : To Edit Product ")
print("Enter 3 : To Delete Product ")
print("Enter 4 : To View Product ")
print("Enter 5 : To Purchase Product")
print("Enter 6 : To View Purchases")
print("Enter 7 : To View Stock Detials")
print("Enter 8 : To Sale the item")
print("Enter 9 : To View Sales Detials")
try: #Using Exceptions For Validation
userInput = int(input("Please Select An Above Option: ")) #Will Take Input From User
except ValueError:
exit("\nHy! That's Not A Number") #Error Message
else:
print("\n") #Print New Line
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. . . ")

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()
runAgn = input("\nwant To Run Again Y/n: ")
runAgain()

Output of code :
Main menu:
Add product:

Edit product:

Delete product:
View product:

Purchase product:
View purchase:

View stock details:

Sale item:
View sales details:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy