[go: up one dir, main page]

0% found this document useful (0 votes)
18 views37 pages

CS Documentation

Uploaded by

mm718982
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)
18 views37 pages

CS Documentation

Uploaded by

mm718982
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/ 37

SNS ACADEMY

COMPUTER SCIENCE (083)


PROJECT
2022-2023
TOPIC:
STOCK MANAGEMENT SYSTEM
GUIDED BY:- Mrs.Deepika.C

SUBMITTED BY: ANUPAMA.M


ARUN KARTHIKEYAN
HARSHIT.V

CLASS AND SECTION: XII-A


ROLL NUMBER: 12B-02
12A-05
12A-06
TABLE OF CONTENTS

CERTIFICATE
ACKNOWLEDGEMENT.
INTRODUCTION TO PYTHON.
INTRODUCTION TO THE PROJECT.
SYSTEM REQUIREMENTS.
BACKEND DETAILS.
FRONTEND DETAILS.
MOTIVE.
SCREEN SHOTS OF EXECUTION.
LIMITATIONS.
BIBLIOGRAPHY.
INTRODUCTION TO PYTHON

Python is an interpreted, object-oriented, high-


level programming language with dynamic
semantics. Its high-level built in data structures,
combined with dynamic typing and dynamic
binding, make it very attractive for Rapid
Application Development, as well as for use as a
scripting or glue language to connect existing
components together. Python's simple, easy to
learn syntax emphasizes readability and therefore
reduces the cost of program maintenance. Python
supports modules and packages, which
encourages program modularity and code reuse.
The Python interpreter and the extensive standard
library are available in source or binary form
without charge for all major platforms, and can be
freely distributed.
History of Python

Python is a widely used general-purpose, high-


level programming language. It was initially
designed by Guido van Rossum in 1991 and
developed by Python Software Foundation. It was
mainly developed for emphasis on code
readability, and its syntax allows programmers to
express concepts in fewer lines of code.
INTRODUCTION TO THE PROJECT
Stock management System is the practice of
ordering, storing, tracking and controlling inventory.
Stock management applies to every item a business
uses to produce its products or services from raw
materials to finished goods. In other words, stock
management covers every aspect of a business’s
inventory.
This project contains the modules:
1.Product management
2.Purchase management
3.Sales management
4.User management
ACKNOWLEDGEMENT

I thank my Computer Science teacher


Mrs.Deepika.C for guidance and support. I am
also thankful to our principal Mr.Boby Mathew
I would also thank to my parent for encouraging
during the course of this project. Finally, I would
like to thank CBSE for giving me this opportunity
to undertake this project.
SYSTEM REQUIREMENTS

Language/s Used: Python (GUI)


PHP version(recommended) 3.8/3.9
Database: MySQL

BACKEND DETAILS
Database Name: STOCK1
Code:
Create Database STOCK;
Use STOCK;
Table Name: PRODUCT
Attributes:
pcode int(4)
pname varchar(30)
pprice float(8,2)
pqty int(4)
pcat varchar(30)
Code:
CREATE TABLE PRODUCT (pcode int(4)
PRIMARY KEY, pname varchar(30) NOT
NULL,pprice float(8,2),pqty int(4),varchar(30));

Table Name: ORDER


Attributes:
Ordered int(4)
Orderdate DATE
pcode varchar(30)
pprice float(8,2)
pqty int(4)
supplier varchar(50)
pcat varchar(30)
Code:
CREATE TABLE ORDER (orderid int(4)PRIMARY
KEY ,orderdate DATE ,pcode varchar(30) NOT
NULL ,pprice float(8,2) ,pqty int(4),supplier
varchar(50),pcat varchar(30));
Table Name: SALES
Attributes:
Salesid int(4)
Salesdate DATE
Pcode varchar(30)
Pprice float(8,2)
Pqty int(4)
Total double(8,2)
Code:
CREATE TABLE SALES (salesid int(4) PRIMARY
KEY ,salesdate DATE ,pcode varchar(30)
reference product(pcode),pprice float(8,2) ,pqty
int(4) ,Total double(8,2));

Table Name: USER


Attributes:
Uid varchar(6)
Uname varchar(30)
Upwd varchar(30)
CODE:
CREATE TABLE USER (uid varchar(6) PRIMARY
KEY,uname varchar(30) NOT NULL,upwd
varchar(30));
FRONTEND DETAILS
PROGRAM CODE
import os
import mysql.connector
import datetime
now = datetime.datetime.now()
def product_mgmt( ):
while True :
print("\t\t\t 1. Add New Product")
print("\t\t\t 2. List Product")
print("\t\t\t 3. Update Product")
print("\t\t\t 4. Delete Product")
print("\t\t\t 5. Back (Main Menu)")
p=int (input("\t\tEnter Your Choice :"))
if p==1:
add_product()
if p==2:
search_product()
if p==3:
update_product()
if p==4:
delete_product()
if p== 5 :
break
def purchase_mgmt( ):
while True :
print("\t\t\t 1. Add Order")
print("\t\t\t 2. List Order")
print("\t\t\t 3. Back (Main Menu)")
o=int (input("\t\tEnter Your Choice :"))
if o==1 :
add_order()
if o==2 :
list_order()
if o== 3 :
break
def sales_mgmt( ):
while True :
print("\t\t\t 1. Sale Items")
print("\t\t\t 2. List Sales")
print("\t\t\t 3. Back (Main Menu)")
s=int(input("\t\tEnter Your Choice"))
if s== 1 :
sale_product()
if s== 2 :
list_sale()
if s== 3 :
break
def user_mgmt( ):
while True :
print("\t\t\t 1. Add user")
print("\t\t\t 2. List user")
print("\t\t\t 3. Back (Main Menu)")
u=int (input("\t\tEnter Your Choice :"))
if u==1:
add_user()
if u==2:
list_user()
if u==3:
break
def create_database():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
print(" Creating PRODUCT table")
sql = "CREATE TABLE if not exists product
(\
pcode int(4) PRIMARY KEY,\
pname varchar(30) NOT NULL,\
pprice float(8,2) ,\
pqty int(4) ,\
pcat varchar(30));"
mycursor.execute(sql)
print(" Creating ORDER table")
sql = "CREATE TABLE if not exists orders (\
orderid int(4)PRIMARY KEY ,\
orderdate DATE ,\
pcode varchar(30) NOT NULL , \
pprice float(8,2) ,\
pqty int(4) ,\
supplier varchar(50),\
pcat varchar(30));"
mycursor.execute(sql)
print(" ORDER table created")

print(" Creating SALES table")


sql = "CREATE TABLE if not exists sales (\
salesid int(4) PRIMARY KEY ,\
salesdate DATE ,\
pcode varchar(30) references
product(pcode), \
pprice float(8,2) ,\
pqty int(4) ,\
Total double(8,2)\ );"
mycursor.execute(sql)
print(" SALES table created")
sql = "CREATE TABLE if not exists user (\
uid varchar(6) PRIMARY KEY,\
uname varchar(30) NOT NULL,\
upwd varchar(30));"
mycursor.execute(sql)
print(" USER table created")
def list_database():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="show tables;"
mycursor.execute(sql)
for i in mycursor:
print(i)
def add_order():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
now = datetime.datetime.now()
sql="INSERT INTO
orders(orderid,orderdate,pcode,pprice,pqty,supplie
r,pcat) values (%s,%s,%s,%s,%s,%s,%s)"
code=int(input("Enter product code :"))
oid=now.year+now.month+now.day+now.hour+no
w.minute+now.second
qty=int(input("Enter product quantity : "))
price=float(input("Enter Product unit price:
"))
cat=input("Enter product category: ")
supplier=input("Enter Supplier details: ")
val=(oid,now,code,price,qty,supplier,cat)
mycursor.execute(sql,val)
mydb.commit()
def list_order():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="SELECT * from orders"
mycursor.execute(sql)
clrscr()
print("\t\t\t\t\t\t\t ORDER DETAILS")
print("-"*85)
print("orderid Date Product code
price quantity Supplier Category")
print("-"*85)
for i in mycursor:
print(i[0],"\t",i[1],"\t",i[2],"\t ",i[3],"\
t",i[4],"\t ",i[5],"\t",i[6])
print("-"*85)
def db_mgmt( ):
while True :
print("\t\t\t 1. Database creation")
print("\t\t\t 2. List Database")
print("\t\t\t 3. Back (Main Menu)")
p=int (input("\t\tEnter Your Choice :"))
if p==1 :
create_database()
if p==2 :
list_database()
if p== 3 :
break
def add_product():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="INSERT INTO
product(pcode,pname,pprice,pqty,pcat) values
(%s,%s,%s,%s,%s)"
code=int(input("\t\tEnter product code :"))
search="SELECT count(*) FROM product
WHERE pcode=%s;"
val=(code,)
mycursor.execute(search,val)
for x in mycursor:
cnt=x[0]
if cnt==0:
name=input("\t\tEnter product
name :")
qty=int(input("\t\tEnter product
quantity :"))
price=float(input("\t\tEnter product
unit price :"))
cat=input("\t\tEnter Product
category :")
val=(code,name,price,qty,cat)
mycursor.execute(sql,val)
mydb.commit()
else:
print("\t\t Product already exist")
def update_product():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
code=int(input("Enter the product code :"))
qty=int(input("Enter the quantity :"))
sql="UPDATE product SET pqty=pqty+%s
WHERE pcode=%s;"
val=(qty,code)
mycursor.execute(sql,val)
mydb.commit()
print("\t\t Product details updated")
def delete_product():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
code=int(input("Enter the product code :"))
sql="DELETE FROM product WHERE
pcode = %s;"
val=(code,)
mycursor.execute(sql,val)
mydb.commit()
print(mycursor.rowcount," record(s)
deleted");
def search_product():
while True :
print("\t\t\t 1. List all product")
print("\t\t\t 2. List product code wise")
print("\t\t\t 3. List product category
wise")
print("\t\t\t 4. Back (Main Menu)")
s=int(input("\t\tEnter Your Choice :"))
if s==1 :
list_product()
if s==2 :
code=int(input(" Enter
product code :"))
list_prcode(code)
if s==3 :
cat=input("Enter category :")
list_prcat(cat)
if s== 4 :
break

def list_product():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="SELECT * from product"
mycursor.execute(sql)
clrscr()
print("\t\t\t\t PRODUCT DETAILS")
print("\t\t","-"*47)
print("\t\t code name price
quantity category")
for i in mycursor:
print("\t\t",i[0],"\t",i[1],"\t",i[2],"\t
",i[3],"\t\t",i[4])
print("\t\t","-"*47)
def list_prcode(code):
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="SELECT * from product WHERE
pcode=%s"
val=(code,)
mycursor.execute(sql,val)
clrscr()
print("\t\t\t\t PRODUCT DETAILS")
print("\t\t","-"*47)
print("\t\t code name price
quantity category")
print("\t\t","-"*47)
for i in mycursor:
print("\t\t",i[0],"\t",i[1],"\t",i[2],"\t
",i[3],"\t\t",i[4])
print("\t\t","-"*47)
def sale_product():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
pcode=input("Enter product code: ")
sql="SELECT count(*) from product
WHERE pcode=%s;"
val=(pcode,)
mycursor.execute(sql,val)
for x in mycursor:
cnt=x[0]
if cnt !=0 :
sql="SELECT * from product
WHERE pcode=%s;"
val=(pcode,)
mycursor.execute(sql,val)
for x in mycursor:
print(x)
price=int(x[2])
pqty=int(x[3])
qty=int(input("Enter no of quantity :"))
if qty <= pqty:
total=qty*price;
print ("Collect Rs. ", total)
sql="INSERT into sales
values(%s,%s,%s,%s,%s,%s)"
val=(int(cnt)
+1,datetime.datetime.now(),pcode,price,qty,total)
mycursor.execute(sql,val)
sql="UPDATE product SET
pqty=pqty-%s WHERE pcode=%s"
val=(qty,pcode)
mycursor.execute(sql,val)
mydb.commit()
else:
print(" Quantity not Available")
else:
print(" Product is not avalaible")
def list_sale():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="SELECT * FROM sales"
mycursor.execute(sql)
print(" \t\t\t\tSALES DETAILS")
print("-"*80)
print("Sales id Date Product Code
Price Quantity Total")
print("-"*80)
for x in mycursor:
print(x[0],"\t",x[1],"\t",x[2],"\t ",x[3],"\t\
t",x[4],"\t\t",x[5])
print("-"*80)
def list_prcat(cat):
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
print (cat)
sql="SELECT * from product WHERE pcat
=%s"
val=(cat,)
mycursor.execute(sql,val)
clrscr()
print("\t\t\t\t PRODUCT DETAILS")
print("\t\t","-"*47)
print("\t\t code name price quantity
categoty")
print("\t\t","-"*47)
for i in mycursor:
print("\t\t",i[0],"\t",i[1],"\t",i[2],"\t
",i[3],"\t\t",i[4])
print("\t\t","-"*47)
def add_user():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
uid=input("Enter id :")
name=input(" Enter Name :")
paswd=input("Enter Password :")
sql="INSERT INTO user values (%s,%s,
%s);"
val=(uid,name,paswd)
mycursor.execute(sql,val)
mydb.commit()
print(mycursor.rowcount, " user created")
def list_user():
mydb=mysql.connector.connect(host="localhost",u
ser="root",passwd="bsangeetha4@",database="st
ock1")
mycursor=mydb.cursor()
sql="SELECT uid,uname from user"
mycursor.execute(sql)
clrscr()
print("\t\t\t\t USER DETAILS")
print("\t\t","-"*27)
print("\t\t UID name ")
print("\t\t","-"*27)
for i in mycursor:
print("\t\t",i[0],"\t",i[1])
print("\t\t","-"*27)
def clrscr():
print("\n"*5)
while True:
clrscr()
print("\t\t\t STOCK MANAGEMENT")
print("\t\t\t ****************\n")
print("\t\t 1. PRODUCT MANAGEMENT")
print("\t\t 2. PURCHASE MANAGEMENT")
print("\t\t 3. SALES MANAGEMENT")
print("\t\t 4. USER MANAGEMENT")
print("\t\t 5. DATABASE SETUP")
print("\t\t 6. EXIT\n")
n=int(input("Enter your choice :"))
if n== 1:
product_mgmt()
if n== 2:
os.system('cls')
purchase_mgmt()
if n== 3:
sales_mgmt()
if n== 4:
user_mgmt()
if n==5 :
db_mgmt()
if n== 6:
break
MOTIVE
 To maintain stock record about their products
managed, ordered, sold and user management.

 Globalized usage.
SCREEN SHOTS OF EXECUTION
MAIN MENU

PRODUCT :
ADDING A PRODUCT:
LISTING THE PRODUCT:

DELETING A PRODUCT:
UPDATING A PRODUCT:
PURCHASE:
Adding an order:

Listing the order:

SALES:
Listing sales

User
Adding a user

BIBLIOGRAPHY
BOOKS:

COMPUTER SCIENCE WITH PYTHON-BY


SUMITA ARORA
COMPUTER SCIENCE WITH PYTHON-BY
PREETI ARORA

WEBSITES:
www.geeksforgeeks.org
https://docs.python.org/3/
https://www.w3schools.com/python/

LIMITATIONS

 The data stored is prone to cyber


hacks.
 Risk of computer virus
CERTIFICATE

This is to certify that


ANUPAMA.M,ARUN KARTHIKEYAN,
HARSHIT.V of class XII, SNS ACADEMY,
COIMBATORE has successfully completed
his/her project in Computer Science
Practical for the AISSCE as prescribed by
CBSE in the year 2022-2023.

Roll No: 12B-O2


12A-05
12A-06
Sign. of Internal Sign. of External

Sign. Of Principal

You might also like