SESSION-2021-2022
STOCK IMPORT MANAGEMENT SYSTEM
NAME-ADITYA GUPTA
CLASS-12-B
board roll number-23669774
CERTIFICATE
This is to certify that this project on topic
“ Stock import MANAGMENT SYSTEM ”
has been made by ADITYA GUPTA of student of
class XII – SEC of B
“ Shree Sanatan Dharm Education Centre “
during the academic year 2021-22.
He has made this project under my guidance with
utmost sincerity
_______________ _______________
External teacher Internal teacher
_______________
Principal
ACKNOWLDGEMENT
I would like to convey my heartfelt thanks to
M s. Shobha Das
my school Principal for providing us with
necessary resources and
M r. Dinesh Maurya
my Computer Science Teacher,
who gave valuable suggestions and guidelines for
completion of my project.
My project has been a success only because of
guidelines.
ADITYA GUPTA
XII-“SECTION”-B
Board Roll No : 23669774
INDEX
➢ CERTIFICATE
➢ ACKNOWLDGEMENT
➢ INTRODUCTION
• BENIFITS OF STOCK IMPORTS SYSTEM
➢ SYNOPSIS
➢ CODING
➢ OUTPUT
➢ BIBLIOGRAPHY
INTRODUCTION OF MY PROJECT
The Benefits Of Using An STOCK Inventory
Management System (2021).
• Simplified inventory management. ...
• Reduced risk of overselling. ...
• Greater cost-savings. ...
• Avoidance of stock-outs and excess stock. ...
• Improved business negotiations. ...
• Better product visibility in the event of a recall
SYNOPSIS
TOPIC:-STOCK IMPORT MANAGMENT
SYSTEM
OVERVIEW:-
STOCKS IMPORT DETAILS are majorly important for our
country as it helps us to manage with stock inputs and
updates us about the import MATERIALS and the total
expenditure .This saves our lot of time for doing the
relative working for updating the details of stocks
imported.
LANGUAGE USED:-
This project is made using Python as the coding
language.
CONCEPT USED:-
Python MySQL connectivity is used for storing
details as a database.
MODULES USED:-
• MYSQL
• visual studio code
• My SQL. connector
PRE-REQUISTIES:-
You must have the following Soft wares for the
successful running of this software:-
1 Python (Version 3 or above) must be
installed(or the latest version) . It is
downloadable from “www.python.org”.
• MySQL 8.0 Command Line Client must be
installed. It is downloadable from
“www.mysql.org”.
WORKING
MY PROGRAM IS BASICALLY A CONNECTIVITY DATABASE
PROGRAM AS
IT HAS 4 OPTIONS
1 .WHEN WE SELECT FIRST OPTION IT ADDS THE
RECORDS
2 .UPDATES THE VALUES ALREADY EXISTING IN THE
STOCK WHEN WE CHOOSE 2 OPTION
3 .OPTION 3 DELETES THE RECORD EXISTING IN THE
STOCK TABLE
4. OPTION 4 DISPLAYS ALL THE RECORDS ENTERED
IN THE TABLE
CODING
#IMPORTS PY MYSQL MODULE
import pymysql
#CONNECTING DATABASE
def dbconnect():
return pymysql.connect(host="localhost",
user="root", password='79851528sg',
database='stocksin2020')
def menu():
retry = 'y'
while retry.lower() == 'y':
database = dbconnect()
cursor = database.cursor()
print('1. add record\n2. update
record\n3. delete record\n4. display records')
#ASKS USER HIS CHOICE
choice = int(input('\nEnter your choice:
').strip())
# DESCRIPTION OF EACH CHOICE
if choice== 1:
adddata(database, cursor)
elif choice== 2:
updatedata(database, cursor)
elif choice== 3:
deletedata(database, cursor)
elif choice== 4:
fetchdata(database, cursor)
else:
print("Invalid input")
retry = input("\n Do you want to
continue or not: ")
#DEFINING THE WORK OF ADD DATA FUNCTION
def adddata(database, cursor):
cursor.execute('create table if not exists
imports(SNo int PRIMARY KEY, ProductName
varchar(255), Units int, Expenditure int)')
cursor.execute('select * from imports')
#FETCHES ALL RECORDS FROM THE DATABASE
data = cursor.fetchall()
if len(data) > 0:
sNo = data[len(data)-1][0] + 1
else:
sNo = 1
product = input('Product Name: ').strip()
units = int(input('Number of units: ').strip())
exp = int(input('Expenditure of 1 unit:
').strip())
total = exp * units
cursor.execute(f'insert into imports
values({sNo}, \'{product}\', {units}, {total})')
database.commit()
print(f'Record added:\n{sNo}, {product},
{units}, {total}')
#DEFINING WORK OF UPDATE DATA FUNCTION
def updatedata(database, cursor):
product = input('Product Name: ').strip()
cursor.execute(f'select * from imports where
ProductName = "{product}"')
#FETCHES ONE RECORD FROM TABLE
data = cursor.fetchone()
sNo, units = data[0], data[2]
exp = int(input('Expenditure of 1 unit:
').strip())
#calculation of total expenditure of all units
total = exp * units
cursor.execute(f'update imports set
Expenditure = {total} where ProductName =
"{product}"')
database.commit()
print("Record updated")
#DEFINING WORK OF DELETE DATA FUNCTION
def delete data(database, cursor):
product = input('Product Name: ').strip()
#deletes the user specified record from the table
cursor.execute(f'delete from imports where
ProductName like "%{product}%"')
database.commit()
print("Record deleted")
def fetchdata(database, cursor):
#WE WRITE THAT CODE WHICH MAY CAUSE
# ERROR
try:
cursor.execute("select * from imports")
data = cursor.fetchall()
for record in data:
print(record)
except:
print("Error: Unable to fetch data")
connection = pymysql.connect(host="localhost",
user="root", password='79851528sg')
cursor = connection.cursor()
#CREATES TABLE IF IT DOES NOT EXISTS
cursor.execute('create database if not exists
stocksin2020')
menu()
OUTPUTS
OUTPUT-1 ADD A RECORD-
OUTPUT2-UPDATE THE RECORD
OUTPUT3-DELETE A RECORD
OUTPUT4-SHOW ALL RECORDS
BIBLIOGRAPHY
(Books Reference)
1.“Computer Science with Python”
by Sumita Arora.
2. “Information Practices with
Python” by Sumita Arora.
(Web Reference)
3. www.wikipedia.com
SPECIAL REFRENCE FROM GOOGLE .COM