Pharmacy Management System - 12 - CS
Pharmacy Management System - 12 - CS
Pharmacy Management System - 12 - CS
Medicine Data:
import mysql.connector
mydb.commit()
print("Database Initialised")
Pharmacy:
# library import
import mysql.connector as sql
import time
import random as rd
def medicine():
# function to add a medicine
def addmedicine():
print("\n")
print("_____" * 15)
print("\n")
mid = input("Enter Medicine Id : ")
name = input("Enter Medicine Name : ")
mf = input("Enter Name of Manufacturer : ")
dom = input("Enter Date of Manufacture : ")
doe = input("Enter Date of Expiry : ")
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("_____" * 15)
print("\n")
mydb.commit()
print("BillNo\tName\t\tMedicine\t\t\t\tAmount\t\tDateofBill")
print("-" * 95)
for k in res:
print(k[0], "\t", k[1], "\t\t", k[2], "\t\t", k[3],
"\t\t", k[4])
print("_____" * 15)
print("\n")
while True:
print("_____" * 15)
print("\t\t______________TINY TOWN MED MART______________")
print("_____" * 15)
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("_____" * 15)
print("\t\t Have a medicine-free life ahead :) ")
print("_____" * 15)
break
else:
print("You're having only 8 options to choose.")
break
# setting connection
mydb = sql.connect(host="localhost", user="root",
password="rimi#5325@mysql", database="medicine_shop")
# login screen
a = rd.randint(1, 9)
b = rd.randint(1, 9)
c = rd.randint(1, 9)
d = rd.randint(1, 9)
e = rd.randint(1, 9)
num = str(a) + str(b) + str(c) + str(d) + str(e)
print("\t\t", num)
n = int(input("Enter the number shown above : "))
if str(n) == num:
print("You've successfully entered the market!")
if mydb.is_connected():
print("_____" * 15)
print("\n")
print("\t\t\tPHARMACY MANAGEMENT SYSTEM")
print("\n")
print("_____" * 15)
medicine()
print("_____" * 15)
print("\t\tThanks for visiting!")
print("_____" * 15)
else:
print("Connection Error!")
else:
print("Seems like it's not a human being. ")
print("Sorry, you can't enter this software. ")
OUTPUT:
Billing:
Displaying previous bills:
Exiting: