DBMS Final Report
DBMS Final Report
Bachelor of Engineering in
Computer Science & Engineering
By
RISHABH KUMAR PATEL (1CR21CS146)
2023-24
CMR INSTITUTE OF TECHNOLOGY
Affiliated to VTU, Approved by AICTE, Accredited by NBA and NAAC with “A++” Grade
ITPL MAIN ROAD, BROOKFIELD, BENGALURU-560037, KARNATAKA, INDIA
CERTIFICATE
This is to certify that the Database Management System Project work entitled “PHARMACY
MANAGEMENT SYSTEM” has been carried out by Rishabh Kumar Patel, 1CR21CS146
and Ritesh Kumar Singh, 1CR21CS149 bonafide students of CMR Institute of Technology,
Bengaluru in partial fulfillment for the award of the Degree of Bachelor of Engineering in
Computer Science and Engineering of the Visvesvaraya Technological University, Belagavi
during the year 2023-2024. It is certified that all corrections/suggestions indicated for the
Internal Assessment have been incorporated in the report deposited in the departmental library.
This Database Management System Project report has been approved as it satisfies the academic
requirements in respect of project work prescribed for the said Degree.
_____________________________ _____________________________
Signature of Guide Signature of HOD
Dr. Sanchari Saha Dr. Shreekanth M Prabhu
Assistant Professor Professor & HoD
Dept. of CSE, CMRIT Dept. of CSE, CMRIT
External Viva
1.
2.
ii
DECLARATION
We, the students of V semester from Department of Computer Science and Engineering, CMR
Institute of Technology, Bangalore declare that the project work entitled "PHARMACY
MANAGEMENT SYSTEM" has been successfully completed under the guidance of Dr.
Sanchari Saha, Assistant Professor, Dept. of CSE, Dept. of Computer Science and Engineering,
CMR Institute of technology, Bengaluru. This project work is submitted in partial fulfillment of
the requirements for the award of the Degree of Bachelor of Engineering in Computer Science and
Engineering during the academic year 2023-2024. The matter embodied in the project report has
not been submitted previously by anybody for the award of any degree or diploma to any
university.
Place: Bangalore
Date: 03-03-2024
Team members:
iii
ABSTRACT
iv
ACKNOWLEDGEMENT
I take this opportunity to express my sincere gratitude and respect to CMR Institute of
Technology, Bengaluru for providing me a platform to pursue my studies and carry out the
Database Management System Project.
It gives me an immense pleasure to express my deep sense of gratitude to Dr. Sanjay
Jain, Principal, CMRIT, Bengaluru, for his constant encouragement.
I would like to extend my sincere gratitude to Dr. Shreekanth M Prabhu, HOD,
Department of Computer Science and Engineering, CMRIT, Bengaluru, who has been a constant
support and encouragement throughout the course of this project.
I would like to thank my guide Dr. Sanchari Saha, Assistant Professor, Department of
Computer Science and Engineering, for the valuable guidance throughout the tenure of the project
work.
I would also like to thank all the faculty members of Department of Computer Science and
Engineering who directly or indirectly encouraged me.
Finally, I thank my parents and friends for all the moral support they have given me during
the completion of this work.
v
TABLE OF CONTENTS
vi
LIST OF FIGURES
vii
LIST OF TABLES
viii
PHARMACY MANAGEMENT SYSTEM
`
CHAPTER 1
INTRODUCTION
The main aim of the project is the management of the database of the pharmaceutical shop.
This project is insight into the design and implementation of a Pharmacy Management
System. This is done by creating a database of the available medicines in the shop. The
primary aim of pharmacy management system is to improve accuracy and enhance safety
and efficiency in the pharmaceutical store. The aim of this project is to develop software
for the effective management of a pharmaceutical store. We have developed this software
for ensuring effective policing by providing statistics of the drugs in stock. The database is
then connected to the main program by using interconnection of the Visual Basic program
and the database already created. Pharmacy management system is useful to maintain
correct database by providing an option to update the drugs in stock. This is pharmacy
management system; it is used to manage most pharmacy related activities in the pharmacy.
Pharmacy management system is a management system that is designed to improve
accuracy and to enhance safety and efficiency in the pharmaceutical store. This program
can be used in any pharmaceutical shops having a database to maintain. It is a computer
based system which helps the Pharmacist to improve inventory management, cost, medical
safety etc. The software used can generate reports, as per the user’s requirements. Using
this pharmacy management system user is also able to generate report within a specified
period of time. The system allows the user to enter a manufacturing and expiry date for a
particular product or drug during opening stock and sales transaction. The software can
print invoices, bills, receipts etc. It can also maintain the record of supplies sent in by the
supplier. The system will also give report showing the list of products expiry after a
specified date before the product eventually expires. The system services and goals are
established by consultation with system user. It also 2 involves manual entry upon arrival
of new batches of drugs and upon drug movement out of the pharmacy for a certain period.
Pharmacy management system is being build. Pharmacy management system is robust,
integrated technology. every month, the pharmacist may want to generate report for the
movement of drugs in and out of the pharmacy, getting information about the drugs e.g.
expiry date, date purchased, number of drug type left, location of a drug in the pharmacy.
It may help collecting perfect management in details. In a very short time, the collection
will be obvious, simple and sensible. It will help a person to know the management of
passed year perfectly and vividly. It also helps in current all works relative to Pharmacy
Management System. It will be also reduced the cost of collecting the management &
collection procedure will go on smoothly.
• In computer system the person has to fill the various forms & number of copies
of the forms can be easily generated at a time.
• In computer system, it is not necessary to create the manifest but we can directly
print it, which saves our time.
• To assist the staff in capturing the effort spent on their respective working areas.
• To utilize resources in an efficient manner by increasing their productivity
through automation.
1. Processor : Intel i3
3. Processor : 2.4GHZ
4. Memory : 32GB
DESIGN
DataFrameLeft=LabelFrame(DataFrame,bd=10,relief=RIDGE,padx=20,text="Medicine
Information",fg="darkgreen",font=("arial",10,"bold"))
DataFrameLeft.place(x=0,y=5,width=420,height=360)
lblstoreid=Label(DataFrameLeft,font=("arial",12,"bold"),text="Store
ID",fg="black",padx=2,pady=6)
lblSideEffects=Label(DataFrameLeft,font=("arial",12,"bold"),text="Side
Effect:",padx=2,pady=6)
lblSideEffects.grid(row=3,column=0,sticky=W)
txtSideEffects=Entry(DataFrameLeft,textvariable=self.sideeffect_var,font=("arial",13,"bo
ld"),bg="white",bd=2,relief=RIDGE,width=24)
txtSideEffects.grid(row=3,column=1)
lblPrice=Label(DataFrameLeft,font=("arial",12,"bold"),text="Tablets
Price:",padx=2,pady=6)
lblPrice.grid(row=4,column=0,sticky=W)
txtPrice=Entry(DataFrameLeft,textvariable=self.price_var,font=("arial",13,"bold"),bg="w
hite",bd=2,relief=RIDGE,width=24)
side_leftframe=Frame(DataFrameLeft,bd=4,relief=RIDGE,bg="white")
side_leftframe.place(x=0,y=180,width=290,height=150)
scc_x=ttk.Scrollbar(side_leftframe,orient=HORIZONTAL)
scc_x.pack(side=BOTTOM,fill=X)
scc_y=ttk.Scrollbar(side_leftframe,orient=VERTICAL)
scc_y.pack(side=RIGHT,fill=Y)
self.medicineinfo_table=ttk.Treeview(side_leftframe,columns=("storeid","ref","typeofme
d","sideeffect","pricemed"),xscrollcommand=scc_x.set,yscrollcommand=scc_y.set)
scc_x.config(command=self.medicineinfo_table.xview)
scc_y.config(command=self.medicineinfo_table.yview)
self.medicineinfo_table["show"]="headings"
self.medicineinfo_table.heading("storeid",text="Store ID")
self.medicineinfo_table.heading("ref",text="Ref")
self.medicineinfo_table.heading("typeofmed",text="Type Of Med")
self.medicineinfo_table.heading("sideeffect",text="Side Effect")
self.medicineinfo_table.heading("pricemed",text="Price")
self.medicineinfo_table.pack(fill=BOTH,expand=1)
self.medicineinfo_table.column("storeid",width=80)
self.medicineinfo_table.column("ref",width=80)
self.medicineinfo_table.column("typeofmed",width=80)
self.medicineinfo_table.column("sideeffect",width=80)
self.medicineinfo_table.column("pricemed",width=80)
self.fetch_dataMedinfo()
self.medicineinfo_table.bind("<ButtonRelease-1>",self.Medget_cursorinfo)
btnAddmed=Button(down_frame1,text="UPDATE",font=("arial",8,"bold"),bg="purple",p
ady=2,fg="white",width=9,command=self.UpdateMedinfo)
btnAddmed.grid(row=1,column=0)
btnAddmed=Button(down_frame1,text="DELETE",font=("arial",8,"bold"),bg="red",pad
y=2,fg="white",width=9,command=self.DeleteMedinfo)
btnAddmed=Button(down_frame1,text="CLEAR",font=("arial",8,"bold"),bg="orange",pa
dy=2,fg="white",width=9,command=self.clearmedinfo)
btnAddmed.grid(row=3,column=0)
btnAddmed=Button(down_frame1,text="REFRESH",font=("arial",8,"bold"),bg="green",
pady=2,fg="white",width=9,command=self.refreshinfo)
btnAddmed.grid(row=4,column=0)
DataFramemid=LabelFrame(DataFrame,bd=10,relief=RIDGE,padx=20,text="Patient
Info",fg="darkgreen",font=("arial",10,"bold"))
DataFramemid.place(x=420,y=5,width=405,height=360)
lblpatientid=Label(DataFramemid,font=("arial",12,"bold"),text="Patient
ID",fg="black",padx=2,pady=6)
lblpatientid.grid(row=0,column=0,sticky=W)
txtpatientid=Entry(DataFramemid,textvariable=self.patientid_var,font=("arial",13,"bold")
,bg="white",bd=2,relief=RIDGE,width=24)
txtpatientid.grid(row=0,column=1)
lblExDate=Label(DataFramemid,font=("arial",12,"bold"),text="Patient
Name",padx=2,pady=6)
lblExDate.grid(row=1,column=0,sticky=W)
txtExDate=Entry(DataFramemid,textvariable=self.patientnamevar,font=("arial",13,"bold"
),bg="white",bd=2,relief=RIDGE,width=24)
txtExDate.grid(row=1,column=1)
lblAddresspatient=Label(DataFramemid,font=("arial",12,"bold"),text="Address",padx=2,
pady=6)
txtAddresspatient=Entry(DataFramemid,textvariable=self.addresspatient_var,font=("arial
",13,"bold"),bg="white",bd=2,relief=RIDGE,width=24)
txtAddresspatient.grid(row=2,column=1)
lblSymtoms=Label(DataFramemid,font=("arial",12,"bold"),text="Symtoms",padx=2,pad
y=6)
lblSymtoms.grid(row=3,column=0,sticky=W)
txtSymtoms=Entry(DataFramemid,textvariable=self.symptoms_var,font=("arial",13,"bold
"),bg="white",bd=2,relief=RIDGE,width=24)
txtSymtoms.grid(row=3,column=1)
lblDoctoridpatient=Label(DataFramemid,font=("arial",12,"bold"),text="Doctor
ID",padx=2,pady=6)
lblDoctoridpatient.grid(row=4,column=0,sticky=W)
txtDoctoridpatient=Entry(DataFramemid,textvariable=self.patientdoctorid_var,font=("aria
l",13,"bold"),bg="white",bd=2,relief=RIDGE,width=24)
txtDoctoridpatient.grid(row=4,column=1)
side_leftpatientframe=Frame(DataFramemid,bd=4,relief=RIDGE,bg="white")
side_leftpatientframe.place(x=0,y=180,width=280,height=150)
patientsc_x=ttk.Scrollbar(side_leftpatientframe,orient=HORIZONTAL)
patientsc_x.pack(side=BOTTOM,fill=X)
patientsc_y=ttk.Scrollbar(side_leftpatientframe,orient=VERTICAL)
patientsc_y.pack(side=RIGHT,fill=Y)
self.patient_table=ttk.Treeview(side_leftpatientframe,columns=("patientid","patientname"
,"address","symtoms","doctorid"),xscrollcommand=patientsc_x.set,yscrollcommand=pati
entsc_y.set)
patientsc_x.config(command=self.patient_table.xview)
patientsc_y.config(command=self.patient_table.yview)
self.patient_table["show"]="headings"
self.patient_table.heading("patientid",text="Patient ID")
self.patient_table.heading("patientname",text="Patient Name")
self.patient_table.heading("address",text="Address")
self.patient_table.column("patientid",width=80)
self.patient_table.column("patientname",width=80)
self.patient_table.column("address",width=80)
self.patient_table.column("symtoms",width=80)
self.patient_table.column("doctorid",width=80)
self.fetch_datapatient()
self.patient_table.bind("<ButtonRelease-1>",self.Medget_cursorpatient)
down_frame1=Frame(DataFramemid,border=4,relief=RIDGE,bg="darkgreen")
down_frame1.place(x=285,y=185,width=80,height=140)
btnAddmed=Button(down_frame1,text="ADD",font=("arial",8,"bold"),bg="lime",pady=2
,fg="white",width=9,command=self.Addpatient)
btnAddmed.grid(row=0,column=0)
btnAddmed=Button(down_frame1,text="UPDATE",font=("arial",8,"bold"),bg="purple",p
ady=2,fg="white",width=9,command=self.Updatepatient)
btnAddmed.grid(row=1,column=0)
btnAddmed=Button(down_frame1,text="DELETE",font=("arial",8,"bold"),bg="red",pad
y=2,fg="white",width=9,command=self.Deletepatient)
btnAddmed.grid(row=2,column=0)
btnAddmed=Button(down_frame1,text="CLEAR",font=("arial",8,"bold"),bg="orange",pa
dy=2,fg="white",width=9,command=self.clearpatient)
btnAddmed.grid(row=3,column=0)
btnAddmed=Button(down_frame1,text="REFRESH",font=("arial",8,"bold"),bg="green",
pady=2,fg="white",width=9,command=self.refreshpatient)
btnAddmed.grid(row=4,column=0)
DataFrameRight=LabelFrame(DataFrame,bd=10,relief=RIDGE,padx=20,text="Medicine
Stock",fg="darkgreen",font=("arial",10,"bold"))
DataFrameRight.place(x=830,y=5,width=420,height=360)
lblrefno=Label(DataFrameRight,font=("arial",12,"bold"),text="Reference
No:",padx=15,pady=6)
lblrefno.place(x=0,y=10)
txtrefno=Entry(DataFrameRight,textvariable=self.refMed_var,font=("arial",13,"bold"),bg
="white",bd=2,relief=RIDGE,width=24)
txtrefno.place(x=145,y=10)
lblmedname=Label(DataFrameRight,font=("arial",12,"bold"),text="Company
Name:",padx=15,pady=6)
lblmedname.place(x=0,y=40)
txtmedname=Entry(DataFrameRight,textvariable=self.companyname_var,font=("arial",13
,"bold"),bg="white",bd=2,relief=RIDGE,width=24)
txtmedname.place(x=145,y=40)
lblmedname=Label(DataFrameRight,font=("arial",12,"bold"),text="Medicine
Name:",padx=15,pady=6)
lblmedname.place(x=0,y=70)
txtmedname=Entry(DataFrameRight,textvariable=self.medname_var,font=("arial",13,"bol
d"),bg="white",bd=2,relief=RIDGE,width=24)
txtmedname.place(x=145,y=70)
lblmedname=Label(DataFrameRight,font=("arial",12,"bold"),text="Quantity:",padx=15,p
ady=6)
lblmedname.place(x=0,y=100)
txtmedname=Entry(DataFrameRight,textvariable=self.medquantity_var,font=("arial",13,"
bold"),bg="white",bd=2,relief=RIDGE,width=24)
txtmedname.place(x=145,y=100)
txtmedname=Entry(DataFrameRight,textvariable=self.expdate_var,font=("arial",13,"bold
"),bg="white",relief=RIDGE,width=24)
txtmedname.place(x=145,y=130)
side_frame=Frame(DataFrameRight,bd=4,relief=RIDGE,bg="white")
side_frame.place(x=0,y=170,width=290,height=160)
sct_x=ttk.Scrollbar(side_frame,orient=HORIZONTAL)
sct_x.pack(side=BOTTOM,fill=X)
sct_y=ttk.Scrollbar(side_frame,orient=VERTICAL)
sct_y.pack(side=RIGHT,fill=Y)
self.medicine_table=ttk.Treeview(side_frame,columns=("ref","companyname","medname
","quantity","expdate"),xscrollcommand=sct_x.set,yscrollcommand=sct_y.set)
sct_x.config(command=self.medicine_table.xview)
sct_y.config(command=self.medicine_table.yview)
self.medicine_table["show"]="headings"
self.medicine_table.heading("ref",text="Ref")
self.medicine_table.heading("companyname",text="Company Name")
self.medicine_table.heading("medname",text="Medicine Name")
self.medicine_table.heading("quantity",text="Quantity")
self.medicine_table.heading("expdate",text="Exp Date")
self.medicine_table.pack(fill=BOTH,expand=1)
self.medicine_table.column("ref",width=100)
self.medicine_table.column("medname",width=100)
self.medicine_table.column("companyname",width=100)
self.medicine_table.column("quantity",width=100)
self.medicine_table.column("expdate",width=100)
self.fetch_dataMed()
self.medicine_table.bind("<ButtonRelease-1>",self.Medget_cursor)
down_frame=Frame(DataFrameRight,border=4,relief=RIDGE,bg="darkgreen")
down_frame.place(x=300,y=185,width=80,height=140)
btnAddmed=Button(down_frame,text="ADD",font=("arial",8,"bold"),bg="lime",pady=2,
fg="white",width=9,command=self.AddMed)
btnAddmed=Button(down_frame,text="UPDATE",font=("arial",8,"bold"),bg="purple",pa
dy=2,fg="white",width=9,command=self.UpdateMed)
btnAddmed.grid(row=1,column=0)
btnAddmed=Button(down_frame,text="DELETE",font=("arial",8,"bold"),bg="red",pady
=2,fg="white",width=9,command=self.DeleteMed)
btnAddmed.grid(row=2,column=0)
btnAddmed=Button(down_frame,text="CLEAR",font=("arial",8,"bold"),bg="orange",pad
y=2,fg="white",width=9,command=self.clearmed)
btnAddmed.grid(row=3,column=0)
btnAddmed=Button(down_frame,text="REFRESH",font=("arial",8,"bold"),bg="green",p
ady=2,fg="white",width=9,command=self.refresh)
btnAddmed.grid(row=4,column=0)
DataFrameDoctor=LabelFrame(DataFrame,bd=10,relief=RIDGE,padx=20,text="Doctor",
fg="darkgreen",font=("arial",10,"bold"))
DataFrameDoctor.place(x=0,y=365,width=1250,height=100)
lbldoctorid=Label(DataFrameDoctor,font=("arial",12,"bold"),text="Doctor
ID:",padx=15,pady=6)
lbldoctorid.grid(row=0,column=0,sticky=W)
conndoctorid=mysql.connector.connect(host="localhost",username="root",password="Pri
shabh@7044",database="mydata")
my_cursordoctorid=conndoctorid.cursor()
ref_combodoctorid=ttk.Combobox(DataFrameDoctor,textvariable=self.doctordoctorid_va
r,width=22,font=("arial",12,"bold"),state="readonly")
ref_combodoctorid["values"]=rowsdoctorid
ref_combodoctorid.current(0)
ref_combodoctorid.grid(row=0,column=1)
lbldoctorpatientid=Label(DataFrameDoctor,font=("arial",12,"bold"),text="Patient
ID",padx=15,pady=6)
lbldoctorpatientid.grid(row=1,column=0,sticky=W)
conndoctorpatientid=mysql.connector.connect(host="localhost",username="root",passwor
d="Prishabh@7044",database="mydata")
my_cursordoctorpatientid=conndoctorpatientid.cursor()
my_cursordoctorpatientid.execute("select PatientID from Patient")
rowsdoctorpatientid=my_cursordoctorpatientid.fetchall()
ref_combodoctorpatientid=ttk.Combobox(DataFrameDoctor,textvariable=self.doctorpatie
ntid_var,width=22,font=("arial",12,"bold"),state="readonly")
ref_combodoctorpatientid["values"]=rowsdoctorpatientid
ref_combodoctorpatientid.current(0)
ref_combodoctorpatientid.grid(row=1,column=1)
lbldoctormedname=Label(DataFrameDoctor,font=("arial",12,"bold"),text="Medicine
Name:",padx=15,pady=6)
lbldoctormedname.grid(row=0,column=5)
conndoctormedname=mysql.connector.connect(host="localhost",username="root",passw
ord="Prishabh@7044",database="mydata")
my_cursordotormedname=conndoctormedname.cursor()
my_cursordotormedname.execute("select distinct MedicineName from
MedicineStock")
rowsdoctormedname=my_cursordotormedname.fetchall()
ref_combodoctormedname=ttk.Combobox(DataFrameDoctor,textvariable=self.doctormed
name,width=22,font=("arial",12,"bold"),state="readonly")
ref_combodoctormedname["values"]=rowsdoctormedname
ref_combodoctormedname.current(0)
ref_combodoctormedname.grid(row=0,column=6)
lbldoctordose=Label(DataFrameDoctor,font=("arial",12,"bold"),text="Med
Dosage",padx=15,pady=6)
lbldoctordose.grid(row=1,column=3)
txtdoctordose=Entry(DataFrameDoctor,textvariable=self.doctordoge_var,font=("arial",13,
"bold"),bg="white",bd=2,relief=RIDGE,width=24)
txtdoctordose.grid(row=1,column=4)
lbldoctorpatientname=Label(DataFrameDoctor,font=("arial",12,"bold"),text="Patient
Name",padx=15,pady=6)
lbldoctorpatientname.grid(row=0,column=3)
conndoctorpatientname=mysql.connector.connect(host="localhost",username="root",pass
word="Prishabh@7044",database="mydata")
my_cursordotorptientname=conndoctorpatientname.cursor()
my_cursordotorptientname.execute("select distinct PatientName from Patient")
rowsdoctorpatientname=my_cursordotorptientname.fetchall()
ref_combodoctorpatientname=ttk.Combobox(DataFrameDoctor,textvariable=self.doctorp
atientname_var,width=22,font=("arial",12,"bold"),state="readonly")
ref_combodoctorpatientname["values"]=rowsdoctorpatientname
ref_combodoctorpatientname.current(0)
ref_combodoctorpatientname.grid(row=0,column=4)
btnAdddoctor=Button(DataFrameDoctor,text="PRESCRIBE",font=("arial",8,"bold"),bg=
"GREEN",pady=2,fg="white",width=15,command=self.Adddoctor)
btnAdddoctor.place(x=910,y=40)
btnview=Button(DataFrameDoctor,text="VIEW",font=("arial",8,"bold"),bg="GREEN",p
ady=2,fg="white",width=15,command=self.viewdoctor)
btnview.place(x=1010,y=40)
#+++++++++++++++++++++++++++++++Billing++++++++++++++++++++++++
self.billID_var=StringVar()
self.billdoctorid=self.doctordoctorid_var
self.billpatientid=self.doctorpatientid_var
self.billpatientname_var=self.doctorpatientname_var
DataFrameBilling=LabelFrame(DataFrame,bd=10,relief=RIDGE,padx=20,text="Billing",
fg="darkgreen",font=("arial",10,"bold"))
DataFrameBilling.place(x=0,y=465,width=1250,height=100)
lblbillid=Label(DataFrameBilling,font=("arial",12,"bold"),text="Bill
ID",padx=15,pady=6)
lblbillid.grid(row=0,column=0,sticky=W)
combillid=ttk.Combobox(DataFrameBilling,textvariable=self.billID_var,state="readonly"
,font=("arial",12,"bold"),width=22)
combillid["values"]=("9001","9002","9003","9004","9005","9006","9007")
combillid.current(0)
combillid.grid(row=0,column=1)
lblbilldoctorid=Label(DataFrameBilling,font=("arial",12,"bold"),text="Doctor
ID",padx=15,pady=6)
lblbilldoctorid.grid(row=1,column=0,sticky=W)
txtbilldoctorid=Label(DataFrameBilling,textvariable=self.billdoctorid,font=("arial",13,"b
old"),bg="white",bd=2,relief=RIDGE,width=22)
txtbilldoctorid.grid(row=1,column=1,sticky=W)
lblbillpatientid=Label(DataFrameBilling,font=("arial",12,"bold"),text="Patient
ID",padx=15,pady=6)
lblbillpatientid.grid(row=0,column=2,sticky=W)
txtbillpatientid=Label(DataFrameBilling,textvariable=self.billpatientid,font=("arial",13,"b
old"),bg="white",bd=2,relief=RIDGE,width=22)
txtbillpatientid.grid(row=0,column=3,sticky=W)
lblbillpatientname=Label(DataFrameBilling,font=("arial",12,"bold"),text="Patient
Name",padx=15,pady=6)
lblbillpatientname.grid(row=1,column=2,sticky=W)
txtbillpatientname=Label(DataFrameBilling,textvariable=self.billpatientname_var,font=("
arial",13,"bold"),bg="white",bd=2,relief=RIDGE,width=24)
txtbillpatientname.grid(row=1,column=3,sticky=W)
lblbilltotalamount=Label(DataFrameBilling,font=("arial",12,"bold"),text="Amount",padx
=15,pady=6)
lblbilltotalamount.grid(row=0,column=4,sticky=W)
txtbilltotalamount=Entry(DataFrameBilling,textvariable=self.billtotal_var,font=("arial",1
2,"bold"),bg="white",relief=RIDGE,width=22)
txtbilltotalamount.grid(row=0,column=5,sticky=W)
btnbillPrint=Button(DataFrameBilling,text="Bill",font=("arial",8,"bold"),bg="red",pady=
2,fg="white",width=15,command=self.Billing)
btnbillPrint.place(x=910,y=40)
def Billing(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("insert into
Bill(BillID,PatientID,DoctorID,PatientName,Amount) values(%s,%s,%s,%s,%s)",(
self.billID_var.get(),
self.billpatientid.get(),
self.billdoctorid.get(),
self.billpatientname_var.get(),
self.billtotal_var.get()
))
messagebox.showinfo("Success","Billing Done")
conn.commit()
conn.close()
output_file = 'Bill.xlsx'
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
wb = Workbook()
ws = wb.active
row_num = 1
column_num = 1
for field in main_list:
ws.cell(row=row_num, column=column_num, value=field)
column_num += 1
row_num = 2
for row in rows:
column_num = 1
for field_value in row:
ws.cell(row=row_num, column=column_num, value=field_value)
column_num += 1
row_num += 1
wb.save(output_file)
conn.commit()
conn.close()
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("insert into
Doctor(DoctorID,PatientID,MedicineName,Dosage,PatientName)
values(%s,%s,%s,%s,%s)",(
self.doctordoctorid_var.get(),
self.doctorpatientid_var.get(),
self.doctormedname.get(),
self.doctordoge_var.get(),
self.doctorpatientname_var.get()
))
def viewdoctor(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("""
create view MedDetail as
select CompanyName ,MedicineName
from MedicineStock
""")
conn.commit()
conn.close()
DataFrame=Frame(self.root,bd=15,relief=RIDGE)
DataFrame.place(x=0,y=40,width=1275,height=600)
side_frame=Frame(DataFrame,bd=4,relief=RIDGE,bg="white")
side_frame.place(x=200,y=100,width=600,height=400)
sct_x=ttk.Scrollbar(side_frame,orient=HORIZONTAL)
sct_x.pack(side=BOTTOM,fill=X)
sct_y=ttk.Scrollbar(side_frame,orient=VERTICAL)
sct_y.pack(side=RIGHT,fill=Y)
self.view_table=ttk.Treeview(side_frame,columns=("ref","companyname"),xscrollcomma
nd=sct_x.set,yscrollcommand=sct_y.set)
sct_x.config(command=self.view_table.xview)
sct_y.config(command=self.view_table.yview)
self.view_table["show"]="headings"
self.view_table.heading("ref",text="Company Name")
self.view_table.heading("companyname",text="Medicine Name")
self.view_table.pack(fill=BOTH,expand=1)
self.view_table.column("ref",width=100)
self.view_table.column("companyname",width=100)
self.fetch_view()
def fetch_view(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("select * from MedDetail")
rows=my_cursor.fetchall()
if len(rows)!=0:
self.view_table.delete(*self.view_table.get_children())
for i in rows:
self.view_table.insert("",END,values=i)
conn.commit()
conn.close()
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("insert into
MedicineStock(Ref,CompanyName,MedicineName,Quantity,ExpDate)
values(%s,%s,%s,%s,%s)",(
self.refMed_var.get(),
self.companyname_var.get(),
self.medname_var.get(),
self.medquantity_var.get(),
self.expdate_var.get()
))
conn.commit()
self.fetch_dataMed()
self.Medget_cursor()
conn.close()
messagebox.showinfo("Success","Medicine Added")
def refresh(self):
self.fetch_dataMed()
def fetch_dataMed(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("select * from MedicineStock")
rows=my_cursor.fetchall()
if len(rows)!=0:
self.medicine_table.delete(*self.medicine_table.get_children())
for i in rows:
self.medicine_table.insert("",END,values=i)
conn.commit()
conn.close()
def Medget_cursor(self,event=""):
cursor_row=self.medicine_table.focus()
content=self.medicine_table.item(cursor_row)
row=content["values"]
self.refMed_var.set(row[0])
self.companyname_var.set(row[1])
self.medname_var.set(row[2])
self.medquantity_var.set(row[3])
self.expdate_var.set(row[4])
def UpdateMed(self):
if self.refMed_var.get()=="" or self.medname_var.get()=="" or
self.medquantity_var.get()=="":
messagebox.showerror("Error","All fields are Required!")
else:
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("update MedicineStock set
CompanyName=%s,MedicineName=%s,Quantity=%s ,ExpDate=%s where Ref=%s",(
self.companyname_var.get(),
self.medname_var.get(),
self.medquantity_var.get(),
self.expdate_var.get(),
self.refMed_var.get()
))
def DeleteMed(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
sql="delete from MedicineStock where Ref=%s"
val=(self.refMed_var.get(),)
my_cursor.execute(sql,val)
conn.commit()
self.fetch_dataMed()
self.fetch_dataMedinfo()
conn.close()
def clearmed(self):
self.refMed_var.set("")
self.medname_var.set("")
self.companyname_var.set("")
self.medquantity_var.set("")
self.expdate_var.set("")
#_______________________________________________
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("insert into
MedicineInfo(StoreID,Ref,MedType,SideEffect,Price) values(%s,%s,%s,%s,%s)",(
self.storeid_var.get(),
def refreshinfo(self):
self.fetch_dataMedinfo()
def fetch_dataMedinfo(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("select * from MedicineInfo")
rows=my_cursor.fetchall()
if len(rows)!=0:
self.medicineinfo_table.delete(*self.medicineinfo_table.get_children())
for i in rows:
self.medicineinfo_table.insert("",END,values=i)
conn.commit()
conn.close()
def Medget_cursorinfo(self,event=""):
cursor_row=self.medicineinfo_table.focus()
content=self.medicineinfo_table.item(cursor_row)
row=content["values"]
self.storeid_var.set(row[0]),
self.refinfo_var.set(row[1]),
self.typemed_var.set(row[2]),
self.sideeffect_var.set(row[3]),
self.price_var.set(row[4])
def UpdateMedinfo(self):
if self.storeid_var.get()=="" or self.typemed_var.get()=="":
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("update MedicineInfo set
MedType=%s,SideEffect=%s,Price=%s where Ref=%s",(
self.typemed_var.get(),
self.sideeffect_var.get(),
self.price_var.get(),
self.refinfo_var.get()
))
conn.commit()
self.fetch_dataMedinfo()
conn.close()
messagebox.showinfo("Success","Medicine has been updated")
def DeleteMedinfo(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
sql="delete from MedicineInfo where Ref=%s"
val=(self.refinfo_var.get(),)
my_cursor.execute(sql,val)
conn.commit()
self.fetch_dataMedinfo()
conn.close()
def clearmedinfo(self):
self.storeid_var.set("")
self.typemed_var.set("")
self.sideeffect_var.set("")
self.price_var.set("")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++
#++++++++++++++++++++Patient Sql Part+++++++++++++++++++++++++
def Addpatient(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("insert into
Patient(PatientID,PatientName,Address,Symtoms,DoctorID) values(%s,%s,%s,%s,%s)",(
self.patientid_var.get(),
self.patientnamevar.get(),
self.addresspatient_var.get(),
self.symptoms_var.get(),
self.patientdoctorid_var.get()
))
conn.commit()
self.fetch_datapatient()
self.Medget_cursorpatient()
conn.close()
messagebox.showinfo("Success","Patient Added")
self.root()
def refreshpatient(self):
self.fetch_datapatient()
def fetch_datapatient(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("select * from Patient")
rows=my_cursor.fetchall()
if len(rows)!=0:
self.patient_table.delete(*self.patient_table.get_children())
for i in rows:
self.patient_table.insert("",END,values=i)
conn.commit()
conn.close()
def Medget_cursorpatient(self,event=""):
cursor_row=self.patient_table.focus()
content=self.patient_table.item(cursor_row)
def Updatepatient(self):
if self.patientnamevar.get()=="" or self.addresspatient_var.get()=="" or
self.symptoms_var.get()=="":
messagebox.showerror("Error","All fields are Required!")
else:
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
my_cursor.execute("update Patient set
PatientName=%s,Address=%s,Symtoms=%s where PatientID=%s",(
self.patientnamevar.get(),
self.addresspatient_var.get(),
self.symptoms_var.get(),
self.patientid_var.get()
))
conn.commit()
self.fetch_datapatient()
conn.close()
messagebox.showinfo("Success","Patient Data has been updated")
def Deletepatient(self):
conn=mysql.connector.connect(host="localhost",username="root",password="Prishabh@
7044",database="mydata")
my_cursor=conn.cursor()
sql="delete from Patient where PatientID=%s"
val=(self.patientid_var.get(),)
my_cursor.execute(sql,val)
conn.commit()
self.fetch_datapatient()
conn.close()
if __name__ == "__main__":
root=Tk()
obj=PharmacyManagementSystem(root)
root.mainloop()
INTERPRETATION OF RESULT
The Pharmacy Management System (PMS) plays a crucial role in streamlining and
enhancing the efficiency of pharmacy operations. By automating various tasks such as
inventory management, prescription filling, patient records management, and billing,
PMS significantly reduces manual errors and improves overall productivity. Moreover,
it enables pharmacists to focus more on patient care and counseling, thereby enhancing
the quality of service provided. The integration of advanced features like barcode
scanning, electronic prescriptions, and data analytics further enhances the system's
capabilities, enabling pharmacies to stay competitive in the rapidly evolving healthcare
landscape.
The future of Pharmacy Management Systems holds immense potential for further
innovation and advancement. Some areas of future development and enhancement
include:
Integration with Electronic Health Records (EHR): Seamless integration with EHR
systems would enable pharmacies to access comprehensive patient health
information, facilitating better medication management and adherence.
Implementation of Artificial Intelligence (AI) and Machine Learning (ML): AI and ML
algorithms can be utilized to analyze prescription patterns, predict medication
shortages, optimize inventory levels, and provide personalized medication
recommendations based on patient data and medical history.
REFERENCES