Академический Документы
Профессиональный Документы
Культура Документы
INTRODUCTION
The main objective of the python project on stock management system is to manage the
details of the customer, inventory, supplier, sales, and payment. It manages all the
information about the customer, purchasing, payment. The project is totally built on
administrative end and access is only guaranteed to the administrator. The purpose of this
project is to build a hassle free application program to reduce manual work. It tracks all the
details about the amount available in stock and payment on producing the bill.
For optimal sales and inventory management processes, you need robust functionality for
managing your logistics facilities. Support for inventory management helps you record and
track materials on the basis of both quantity and value. Warehouse inventory management
functions cover internal warehouse movements and storage. Using this software we can
reduce costs for warehousing, transportation, order fulfillment, and material handling – while
improving customer service. You can significantly improve inventory turns, optimize the
flow of goods, and shorten routes within your warehouse or distribution center. Additional
benefits of inventory management include improved cash flow, visibility, and decision
making. This software is user friendly and hence easy to use. Employees can plan, enter, and
document warehouse and internal stock movements by managing goods receipts, goods
issues, storage, picking and packing, physical stock transfers, and transfer postings. In
existing system there are numerous problems of manual stock management system
As we know manual system are quite tedious, time consuming and less efficient and accurate
in comparison to the computerized system.
1. Time consuming
2. Less accurate
3. Less efficient
1|Page
2. LIBRARIES USED
ii. tabulate: It enables readable representation of mixed textual and numeric data using
tables. The main function of this library is printing small tables without hassle: just one
function call, formatting is guided by the data itself, authoring tabular data for
lightweight plain-text markup: multiple output formats suitable for further editing or
transformation, readable presentation of mixed textual and numeric data: smart column
alignment, configurable number formatting, alignment by a decimal point
iv. getpass: It prompts the user for a password without echoing. The getpass
module provides a secure way to handle the password prompts where programs
interact with the users via the terminal. The getpass library is used to prompt to users
using the string prompt and reads the input from the user as Password
2|Page
3. FUNCTIONS USED
Inbuilt Functions:
i. input():This function is used to tell the program to stop and wait for the user to key in
the data to interact with the python program.
ii. print(): This function is used to print the specified information or message on the
screen.
iii. cursor(): This function is used to facilitate the row by row processing of records in
the result set.
iv. execute(): This function is used in python to use the various commands available in
python.
v. fetchall(): This function is used to return all the records retrieved as per query in a
tuple form.
vi. connect(): This function is used to create a connection to the database having four
arguments namely Server Name, Database Username, Password And Database Name.
i. feed(): This function is used to take the feedback from the customer.
ii. dat(): This function is used to create a table in mysql for storing product details.
iii. shop(): This function is used by the shopkeeper to manage the stock and product
details.
iv. customer(): This function is used to execute the buying procedure of the products.
vi. main(): This function is used to select the features of the main menu.
3|Page
4. DATABASE DESCRIPTION
A database is a data structure that stores organized information. Most databases contain
multiple tables, which may each include several different fields. For example, a company
database may include tables for products, employees, and financial records. Each of these
tables would have different fields that are relevant to the information stored in the table.
4|Page
5. SOURCE CODE
stock.py
import getpass
import webbrowser
import mysql.connector as ms
from tabulate import tabulate
print("\t\t===========WELCOME TO STOCK
MANAGEMENT=============\n\t\t\t")
def feed1():
x=ms.connect(host="localhost",user="root",passwd="123",databas
e='stock')
if x.is_connected():
cur=x.cursor()
cur.execute("create table Feedback(Name
char(50),Experience char(30),Satisfied char(10),Rating
int,Service char(10),Feedback char(100))")
feed2()
def feed2():
x=ms.connect(host="localhost",user="root",passwd="123",databas
e='stock')
if x.is_connected():
cur=x.cursor()
Name=input("Enter your name: ")
Experience=input("How was your overall experience?
")
Satisfied=input("Are you satisfied with the product?
")
Rating=int(input("How would you like to rate our
product on the scale of 1-10? "))
Service=input("Was the service good? ")
Feedback=input("Please suggest us how to improve to
live up to your expectations: ")
5|Page
cur.execute("Insert into Feedback
values('{}','{}','{}',
{},'{}','{}')".format(Name,Experience,Satisfied,Rating,Service
,Feedback))
x.commit()
x.close()
def feed():
while True:
print("1. Online Feedback")
print("2. Offline Feedback")
print("3. Back to main menu")
g1=int (input("\t\t Enter Your Choice: "))
if g1==1:
webbrowser.open_new_tab('https://forms.gle/x
LS6BteXzKdFh6gw8')
elif g1==2:
print("1. Feedback Form")
print("2. Feedback Result [Does not open
without entering feedback form]")
s1=int (input("\t\t Enter Your Choice: "))
if s1==1:
feed1()
elif s1==2:
result()
else:
print("ERROR")
elif g1==3:
main()
else:
print("ERROR")
def dat():
x=ms.connect(host="localhost",user="root",passwd="123")
if x.is_connected():
6|Page
cur=x.cursor()
cur.execute("create database stock")
cur.execute("use stock")
cur.execute("create table products ( Product_ID
char(100),Product_Name char(100),Brand_Name char(100),Qty
int,cost_Price int,selling_price int)")
x.commit()
x.close()
print("database is successfully created\n*** Please Note
that once Database is created it need not be created
again***")
main()
def shop():
x=ms.connect(host="localhost",user="root",passwd="123",databas
e='stock')
if x.is_connected():
cur=x.cursor()
a="y"
while a=="y" or a=="Y":
chooser=int(input("Enter the choice to be
selected \n 1. Insert Products details \n 2. Read Product
details \n 3. Update Product details \n 4. Delete Product
details \n 5. View Record \n 6.Main menu\n"))
if chooser==1:
a="y"
while a=="y" or a=="Y":
Product_id=input("Enter Product Id: ")
Product_name=input("Enter Product Name:
")
Brand_name=input("Enter Brand Name: ")
Qty=int(input("Enter Quantity of the
product: "))
cost_price=int(input("Enter cost Price
of the products: "))
7|Page
selling_price=int(input("Enter selling
Price of the products: "))
8|Page
data=cur.fetchone()
if data[0]==1:
new_id=input("Enter new
Product Id: ")
cur.execute("update
products set Product_id='{}' where
Product_id='{}'".format(new_id,existing_id))
print ("Data updated
successfully")
x.commit()
cur.execute("select *
from products")
head=['Product
id','Product name','Brand name','Qty','cost price','selling
price']
data=cur.fetchall()
print(tabulate(data,head
ers=head,tablefmt='psql'))
a=input("Do you want to
update more data? (y/n)")
else:
print("Invalid Product
Id")
if update_chooser==2:
existing_id=input("Enter
existing Product Id: ")
cur.execute("select
exists(select * from products where
Product_Id='{}')".format(existing_id))
data=cur.fetchone()
if data[0]==1:
new_name=input("Enter
new Product Name: ")
cur.execute("update
products set Product_name='{}' where
Product_Id='{}'".format(new_name,existing_id))
9|Page
print ("Data updated
successfully")
x.commit()
cur.execute("select *
from products")
head=['Product
id','Product name','Brand name','Qty','cost price','selling
price']
data=cur.fetchall()
print(tabulate(data,head
ers=head,tablefmt='psql'))
10 | P a g e
head=['Product
id','Product name','Brand name','Qty','cost price','selling
price']
data=cur.fetchall()
print(tabulate(data,headers=head,tablefmt='psql'))
a=input("Do you want to
update more data? (y/n)")
else:
print("Invalid Product
Id")
if update_chooser==4:
existing_id=input("Enter
existing Product Id: ")
cur.execute("select
exists(select * from products where
Product_id='{}')".format(existing_id))
data=cur.fetchone()
if data[0]==1:
new_qty=input("Enter new
Qty of the Product: ")
cur.execute("update
products set Qty={} where
Product_id={}".format(new_qty,existing_id))
11 | P a g e
a=input("Do you want to
update more data? (y/n)")
else:
print("Invalid Product
Id")
if update_chooser==5:
existing_id=input("Enter
existing Product Id: ")
cur.execute("select
exists(select * from products where
Product_id='{}')".format(existing_id))
data=cur.fetchone()
if data[0]==1:
new_price=input("Enter
new cost Price: ")
cur.execute("update
products set cost_price={} where
Product_id='{}'".format(new_price,existing_id))
print ("Data updated
successfully")
x.commit()
cur.execute("select *
from products")
head=['Product
id','Product name','Brand name','Qty','cost price','selling
price']
data=cur.fetchall()
print(tabulate(data,head
ers=head,tablefmt='psql'))
a=input("Do you want to
update more data? (y/n)")
else:
print("Invalid Product
Id")
if update_chooser==6:
12 | P a g e
existing_id=input("Enter
existing Product Id: ")
cur.execute("select
exists(select * from products where
Product_id='{}')".format(existing_id))
data=cur.fetchone()
if data[0]==1:
new_price=input("Enter
new selling Price: ")
cur.execute("update
products set selling_price={} where
Product_id='{}'".format(new_price,existing_id))
print ("Data updated
successfully")
x.commit()
cur.execute("select *
from products")
head=['Product
id','Product name','Brand name','Quantity','cost
price','selling price']
data=cur.fetchall()
print(tabulate(data,head
ers=head,tablefmt='psql'))
a=input("Do you want to
update more data? (y/n)")
else:
print("Invalid Product
Id")
if chooser==4:
a='y'
while a=='y' or a=='Y':
Product_id=input("Choose Product
id to delete: ")
cur.execute("select
exists(select * from products where
Product_id='{}')".format(Product_id))
13 | P a g e
data=cur.fetchone()
if data[0]==1:
cur.execute("delete from
products where Product_id='{}'".format(Product_id))
x.commit()
print("Data of Product_id:
'{}' deleted successfully".format(Product_id))
a=input("Delete more data ?
(y/n)")
else:
print("Invalid Product_id")
a=input("Do you want to try
again ?(y/n)")
if chooser==5:
a='y'
while a=='y' or a=='Y':
head=['Product id','Product
name','Brand name','Quantity','cost price','selling price']
Product_id=input("Enter Your
Product id: ")
cur.execute("select
exists(select * from products where
Product_id='{}')".format(Product_id))
data=cur.fetchone()
if data[0]==1:
cur.execute("select * from
products where Product_id='{}'".format(Product_id))
data=cur.fetchall()
print(tabulate(data,headers=
head,tablefmt='psql'))
a=input("View another
result? (y/n)")
else:
print("Invalid Product_id")
14 | P a g e
a=input("Do you want to try
again ?(y/n)")
a=input("Do you want to continue(y/n)?")
if chooser==6:
main()
x.close()
def customer():
x=ms.connect(host="localhost",user="root",passwd="123",databas
e='stock')
if x.is_connected():
cur=x.cursor()
cur.execute("create table bill (Product_id
char(100),Product_name char(100),Brand_name char(100),Price
int)")
x.commit()
m="y"
while m=="Y" or m=="y":
chooser1=int(input("Enter the choice
to be selected \n 1. Show the menu \n 2. Add into cart \n 3.
Remove from cart \n 4. View Bill \n 5. Main Menu\n"))
if chooser1==1:
cur.execute("Select
Product_ID,Product_Name,Brand_Name,Selling_price from
products")
head=['Product Id','Product
name','Brand name','price']
data=cur.fetchall()
print(tabulate(data,headers=head
,tablefmt='psql'))
if chooser1==2:
m="y"
while m=="y" or m=="Y":
i=input("enter the ID of the
product to add into the cart:")
15 | P a g e
cur.execute("insert into
bill (Product_Id,Product_name,Brand_name,Price) select
Product_Id,Product_Name,Brand_Name,selling_Price from products
where Product_Id='{}'".format(i))
cur.execute("update products
set Qty=Qty-1 where Product_Id='{}'".format(i))
x.commit()
print("item has been
successfully added to cart.\n")
16 | P a g e
cur.execute("select SUM(price)
as totalsum from bill")
result=cur.fetchall()
for i in result:
print("
total=Rs",i[0])
cur.execute("drop table bill")
x.commit()
x.close()
print("\n")
if chooser1==5:
main()
m=input("Do you want to
continue(y/n)?")
def dele():
x=ms.connect(host="localhost",user="root",passwd="123")
if x.is_connected():
cur=x.cursor()
cur.execute("drop database Stock")
x.commit()
x.close()
main()
def main():
while True :
print("\t\t\t 1. Create Database (Only
when used first time)")
18 | P a g e
6. OUTPUT SCREENSHOTS
19 | P a g e
Fig 3-Menu for Shopkeeper
20 | P a g e
Fig 5- Items present in Stock
21 | P a g e
Fig 7- Customer Menu
22 | P a g e
Fig. 11 Offline Feedback Form
23 | P a g e
24 | P a g e
Fig. 13 Online Feedback Result (i)
25 | P a g e
7. CONCLUSION
26 | P a g e
8. Bibliography
27 | P a g e