0% found this document useful (0 votes)
103 views45 pages

DBMS Final Report

The document describes a pharmacy management system project submitted by two students. The project was developed under the guidance of Dr. Sanchari Saha and submitted in partial fulfillment of the requirements for a Bachelor of Engineering degree. The project involved developing a database and software for effective management of a pharmacy. Key functions included maintaining medicine stock details, patient and doctor details, and billing. The aim was to improve accuracy, safety, and efficiency in the pharmacy.

Uploaded by

Rishabh Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views45 pages

DBMS Final Report

The document describes a pharmacy management system project submitted by two students. The project was developed under the guidance of Dr. Sanchari Saha and submitted in partial fulfillment of the requirements for a Bachelor of Engineering degree. The project involved developing a database and software for effective management of a pharmacy. Key functions included maintaining medicine stock details, patient and doctor details, and billing. The aim was to improve accuracy, safety, and efficiency in the pharmacy.

Uploaded by

Rishabh Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belagavi-590018

A Database Management System Mini Project Report on


“PHARMACY MANAGEMENT SYSTEM”
Submitted in Partial fulfillment of the Requirements for the V Semester of the Degree of

Bachelor of Engineering in
Computer Science & Engineering
By
RISHABH KUMAR PATEL (1CR21CS146)

RITESH KUMAR SINGH (1CR21CS149)

Under the Guidance of,


Dr. SANCHARI SAHA, Assistant Professor, Dept. of CSE

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


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

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

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

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

Name of the Examiners Signature with date

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:

RISHABH KUMAR PATEL (1CR21CS146)

RITESH KUMAR SINGH (1CR21CS149)

iii
ABSTRACT

Pharmacy Management System application to help pharmacist to manage pharmacy in the


systematic ways. Pharmacy Management System can make the work easier by giving the
details of medicine when its name is entered. A computer gives the details of the medicine
like rate of medicine, and expiry date of the medicine. It becomes very difficult in big medical
stores to handle the details of all the medicines manually, so by using this pharmacy
management system We can maintain the records of all the medicines. It is fed with the
information whenever new medicines are brought and it is provided with expire date with
search option. When we entire the name of medicine it gives the details of medicine. One of
the most important responsibilities of pharmacy management is to supervise and manage the
pharmacy employees in order to ensure healthy working relationships and outcomes. Each of
these functions is critical to the pharmacy’s operation and should be explained by the
management.

Keywords: Medicine, Stocks, Billing, GUI, Pharmacy.

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

Contents Page No.


Certificate ii
Declaration iii
Abstract iv
Acknowledgement v
Table of contents vi
List of Figures vii
List of Tables viii
1. Introduction 1-3
2. System Requirements 4-5
2.1 Hardware Requirements
2.2 Software Requirements
2.3 Software Used
3. Design 6-8
3.1 Schema Diagram
3.2 ER Diagram
3.3 Database Tables
4. Implementation 9-31
5. Interpretation of Result 32-35
6. Conclusion and Future Scope 36
7. References 37

vi
LIST OF FIGURES

Fig.no Name Pg.no


Fig 1.1 Pharmacy Management 2

Fig 3.1 Schema diagram 6

Fig 3.2 ER Diagram 7

Fig 5.1 Homepage 32

Fig 5.2 Medicine Stock Details 33

Fig 5.3 Medicine Information 33

Fig 5.4 Doctor Details 34

Fig 5.5 Patient Details 34

Fig 5.6 Billing Detail 34

Fig 5.7 Stock View 35

vii
LIST OF TABLES

Sn no. Names Page no.


Table 3.1 Medicine Info 7

Table 3.2 Medicine Stock 8

Table 3.3 Patient 8

Table 3.4 Doctor 8

Table 3.5 Billing 8

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.

Dept. of CSE, CMRIT 2023-2024 Page 1


PHARMACY MANAGEMENT SYSTEM
`
Pharmacy management system deals with the maintenance of drugs and consumables in
the pharmacy unit. This pharmacy management system is user friendly. The purpose of this
Pharmacy Management System project is to improve the maintenance and manipulation of
the drugs in the medicals. The pharmacy management system will be used to minimize the
time and resource by maintaining the details of the drug systemically so that the data can
be used in possible quickest time. While the resource which is minimized are workforce,
money, papers, etc. The system is user-friendly and will help the pharmacist. This Pharmacy
Management System will reduce the burden on pharmacist and will make the system
efficient by providing the more accurate details about drugs in the medical.

Fig 1.1 Typical Pharmacy Management

1.1 Scope and Objectives:

One of the most important responsibilities of Medical Shop management is to


supervise and manage the pharmacy employees in order to ensure healthy working
relationships and outcomes. Each of these functions is critical to the pharmacy’s
operation and should be explained by the management. However, most pharmacies
faced problems such as insufficient service promotions, lack of coherence of pharmacy
services in hospitals, poor drug information systems and the inconsistency of the
pharmacy information management due to its manual processes. Now these are the

Dept. of CSE, CMRIT 2023-2024 Page 2


PHARMACY MANAGEMENT SYSTEM
`
problems that must be solved with this Pharmacy Management System Project
Proposal

1.2 Scope of the project:

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.

Dept. of CSE, CMRIT 2023-2024 Page 3


PHARMACY MANAGEMENT SYSTEM
`
CHAPTER 2
SYSTEM REQUIREMENTS

2.1 Hardware Requirements


Hardware Requirements The most common set of requirements defined by any
operating system or software application is the physical computer resources, also
known as hardware.

The minimal hardware requirements are as follows,

1. Processor : Intel i3

2. RAM : 4GB ram

3. Processor : 2.4GHZ

4. Memory : 32GB

2.2 Software requirements


Software requirements deals with defining resource requirements and prerequisites that
needs to be installed on a computer to provide functioning of an application.

The minimal software requirements are as follows,

1. Front end : Python


2. Back end : SQL
3. IDE : Pycharm
4. Operating system : Windows 10

Dept. of CSE, CMRIT 2023-2024 Page 4


PHARMACY MANAGEMENT SYSTEM
`
2.3Software Used

2.3.1 Python Language

Python is an object-oriented programming language created by Guido Rossum in 1989.


It is ideally designed for rapid prototyping of complex applications. It has interfaces to
many OS system calls and libraries and is extensible to C or C++. Many large
companies use the Python programming language include NASA, Google, YouTube,
Bit Torrent, etc. Python programming is widely used in Artificial Intelligence, Natural
Language Generation, Neural Networks and other advanced fields of Computer
Science. Python had deep focus on code readability & this class will teach you python
from basics.

2.3.2 Python Characteristics


• It provides rich data types and easier to read syntax than any other
programming languages
• It is a platform independent scripted language with full access to operating
system API’s.
• Compared to other programming languages, it allows more run-time
flexibility.
• It includes the basic text manipulation facilities of Perl and Awk
• A module in Python may have one or more classes and free functions
• Libraries in Pythons are cross-platform compatible with Linux, Macintosh, and
Windows
• For building large applications, Python can be compiled to byte-cod 9
• Python supports functional and structured programming as well as OOP
• It supports interactive mode that allows interacting Testing and debugging of
snippets of code.
• In Python, since there is no compilation step, editing, debugging and testing
is fast.

Dept. of CSE, CMRIT 2023-2024 Page 5


PHARMACY MANAGEMENT SYSTEM
`
CHAPTER 3

DESIGN

A pharmacy management system is crucial for efficiently managing the operations of a


pharmacy, including inventory management, prescription processing, customer
management, sales tracking, and reporting. Designing a schema and an entity-relationship
(ER) diagram for such a system is essential for understanding the relationships between
different entities and ensuring a well-organized database structure

3.1 Schema Diagram:

Fig 3.1 – Schema Diagram

Dept. of CSE, CMRIT 2023-2024 Page 6


PHARMACY MANAGEMENT SYSTEM
`
3.2 ER Diagram

Fig 3.2 – ER Diagram

3.3 Database Tables

Table 3.1 – Medicine Info


`

Dept. of CSE, CMRIT 2023-2024 Page 7


PHARMACY MANAGEMENT SYSTEM
`
Table 3.2 – Medicine Stock

Table 3.3 – Patient


`

Table 3.4 – Doctor

Table 3.5 – Billing

Dept. of CSE, CMRIT 2023-2024 Page 8


PHARMACY MANAGEMENT SYSTEM
`
CHAPTER 4
IMPLEMENTATION

4.1 Installation Steps for Execution of the Project

• Install the VScode software.


• Download the required Libraries Tkinter,PIL,Openpyxl

4.2 Source Code

from tkinter import*


from PIL import Image,ImageTk
from tkinter import ttk
import mysql.connector
from tkinter import messagebox
from openpyxl import Workbook
import pandas as pd
class PharmacyManagementSystem:
def __init__(self,root):
self.root=root
self.root.title("Pharmacy Management System")
self.root.geometry("1000x800")
lbltitle=Label(self.root,text="PHARAMACY MANAGEMENT
SYSTEM",bg='white',fg="red",font=("times new roman",20,"bold"),padx=2,pady=4)
lbltitle.pack(side=TOP)
DataFrame=Frame(self.root,bd=15,relief=RIDGE)
DataFrame.place(x=0,y=40,width=1275,height=600)
################################################ MedicineInfo Table
#######################################################
self.refinfo_var=StringVar()
self.storeid_var=StringVar()
self.typemed_var=StringVar()
self.sideeffect_var=StringVar()
self.price_var=StringVar()

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)

Dept. of CSE, CMRIT 2023-2024 Page 9


PHARMACY MANAGEMENT SYSTEM
`
lblstoreid.grid(row=0,column=0,sticky=W)
ref_combo=ttk.Combobox(DataFrameLeft,textvariable=self.storeid_var,width=22,font=("
arial",12,"bold"),state="readonly")
ref_combo["values"]=("1001","1002","1003","1004","1005")
ref_combo.current(0)
ref_combo.grid(row=0,column=1)
lblExDate=Label(DataFrameLeft,font=("arial",12,"bold"),text="Ref",padx=2,pady=6)
lblExDate.grid(row=2,column=0,sticky=W)
connref=mysql.connector.connect(host="localhost",username="root",password="Prishabh
@7044",database="mydata")
my_cursorref=connref.cursor()
my_cursorref.execute("select Ref from MedicineStock")
rowsref=my_cursorref.fetchall()
ref_combowalabox=ttk.Combobox(DataFrameLeft,textvariable=self.refinfo_var,width=2
2,font=("arial",12,"bold"),state="readonly")
ref_combowalabox["values"]=rowsref
ref_combowalabox.current(0)
ref_combowalabox.grid(row=2,column=1)
lblTypeofMedicine=Label(DataFrameLeft,font=("arial",12,"bold"),text="Type Of
Medicine",padx=2,pady=6)
lblTypeofMedicine.grid(row=1,column=0,sticky=W)
comTypeofMedicine=ttk.Combobox(DataFrameLeft,textvariable=self.typemed_var,state=
"readonly",font=("arial",12,"bold"),width=22)
comTypeofMedicine["values"]=("Tablet","Liquid","Capsules","Topical
Medicines","Drops","Inhales","Injection")
comTypeofMedicine.current(0)
comTypeofMedicine.grid(row=1,column=1)

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)

Dept. of CSE, CMRIT 2023-2024 Page 10


PHARMACY MANAGEMENT SYSTEM
`
txtPrice.grid(row=4,column=1)

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)

#MedicineInfo button frame


down_frame1=Frame(DataFrameLeft,border=4,relief=RIDGE,bg="darkgreen")
down_frame1.place(x=300,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.AddMedinfo)
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.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)

Dept. of CSE, CMRIT 2023-2024 Page 11


PHARMACY MANAGEMENT SYSTEM
`
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.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)

########################################## PATIENT tABLE


##########################################################
#Patient Table Variables
self.patientid_var=StringVar()
self.patientnamevar=StringVar()
self.addresspatient_var=StringVar()
self.patientdoctorid_var=StringVar()
self.symptoms_var=StringVar()

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)

Dept. of CSE, CMRIT 2023-2024 Page 12


PHARMACY MANAGEMENT SYSTEM
`
lblAddresspatient.grid(row=2,column=0,sticky=W)

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")

Dept. of CSE, CMRIT 2023-2024 Page 13


PHARMACY MANAGEMENT SYSTEM
`
self.patient_table.heading("symtoms",text="Symtoms")
self.patient_table.heading("doctorid",text="Doctor ID")
self.patient_table.pack(fill=BOTH,expand=1)

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)

########################################### MedicineStock Table


##############################################################
#MedicineStock Variables
self.medname_var=StringVar()
self.refMed_var=StringVar()
self.companyname_var=StringVar()

Dept. of CSE, CMRIT 2023-2024 Page 14


PHARMACY MANAGEMENT SYSTEM
`
self.medquantity_var=StringVar()
self.expdate_var=StringVar()

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)

Dept. of CSE, CMRIT 2023-2024 Page 15


PHARMACY MANAGEMENT SYSTEM
`
lblmedname=Label(DataFrameRight,font=("arial",12,"bold"),text="Exp
Date:",padx=15,pady=6)
lblmedname.place(x=0,y=130)

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)

Dept. of CSE, CMRIT 2023-2024 Page 16


PHARMACY MANAGEMENT SYSTEM
`
btnAddmed.grid(row=0,column=0)

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)

################################################### Doctor Table


#############################################################

#Doctor Table Variables


self.doctordoctorid_var=StringVar()
self.doctorpatientid_var=StringVar()
self.doctormedname=StringVar()
self.doctordoge_var=StringVar()
self.doctorpatientname_var=StringVar()
self.doctortotalamount=StringVar()

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()

Dept. of CSE, CMRIT 2023-2024 Page 17


PHARMACY MANAGEMENT SYSTEM
`
my_cursordoctorid.execute("select distinct DoctorID from Patient")
rowsdoctorid=my_cursordoctorid.fetchall()

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)

Dept. of CSE, CMRIT 2023-2024 Page 18


PHARMACY MANAGEMENT SYSTEM
`

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

Dept. of CSE, CMRIT 2023-2024 Page 19


PHARMACY MANAGEMENT SYSTEM
`
self.billtotal_var=StringVar()

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)

Dept. of CSE, CMRIT 2023-2024 Page 20


PHARMACY MANAGEMENT SYSTEM
`

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()

my_cursor.execute("SELECT * from Bill where BillID =%s and PatientID=%s and


DoctorID=%s",(self.billID_var.get(),self.billpatientid.get(),self.billdoctorid.get(),))
rows = my_cursor.fetchall()

Dept. of CSE, CMRIT 2023-2024 Page 21


PHARMACY MANAGEMENT SYSTEM
`
main_list = ['BillID',
'PatientID',
'DoctorID',
'PatientName',
'Amount']

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()

############3SQL For doctor table+++++++++++++++++++


def Adddoctor(self):

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()
))

Dept. of CSE, CMRIT 2023-2024 Page 22


PHARMACY MANAGEMENT SYSTEM
`
conn.commit()
conn.close()
messagebox.showinfo("Success","Medicine Added")

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):

Dept. of CSE, CMRIT 2023-2024 Page 23


PHARMACY MANAGEMENT SYSTEM
`

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()

#+++++++++++++++ Stock SQL Part ++++++++++++++++++++++++++++


def AddMed(self):

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):

Dept. of CSE, CMRIT 2023-2024 Page 24


PHARMACY MANAGEMENT SYSTEM
`

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()
))

Dept. of CSE, CMRIT 2023-2024 Page 25


PHARMACY MANAGEMENT SYSTEM
`
conn.commit()
self.fetch_dataMed()
conn.close()
messagebox.showinfo("Success","Medicine has been updated")

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("")

#_______________________________________________

#^^^^^^^^^^^^^^^^^^Now SQL Part For Left Data


Frame*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
def AddMedinfo(self):

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(),

Dept. of CSE, CMRIT 2023-2024 Page 26


PHARMACY MANAGEMENT SYSTEM
`
self.refinfo_var.get(),
self.typemed_var.get(),
self.sideeffect_var.get(),
self.price_var.get(),
))
conn.commit()
self.fetch_dataMedinfo()
self.Medget_cursorinfo()
conn.close()
messagebox.showinfo("Success","Medicine Info Added")

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()=="":

Dept. of CSE, CMRIT 2023-2024 Page 27


PHARMACY MANAGEMENT SYSTEM
`
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 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+++++++++++++++++++++++++

Dept. of CSE, CMRIT 2023-2024 Page 28


PHARMACY MANAGEMENT SYSTEM
`

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)

Dept. of CSE, CMRIT 2023-2024 Page 29


PHARMACY MANAGEMENT SYSTEM
`
row=content["values"]
self.patientid_var.set(row[0])
self.patientnamevar.set(row[1])
self.addresspatient_var.set(row[2])
self.symptoms_var.set(row[3])
self.patientdoctorid_var.set(row[4])

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()

Dept. of CSE, CMRIT 2023-2024 Page 30


PHARMACY MANAGEMENT SYSTEM
`
def clearpatient(self):
self.patientnamevar.set("")
self.addresspatient_var.set("")
self.symptoms_var.set("")
self.patientdoctorid_var.set("")

if __name__ == "__main__":
root=Tk()
obj=PharmacyManagementSystem(root)
root.mainloop()

Dept. of CSE, CMRIT 2023-2024 Page 31


PHARMACY MANAGEMENT SYSTEM
`
CHAPTER 5

INTERPRETATION OF RESULT

Fig 5.1 – Homepage 1

Dept. of CSE, CMRIT 2023-2024 Page 32


PHARMACY MANAGEMENT SYSTEM
`

Fig 5.2 - Medicine Stock Details

Fig 5.3 - Medicine Information

Dept. of CSE, CMRIT 2023-2024 Page 33


PHARMACY MANAGEMENT SYSTEM
`

Fig 5.5 – Doctor Details

Fig 5.5 – Patient Details

Fig 5.6 – Billing Detail

Dept. of CSE, CMRIT 2023-2024 Page 34


PHARMACY MANAGEMENT SYSTEM
`

Fig 5.7 – Stock View

Dept. of CSE, CMRIT 2023-2024 Page 35


PHARMACY MANAGEMENT SYSTEM
`
CHAPTER 6

CONCLUSION AND FUTURE SCOPE

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.

Dept. of CSE, CMRIT 2023-2024 Page 36


PHARMACY MANAGEMENT SYSTEM
`

REFERENCES

[1] Pharmacy Management


https://youtu.be/st733v6gXlg?si=1RJTySHCqq07LkbG

[2] Website to learn about Python


https://www.w3schools.com/python/

[3] Connecting database with the Python GUI:


https://www.youtube.com/watch?v=16wcGN1SKzo

Dept. of CSE, CMRIT 2023-2024 Page 37

You might also like