Stock Final
Stock Final
STOCK MANAGEMENT
Index
1. ABSTRACT
2. TECHNOLOGIES USED:
3. SOFTWARE SPECIFICATION:-
4. HARDWARE SPECIFICATION:-
5. TABLE STRUCTURE:
6. SOURCE CODE
7. OUTPUT SCREEN
STOCK MANAGEMENT
Abstract
Stock management 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.
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.
Technologies Used:
SOFTWARE SPECIFICATION:-
Operating System : Windows 7
Platform : Python IDLE 2.7
Database : MySQL
Languages : Python
HARDWARE SPECIFICATION:-
DBMS: MySQL
Host: local host
User: root
Pass: root
Database: stock
# STOCK MANAGEMENT
importos
importmysql.connector
importdatetime
now = datetime.datetime.now()
defsale_product():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
val=(pcode,)
mycursor.execute(sql,val)
for x in mycursor:
cnt=x[0]
ifcnt !=0 :
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 :"))
ifqty<= pqty:
total=qty*price;
val=(int(cnt)+1,datetime.datetime.now(),pcode,price,qty,total)
mycursor.execute(sql,val)
val=(qty,pcode)
mycursor.execute(sql,val)
mydb.commit()
else:
else:
deflist_sale():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
mycursor.execute(sql)
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)
defadd_product():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock") #change as per system
mycursor=mydb.cursor()
val=(code,)
mycursor.execute(search,val)
for x in mycursor:
cnt=x[0]
ifcnt==0:
val=(code,name,price,qty,cat)
mycursor.execute(sql,val)
mydb.commit()
else:
deflist_product():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
mycursor.execute(sql)
print("\t\t","-"*47)
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)
deflist_prcode(code):
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
val=(code,)
mycursor.execute(sql,val)
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)
defupdate_product():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
val=(qty,code)
mycursor.execute(sql,val)
mydb.commit()
defdelete_product():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
mycursor.execute(sql,val)
mydb.commit()
defsearch_product():
while True :
if s==1 :
list_product()
if s==2 :
list_prcode(code)
if s==3 :
list_prcat(cat)
if s== 4 :
break
deflist_prcat(cat):
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
print (cat)
val=(cat,)
mycursor.execute(sql,val)
#clrscr()
print("\t\t","-"*47)
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)
defproduct_mgmt( ):
while True :
if p==1:
add_product()
if p==2:
search_product()
if p==3:
update_product()
if p==4:
delete_product()
if p== 5 :
break
defadd_order():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock") #change as per system
mycursor=mydb.cursor()
now = datetime.datetime.now()
#oid=now.year+now.month+now.day+now.hour+now.minute+now.second
oid=now.year+now.month+now.day
val=(oid,now,code,price,qty,supplier,cat)
mycursor.execute(sql,val)
mydb.commit()
deflist_order():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",
database="stock") #change as per system
mycursor=mydb.cursor()
mycursor.execute(sql)
print("-"*85)
print("-"*85)
for i in mycursor:
print("-"*85)
defpurchase_mgmt( ):
while True :
print("\t\t\t 1. Add Order")
if o==1 :
add_order()
if o==2 :
list_order()
if o== 3 :
break
defsales_mgmt( ):
while True :
if s== 1 :
sale_product()
if s== 2 :
list_sale()
if s== 3 :
break
deflist_database():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock") #change as per system
mycursor=mydb.cursor()
sql="show tables;"
mycursor.execute(sql)
for i in mycursor:
print(i)
defadd_user():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
val=(uid,name,paswd)
mycursor.execute(sql,val)
mydb.commit()
deflist_user():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock")
mycursor=mydb.cursor()
mycursor.execute(sql)
clrscr()
print("\t\t","-"*27)
print("\t\t","-"*27)
for i in mycursor:
print("\t\t",i[0],"\t",i[1])
print("\t\t","-"*27)
defclrscr():
print("\n"*5)
defuser_mgmt( ):
while True :
if u==1:
add_user()
if u==2:
list_user()
if u==3:
break
'''
defcreate_database():
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",da
tabase="stock") #change as per system
mycursor=mydb.cursor()
mycursor.execute(sql)
mycursor.execute(sql)
mycursor.execute(sql)
sql = "CREATE TABLE if not exists user (uid char(6) PRIMARY KEY,uname
char(30) NOT NULL,upwd char(30));"
mycursor.execute(sql)
print(" USER table created")
'''
defdb_mgmt( ):
while True :
if p==1 :
list_database()
if p== 2 :
break
while True:
#clrscr()
print("\t\t\t ****************\n")
print("\t\t 6. EXIT\n")
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
OUTPUT SCREEN
STOCK MANAGEMENT
****************
1. PRODUCT MANAGEMENT
2. PURCHASE MANAGEMENT
3. SALES MANAGEMENT
4. USER MANAGEMENT
5. DATABASE SETUP
6. EXIT
2. list Product
3. Update Product
4. Delete Product
2. list Product
3. Update Product
4. Delete Product
2. list Product
3. Update Product
4. Delete Product
PRODUCT DETAILS
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
pen
PRODUCT DETAILS
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
-----------------------------------------------
BIBLIOGRAPHY
1. http://www.google.com/
2. http://en.wikipedia.org
bySumitaArora