You are on page 1of 23

PYTHON SOURCE CODE:

#***************WOODBINE GARDENIA SCHOOL**********************


#***************PHARMACY MANAGEMENT SYSTEM**********************

################KALYANPUR KANPUR###############################

################SESSION: 2022-2023##############################

#*********Designed and maintained by:"

#*********SNEHATANDON (CLASS XII-B) ROLL NO.-


#*********SANSKRITI SRIVASTAVA (CLASS XII-A) ROLL NO.-

#*********VARDHANAM RAWAT (CLASS XII-B) ROLL NO.-

#*********YOGESH KUMAR SINGH (CLASS XII-B) ROLL NO.-

import os

import platform

import mysql.connector
mydb = mysql.connector.connect(host = "localhost", user = "yourusername", password =

"your_password")

mycursor=mydb.cursor()

P="""CREATE TABLE product(Id varchar(30), Name varchar(30), Company varchar(30), Cost


numeric(30), Manufacture Date varchar(30), Expiration_Date varchar(30))"""

mycursor.execute(P)

R="""INSERT INTO product (Id,Name,Company,Cost,Manufacture_Date,Expiration_date) values

(1001,'T-Dolo(650)','Micro-Labs',12,'01/09/2022','02/03/2023'),

(1002,'C-Evian(400)','Defi-Labs',20,'27/12/2022','02/05/2023'),

(1003,'T-Zerodol','Contra-Labs',42,'14/08/2022','12/01/2023'),

(1004,'Pantip(40)','Sci-Labs',17,'12/01/2022','27/07/2023'),
(1005,'Carca(25)','Eren-Labs',10,'04/12/2022','06/05/2023'),
(1006,'Thyronorm','Kaisen-Labs',99,'19/06/2022','05/08/2023'),

(1007,'C-Omez(20)','Vixen-Labs',61,'18/01/2022','16/09/2022'),

(1008,'Montair-LC','Ultra-Labs',58,'23/05/2022','29/06/2023'),
(1009,'T-Meftal-SPAS','Zen-Labs',14,'06/06/2022','03/02/2023
'),
(1010,'Gudcef(200)','Spy-Labs',52,'11/04/2022','25/04/2023')"""

mycursor.execute(R)
K="""CREATE TABLE customer(Customer_Id varchar(30), Customer_Name varchar(30), PhoneNo
varchar(30),Age varchar(30), Gender varchar(30), Membership varchar(30))"""

mycursor.execute(K)

M="""INSERT INTO customer (Customer_Id,Customer_Name,PhoneNo,Age,Gender,Membership)

values (101,'Loid Forger','+919783485633',21,'Male','Premium'),


(102,'Mikasa Ackerman','+919864758286',19,'Female','Platinum'),

(103,'Yoichi Isagi','+919475837465',17,'Male','Diamond'),

(104,'Hinata Hyuga','+919783546789',19,'Female','Premium')"""
mycursor.execute(M)

mydb.commit()

def MedicineInsert():

Id=input("Enter the medicine ID number : ")

Name=input("Enter the Medicine Name: ")


Company=input("Enter company of Medicine : ")

Cost=input("Enter the Cost : ")


Manufacture Date=input("Enter the Date of Manufacture : ")

Expiration_Date=input("Enter the Date of Expiry : ")

mycursor.execute('insert into product(Id,Name,Company,Cost,Manufacture_Date,Expiration_Date)

values(?,?,?,?,?,?)', (Id,Name,Company,Cost,Manufacture_Date,Expiration_Date))

mydb.commit()

print("\nNew Medicine Has Been Entered In The System Successfully!")

def customerInsert():
Customer_Id=input("Enter the Customer number : ")

Customer_Name=input("Enter the Customer Name: ")

Phoneno=input("Enter Phone no. of Customer : ")

Age=input("Enter Age of Customer : ")


Gender=input("Enter gender of customer: ")

Membership=input("Enter the membership: ")


mycursor.execute('insert into
customer(Customer_Id,Customer_Name,PhoneNo,Age,Gender,Membership) values
(?,?,?,?,?,?)',(Customer_Id,Customer_Name,Phoneno,Age,Gender,Membership))

mydb.commit()

print("\nNew Customer Record Has Been Entered In The System Successfully!")

def MedicineView():
print("Select the search criteria : ")

print("1. Medicine Id")


print("2. Medicine Name")

print("3. All")
ch=int(input("\nEnter the choice : "))

if ch==1:
s=input("Enter Medicine ID : ")
mycursor.execute('select * from product where Id=?',(s))

res=mycursor.fetchall()
print("\nDetails of the Specified Medicine areas follows:")

for row in res:


print(" Medicine Id ----->",row[0])
print(" Medicine Name ----->",row[1])

print(" Made By ----->",row[2])

print(" Cost(Rs.) ----->",row[3])


print(" Manufacture Date ----->",row[4])

print(" Expiration Date ----->",row[5])

return

elif ch==2:
s=input("Enter Medicine Name : ")
mycursor.execute('select * from product where Name=?',(s))

res=mycursor.fetchall()

print("\nDetails of the Specified Medicine areas follows:")


for row in res:
print("\n Medicine Id ----->",row[0])

print(" Medicine Name ----->",row[1])

print(" Made By ----->",row[2])

print(" Cost(Rs.) ----->",row[3])


print(" Manufacture Date ----->",row[4])

print(" Expiration Date ----->",row[5])

return

elif ch==3:
mycursor.execute('SELECT * FROM product;')

r=mycursor.fetchall()

print("\nThe Medicine Stock details areas follows : ")


print("(Medicine ID, Medicine Name, Cost, Date of Manufacture, Date of Expiry)")

for i in r:
print(i)

def viewCustomer():
print("Select the search criteria : ")

print("1. Customer ID")


print("2. Customer Name")

print("3. All")
ch=int(input("\nEnter the choice : "))

if ch==1:
s=int(input("Enter customer ID : "))
mycursor.execute('select * from customer where Customer_Id=?',(s))

res=mycursor.fetchall()
print("\nDetails of the Specified Customer areas follows:")

for row in res:


print("\n Customer Id ----->",row[0])

print(" Customer Name ----->",row[1])

print(" Phone No. ----->",row[2])

print(" Age ----->",row[3])


print(" Gender ----->",row[4])

print(" Membership ----->",row[5])

return

elif ch==2:
s=input("Enter Customer Name : ")
mycursor.execute('select * from customer where Customer_Name=?',(s))

res=mycursor.fetchall()
print("\nDetails of the Specified Customer areas follows:")

for row in res:


print("\n Customer Id ----->",row[0])

print(" Customer Name ----->",row[1])

print(" Phone No. ----->",row[2])

print(" Age ----->",row[3])

print(" Gender ----->",row[4])


print(" Membership ----->",row[5])

return

elif ch==3:
sql="select * from customer"

mycursor.execute(sql)

res=mycursor.fetchall()

print("\nThe Customer details areas follows : ")


print("(Customer ID, Customer Name, Phone No., Age, Gender, Membership)")

for x in res:
print(x)

def CustomerPurchase():
sql="select * from product"

mycursor.execute(sql)

res=mycursor.fetchall()

print("\nThe Medicine Stock details areas follows : ")


print("(Medicines ID, Medicine Name, Cost, Date of Manufacture, Date of Expiry)")

for x in res:
print(x)

cost=0.0

ch='y'

while(ch=='y'):

c1=input("\nEnter The Medicine Id To Be Purchase : ")


mycursor.execute('Select cost from product where Id=?',(c1))

res=mycursor.fetchall()
tsum=0

for x in res:
cost=float(x[0])

print (cost)

q1=int(input("Enter the quantity: "))

cc=q1*cost

print(cc)

tsum=tsum+cc
ch=input("Want to purchase more meds:")

if (ch=='Yes'):

c2=input("\nEnter The Medicine Id To Be Purchase : ")


mycursor.execute('Select cost from product where Id=?',(c2))

res=mycursor.fetchall()

for x in res:
cost=float(x[0])

print (cost)

q2=int(input("Enter the quantity: "))

ccc=q2*cost

print(ccc)

gsum=tsum+ccc

ch=input("Want to purchase more meds:")


if (ch=='No'):
print("Total cost of meds purchased is Rs.",gsum)

print("""

)))T H A N K Y O U F O R P U R C H A S I N G !(((
""")

def removeMedicine():

i=input("\nEnter the medicine Id to be deleted : ")


mycursor.execute('Delete from product where Id=?',(i))

print("Specified Medicine Record Has Been Deleted!")

return

def Exit():
Exit=input("Are you sure? ")

if (Exit== 'Yes'):
mycursor.execute('DROP TABLE product, customer;')

mydb.commit()

print("""
~~*~~*~~{G O O D B Y E !}~~*~~*~~

""")

exit()

def MenuSet(): #Function For The Student Management System

print("""
#***************WOODBINE GARDENIA SCHOOL**********************
#*
**************PHARMACY MANAGEMENT SYSTEM**********************
####################KALYANPUR KANPUR#############################

###################SESSION: 2022-2023#############################

#*********Designed and maintained by:"

#*********SNEHA TANDON (CLASS XII-B) ROLL NO.-


#*********SANSKRITI SRIVASTAVA (CLASS XII-A) ROLL NO.-

#*********VARDHANAM RAWAT (CLASS XII-B) ROLL NO.-


#*********YOGESH KUMAR SINGH (CLASS XII-B) ROLL NO.

""")
print("""
\C O N G R A T U L A T I O N S!!! /

\ /

\C O N N E C T I O N E S T A B L I S H E D !/
\ /

""")

print("""

1----> To Add Medicine

2----> To View Complete Medicine Stock

3----> To Purchase any Medicine

4----> To Remove any Medicine

5----> To Add Customer Details

6----> View Customer Details


7----> To Exit

""")

try:

#Using Exceptions For Validation


userInput = int(input("Please Select An Above Option: ")) #Will Take Input From User

except ValueError:
exit("\nHey!That's Not A Number") #Error Message

else:
print("\n") #Print New Line

if(userInput == 1):

MedicineInsert()
elif (userInput==2):

MedicineView()
elif (userInput==3):

CustomerPurchase()

elif (userInput==4):

removeMedicine()

elif (userInput==5):

customerInsert()
elif (userInput==6):

viewCustomer()

elif (userInput==7):
Exit()

else:

print("Enter correct choice. . . ")

MenuSet()

def script():

sc=True

while (sc==True):
restart = input("\nWould You Like To Restart The System? ")

if restart == "Yes" or restart == "Y":


MenuSet()

if restart == "N" or restart == "No":


print("System terminating, Goodbye.")

exit()

sc=script()
OUTPUT OF THE PROJECT:
Finally, we conclude our work and present the output of the Project.

MAIN SCREEN:
ADDING MEDICINES:
VIEWING MEDICINE:
VIEWING MEDICINE DETAILS USING MEDICINE ID:
MEDICINE STOCK DETAILS:
PURCHASE OF MEDICINES:
DELETING MEDICINE RECORD USING MEDICINE ID:
ENTERING NEW CUSTOMER RECORD:
VIEWING DETAILS OF THE CUSTOMER USING CUSTOMER
NAME:
VIEWING CUSTOMER ENTRIES IN THE SYSTEM:
TERMINATING THE SYSTEM:
MYSQL DATABASE AND TABLES USED IN THIS
PROJECT:

BACKEND DATA GENERATED THROUGH SOFTWARE:


BACKEND DATA GENERATED THROUGH SOFTWARE:
BIBLIOGRAPHY:
1. Python.org
2. Code Academy
3. Tutorialspoint.com
4. Book of SumitaArora
CONCLUSION:
This Pharmacy Management System software enhances the Pharmacy work
culture by
eliminating the human-time consuming and tedious tasks, which can be done
by this
software.
This system has the ability to keep track of records of the product’s stocks
and sales. The main purpose is effectively and easily handle pharmacy data and
its management.

You might also like