INTRODUCTION
TITLE
STORE MANAGEMENT SYSTEM
Specifications:
➢Managing medical stores in an effective way
and reducing paperwork.
➢Managing medicines and their bills.
➢Implementation of connectivity of python with
mysql
➢Project created on IDE Python 3.8.7 for
Windows 10
PYTHON OUTPUTS
(for the projects)
# library import
import mysql.connector as sql
import time
import random as rd
n = input("Enter password:")
def medicine():
# function to add a medicine
def addmedicine():
print("\n")
mid = input("Enter Medicine Id : ")
name = input("Enter Medicine Name : ")
mf = input("Enter Name of Manufacturer: ")
dom = input("Enter Date of Manufacture(yyyy-mm-dd): ")
doe = input("Enter Date of Expiry(yyyy-mm-dd): ")
mg = input("Enter the Weight (in mg) : ")
content = input("Enter Content : ")
price = input("Enter the Price : ")
qty = input("Enter the Quantity : ")
print("\nSTORING MEDICINE DETAILS.......")
time.sleep(2)
q = "insert into medicine
values(%s,%s,%s,%s,%s,%s,%s,%s,%s)"
data = (mid, name, mf, dom, doe, mg, content, price, qty)
cr = mydb.cursor()
cr.execute(q, data)
print("\nMedicine Inserted.......!!!!")
print("\n")
mydb.commit()
# function to show a medicine
def showmedicine():
q = "select * from medicine"
cr = mydb.cursor()
cr.execute(q)
res = cr.fetchall()
print("\n")
print("-" * 95)
print("Id\tName\t\tDate_of_Expiry\t\tPricepertab\t\tQty")
print("-" * 95)
for k in res:
print(k[0], "\t", k[1], "\t\t", k[4], "\t\t", k[-2], "\t\t", k[-1])
print("-" * 95)
print("\n")
# function to restock a medicine
def restock():
mid = input("Enter the Medicine ID : ")
qty = input("Enter the Quantity to Add : ")
q = "update medicine set qty = qty + %s where mid =
%s"
d = (qty, mid)
cr = mydb.cursor()
cr.execute(q, d)
print("\n")
print("Medicine Restocked......!!")
print("\n")
mydb.commit()
# function to search a medicine
def search():
mid = input("Enter the Medicine ID : ")
q = "select * from medicine where mid = " + mid
cr = mydb.cursor()
cr.execute(q)
k = cr.fetchone()
if k == None:
print("\nNo Medicine Available With This ID\n")
else:
print("\nMedicine Found......!!")
print("\n")
print("Id\tName\t\tDate_of_Expiry\t\tPricepertab\t\tQty")
print(k[0], "\t", k[1], "\t\t", k[4], "\t\t", k[-2], "\t\t", k[-1])
print()
# Function to delete a medicine
def deletem():
mid = input("Enter the Medicine ID : ")
q = "delete from medicine where mid = " + mid
cr = mydb.cursor()
cr.execute(q)
print("\nMedicine Deleted......!!\n")
print("\n\n")
mydb.commit()
# function for billing
def billing():
bno = input("Enter Bill No. : ")
cname = input("Enter Customer's Name : ")
bdate = input("Enter Bill Date (yyyy-mm-dd) : ")
amount = 0
medicine =""
cr = mydb.cursor()
while True:
mid = input("Enter Medicine id : ")
q = "select * from medicine where mid = " + mid
cr.execute(q)
res = cr.fetchone()
if res == None:
print("\nNo Medicine Available With This ID\n")
else:
price = int(res[-2])
medicine += res[1] + " "
print("Price of Medicine is : ", price)
qty = int(input("Enter the Quantity to be Purchased :
"))
bill = price * qty
amount += bill
print("Amount for Medicine ", amount)
ans = input("Are There More Medicine to be
Purchased(yes/no) : ")
if ans.lower() == "no":
print("Calculating Your Bill ")
break
print("Total Bill Amount is : ", amount)
q = "insert into bill values(%s,%s,%s,%s,%s)"
data= (bno,cname,medicine,amount,bdate)
cr.execute(q,data)
mydb.commit()
print(" Bill Generated !!! \n\n")
def showbills():
q = "select * from bill"
cr = mydb.cursor()
cr.execute(q)
res = cr.fetchall()
print("\n")
print("BillNo\tName\t\tMedicine\t\t\t\tAmount\t\tDateofBill")
for k in res:
print(k[0], "\t", k[1], "\t\t", k[2], "\t\t", k[3], "\t\t", k[4])
print("\n")
while True:
print("\t\t\t Medical Store")
print("\n")
print("Press 1 - Add New Medicine")
print("Press 2 - Restock a Medicine")
print("Press 3 - Show All Medicines")
print("Press 4 - Search a Medicine")
print("Press 5 - Delete a Medicine")
print("Press 6 - Billing")
print("Press 7 - Display Previous Bills")
print("press 8 - to Exit")
print("\n")
opt = int(input("Enter Your Choice : "))
if opt == 1:
addmedicine()
elif opt == 2:
restock()
elif opt == 3:
showmedicine()
elif opt == 4:
search()
elif opt == 5:
deletem()
elif opt == 6:
billing()
elif opt == 7:
showbills()
elif opt == 8:
print("THANKS FOR VISITING..!!")
print("\t\t Have a Medicine-Free Life Ahead")
break
else:
print("You're having only 8 options to choose -___-")
break
# setting connection
mydb = sql.connect(host="localhost", user="root",
password=n)
cr = mydb.cursor()
q = "create database IF NOT EXISTS medicine_shop;"
cr.execute(q)
q = "use medicine_shop"
cr.execute(q)
q = '''create table if not exists medicine(
mid integer primary key,
mname varchar(30) not null,
manufacturer varchar(50),
dateofm date,
dateofexp date not null,
mg float,
content varchar(100),
pricepertab float,
qty integer)'''
cr.execute(q)
q = '''
create table if not exists bill(
billid integer primary key,
cname varchar(50),
medicine_bought varchar(100),
amount float,
billdate date)'''
cr.execute(q)
q='''
insert into medicine(
mid,mname,manufacturer,dateofm,dateofexp,mg,content,pric
epertab,qty)
values(
568,'ColdT','Vix','2023-07-24','2024-12-23',100,'Salts',0.50,10
7)
'''
cr.execute(q)
q='''
insert into medicine(
mid,mname,manufacturer,dateofm,dateofexp,mg,content,pric
epertab,qty)
values(
567,'GasT','Liv','2023-08-12','2025-01-29',150,'Salts and
Acids',1,89)
'''
cr.execute(q)
mydb.commit()
print("Database Initialised")
# login screen
print("You've Successfully Entered the Market..!!")
if mydb.is_connected():
print("\n")
print("\t\t\tCHEMIST SHOP MANAGEMENT")
print("\n")
medicine()
print("\t\tThanks for Visiting....!!!")
Python 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
= RESTART: C:\Users\AYUSH\OneDrive\Desktop\Proj\chemist.py
Enter password:sqlpython
Database Exists
You've Successfully Entered the Market..!!
CHEMIST SHOP MANAGEMENT
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 1
Enter Medicine Id : 101
Enter Medicine Name : Cold
Enter Name of Manufacturer : Miku
Enter Date of Manufacture : 2023-12-02
Enter Date of Expiry : 2024-12-25
Enter the Weight (in mg) : 100
Enter Content : Salts
Enter the Price : 30
Enter the Quantity : 12
STORING MEDICINE DETAILS.......
Medicine Inserted.......!!!!
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
101 Cold 2024-12-25 30.0 12
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 2
Enter the Medicine ID : 101
Enter the Quantity to Add : 10
Medicine Restocked......!!
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
101 Cold 2024-12-25 30.0 22
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
101 Cold 2024-12-25 30.0 22
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 4
Enter the Medicine ID : 101
Medicine Found......!!
Id Name Date_of_Expiry Price Qty
101 Cold 2024-12-25 30.0 22
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 5
Enter the Medicine ID : 102
Medicine Deleted......!!
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
101 Cold 2024-12-25 30.0 22
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 6
Enter Bill No. : 1
Enter Customer's Name : K
Enter Bill Date (yyyy-mm-dd) : 2023-11-25
Enter Medicine id : 101
Price of Medicine is : 30
Enter the Quantity to be Purchased : 15
Amount for Medicine 450
Are There More Medicine to be Purchased : no
Calculating Your Bill
Total Bill Amount is : 450
Bill Generated !!!
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
101 Cold 2024-12-25 30.0 22
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 7
BillNo Name Medicine Amount
DateofBill
1 K Cold 450.0 2023-11-25
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 5
Enter the Medicine ID : 101
Medicine Deleted......!!
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 3
-----------------------------------------------------------------------------------------------
Id Name Date_of_Expiry Price Qty
-----------------------------------------------------------------------------------------------
Medical Store
Press 1 - Add New Medicine
Press 2 - Restock a Medicine
Press 3 - Show All Medicines
Press 4 - Search a Medicine
Press 5 - Delete a Medicine
Press 6 - Billing
Press 7 - Display Previous Bills
press 8 - to Exit
Enter Your Choice : 8
THANKS FOR VISITING..!!
Have a Medicine-Free Life Ahead
Thanks for Visiting....!!!