CSC Investigatory Project
CSC Investigatory Project
CSC Investigatory Project
INVESTIGATORY PROJECT
COMPUTER SCIENCE
2022 - 23
THE BELLVILLE
“Too much of a good thing can be wonderful.”
1|Page
BONAFIDE CERTIFICATE
_______________ _______________
Mrs. Harsha Varun External Examiner
(Computer Science Teacher)
_______________________
Mrs. Asha Nathan
(Principal) School Seal
2|Page
ACKNOWLEDGMENT
3|Page
TABLE OF CONTENTS
5 CASE STUDY
6 SOFTWARE USED
6 Software
6 Module
6 Python File & Table Used
7 Creating the tables
11 OPERATING INSTRUCTIONS
12 SOURCE CODE
22 SCREENSHOTS
22 Product Management
30 Sales Management
32 Purchase Management
36 User Management
41 CONCLUSION
42 BIBLIOGRAPHY
4|Page
CASE STUDY
THE BELLVILLE’S Inventory and Sales (Stock)
Management System software is a program which
makes it easy to maintain a record of products available
in the list and track orders issued to suppliers in THE
BELLVILLE.
5|Page
SOFTWARE USED
Software:
Windows 10
Python 3.10
MySQL 8.0
Modules:
MySQL Connector
Datetime
PIP
Python File:
THE BELLVILLE.py
6|Page
Host-localhost, user- root, password- ‘aegyo2013’,
database- STOCK
II. ORDERS:
7|Page
III. SALES:
IV. USER:
8|Page
9|Page
10 | P a g e
OPERATING INSTRUCTIONS
THIS PROGRAM IS DESIGNED TO KEEP RECORDS OF
STOCK IN THE BELLVILLE AND MANAGE SALES, ORDERS
AND PURCHASE DETAILS OF THE STOCK.
This program also provides the user the permission to add sale
details, user details, product details and order details.
THE PROGRAM PROVIDES THE FOLLOWING SERVICES:
ADD,
MODIFY,
VIEW PURCHASE DETAILS,
SALES DETAILS,
PRODUCT DETAILS AND
ORDER DETAILS.
The project contains following modules:
11 | P a g e
SOURCE CODE
# INVENTORY AND SALES MANAGEMENT OF THE BELLVILLE
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\t Enter Your Choice :"))
if p == 1:
add_product()
elif p == 2:
search_product()
elif p == 3:
update_product()
elif p == 4:
delete_product()
elif p == 5:
break
else:
print('INVALID CHOICE')
def purchase_mgmt():
while True:
print("\t\t\t 1. Add Order")
print("\t\t\t 2. List Order")
print("\t\t\t 3. Update Order")
print("\t\t\t 4. Delete Order")
print("\t\t\t 5. Back (Main Menu)")
o = int(input("\t\t Enter Your Choice :"))
if o == 1:
add_order()
12 | P a g e
elif o == 2:
list_order()
elif o == 3:
update_order()
elif o==4:
delete_order()
elif o==5:
break
else:
print('INVALID CHOICE')
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\t Enter Your Choice :"))
if s == 1:
sale_product()
elif s == 2:
list_sale()
elif s == 3:
break
else:
print('INVALID CHOICE')
def user_mgmt():
while True:
print("\t\t\t 1. Add User(s)")
print("\t\t\t 2. List User")
print("\t\t\t 3. Delete User")
print("\t\t\t 4. Back (Main Menu)")
u = int(input("\t\t Enter Your Choice :"))
if u == 1:
add_user()
elif u == 2:
list_user()
elif u==3:
delete_user()
13 | P a g e
elif u==4:
break
else:
print('INVALID CHOICE')
def add_order():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
mycursor = mydb.cursor()
now = datetime.datetime.now()
sql = "INSERT INTO orders (order_id, orderdate, pcode, pprice, pqty,
supplier, pcat) values(%s,%s,%s,%s,%s,%s,%s)"
code = int(input("Enter product code :"))
oid = now.year+now.month+now.day+now.hour+now.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", user="root",
password="aegyo2013", database="STOCK")
mycursor = mydb.cursor()
sql = "SELECT * from orders"
mycursor.execute(sql)
print("\t\t\t\t\t ORDER DETAILS")
print("-"*85)
print("ORDER_ID DATE\t\tPRODUCTCODE PRICE \tQUANTITY \
tSUPPLIER \tCATEGORY")
print("-" * 85)
for i in mycursor:
print(i[0], "\t", i[1], "\t", i[2], "\t ", i[3], "\t", i[4],"\t\t", i[5], "\t", i[6])
print("-" * 85)
def update_order():
14 | P a g e
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013",database="STOCK")
mycursor = mydb.cursor()
O_ID = int(input("Enter the Order ID :"))
qty = int(input("Enter the Quantity :"))
sql = "UPDATE orders SET pqty=%s WHERE order_id=%s;"
val = (qty,O_ID)
mycursor.execute(sql,val)
mydb.commit()
def delete_order():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
mycursor=mydb.cursor()
code = int(input("Enter the Product Code :"))
sql = "DELETE FROM orders WHERE pcode = %s;"
val = (code,)
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount,"RECORD(S) DELETED");
def add_product():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013",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 :")
15 | P a g e
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", user="root",
password="aegyo2013", database="STOCK")
mycursor = mydb.cursor()
code = int(input("Enter the Product Code :"))
qty = int(input("Enter the Quantity :"))
sql = "UPDATE product SET pqty=%s WHERE pcode=%s;"
val = (qty,code)
mycursor.execute(sql,val)
mydb.commit()
print(mycursor.rowcount, "RECORD(S) AFFECTED")
print("\t\t PRODUCT DETAILS UPDATED")
def delete_product():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", 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 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\t Enter Your Choice :"))
if s == 1:
list_product()
16 | P a g e
elif s == 2:
code=int(input(" Enter Product Code :"))
list_prcode(code)
elif s == 3:
cat=input("Enter Category :")
list_prcat(cat)
elif s == 4:
break
else:
print('INVALID CHOICE')
def list_product():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013",database="STOCK")
mycursor = mydb.cursor()
sql = "SELECT * from product"
mycursor.execute(sql)
print("\t\t\t\t PRODUCT DETAILS")
print("\t\t", "-" * 50)
print("\t\t CODE \t\tNAME \t\tPRICE \tQUANTITY \tCATEGORY")
print("\t\t", "-" * 50)
for i in mycursor:
print("\t\t", i[0], "\t", i[1],"\t",i[2],"\t", i[3], "\t", i[4])
print("\t\t", "-" * 47)
def list_prcode(code):
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", 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", "-" * 56)
print("\t\t CODE \t NAME \t\t PRICE \t QUANTITY CATEGORY")
print("\t\t", "-" * 56)
for i in mycursor:
print("\t\t", i[0], "\t", i[1], "\t", i[2], "\t", i[3], "\t", i[4])
print("\t\t", "-" * 56)
17 | P a g e
def sale_product():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
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 (SALESDATE,PCODE,PPRICE,PQTY,TOTAL)
values(%s,%s,%s,%s,%s)"
val=(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 available")
def list_sale():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
18 | P a g e
mycursor = mydb.cursor()
sql = "SELECT * FROM sales"
mycursor.execute(sql)
print("\t\t\t\t SALES DETAILS")
print("-" * 50)
print("SALES_ID DATE PRODUCTCODE PRICE QUANTITY TOTAL")
print("-" * 50)
for x in mycursor:
print(x[0], "\t", x[1],"\t",x[2],"\t",x[3],"\t",x[4],"\t",x[5])
print("-" * 50)
def list_prcat(cat):
mydb = mysql.connector.connect(host="localhost",
user="root",password="aegyo2013", database="STOCK")
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", "-" * 55)
print("\t\t CODE \t NAME \t\t PRICE \tQUANTITY CATEGORY")
print("\t\t", "-" * 55)
for i in mycursor:
print("\t\t", i[0], "\t", i[1], "\t", i[2], "\t", i[3], "\t", i[4])
print("\t\t", "-" * 55)
def add_user():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
mycursor = mydb.cursor()
uid = input("Enter User ID :")
name = input("Enter User Name :")
password = input("Enter ID Password :")
sql = "INSERT INTO user values (%s,%s,%s);"
val = (uid, name, password)
mycursor.execute(sql, val)
mydb.commit()
19 | P a g e
print(mycursor.rowcount, "USER CREATED")
def list_user():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
mycursor = mydb.cursor()
sql = "SELECT uid, uname from user"
mycursor.execute(sql)
clrscr()
print("\t\t\t USER DETAILS")
print("\t\t", "-" * 27)
print("\t\t UID\t NAME ")
print("\t\t", "-" * 27)
for i in mycursor:
print("\t\t", i[0], "\t", i[1])
print("\t\t", "-" * 27)
def delete_user():
mydb = mysql.connector.connect(host="localhost", user="root",
password="aegyo2013", database="STOCK")
mycursor=mydb.cursor()
uid = int(input("Enter the User ID :"))
sql = "DELETE FROM user WHERE UID = %s;"
val = (uid,)
mycursor.execute(sql, val)
mydb.commit()
print(mycursor.rowcount,"RECORD(S) DELETED");
def clrscr():
print("\n"*3)
while True:
clrscr()
print("\t\t\t THE BELLVILLE'S 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")
20 | P a g e
print("\t\t 5. EXIT\n")
n = int(input("Enter Your Choice :"))
if n == 1:
product_mgmt()
elif n == 2:
purchase_mgmt()
elif n == 3:
sales_mgmt()
elif n == 4:
user_mgmt()
elif n == 5:
break
else:
print('INVALID CHOICE')
SCREENSHOTS
MAIN MENU:
21 | P a g e
PRODUCT MANGAGEMENT
ADDING PRODUCTS:
22 | P a g e
23 | P a g e
24 | P a g e
25 | P a g e
VIEW ALL PRODUCTS:
26 | P a g e
VIEW WITH SPECIFIC PRODUCT CATEGORY:
27 | P a g e
UPDATING THE PRODUCT QUANTITY:
28 | P a g e
DELETING THE PRODUCT USING THE PRODUCT CODE:
29 | P a g e
SALES MANAGEMENT
32 | P a g e
LISTING ALL THE ORDERS:
33 | P a g e
UPDATING THE QUANTITY IN THE ORDER:
34 | P a g e
DELETE THE ORDER PLACED:
35 | P a g e
USER MANAGEMENT
ADDING USER:
36 | P a g e
LIST ALL THE USERS:
37 | P a g e
38 | P a g e
DELETE THE USER:
39 | P a g e
Scope of improvement/ limitations
The process of gathering information, diagnosing
the problems, then interpreting facts is known as
System Analysis. It includes recommending the
system improvements that are required, based on
the same data.
The system is observed as a whole. The inputs need
to be identified first before tuning them and then
the system is subjected to study as a whole to
identify the problems.
Although tuning any system as a whole is a complex
procedure, tuning individual statements is not the
best as something that is correct for one input may
hurt another’s input performance.
The solutions are given as a proposal. The
suggestion is revised upon user request and optimal
changes are made. This loop terminates as soon as
the user is gratified with the proposal.
So on the whole, system analysis is done to improve
the system performance by monitoring it and
obtaining the best possible output from it.
It would provide a vast array of details about the
products according to the consumer’s needs.
40 | P a g e
CONCLUSION
41 | P a g e
BIBLIOGRAPHY
https://python4csip.com/
https://data-flair.training/blogs/
http://sultan-chand.com/download/
Pythonsupplement.pdf
http://cbseacademic.nic.in/
web_material/doc/cs/
2_Computer_Science_Python_ClassXII.
pdf
https://www.w3schools.com/
https://pythontutor.com/
visualize.html#mode=edit
42 | P a g e