0% found this document useful (0 votes)
368 views21 pages

Store Inventory Management System: SUBJECT-Computer Science (083)

This document contains the code for a store inventory management system built using Python and MySQL. The system includes modules for product management, purchase management, sales management, and database setup/management. The product management module allows adding, updating, deleting products. The purchase module manages purchase orders. The sales module allows selling products and updating inventory. The database setup module creates the necessary tables in the MySQL database. Screenshots of the system and references are also included.

Uploaded by

Utsav
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)
368 views21 pages

Store Inventory Management System: SUBJECT-Computer Science (083)

This document contains the code for a store inventory management system built using Python and MySQL. The system includes modules for product management, purchase management, sales management, and database setup/management. The product management module allows adding, updating, deleting products. The purchase module manages purchase orders. The sales module allows selling products and updating inventory. The database setup module creates the necessary tables in the MySQL database. Screenshots of the system and references are also included.

Uploaded by

Utsav
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/ 21

Store Inventory Management

System
SUBJECT-Computer
Science( 083 )
SESSION: 2022-23

Submitted by
Name : UTSAV DAS
Class : XII
AISSCE Roll no :
Admission no : 320/S/21
Submitted to : Mr. Sanjay Paul Sir
CERTIFICATE
Name: UTSAV DAS
Class: XII
AISSCE Roll no:

This is certified that UTSAV DAS student of class XII


has successfully completed the physics project during
academic year 2022-23.

…………………………………………………
…….………………………………...…………
Internal Examiner’s signature External
Examiner’s signature

…………………………………………………..
Principal

AKNOWLEGMENT:

I would like to express my special thanks


of gratitude to my teacher (Mr. Sanjay
Paul Sir) as well as our principal (Mrs
Seema Chitlangiya) who gave me the
golden opportunity to do this wonderful
project which also helped me in doing a lot
of Research and I came to know about so
many new things I am really thankful to
them.
Secondly I would also like to thank my
parents and friends who helped me a lot in
finalizing this project within the limited
time frame
INDEX
Topics Page No.
Certificate 2
Acknowledgement 3
Introduction to Project 5
Program Code 8
Screen Shots 15
Bibliography 21
About Project
Inventory management is the practice of ordering,
storing, tracking, and controlling inventory.
Inventory management applies to every item a
business uses to produce its products or services –
from raw materials to finished goods. In other
words, inventory management covers every
aspect of a business’s inventory.

The project contains following modules:-

1. Product Management: This module is used to


add, update and delete the products.

2. Purchase Management: This module is used to


manage the purchase system.

3. Sales Management: This module is used to


manage the sale of the products.
4. User Management: This module is used to
add/delete the user/staff.
5. Database setup: This module is used to setup
the database in the system for the first time.
SOFTWARE

SPECIFICATION:- Operating System : Windows


8 Platform : Python IDLE 3.7 Database : MySQL
Languages : Python Note: For Python-MySQL
connectivity, following data have been used:-
Host- localhost, user- root, password- ‘123456 ‘,
database- stock
Program Code
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. Delete Product")
print("\t\t\t 4. Back (Main Menu)")
p = int(input("\t\t Enter Your Choice :"))
if p == 1:
add_product()
if p == 2:
list_product()
if p == 3:
delete_product()
if p == 4:
break
def purchase_mgmt():
while True:
print("\t\t\t 1. Add Order")
print("\t\t\t 2. Back (Main Menu)")
o = int(input("\t\t Enter Your Choice :"))
if o == 1:
add_order()
if o == 2:
break
def sales_mgmt( ):
while True:
print("\t\t\t 1. Sale Items")
print("\t\t\t 2. Back (Main Menu)")
s = int (input("\t\t Enter Your Choice :"))
if s == 1:
sale_product()
if s == 2:
break

def create_database():
mydb = mysql.connector.connect(host="localhost", user="root",
password="123456", database="stock")
mycursor = mydb.cursor()
print(" Creating PRODUCT table")
sql = '''CREATE TABLE if not exists product(pcode int(4) PRIMARY
KEY,
pname char(30) NOT NULL, price float(8,2), pqty int(4), pcat
char(30));'''
mycursor.execute(sql)
sql = '''CREATE TABLE if not exists orders(orderid int(4)PRIMARY
KEY, orderdate DATE, pcode char(30) NOT NULL , price float(8,2), pqty
int(4), supplier char(50), pcat char(30));'''
mycursor.execute(sql)
print("Creating SALES table")
sql = '''CREATE TABLE if not exists sales(salesid int(4) PRIMARY
KEY,
salesdate DATE, pcode char(30) references product(pcode),
price float(8,2), pqty int(4), Total double(8,2));'''
mycursor.execute(sql)
print("SALES table created")
def list_database():
mydb = mysql.connector.connect(host="localhost", user="root",
password="123456", database="stock")
mycursor = mydb.cursor()
sql = "show tables;"
mycursor.execute(sql)
for i in mycursor:
print(i)
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\t Enter 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", user="root",
password="123456", database="stock")
mycursor = mydb.cursor()
sql = "INSERT INTO product(pcode,pname,price,pqty,pcat) values
(%s,%s,%s,%s,%s)"
code = int(input("\t\t Enter 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\t Enter product name :")
qty = int(input("\t\t Enter product quantity :"))
price = float(input("\t\t Enter product unit price :"))
cat = input("\t\t Enter Product category :")
val = (code,name,price,qty,cat)
mycursor.execute(sql,val)
mydb.commit()
else:
print("\t\t Product already exist")
def delete_product():
mydb = mysql.connector.connect(host="localhost", user="root",
password="123456", database="stock")
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 list_product():
mydb = mysql.connector.connect(host="localhost", user="root",
password="123456", database="stock")
mycursor = mydb.cursor()
sql = "SELECT * from product"
mycursor.execute(sql)
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 list_prcode(code):
mydb = mysql.connector.connect(host="localhost", user="root",
password="", database="stock")
mycursor = mydb.cursor()
sql = "SELECT * from product WHERE pcode=%s"
val = (code,)
mycursor.execute(sql, val)
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", user="root",
password="123456", database="stock")
mycursor = mydb.cursor()
pcode = input("Enter product code: ")
sql = "SELECT count(*) from product WHERE pcode=%s;"
val = (pcode,)
mycursor.execute(sql,val)
x=mycursor.fetchone()
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("Product is not available")

while True:
print("\t\t\t STOCK MANAGEMENT")
print("\t\t\t ****************\n")
print("\t\t 1. PRODUCT MANAGEMENT")
print("\t\t 2. SALES MANAGEMENT")
print("\t\t 3. DATABASE SETUP")
print("\t\t 4. EXIT\n")
n = int(input("Enter your choice :"))
if n == 1:
product_mgmt()
if n == 2:
sales_mgmt()
if n == 3:
db_mgmt()
if n == 4:
break
SCREEN SHOTS
Bibliography
1>Computer Science Python for Class 12
By Preeti Arora
2>www.google.com
3>https://sultan-chand.com/ws/python12/

--------------------------------------------------

You might also like