Pharmacy Management System 2020-2021
CHAPTER – 1
INTRODUCTION
1.1 Introduction to DBMS
Database and database technology has a major impact on the growing use of computers. It is
fair to say that databases play a critical role in almost all areas where computers are used,
including business, electronic commerce, engineering, medicine, genetics, law, education, and
library science. The word database is so commonly used that we must begin by defining what
the database is.
Our initial definition is quite general. A database is a collection of related data. By data,
we mean known facts that can be recorded and that have implicit meaning. For example,
consider the names, telephone numbers, and addresses of the people you know. You may have
recorded this data in an indexed address book or you may have stored it on a hard drive, using
personal computers and software such as Microsoft excel. This collection of related data with
an implicit meaning is a database.
The preceding definition of a database is quite general, for example, we may consider
the collection of words that make up this page of text to be related data and hence to constitute
a database. However, the common use of the term database is usually more restricted. A
database has the following properties:
● A database represents some aspect of the real world, sometimes called the mini world
or the universe of discourse. The changes to the mini world are reflected in the database.
● A database is a logically coherent collection of data with some inherent meaning. A
random assortment of data cannot correctly be referred to as a database.
● A database is designed, built and populated with data for a specific purpose. It has an
intended group of users and some preconceived applications in which these users are
interested.
In other words, a database has some source from which data is derived, some degree of
interaction with events in the real world, and an audience that is actively interested in its
contents. The end-users of the database may perform business transactions (for example a
customer buys a camera) or events may happen that may cause the information in the
database to change. In order for a database to be accurate and reliable at all times, it must
be a true reflection of the mini world that it represents; therefore changes must be reflected
in the database as soon as possible.
Dept of ISE, AIT 1
Pharmacy Management System 2020-2021
A database can be of any size and complexity. A database may be generated and
maintained manually or computerized. For example, a library card catalog is a database
that may be created and maintained manually. A computerized database may be created
and maintained either by a group of application programs written specifically for that task
or by a database management system.
A database is a collection of data, typically describing the activities of one or more
related organizations. For example, a university database might contain information about
the following:
● Entities such as students, faculty, courses, and classrooms.
● Relationships between entities, such as student’s enrolment in courses, faculty
teaching courses, and the use of rooms for courses.
A database management system, or DBMS, is software designed to assist in
maintaining and utilizing a large collection of data. The need for such systems as well as
their use is growing rapidly. The alternative to using a DBMS is to store the data in files
and write application-specific code to manage it.
File system versus DBMS
To understand the need for a DBMS, let us consider a motivating scenario: a company has
a large collection (say 500 GB) of data on employees, departments, products, sales, and so
on. This data is accessed concurrently by several employees. Questions about the data must
be answered quickly, changes made to the data by different users must be applied
consistently and access to certain parts of the data must be restricted. We can try to manage
the data by storing it in operating system files. This approach has many drawbacks,
including the following
● We probably do not have 500GB of main memory to hold all the data. We must, therefore,
store data in a storage device such as a disk or tape and bring relevant parts into the main
memory for processing as needed.
● Even if we have 500 GB of main memory, on computer systems with 32 bit addressing, we
cannot refer directly to more than about 4 GB of data. We have to program some method
of identifying all data items.
Dept of ISE, AIT 2
Pharmacy Management System 2020-2021
● We have to write special programs to answer each question a user may want to ask about
the data. These programs are likely to be complex because of the large volume of data to
be searched.
● We must protect the data from the inconsistent changes made by different users accessing
the data concurrently. If applications must address the details of such concurrent access,
this adds greatly to their complexity.
● We must ensure that the data is restored to a consistent state if the system crashes while
changes are being made.
● Operating systems provide only a password mechanism for security. This is not sufficiently
flexible to enforce security policies in which different users have permission to access
different subsets of the data.
A DBMS is a piece of software designed to make the preceding tasks easier. By
storing data in DBMS rather than as a collection of operating system files, we can use the
DBMS’s features to manage the data in a robust and efficient manner. As the volume of
data and the number of users grow hundreds of gigabytes of data and thousands of users
are common in current corporate database DBMS support becomes indispensable.
1.1 DATABASE ENVIRONMENT SYSTEM
Fig 1.1: Simplified database environment system
Dept of ISE, AIT 3
Pharmacy Management System 2020-2021
A database management system (DBMS) is a collection of programs that enables users to
create and maintain a database. The DBMS is a general-purpose software system that facilities
the processes of defining, constructing, manipulating and sharing databases among various
users and applications. Defining a database involves specifying the data types, structures and
constraints of the data to be stored in the database.
The database definition or description information is also stored by the DBMS in the
form of a database catalog or dictionary, it is called Metadata. Constructing the database is the
process of storing the data on some storage medium that is controlled by the DBMS.
Manipulating a database includes functions such as querying the database to retrieve specific
data, updating the database to reflect changes in the mini world and generating reports from
the data. Sharing a database allows multiple users and programs to access the database
simultaneously.
An application program accesses the database by sending queries or requests for data
to DBMS. A query typically causes some data to be retrieved; a transaction may cause some
data to be read and some data to be written into the database.
Other important functions provided by DBMS include protecting the database and
maintaining it over a long period of time, protection includes system protection against
hardware or software malfunction and security protection against unauthorized or malicious
access. A typical large database may have a life cycle of many years, so the DBMS must be
able to maintain the database system by allowing the system to evolve as requirements change
over time.
It is not absolutely necessary to use general-purpose DBMS software to implement a
computerized database. We could write our own set of programs to create and maintain the
database, in effect creating our own special purpose DBMS software. In either case, whether
we use a general-purpose DBMS or not we usually have deployed a considerable amount of
complex software. In fact, most DBMSs are very complex software systems. Fig 1.1 shows a
simplified database environment system.
Dept of ISE, AIT 4
Pharmacy Management System 2020-2021
1.2 ADVANTAGES OF USING DBMS APPROACH
Using a DBMS to manage data has many advantages:
● Data Independence: application program should not, ideally, be expected to details of
data representation and storage, the DBMS provides an abstract view of the data that
hides such details.
● Efficient Data Access: A DBMS utilizes a variety of sophisticated techniques to store
and retrieve data efficiently. This feature is especially important if the data is to be
stored on an external device.
● Data Integrity and Security: if data is always accessed through DBMS, the DBMS
can enforce integrity constraints. For example, before inserting salary information for
an employee, the DBMS can check that the department budget is not exceeded. Also, it
can enforce access controls that govern what data is visible to different classes of users.
● Data Administration: when several users share data, centralizing the administration
of data can offer significant improvements. Experienced professionals who understand
the nature of the data being managed, and how different groups of users use it, it can be
responsible for organizing the data representation to minimize redundancy and for fine-
tuning the storage of the data to make retrieval efficient.
● Concurrent Access and Crash Recovery: A DBMS schedules concurrent accesses to
the data in such a manner that users can think of the data as being accessed by only one
user at a time. Further, the DBMS protects users from the effects of system failures.
● Reduced Application Development Time: clearly, the DBMS supports important
functions that are common to many applications accessing data in the DBMS. This, in
conjunction with the high-level interface to data, facilities quick application
development. DBMS applications are also likely to be more robust than a similar stand-
alone application because many important tasks are handled by the DBMS.
Dept of ISE, AIT 5
Pharmacy Management System 2020-2021
1.3 ARCHITECTURE OF DATABASE
The Three-Schema Architecture
The goal of the three-schema architecture illustrated in the figure is to separate the user
application from the physical database. In this architecture, schemas can be defined at the
following three levels:
● The internal level has an internal schema, which describes the physical storage structure of
the database. The internal schema uses a physical data model and describes the complete details
of data storage and access paths for the database.
● The conceptual level has a conceptual schema, which describes the structure of the whole
database for a community of users. The conceptual schema hides the details of physical storage
structures and concentrates on describing entities, data types, relationships, user operations,
and constraints. Usually, a representational data model is used to describe the conceptual
schema when a database system is implemented. This implementation conceptual schema is
often based on a conceptual schema design in a high-level data model.
● The external or view level includes a number of external schemas or user views. Each
external schema describes the part of a database that a particular user group is interested in and
hides the rest of the database from that user group. As in the previous level, each external
schema is typically implemented using a representational data model, possibly based on
external schema design in a high-level data model.
Fig 1.2 shows the architecture of DBMS.
Fig 1.2: Architecture of DBMS
Dept of ISE, AIT 6
Pharmacy Management System 2020-2021
CHAPTER 2
INTRODUCTION TO PROJECT
2.1 BRIEF DESCRIPTION
The mini-project entitled “PHARMACY MANAGEMENT SYSTEM “ is developed as a part
of the fifth semester DBMS laboratory, for the partial fulfillment of the requirement for the
BE( Information Science) course.
Project Description
The project entitled Pharmacy Management System this is developed for established Medical
store in the city. To manage all operations of the medical store this project is being developed. It
will have the entire basic module to manage the medical store operations.
Objectives
The main objective of the application is to automate the existing system of manually
maintained records of the counter sales, purchases, reorder levels, Supplier and Customer
monetary positions and other related transactions made by the seller.
2.2 SCOPE
This application can be used by any other store to automate the process of manually
maintaining the records related to the subject of maintaining the stock and liquid flows.
Dept of ISE, AIT 7
Pharmacy Management System 2020-2021
2.3 TABLE DESCRIPTION
2.3.1 ADMIN
ADMIN table has the admin_id, admin_username, admin_password and admn_id is
used as the primary key as shown in Table 2.1.
Table 2.1 Structure of ADMIN
2.3.2 CASHIER
Cashier table has the casier_id,first_name,last_name,staff_id,postal_address,phone,email,
username,password,date.cashier_id is used as a primary key attribute as shown in Table 2.2.
Table 2.2 Structure of CASHIER
2.3.3 IDS
ids table has user_id,ids,invoice_id and user_id is used as primary key as shown in
Table 2.3.
Table 2.3 Structure of ids
Dept of ISE, AIT 8
Pharmacy Management System 2020-2021
2.3.4 INVOICE
INVOICE table has the attributes id,invoice_id,customer_name,served_by,status,date and id
is used as primary key as shown in Table 2.4.
Table 2.4 Structure of INVOICE
2.3.5 INVOICE_DETAILS
INVOICE_DETAILS table has the attributes id,invoice,drug,cost,quantity,day,month,year
And id is the primary keys as shown in Table 2.5.
Table 2.5 Structure of INVOICE_DETAILS
2.3.6 PHARMACIST
PHARMACIST table has the attributes pharmacist_id,first_name,last_name,staff_id,
postal_address,phone,email,username,password,date and pharmacist_id is the primary
keys as shown in Table 2.6.
Table 2.6 Structure of PHARMACIST
Dept of ISE, AIT 9
Pharmacy Management System 2020-2021
2.3.7 PRESCRIPTION
PRESCRIPTION table has the attributes id,prescription_id,customer_id,customer_name,
invoice_id,phone,date and pharmacist_id and id is the primary keys as shown in Table 2.7.
Table 2.7 Structure of PRESCRIPTION
2.3.8 RECIEPT
RECIEPT table has the attributes reciptNo,customer_id,total,payType,serialno,served_by,
Date and reciptNo is the primary keys as shown in Table 2.8
.
Table 2.8 Structure of RECIEPT
2.3.9 SALES
SALES table has the attributes userid,invoice,drug,cost,quantity,day,month,year and
userid is the primary keys as shown in Table 2.9
Table 2.9 Structure of SALES
Dept of ISE, AIT 10
Pharmacy Management System 2020-2021
2.3.10 STOCK
STOCK table has the attributes stock_id,drug_name,category,description,company,supplier
and strength,quantity,cost,status,date_supplied and stock_id is the primary keys as shown
in Table 2.10
Table 2.10 Structure of STOCK
2.3.11 TEMPPRESCRI
TEMPPRISCRI table has the attributes userid,customer_id,customer_name,phone,
drug_name,strength,dose,quantity and stock_id is the primary keys as shown in Table 2.11
Table 2.11 Structure of TEMPPRESCRI
Dept of ISE, AIT 11
Pharmacy Management System 2020-2021
2.4 TRIGGERS
A trigger is a special type of stored procedure that automatically executes when an event
occurs in the database server.
Table 2.6 date on prescription trigger
2.7 Date on receipt Trigger
In this project, two triggers called date_on_prescription and date_on_reciept as shown in Table
2.6 and Table 2.7 are used to set an attribute called date in the table receipt and prescription
table before insertion and before updation respectively.
Dept of ISE, AIT 12
Pharmacy Management System 2020-2021
2.5 STORED PROCEDURE
A stored procedure is a set of Structured Query Language (SQL) statements with an
assigned name, which is stored in a relational database management system as a group, so it
can be reused and shared by multiple programs.
In this project, a stored procedure called getCashier, as shown in Table 2.8, is used to
set an attribute from all the users of Cashier in table Cashier
Table 2.8 Stored procedure getCashier
In this project, a stored procedure called getCashier, as shown in Table 2.9, is used to
set an attribute from all the users of Pharmacist in table Pharmacist
Table 2.9 Stored procedure getPharmacist
Dept of ISE, AIT 13
Pharmacy Management System 2020-2021
CHAPTER 3
DESIGN
3.1 ENTITY RELATIONSHIP DIAGRAM:
ER Relationship model allows us to describe the data involved in a real-world enterprise
in terms of objects and their relationship widely used to develop an initial database design. It
is primarily important in its role in database design.
Fig 3.1: ER diagram
In this ER Diagram shown in Fig 3.1 Entities ADMIN,PHARMACIST,CASHIER,
PRESCRIPTS,PRESCRIPTION and STOCK are represented by rectangles, attributes of the
tables are represented by ovals and relationships are represented using diamonds.
Dept of ISE, AIT 14
Pharmacy Management System 2020-2021
3.2 NORMALIZATION
3.3.1 First Normal Form (1NF)
As the domain of all attributes of all relations in the database has atomic value and no tuples
can have a set of these values, all relations are in 1NF.
3.3.2 Second Normal Form (2NF)
As there is no partial dependency in the database, i.e. all nonprime attributes of a relation are
fully functionally dependent on the primary key of the relation schema, all relations are in 2NF.
3.3.3 Third Normal Form (3NF)
As all relations are in 2NF and no non-prime attribute of a relation schema is transitively
dependent on the primary key, all relations are in 3NF.
Dept of ISE, AIT 15
Pharmacy Management System 2020-2021
3.3 SCHEMA DIAGRAM
A database schema can be represented in a visual diagram, which shows the database
object and their relationship which represents the logical view of the database and how the
relationships among them are represented.
Fig 3.2: Schema Diagram in 3rd normal form.
This Schema Diagram in Fig 3.2 represents different tables used and underlined attributes are
primary keys and arrows are used to represent foreign keys.
Dept of ISE, AIT 16
Pharmacy Management System 2020-2021
CHAPTER-4
HARDWARE AND SOFTWARE REQUIREMENTS
4.1 FUNCTIONAL AND NON-FUNCTIONAL REQUIREMENTS
4.1.1 FUNCTIONAL OR SPECIFIC REQUIREMENTS
The required software is used for ordering food online. The system should satisfy the
following requirements:
● 1. Logging into the system
● 2. Signup option
● 3. View Menu Details
● 4. Order Option
● 6. View User Orders
● 7. Logout option
4.1.2 NON-FUNCTIONAL REQUIREMENTS
All of the application data is stored in an Oracle database, and therefore an Oracle
Database must also be installed on the host computer. As with Apache2, this software is freely
available and can be installed and run under most operating systems. The server hardware can
be any computer capable of running both the web and database servers and handling the
expected traffic. For a small scale restaurant that is not expecting to see much web traffic, an
average personal computer may be appropriate. Once the site starts generating more hits,
though, it will likely be necessary to upgrade to a dedicated host to ensure proper performance.
The exact cut-offs will need to be determined through a more thorough stress testing of the
system.
Dept of ISE, AIT 17
Pharmacy Management System 2020-2021
4.1.2.1 SECURITY REQUIREMENTS
Some of the factors that are identified to project the software from accidental or
malicious access, use, modification, destruction, or disclosure are described below.
● Ascertain functions to different modules
● Restrict communication between areas of the program
● Check data integrity for critical variables
● A later version of the software will incorporate encryption techniques in the
user/license authentication process
● Communication needs to be restricted when the application is validating the user or
license
4.2 HARDWARE REQUIREMENTS
• A desktop or laptop with a proper internet connection.
• 20 GB of hard disk (free space)
• Minimum 2GB or Greater of the RAM
• Windows 7 or 8 or 10 Operating system.
4.3 SOFTWARE REQUIREMENTS
4.3.1 SERVER SIDE
1. Programming language: PHP 5.6.31
2. Web Server: Apache 2.4.27
3. Database: SQL 5.7.19
4.3.2 CLIENT SIDE
1. Programming language: JAVASCRIPT, HTML, CSS
2. OS: windows7/8/10
3. MYSQL server
Dept of ISE, AIT 18
Pharmacy Management System 2020-2021
4.3.1.1 PHP
PHP is a server-side scripting language designed primarily for web development but also
used as a general programming language PHP code may be embedded into HTML or
HTML5 markup or it can be used in combination with various web template systems, web
content management systems, and web frameworks. PHP code is usually processed by a PHP
interpreter implemented as a module in the web server. The web server software combines
the results of the interpreted and executed PHP code, which may be any type of data,
including images, with the generated webpage.[1]
4.3.1.2 WEB SERVER: APACHE
Apache is the most widely used web server software. Developed and maintained by Apache
Software Foundation, Apache is open-source software available for free. It runs on 67% of all
web servers in the world. It is fast, reliable, and secure. It can be highly customized to meet
the needs of many different environments by using extensions and modules. Most WordPress
hosting providers use Apache as their web server software. However, WordPress can run on
other web server software as well.[2]
4.3.1.3 HTML
HTML is an acronym that stands for HyperText Markup Language.
HyperText: HyperText simply means "Text within Text". A text has a link within it, is a
hypertext. Every time you click on a word that brings you to a new webpage, you have clicked
on a hypertext.
Markup language: A markup language is a programming language that is used to make text
more interactive and dynamic. It can turn a text into images, tables, links, etc. An HTML
document is made of many HTML tags and each HTML tag contains different content.[3]
4.3.1.4AVASCRIPT
Javascript is a dynamic computer programming language. It is lightweight and most commonly
used as a part of web pages, whose implementations allow client-side script to interact with
the user and make dynamic pages. It is an interpreted programming language with object-
oriented capabilities.[4]
Dept of ISE, AIT 19
Pharmacy Management System 2020-2021
CONCLUSION
Pharmacy management system is actually a software which handle the essential data
and save the data and actually about the database of a pharmacy and it's management.This
software help in effectively management of the pharmaceutical store or shop.It provide the
statistics about medicine or drugs which are in stocks which data can also be updated and
edited.It works as per the requirement of the user and have options accordingly.It allow user
to enter manufacturing as well as the expiry date of medicine placing in stock and for sales
transaction.This software also have ability to print the bill and invoices etc.The record of
suppliers supplies can also be saved in it.There are other function available too . The main
purpose is effectively and easily handling of pharmacy data and it's management.
Dept of ISE, AIT 20
Pharmacy Management System 2020-2021
FUTURE ENHANCEMENT
Due to the findings from carrying out this research on Pharmacy Management System, some
points to consider in its
implementation in the future include:
1. A platform capable of use at a regional/national level
2.Strict security measures put in place to prevent an abuse of the
application in general
Dept of ISE, AIT 21
Pharmacy Management System 2020-2021
REFERENCES
[1] https://github.com/samgakii123/
[2] http://php.net/
[3] https://www.http://en.wikipedia.org/wiki/PHP
[4] https://www.w3shools.com
Dept of ISE, AIT 22
Pharmacy Management System 2020-2021
APPENDIX ‘A’- CODE SNIPPETS
Dept of ISE, AIT 23
Pharmacy Management System 2020-2021
A.1 DATABASE CONNECTION
The connect() / mysqli_connect() function opens a new connection to the MySQL
server with the following syntax:
mysqli_connect(host, username, password, dbname);
FIG A.1 Database Connection
A.2 INPUT QUERY
This query is used to get the details of the cashier using INSERT querry
FIG A.2 Input Query
A.3 SELECT QUERY
In this querry, all the details are fetched using SELECT * command
FIG A.3 Select Query
A.4 UPDATE QUERY
Dept of ISE, AIT 24
Pharmacy Management System 2020-2021
Here the update query is called to update the user of an already existing based on its name and
category id,address etc respectively.
FIG A.4 Update Query
A.5 DELETE QUERY
Here the delete query is called to delete a particular person based on user id, user name
FIG A.5 Delete Query
Dept of ISE, AIT 25
Pharmacy Management System 2020-2021
APPENDIX ‘B’ – SCREENSHOTS
B.1 LOGIN PAGE
Dept of ISE, AIT 26
Pharmacy Management System 2020-2021
This is the first window when the application is executed as shown in Fig B.1.
FIG B.1 LOGIN Page
B.2 ADMIN HOME PAGE
On successful login, admin can either add, update or delete any user and can also view the
details of all the pharmacists and cahier
FIG B.2 Admin Login Page
B.3 ADMIN_PHARMACIST PAGE
Dept of ISE, AIT 27
Pharmacy Management System 2020-2021
admin can access to add, update or delete any pharmacist and view their id,username,firstname
and lastname in fig.B3
FIG B.3 Admin_Pharmacist Page
B.4 ADMIN_Cashier Page
admin can access to add, update or delete any pharmacist and view their
id,username,firstname and lastname Fig B.4.
FIG B.4 Admin_Cashier Page
B.5 PHARMACIST HOME PAGE
Dept of ISE, AIT 28
Pharmacy Management System 2020-2021
PHARMACIST can view and write prescription. And also check the availability of
medicine stock shown in Fig B.6.
FIG B.5 PHARMACIST Home Page
B.6 PHARMACIST_PRESCRIPTION PAGE
On this page, PHARMACIST can view and add the prescription ,here the invoice id
will generate as shown in Fig B.6.
FIG B.6 Pharmacist Prescription Page
B.7 PHARMACIST STOCK PAGE
Dept of ISE, AIT 29
Pharmacy Management System 2020-2021
On this page, Pharmacist can view the name of drugs,availability of
stocks,description of drugs,availability and access to remove medicine on figB.7
FIG B.7 PHARMACIST STOCK PAGE
B.8 CASHIER HOME PAGE
On successful login,cashier can move to process payment page shown in fig B.8
FIG B.8 Casheir Home Page
B.9 CASIER PAYMENT PAGE
Dept of ISE, AIT 30
Pharmacy Management System 2020-2021
In this payment page using invoice Id they can view the temporary prescription and can pay
the amount which is shown in Fig B.9
FIG B.9 Cashier Payment Page
Dept of ISE, AIT 31