mewa hospital software system
DESCRIPTION
AbstractThe project analysis and evaluates the current Pharmacy system of MEWA Hospital Pharmacy department, feasibility and practicalilty as well as develop a new proposed system to the deparment and organizationCurrently MEWA pharmacy departments does not have an automated system to analyze stock and statistical records, generate monthly reports, pricing and invoicing of the patients which has lead to organization to compromise the core pharmacist work of dispensing and customer care hence leading to inefficiency causing high patient waiting time and loss of patients to competitors. The main object of this project is to automate the current manual pharmacy system by implementing computer based Pharmacy Information system, which will address the inefficiency of the department leading loss of patients to competitors.The target users of the pharmacy system are all users of pharmacy department at different dispensing outlets namely Outpatient Pharmacy, Inpatient Pharmacy, HIV Testing & Counseling (HTC) Pharmacy, Theatre Pharmacy, Surgical Pharmacy, Procurement Pharmacy and Drug Store. The sample sampling technique entails to take employees and divided into stratum according to their outlet since the Population is heterogeneous a stratified random sampling technique was graphed. Three representatives were selected from each outlet where a simple random sampling was conducted to select a few employees; the questionnaires were then distributed to the staffs as per outlet. Each outlet was given three questionnaires.The questionnaire method of data collection was adopted to collect primary data. The Questionnaires administered contained closed questions and were hand delivered to the Targeted group. The proposed system will run on windows platform using Microsoft Visual Studio 2008 programming language, with Microsoft Access 2007 as the database. The Visual Studio is an ideal programming language for creating sophisticate applications, it’s based on graphical user interface (GUI) friendly interface for all system users.This project will involve the analysis of the methodology technique put in use to aid in the creation of the proposed system and the successful development and implementation of the system. The methodology that will be used will be Phase Development Methodology of Rapid Application Development (RAD).From the above discussion it can be recommended that although pharmacy system has been computerized, after gap analysis and literature review there are many areas of improvementTRANSCRIPT
i
JOMO KENYATTA UNIVERSITY OF
AGRICULTURE AND TECHNOLOGY
BACHALOR OF SCIENCE IN
INFORMATION TECHNOLOGY
ICS 2304 REPORT
MEWA PHARMACY SOFTWARE SYSTEM
ABDULREHMAN AHMED MOHAMED
CS211-C005-0043/11
SUPERVISED BY
AISHA MOHAMED
JUNE 2012
STAGE III SEMESTER I 2011/2012
ii
DECLARATION
I hereby declare that I am responsible for the work submitted in this project,
that the original work is my own and conducted only in collaboration with
Aisha Mohamed, who is my supervisor and except as specified in the
references and acknowledgements, and that the original work contained herein
have not been taken or done by unspecified sources or persons.
ABDULREHMAN AHMED MOHAMED
CS211-C005-043/11
Signature
Date_______________________________________________
This report has been submitted for examination with my approval as University
supervisor.
AISHA MOHAMED MODHAR
Signature _____________________________________________
Date________________________________________________
iii
ABSTRACT
The project analysis and evaluates the current Pharmacy system of MEWA
Hospital Pharmacy department, feasibility and practicalilty as well as develop
a new proposed system to the deparment and organization
Currently MEWA pharmacy departments does not have an automated system
to analyze stock and statistical records, generate monthly reports, pricing and
invoicing of the patients which has lead to organization to compromise the core
pharmacist work of dispensing and customer care hence leading to inefficiency
causing high patient waiting time and loss of patients to competitors.
The main object of this project is to automate the current manual pharmacy
system by implementing computer based Pharmacy Information system, which
will address the inefficiency of the department leading loss of patients to
competitors.
The target users of the pharmacy system are all users of pharmacy department
at different dispensing outlets namely Outpatient Pharmacy, Inpatient
Pharmacy, HIV Testing & Counseling (HTC) Pharmacy, Theatre Pharmacy,
Surgical Pharmacy, Procurement Pharmacy and Drug Store.
The sample sampling technique entails to take employees and divided into
stratum according to their outlet since the Population is heterogeneous a
stratified random sampling technique was graphed. Three representatives
were selected from each outlet where a simple random sampling was
iv
conducted to select a few employees; the questionnaires were then
distributed to the staffs as per outlet. Each outlet was given three
questionnaires.
The questionnaire method of data collection was adopted to collect primary
data. The Questionnaires administered contained closed questions and were
hand delivered to the Targeted group.
The proposed system will run on windows platform using Microsoft Visual
Studio 2008 programming language, with Microsoft Access 2007 as the
database. The Visual Studio is an ideal programming language for creating
sophisticate applications, it’s based on graphical user interface (GUI) friendly
interface for all system users.
This project will involve the analysis of the methodology technique put in use
to aid in the creation of the proposed system and the successful development
and implementation of the system. The methodology that will be used will be
Phase Development Methodology of Rapid Application Development (RAD).
From the above discussion it can be recommended that although pharmacy
system has been computerized, after gap analysis and literature review there
are many areas of improvement
v
TABLE OFCONTENTS
PREFACE .................................................................................................... i-xii
Declaration ...................................................................................................... i
Abstract ..................................................................................................... ii-iii
Table of Content ........................................................................................ iv-vii
Table of Figures ...................................................................................... viii-ix
List of Table .................................................................................................... x
Acronyms ................................................................................................. xi-xii
CHAPTER 1
INTRODUCTION ....................................................................................... 1- 8
1.1 Background .......................................................................................... 1- 4
1.2 Statement of the problem ..................................................................... 4- 5
1.3 Objective .................................................................................................. 5
1.3.1 Specific Objective ............................................................................. 5 -6
1.4 Justification .......................................................................................... 6 -7
1.5 Project Scope ............................................................................................ 7
1.6 Target Users ......................................................................................... 7 - 8
1.7 Project Limitation .................................................................................... 8
1.8 Summary .................................................................................................. 8
CHAPTER 2
LITERATURE REVIEW .......................................................................... 9-26
2.1 Introduction .............................................................................................. 9
2.2 Theoretical Review ............................................................................. 9-12
2.3 System Review .................................................................................. 13-25
2.4 System Critique ................................................................................. 25-26
vi
2.5 System Adaption .................................................................................... 26
CHAPTER 3
ANALYSIS AND DESIGN ...................................................................... 27-51
3.1 Introduction ............................................................................................ 27
3.2 Development Approach ......................................................................... 27
3.2.1 System Design ....................................................................... 27-28
3.2.2 Systems Development Lifecycle (SDLC) Steps .................... 28-30
3.2.3 Structured Design ....................................................................... 30
3.2.4 RAD (Rapid Application Development) ............................... 31-36
3.2.5 Methodology Justification ..................................................... 36-38
3.3 Fact Finding Approach ........................................................................... 38
3.3.1 Research Design ......................................................................... 38
3.3.2 Target Population ....................................................................... 39
3.3.3 Sample and Sample techniques .................................................. 39
3.3.4 Data Collection Tools ................................................................. 39
3.4 Requirement Specification ..................................................................... 40
3.5 Logical Design ....................................................................................... 41
3.5.1 Activity Diagram ........................................................................ 41
3.5.2 Data Flow Diagram .................................................................... 42
3.5.3 Use Case Diagram ...................................................................... 43
3.6 Database Design ............................................................................... 44- 49
vii
3.7 Interface Design ..................................................................................... 49
3.8.1 Specific Platform ................................................................................. 49
3..8.2 Hardware Specification ...................................................................... 50
3.9 Justification ............................................................................................ 50
3.10 Conclusion ........................................................................................... 51
CHAPTER 4
IMPLEMENTATION ............................................................................ 52 - 59
4.1 Introduction ............................................................................................ 52
4.2 Construction and Coding ................................................................ 52 - 58
4.3 Findings and Results ....................................................................... 58 - 59
CHAPTER 5
CONCLUSION AND RECOMMENDATIONS .................................. 60 - 62
5.1 Introduction ............................................................................................ 60
5.2 Summary .......................................................................................... 60 -61
5.3 Conclusions ............................................................................................ 61
5.4 Recommendations ............................................................................ 61 -62
REFERENCES ..................................................................................... 63 -64
APPENDICES .................................................................................... 65 -150
1.5 Appendices A ............................................................................................ 65
A.1 Project Budget ...................................................................................... 65
A.2 Expected Completion Time ........................................................... 66 - 67
1.6 Appendices B ................................................................................ 68 - 144
viii
B.1 Login System Code ........................................................................ 68 - 72
B.2 Main Dash Board Code .................................................................. 72 - 73
B.3 Sales Report Code .......................................................................... 73 - 74
B.4 Staff Work load Cod ........................................................................ 75 - 76
B.5 Stock level .................................................................................... 76 - 144
1.7 Appendices C . ............................................................................. 145 -150
C.1 User Acceptance Test Form ........................................................ 145 -146
C.2 Letter to organization .......................................................................... 147
C.3 Questionnaire .............................................................................. 148 - 150
ix
1.1 List of Figures
CHAPTER 2
LITERATURE REVIEW ............................................................................... 9
Figure 2.1 Apothesoft, (2001). Main treatment filling screen ..................... 14
Figure 2.2 Apothesoft, (2001). Patient information screen .......................... 15
Figure 2.3 Apothesoft, (20010. Patient profile screen .................................. 16
Figure 2.4 Care Right Tech (2006). Prescription generation ....................... 18
Figure 2.5 Care Right Tech (2006). Dispensing medication ........................ 19
Figure 2.6 Care Right Tech (2006). Consulting the drug formulary ........... 20
Figure 2.7 Care Right Tech (2006). Consulting for prescription ................. 21
Figure 2.8 Wasifable, (2011). Main menu ................................................... 23
Figure 2.9 Wasifable, (2011). Setting up pharmacy store ............................ 24
Figure 2.10 Wasifable, (2011). Making sales of medicine .......................... 25
CHAPTER 3
ANALYSIS AND DESIGN .................................................................... 27 - 51
Figure 3.1 Eton Digital, (2004). Structure design methodology .................. 31
Figure 3.2 Eton Digital, (2004). Phased development methodology ........... 33
Figure 3.3 Eton Digital, (2004). Prototyping methodology ......................... 34
Figure 3.4 Eton Digital, (2004). Throw-away prototyping methodology .... 36
Figure 3.5 Eton Digital, (2004). Traditional and RAD methodology .......... 38
x
Figure 3.6 Activity diagram, Pharmacy login system (2012) ...................... 41
Figure 3.7 Data flow diagram, Login validation system (2012) .................. 42
Figure 3.8 Use case diagram, Pharmacy dispensing system (2012) ............ 43
Figure 3.9 Access database, Pharmacy system database (2012) .................. 44
Figure 3.10 Data flow diagram, MEWA pharmacy system (2012) ............. 45
CHAPTER 4
IMPLEMENTATION ............................................................................. 52 -59
Figure 4.1 MEWA Pharmacy login window (2012) ..................................... 52
Figure 4.2 MEWA Pharmacy Main dash board window (2012) .................. 53
Figure 4.3 MEWA Pharmacy Sales report (2012) ........................................ 54
Figure 4.4 MEWA Pharmacy Staff workload (2012) ................................... 55
Figure 4.5 MEWA Pharmacy Stock level (2012) ......................................... 55
Figure 4.6 MEWA Pharmacy Administration (2012) ................................... 56
Figure 4.7 MEWA Pharmacy Prescription (2012) ........................................ 57
Figure 4.8 MEWA Pharmacy Purchase invoice (2012) ................................ 58
APPENDICES
Appendices A ............................................................................................ 65 - 67
Figure 1.0 Resource budget cost (2012) ...................................................... 65
Figure 1.1 MEWA pharmacy development activity (2012) ........................ 66
Figure 1.2 MEWA Pharmacy schedule (2012) ............................................ 67
xi
1.2 List of Tables
CHAPTER 3
ANALYSIS AND DESIG) ...................................................................... 45 - 49
Table 3.1 Access database, Login table (2007) ............................................ 45
Table 3.2 Access database, Purchase table (2007) ........................................ 45
Table 3.3 Access database, Invoice table (2007) .......................................... 46
Table 3.4 Access database, Prescription table (2007) ................................... 46
Table 3.5 Access database, Sales table (2007) .............................................. 47
Table 3.6 Access database, Workload table (2007) ...................................... 47
Table 3.7 Access database, Stock table (2007) ............................................. 48
Table 3.8 Access database, Vendor table (2007) .......................................... 48
Table 3.9 Access database, Pharmacy System Database (2007) .................. 49
xii
1.3 Acronyms
MEWA Muslim Education and Welfare Association
ATM Automated Teller Machine
HTC HIV Testing and counseling
HIV Human Immunodeficiency Virus
AIDS Acquired Immune Deficiency Virus
TB Tubercle Bacillius
LPO Local Purchase Order
GUI Graphical User Interface
RAM Random Access Memory
MB Mega Bytes
MHz Mega Hertz
GB Giga Bytes
xiii
CBIS Computer Based Information System
PIS Pharmacy Information System
DUR Drug Utilization Review
MIS Management Information System
RAD Rapid Application Development
SDLC Software Development Life Cycle
4G Fourth Generation
DRY Don’t Repeat Yourself
TDD Test Driven Development
1
CHAPTER 1
INTRODUCTION
1.1 Background
Troiano (1999), explains the basic functions commonly needed in a pharmacy
department information system, how they are used, and important features
related to them, should provide support to the following activities performed
in the pharmacy:
Inpatient order entry, management, and dispensing; Outpatient order entry,
management, and dispensing; Inventory and purchasing management
Reporting (utilization, workload, and financial); Clinical monitoring;
Manufacturing and compounding; Intervention management; Medication
administration; Connectivity to other systems; Pricing, charging, and billing.
Inpatient Order Entry: Typically there are three steps in initial order entry.
The first is the physical entry of the order (which may involve persons outside
of the pharmacy department). This may come from an order communications
system where a physician, nurse, or ward clerk has entered it, or may be
directly entered into the pharmacy system. The differences between orders
entered by pharmacy department personnel and orders entered by other parties
are explained at subsequent points in this article.
The second step is the pharmacist’s validation of the order. When an order is
entered by anyone other than a pharmacist, it must be given a conditional or
2
pending status. These orders are subject to review by a pharmacist prior to
being dispensed to a patient.
The third step is the initial dispensing of the medication in preparation for
administration to the patient. Order entry in the pharmacy is typically used to
identify a pharmaceutical product that is suitable to meet the physician order.
This includes identification of crucial aspects of the order such as item
strength, package size, method of administration, as well as the ingredients that
must be prepared by the pharmacy. In order to ensure a continuing supply of
the medication to the patient, the location, method of distribution, and supplier
must also be specified. This allows for an efficient, ongoing automated
resupply of the medication. Typically, there are six types of orders that may
occur in relation to the specific product being used in an inpatient setting, the
schedule of the administrations, and the method of resupply:
Inpatient Order Management and Dispensing: Because physicians or
pharmacists frequently must change pharmacy orders, it is important that a
pharmacy be able to change the orders quickly and easily, while maintaining a
complete and easily accessible audit trail.
The patient profile is the primary order review screen used in most pharmacies.
This screen provides a summary-level view of the patient’s orders. It is
desirable to have a number of options for sorting and displaying orders and
subsets of orders. This allows the pharmacist to have a full understanding of
the patient’s orders, and to focus on those of a specific type, such as IV,
antibiotic, or those of a certain drug. The profile should provide easy drill-
3
down to the detail of the orders. This detail should include the entire history of
the order, audit trails, drug interactions, dispensing history, charges, and any
other comments or notes. Easy access to pharmacy order details is also
important; the program user should be able to access specific pieces of
information directly and with little effort.
The use of automation in the inpatient setting to perform routine dispensing has
become quite common. There are principally two types of pharmacy
dispensing automation systems, centralized and decentralized. The pharmacy
computer system must be able to handle both types of systems jointly or
separately.
The centralized dispensing device is typically a large robot that has access to
the most frequently used medications. It can perform labeling of medications
for patients or place medications in patient-specific drawers in an exchange
cart. The interface to the centralized automation is generally a one way,
periodic interface used to handle refills of ongoing orders and, less frequently,
the initial dispensing for orders recently entered into the system.
The decentralized dispensing device is analogous to an ATM (Automated
Teller Machine). These devices generally contain two-way interfaces and are
located near the patient care area. The pharmacy information system may send
a list of verified orders for each patient to the device. This permits some
devices to provide a check on the person requesting the medication for a
specific patient. If the patient does not have an order for the medication, the
4
requestor is notified and may even be prohibited from obtaining the
medication. There is a billing interface from the dispensing device, networked
to the pharmacy system, to log which medications have been dispensed for
which patients.
The project aims to automate the current MEWA Hospital Pharmacy
department manual system, pushing paperwork, for ages. They have had
cumbersome working procedures and this has led to low productivity
occasioned by highly inept manual system.
MEWA Hospital was founded in 1985 in Mombasa and its principle objective
is to promote, encourage and improve the medical, educational, socio-
economical and cultural welfare of all Kenyans. (MEWA 2000)
1.2 Statement of the problem
Currently MEWA pharmacy departments does not have an automated system
to analyze stock and statistical records, generate monthly reports, pricing and
invoicing of the patients which has lead to organization to compromise the core
pharmacist work of dispensing and customer care hence leading to inefficiency
causing high patient waiting time and loss of patients to competitors.
The Manual system has made it more difficult to keep up with the prices
updates as changes in prices are daily norms due to the fluctuation of the
foreign currency. This has result in undercharging or overcharging the patient,
consuming a lot of time and materials.
5
The results of the interview with the pharmacy staff yield the following
problems:
i. Going through physical stock count and using bin card to generate
replenishment orders to the suppliers.
ii. Manually filling in of various procurement documents i.e. Local
Purchase Order, Requisition Forms, Issues Notes etc, which has proved
to be cumbersome and time consuming.
iii. Calculating the prices of each and every medicine for the purpose of
quotation or a sale to the patient, which is time consuming and
cumbersome.
iv. Manual inventory controls where bin cards are to be manually updated
for each and every sale or purchase.
v. The manual recording of prescriptions on a prescription book, as per
pharmacy practice requirement of CAP 244 of Kenya Law.
1.3 Objective
The main purpose of this project is to automate the current manual pharmacy
system by implementing computer based Pharmacy Information system, which
will address the inefficiency of the department leading loss of patients to
competitors.
1.3.1 Specific Object
The specific objective entails to develop system modules that will
i. To reduced pharmacist work load by half.
6
ii. To harmonize prices within different outlets
iii. To reduced patient service time (time taken for a patient to be served)
by at least half.
iv. To keep track of the inventory
1.4 Justification
The significance of this project is the automation of current Manual
Information System to a Computer Based Information System (CBIS) will
benefit its users as
i. Reduced patient waiting time – The pharmacist time will be reduced as
most of the functions will be replaced by the Computer based
information system as a result patient will be attended much faster as
compared to the current system.
ii. Reduced users work load – The general work load of the pharmacist
will be significant reduced and give room to the pharmacist to give
better services especially in the areas of patient medication compliance
and customer care.
iii. Up to date prices – The system will entail prices which can be view in
all outlets at any time. While any changes of prices are reflected
immediately and the pharmacist doesn’t bother to memorize the price,
as it is taken care by the system
iv. Up to date stock levels – The stock levels will be automated by system.
This will give the pharmacist information to avoid over stocking, under
stocking and to avoid stock outs.
7
v. Automated orders using reorder levels - The stock levels will be
automated by system. This will give the pharmacist the re-order level as
the cost of out of stock may lead to patient dead.
1.5 Project Scope
The scope of this project is MEWA Hospital Pharmacy department situated at
Sharif Kassim Street, Kingo’rani next to Musa Mosque Mombasa Kenya.
1.6 Target Users
The target users of the pharmacy system are all users of pharmacy department
at different dispensing outlets namely
i. Outpatient Pharmacy: This is an outlet that deals with patient who are
seen for all general illness and medication are prescribed and the patient
does not need hospitalization but allowed to go home.
ii. Inpatient Pharmacy: This outlet deals with critically ill patients who
need specialized professional care. These patients need to be
hospitalized and be monitored around the clock. Special medications
are prepared for them.
iii. HIV Testing & Counseling (HTC) Pharmacy: This outlet specializes
with patients suffering HIV/AIDS and TB diseases. The pharmacist
deals with drug compliance counseling of Anti-retrial and Anti-TB
therapy.
iv. Theatre Pharmacy: It is an outlet that specializes with anesthetists
medication, pre-operative medication and post-operative medication.
These are patient who need surgery to elevate their suffering.
8
v. Surgical Pharmacy: It is an outlet that mostly deals with other medical
department within the hospital. The outlet deals with surgical
consumables like syringes, needles, gloves, and many others.
vi. Procurement Pharmacy: It is an outlet that deals with inventory
controls. It deals with suppliers, Local Purchase Orders (LPO),
quotations, discounts and so on.
vii. Drug Store: It is an outlet that deals with store management. Both
medical and surgical supplies are store in required conditions as
speculated by the manufacture to preserve potency.
1.7 Project Limitation
i. Subjective biases reported on data reported by the respondents
ii. Not all employees responded
1.8 Summary
MEWA Hospital has been operating on manual systems, stand alone systems,
pushing paperwork, for ages. They have had cumbersome working procedures
and this has led to low productivity occasioned by highly inept manual
systems.
In MEWA Hospital there is an increased recognition of information as an
important corporate resource that is key to good decision making in a
competitive and ever dynamic environment; and technology- hardware,
software, telecommunications and related technologies- is now fairly priced
and therefore more affordable to take this decision.
9
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
This chapter examines the related literature on the development of pharmacy
software system in different organizations. It also examines the different
literature on pharmacy practice and dispensing procedures as prescribed by
different pharmaceutical regulatory boards or government agencies.
2.2 Theoretical Review
According to Biohealthmatics (2012), Pharmacy information systems (PIS) are
complex computer systems that have been designed to meet the needs of a
pharmacy department. Through the use of such systems, pharmacists can
supervise and have inputs on how medication is used in a hospital.
Some of the activities which Pharmacy Information Systems have been
employed in pharmacy departments include:
Clinical Screening: The Pharmacy Information System can assist in patient
care by the monitoring of drug interactions, drug allergies and other possible
medication-related complications.
When a prescription order is entered, the system can check to see if there are
any interactions between two or more drugs taken by the patient
simultaneously or with any typical food, any known allergies to the drug, and if
the appropriate dosage has been given based on the patient’s age, weight and
10
other physiologic factors. Alerts and flags come up when the system picks up
any of these.
Prescription Management: The Pharmacy Information System can also be use
to mange prescription for inpatients and/or outpatients. When prescription
orders are received, the orders are matched to available pharmaceutical
products and then dispensed accordingly depending on whether the patient is
an inpatient or outpatient.
It is possible to track all prescriptions passed through the system from who
prescribed the drug, when it was prescribed to when it was dispensed.
It is also possible to print out prescription labels and instructions on how
medication should be taken based on the prescription.
Inventory Management: Pharmacies require a continuous inventory culture in
order to ensure that drugs do not go out of stock. This is made even more
difficult when there are multiple dispensing points. When don manually it is
very difficult to maintain an accurate inventory.
Pharmacy Information Systems aid inventory management by maintaining an
internal inventory of all pharmaceutical products, providing alerts when the
quantity of an item is below a set quantity and providing an electronic ordering
system that recommends the ordering of the affected item and with the
appropriate quantity from approved suppliers.
11
Patient Drug Profiles: These are patient profiles managed by the Pharmacy
Information System and contain details of their current and past medications,
known allergies and physiological parameters. These profiles are used for used
for clinical screening anytime a prescription is ordered for the patient.
Report Generation: Most Pharmacy Information Systems can generate reports
which range from determining medication usage patterns in the hospital to the
cost of drugs purchased and or dispensed.
Interactivity with other systems: It is important that Pharmacy Information
Systems should be able to interact with other available systems such as the
clinical information systems to receive prescription orders and financial
information system for billing and charging.
Damle and Puri (2007), mentioned the key benefits of pharmacy management
systems are to automating processes, streaming workflow and thereby
enhancing the customer base which are attractive enough to draw retail
pharmacy chains competing in a world of growing challenges. However, the
choices are tough with handful of products and high cost of customized
solutions.
Pharmacy chains competing for growth in the face of significant competitive
face of dire need to improve productivity t cope withe sever shortage of trained
pharmacy staff and regulatory government bodies like pharmacy and poision
board. To address these challenges, the need to develop customers pharmacy
12
management systems to suit a particular country regulation and requirement,
(Damle and Puri , 2007).
Pharmacy Management Systems – Critical Features
Pharmacy management system must work unfailingly, flawlessly and
seamlessly in complex multi-outles, to enable drugstore chains to operate
efficiently and profitably.
Some of the functionality driven critical features include:
Smooth workflow processes – enabling external services such as third
payments, DUR (Drug Utilization Review), consultation, wait time calculation.
Integration capabilities – for refill alerts, grouping of prescription, point of sale,
order/inventory management and order-to-promise.
Centralized view of data – including patient history, inventory and ability to fill
prescription anywhere in the outlet and prescription transfers.
Workload balancing – ability to off-load activities to alternative outlets.
Ability to extend services and integrate across channels, viz, e-commerce, e-
prescription and mail-orders.
From the architecture perspective, pharmacy management systems can be
centralized with corporate as the hub and client terminals as the outlets. An
alternative could be standalone outlet-driven systems where frequent
connectivity with the headquarters is not essential, or even a combination of
the two. The model to be selected would be based on the pharmacy practise of
a particular country’s regulations and rules.
13
2.3 System Review
The market entails various pharmaceutical information systems but there is no
one general prototype that can be applied to all types pharmacy outlets.
Therefore there is a need for customized software information system to solve
user customer need. The following are a few among several information
systems with varying degrees of functionalities depending on the user customer
needs.
2.3.1 ApotheSoft Pharmacy Management Software
The ApotheSoft pharmacy management software was designed by a
Pharmacist who fills prescriptions everyday with the Apothesoft pharmacy
software. The ApotheSoft pharmacy software does dual third party insurance
billing. The ApotheSoft program has been designed and is intended for small
retail pharmacies that have script volumes of 100 to 500 prescriptions per day,
as report by ApotheSoft, (2001).
The ApotheSoft Pharmacy management software was designed with the
following functionality models:
i. Entering a New Patient (Customer).
ii. Entering the Doctor's Information.
iii. Inputting Inventory.
iv. Entering Insurance Claim Information.
v. Pricing Table.
vi. Inputting Compounds.
14
vii. Entering Intravenous Medication Compounds.
viii. Entering Prescriptions.
ix. Running Reports.
x. Medication Administration Records.
The Figure 2.1 below is the main screen of the ApotheSoft Pharmacy
Management Software, and has the following modules
Figure 2.1 ApotheSoft, (2001). Main Treatment Filling Screen
Treatment Information: It is compose of the unique number of for the
treatment regime, filled date of the drugs, the next refill date, the drug labels
and patient status
Patient Name and Information: It is compose of patient details like patient
name, patient date of birth, insurance number and insurance plans.
15
Doctor Name and Information: It is compose of doctor name, doctor phone,
doctor DEA number and doctor fax.
Drug Name and Information: It is compose of Drug name, Drug NDC
number, Generic Name and treatment Id number.
Cost / Price Information: It is compose of Unit cost, Unit / Packet price,
amount of markup, amount of discount and total amount.
Treatment fill data: It is composed of quantity dispensed, the print label of
drug instruction, total amount, dispensed to date, quality remaining and total
amount authorized
The Figure 2.2 below is the Patient Information screen of the ApotheSoft
Pharmacy Management Software, and has the following modules
Figure 2.2 ApotheSoft, (2001). Patient Information Screen
16
Patient Search: The search window consists of different types of searches for
a patient. The pharmacist can search the patient using patient last name, or
patient phone number, and or patient address.
Adding New Patient: This window consists of the bio-data of the patient. It
entails the patient full names, patient insurance number, patient phone number,
patient insurance limit and patient address.
Insurance Information: The Insurance window mainly deals with insurance
details. The information is insurance plan, insurance code, employee id, person
code, insurance verification code and insurance card validity.
The Figure 2.3 below is the Patient Profile screen of the ApotheSoft Pharmacy
Management Software, and has the following modules
Figure 2.3 ApotheSoft, (2001). Patient Profile Screen (Summary)
17
Patient Detail: The Patient detail window entails the basic patient information.
The Patient detail is the patient name, patient prescription number, patient
insurance policy plan and the patient treatment regime.
Patient History: The patient history window entails the patient treatment
regime history. The module entails specify date criteria from a specify date to a
current date. The prescribing habit for a particular doctor can also be accessed.
Drug Interaction: The drug interaction window entails a list of all medication
of the patient currently taking. This list gives a snap shot view to pick any drug
reaction or interaction in the list for patient safety.
2.3.2 MedRight Medication Management Software
According to Care Right Tech (2006), MedRight Medication Management
Software was designed specifically for long term care facilities; MedRight™
medication management software differentiates itself from other Electronic
Medication Administration Record systems with its easy to use functionality
and its transparent state of the art technology.
The MedRight medication Management software has the following features
i. Full medication profile for residents
ii. Pharmacy integration
iii. Biometric authentication
iv. Eliminate monthly changeover
v. Patient directives viewable
vi. Medication check-in & Inventory counts
18
vii. Late medication, follow-up reminders
viii. Insulin sliding scale setup available
ix. Bar code scanner (optional)
x. Flexible & powerful reporting
Dispensing Medication
The Figure 2.4 below is the Prescription Generation screen of the MedRight
Medication Management Software, and has the following modules
Figure 2.4 Care Right Tech (2006). Prescription Generation
Prescription Generation
The figure 2.4 entails the following functionalities; the doctors or prescriber’s
name, the date of the prescription, the new treatment or regime prescribed to
19
the patient, the treatment name, the doctors diagnosis, the treatment starting
date and treatment ending date.
There is a calendar for ease access for patient drug management schedules for
the treatment regime compliance.
There are also two buttons one for cancel if the pharmacist is unsure and made
any mistake and another for submit the information to be saved in the database.
Dispensing Medication
The Figure 2.5 below is the Dispensing Medication screen of the MedRight
Medication Management Software, and has the following modules
Figure 2.5 Care Right Tech (2006). Dispensing Medication
20
Dispensing Medication window: It gives a full detail of a typical legal
prescription with all the components of the prescription. It entails doctors
name, prescription date, drug names and drugs strength, and drug frequency
and drug duration
It has three buttons for validation of dispensing. The one label Give for
dispensed drugs, the other label Not Given for non-dispensed drugs and the
lastly label Options for special instruction and drug instruction information to
the patient.
Consulting the drug formulary
The Figure 2.6 below is the Consulting the drug formulary screen of the
MedRight Medication Management Software, and has the following modules
Figure 2.6 Care Right Tech (2006). Consulting the drug formulary
21
The Figure 2.6 shows the pharmacist if the doctor is prescribing rational. A
drug formulary is a list prepared by the pharmacists and other stalk holders
including insurance company to control type of drugs to be prescribed and
dispensed to the patient.
In this window a comparison of the prescription and the of the formulary is
done while those drugs not supposed to be dispensed to a particular patient are
marked “NOT ACTIVE”
Consulting for prescription conformity
The Figure 2.7 below is the Consulting for prescription conformity screen of
the MedRight Medication Management Software, and has the following
modules
Figure 2.7 Care Right Tech (2006). Consulting for prescription conformity
22
Consulting for prescription conformity
The new routing medication window show the prescription conformity details
which include the doctors name, order date, order type, type of medication,
medication name, the start and end of the prescription, number of doses,
treatment type and diagnosis.
2.3.3 Axis Pharmacy Manager Software
According to Wasifable (2011), Axis Pharmacy Manager Software is a
comprehensive solution designed to automate the activities of
Medical/Pharmaceutical Retailers. Axis Pharmacy Manager has the Capability
to administer the total enterprise and efficiency and manage information. It is
designed with an easy-to-use interface. Axis Pharmacy Manager is an
automated system for any large/medium Pharmaceutical Retailers. It covers
Complete Customer Management, Inventory Reporting, Cashier with
integrated accounts, Product database etc. Thus this software is a complete
business management/medical stores-shop management/ retail chemists and
druggists management.
The following are the features of Axis Pharmacy Manager Software
i. Purchase, Sales, Cash receipts/payments.
ii. Stock, sales, Inventory and MIS Reports.
iii. Information list views for faster data location.
iv. Easy-to-use, User friendly Graphical user interface.
v. Faster accessing, accuracy, more efficiency, more security.
vi. Better service to customer. Enhanced administration and control.
23
The Main Menu
The figure 2.8 below entails the following modules – sales, sales return,
customer, purchase, purchase return, vendors and the items
Figure 2.8 Wasifable, (2011). Main Menu
The Figure 2.9 below describes the system how it can create new pharmacy
outlets. It entails the store name, address, city, country, e-mail, drug license
numbers, additional tax among others.
24
Figure 2.9 Wasifable, (2011). Setting up the pharmacy stores (Outlets)
The Figure 2.10 below shows details when sales of the medicine. It describe
and display information of the sales number, sales date, customer type,
customer name, address, sold by, amount and tax.
25
Figure 2.10 Wasifable, (2011). Making sales of medicine
2.4 System Critique
The above three softwares vary in the functionality and integration with other
health management system. This integration biasness, depend on the country
regulatory bodies, which shows broad responsibility of a pharmacist. Theses
difference alert the professional regulatory bodies to standardized pharmacy
practice across the globe to enable system developers to come up with one
pharmacy management prototype.
26
Although pharmacy training across institutions of learning are standard but
pharmacy practice remains a challenge across the global where government
regulatory bodies regulates its professionals to work within certain limits.
This challenge has lead to the development of several variants of pharmacy
management systems, creating a need for toiler made software for a particular
region or even a particular outlet. This makes it impossible to create standard
pharmacy software that can be implemented across the globe.
2.5 System Adaption
There is a general demand on institutional managers to deliver high quality
service; there is increasing need for management productivity; efficiency
brought about by the systems; there is the increased recognition of information
as an important corporate resource that is key to good decision making in a
competitive and ever dynamic environment; and technology- hardware,
software, telecommunications and related technologies- is now fairly priced
and therefore more affordable to many institutions.
In pharmaceutical departments, the stock control has been an issue especially
the variance which cannot be eliminated due various reasons among them theft.
This system will make stock control problems a thing of the past. In
procurement procedures, partnering reorder level will also be address by this
software hence justifying all the purchases as reorder level, will be
automatically generate therefore eliminating the use of bin card to make orders.
27
CHAPTER 3
ANALYSIS AND DESIGN
3.1 Introduction
This chapter will involve the analysis of the methodology technique put in use
to aid in the creation of the proposed system and the successful development
and implementation of the system. The methodology that will be used will be
Phase Development Methodology of Rapid Application Development (RAD).
Therefore, the project analyses and evaluates the current MEWA Hospital
Pharmacy system , its feasibility, design and its practicalibily as well as to
developed a new proposed system to the deparment and organization as a
whole.
3.2 DEVELOPMENT APPROACH
3.2.1 System Design
As reported by Maner Walter (1997), in order to ensure high responsiveness,
projects are designed with fixed timescales, sacrificing functionality if
necessary. This allows the development team to focus on the pieces of
functionality that have the highest business value, and deliver that functionality
rapidly. Change is often the reason for delays in application development.
In long linear development processes, changes in functionality requirements or
project scope, particularly after a lot of time has been invested in planning,
28
design, development and testing, cause many months to be lost and significant
expense to be incurred for redesigning and redevelopment.
Rapid Application Development (RAD) combats scope and requirements creep
by limiting the project's exposure to change -- shortening the development
cycle and limiting the cost of change by incorporating it up-front before large
investments are made in development and testing."
3.2.2 Systems Development Lifecycle (SDLC) Steps
It covers many activities; starts from understanding why the system should be
built, studying the project feasibility, analyzing problems, choosing the system
design and architecture, implementing and testing it, up to delivering the
system as product to the user. SDLC is a process of gradual refinement,
meaning that it is done through several development phases. Each phase
continues and refines what’s done in the previous phase. Commonly known
development phases in SDLC are:
Planning: It is the process of understanding why the system should be built
and defining its requirements. It also includes feasibility study from several
different perspectives, technical, economic, and organization feasibility
aspects.
Analysis: This phase includes activities such as problems identifying and
analysis, and even predicting potential problems that may arise in the future
29
regarding the system. The deliverables / products of this phase will drive how
the system will be built and guide the developers’ works.
Design: System analysis leads to design decision, which exactly determines
how the system operates in terms of process, data, hardware, network
infrastructures, user interface, and other important factors in the system
environment.
Implementation: This is probably the most resource-, cost-, and time-
consuming phase of all. This is when the system is actually built, tested, and
finally installed. It also includes activities such as user training and system
maintenance. Some experts like to separate them into different phases
Deployment and Maintenance. However the four phases are the most
commonly known and accepted steps.
EtonDigital (2004), elaborate that, Software Development Life Cycle (SDLC)
tries to achieve high quality system that meets or exceeds the requirements.
Many methodologies have been developed and introduced in order to
implement SDLC; some of them also try to improve other (previously) known
methodology. Although each method follows certain different techniques and
steps, they are all must go into the same development phases described above.
There are many system development methods known today, but most of them
basically are extended from three main methodologies which are Structured
30
Design, RAD (Rapid Application Development), and Object-oriented Analysis
and Design.
3.2.3 Structured Design
As reported by EtonDigital (2004), the method follows a step-by-step
approach which moves logically from one phase to the next. The works done in
each phase need to be approved by the project sponsor (this is usually the
customer or the business analyst in an organization) before it can proceed to
the next development phase.
The Waterfall development methodology can be classified as this kind of
methodology. This rigor and inflexible manner make this methodology
vulnerable to any business changes that happen while the development is still
on the way, as it is extremely difficult to go backwards. This may require
repeating the whole development process from the start and throw away all
that’s been done, and in the worst case it could cause the change of project
contract or agreement with the customer.
There are two approaches in developing system using this methodology,
process-centered and data-centered approaches. Process-centered approach
attempts to get the works done mainly from the perspective of the processes
that exist in the operation of the system, which will likely result in system that
constructed by process-oriented components. On the other hand, the data-
centered approach concentrates on the data used by and involved in the system.
31
Structured design methodology has some advantages in that the rigor manner
of this method forces the developers (analyst and his/her team) to well identify
and understand system requirements long time before the implementation
phase begins. At least it should have been approved by the sponsor before the
developers start coding any programs.
The lack of ability to go backwards of the development phases makes this
methodology un-accommodateable to business process changes as the project
proceeds. Projects done using this methodology take a long time until users
receive some deliverables because usually the system being built cannot be
presented until it is completely done at the end of the implementation phase.
Figure 3.1 EtonDigital, (2004) Structured Design Methodology
The Figure 3.1 above shows the structured design methodology of water fall
model where one phase has to be completed before proceeding to the next
phase and there is no flexibility of revisiting the previous phase.
32
3.2.4 RAD (Rapid Application Development)
It is reported by EtonDigital (2004), RAD methodology enters to overcome the
weaknesses of Structured Design method. RAD-based development tries to
adjust the SDLC phases to have some part of the system (most likely the core
function of the system) developed quickly to be delivered to the users. Certain
types of RAD method also try to be adaptive to possible changes in the
business process by concurrently perform all development phases at (roughly)
the same time, like those manifested in the Prototyping RAD and Agile
Development Methodology.
RAD methodology introduced the use of advance development tools like code
generators and the visual fourth-generation (4G) programming languages such
as Microsoft Visual Basic and Borland Delphi. The use of these tools speed up
the development process and in some degree produces higher quality of codes.
However as the system can be delivered quickly, users tend to change their
expectations of what the system can do, thus the requirements tend to change
and expand.
There are three categories of RAD:
1 Phased Development
This method breaks the requirements into a series of versions, based on which
several versions of system will be built sequentially, being the most
fundamental and important functions bundled in the first version. Sequentially
here means that the next version development will begin only after the
preceding version has been approved and implemented. Each version has its
33
own Analysis-Design-Implementation phases (in a smaller scale compared to
the overall system). All of these versions will later be tailored to form a
complete system that meets the requirements. This method delivers useful
system very quickly to users, though it doesn’t cover all functions just yet. And
as the system will be built based on many sequential versions, it is very critical
to identify important and fundamental functions to be included in the first
version, an in-depth initial analysis of the system is needed.
Figure 3.2 EtonDigital, (2004) Phased Development Methodology
The above Figure 3.2 shows the RAD, Phased Development Methodology
where various versions of the systems are build with minimum functionalities
and keeping on improving until a final version is achieved.
34
2 Prototyping
According to EtonDigital (2004), the methodology used usually when the
business process is likely to be changed as the project proceeds or when the
project sponsor has little idea of what system to be built. The Analysis, Design,
and Implementation phases performed concurrently and on each cycle resulting
in a system prototype that will be reviewed by the project sponsor. The cycle
repeated continually based on the sponsor comments until the prototype
successfully meets the requirements. The last prototype will then be called the
system.
Prototyping development needs only initial basic analysis and design, but as
the result important system functions may not be recognized until somewhere
in the middle of project timeline. Thus there is a possibility to alter the initial
design decision and start all over again from the beginning. It can delivers
system quickly to users, though it not exactly meets the requirements.
Figure 3.3 EtonDigital, (2004) Prototyping Methodology
35
The above Figure 3.3 shows the RAD Prototyping Methodology, which entails
of building several functioning prototypes from analysis phase to
implementation phase then going back to the stake holders to see if it meets
their specification until when specification are meet.
3 Throw-away Prototyping
Adi (2008), describes the throw-away Prototyping is similar to the Prototyping
method in that it also develops a prototype. But the throw-away prototype is
rather presentational only, the prototype actually does nothing. It is intended to
help users visualize the system being built. Based on the user’s comments, the
next prototype continuously built until it can visualize the real working system.
The next step would be implementing the real system. This throw-away
prototype is also called dummy (mock-up) prototype. It is best if possible to do
a thorough initial analysis before the developers start working on the first
dummy prototype, as the dummy needs to contain enough details about the real
system. This method doesn’t deliver incomplete systems within the project
timeline like prototyping method, but in the end it delivers the complete system
very quickly. It generally has shorter project timeline compared to other
methods, because building dummies is considered easier and less time-
consuming than building working prototypes.
36
Figure 3.4 EtonDigital, (2004) Throw-away Prototyping Methodology
The above Figure 3.4 is based on the user’s comments, where the prototype is
continuously built until it can visualize the real working system. This prototype
has no functionality it gives the user an over view of the whole system in the
early development of the system.
3.2.5 Methodology Justification
EtonDigital (2004), describes the Rapid Application Development (RAD) is a
methodology for compressing the analysis, design, build and test phases into a
series of short, iterative development cycles. This has a number of distinct
advantages over the traditional sequential development model.
One of the principles of RAD is to start developing as early as possible in the
project, possibly the day the order has been signed, so that clients can review a
working prototype and offer additional direction. The application then gets
37
built in an iterative process, releasing increasingly feature-rich versions in short
development cycles and which, most importantly, involve the client in the
build of their project.
The advantages for the client are numerous. For a start, their developer doesn't
need to factor in potential future changes when implementing a feature and
therefore the client can request changes as the project evolves. When changes
to functionality are inevitably requested during development, existing code
usually has to be re-written, a process called “refactoring”. Refactored code is
moved to other places according to its nature and in the special case of
duplicate code, this is refactored to a single place, thus applying the Don’t
Repeat Yourself (DRY) principle.
And to make sure that the client’s application still runs when it changes
constantly, it needs a full set of automated unit tests. If well written, unit tests
are a solid way to ensure that nothing is broken by adding or refactoring code
in real time. Some development methodologies even stipulate writing tests
before coding, a practice that’s that's called Test-Driven Development (TDD).
38
Figure 3.5 EtonDigital, (2004) Traditional and RAD Methodologies
The Figure 3.5 above shows the different phase both for the traditional and
RAD Methodologies. It describes the system from analysis phase to the
implementation phase. It also show the inflexibility of the traditional method
where phases are executed sequentially, and the iterative nature of RAD
whereby prototype are seen at the early stages of the project.
3.3 Fact Finding Approach
This section discuss the research design, target population, sample size and
sampling technique, research instruments, data collection procedures and
various methods of Data collection instruments that is being used in the course
of the project
3.3.1 Research Design
The design for this project is sampling. Sampling is an attempt where we select
a group of subjects for study from a larger group. Each individual is chosen
39
entirely by chance and each member of the population has an equal chance of
being included in the sample.
3.3.2 Target Population
The research was carried out at the MEWA Hospital Pharmacy department and
Administration department. The population targeted for the study comprised of
employees spread out in seven different outlets from where a source of 33
employees were selected.
3.3.3 Sample and Sample techniques
The employees were divided into stratum according to their outlet since the
Population is heterogeneous a stratified random sampling technique was
graphed. Three representatives were selected from each outlet who’s a
simple random sampling was conducted to select a few employees; the
questionnaires were then distributed to the staffs as per outlet. Each outlet
was given three questionnaires.
3.3.4 Data Collection Tools
The questionnaire method of data collection was adopted to collect primary
data. The Questionnaires administered contained closed questions and were
hand delivered to the Targeted group. The questionnaires method was a
preference because most staff could only spare a short time to complete the
questionnaire and since they are pressured with the nature of their work there
was no time for lengthy discussion. The respondents were required to tick from
the option given. The procedure for data collection involved the distribution of
questionnaires.
40
3.4 Requirement Specification
The pharmacy software system will include the following functionalities
Login system – for security and data integrity, where the user is control for
access of the system. The user has to provide user name and password and
system check against the stored data and verified in order the user to log in.
Sales System – where client can make sales, the user selects the requested
medicine to be dispensed, and automatically gives the prices of the drug and
the available stock. The sales is completed by giving the grand total of the sale.
Report System – the ability to generate various reports e.g. stock transfers to
different outlets, total sales, staff workload, total purchases and closing stock.
Administration – password management, the system administrator is able to
create users and give them various rights to access the system and also deny
some functions to particular users.
Prescription – Patient records of drugs consumed, according to pharmacy and
poison board and Cap 244 of Kenya patient records in the form of prescription
should be recorded and keep for at least two years before are destroyed
Purchases – purchase type, vendors, invoices etc, the suppliers information
and history of suppliers both of the product, medicines and cost can be tract to
keep good relationship.
41
3.5 LOGICAL DESIGN
3.5.1 Activity Diagram
The activity diagram below shows how users will login in the Pharmacy
system. It further displays how users will be managed for accountability and
data integrity.
Figure 3.6 Activity Diagram, Pharmacy login system (2012)
The above Figure 3.6 above shows the pharmacy login system, where the
administrator has the privilege to create account to users to login in the system.
Also the administrator can assign to users, different privilege to access the
intended sections of the system.
42
3.5.2 Data Flow Diagram
The Figure 3.7 below shows how the login validation system uses validation
procedures to keep away unauthorized people from accessing the system hence
enhancing the system security
Figure 3.7 Data Flow Diagram, login validation system (2012)
43
3.5.3 Use Case Diagram
The Figure 3.8 below shows a use case diagram that captures the interaction
between users and the business logic of the pharmacy system. It shows
different modules and how they interact with the both the client and the server.
Figure 3.8 Use Case Diagram, Pharmacy dispensing system (2012)
44
Figure 3.9 System Data Flow Diagram, MEWA Pharmacy System (2012)
The following functionalities are depicted:
The sales modules, where a user can make sales of the drug. The report module
is able to generate various reports, the stock transfers to various pharmacy
outlets, sales report, staff work load report, purchase report, and stock report.
The administrator modules, which enables the system administrator to manager
access to the system. The Prescription modules, it has the functionality of
keeping patient records and list of medication given. The purchase module
entails the purchase made, the vendor’s information, and the invoice and
receipt.
3.6 Database Design
The Pharmacy management system entails the following tables of the database:
45
The Table 3.1 below shows the login table design consisting of various fields,
primary key is UserID and others fields are Username, Password, Surname,
Firstname, SecurityPhrase, SecurityAnswer and TimeDate.
Table 3.1 Access Database Login Table (2007)
The Table 3.2 below shows the Purchases table with ID field as its primary
key. The other fields are hospital departments which are supplied with
medicine by pharmacy department, which include Nursing, pharmacy (outlets),
others, DepartmentName, Totalin and TotalOut.
Table 3.2 Access Database Purchase Table (2007)
46
The Table 3.3 below shows the Invoice Table with primary key field as
InvoiceID. The other fields consist of ItemDescription, ItemID, Units,
Quantity, VAT, Discount, SubTotal, Total, InvoiceTo and Dates
Table 3.3 Access Database Invoice Table (2007)
The Table 3.4 below shows the Prescription Table with the ID field having the
primary key. The other fields consists of the PatientsNo, PrescriptionNo,
DrugName, Quantity, TotalCost, DoctorsName, Dipensed, Dispenser,
Remarks, price and patientName.
Table 3.4 Access Database Prescription Table (2007)
47
The Table 3.5 below shows the Sales Table with the primary key of ID field
which will be automatic generated with AutoNumber data type. The other
fields are InvoiceID, DrugName, Price, Quantity, Total, Dates, Paid,
Dispenser, Doctor, PatientsName and Dispensed.
Table 3.5 Access Database Sales Table (2007)
The Table 3.6 below shows the StaffWorkload Tables with ID field as ist
primary key. Other fields are Dispenser, Dates, TotalSale, TotalPrescription,
TotalPatients and TotalPrescriptionItems
Table 3.6 Access Database Workload Table (2007)
48
The Table 3.7 shows the Stock Table with the primary key field of DrugID.
The other field names are the DrugName, Quantity, ExpiryDate, SalePrice,
DiscountPrice, StorageType, DateOfPurchase, Formulation, DrugBalance and
ReOrder
Table 3.7 Access Database Stock Table (2007)
The Table 3.8 shows the Vendors table with ID field as the primary key. The
other fields include the VendorName, Telephone, Email, CreditLimit,
ContactName, Balance and Discount.
Table 3.8 Access Database Vendor Table (2007)
49
The Figure 3.9 shows the pharmacy software database entity relationship. The
database consists of the login table, purchases table, sales table, staff work load
table, invoice table, stock table, vendors table and prescription table.
Figure 3.9 Access Database, Pharmacy system database (2007)
3.7 Interface Design
The Figure 3.10 above shows how the Pharmacy system integrates the different
functionality of the system. It also depicts the functionalities of the system in a
snap shot.
3.8.1 Specific Platform
The system will run on windows platform using Microsoft Visual Studio 2008
programming language, with Microsoft Access 2007 as the database.
50
The Visual Studio is an ideal programming language for creating sophisticate
applications, it’s based on graphical user interface (GUI) friendly interface for
all system users
3.8.2 Hardware Specification
The system requires the following in order to function effectively:
RAM Size at least 128 MB
A printer for printing the output
Processor speed of above 200 MHz
Hard Disk of at least 15 GB. Free space at least 100MB
This is the identification and indication of what information/assets the system
development will require in order for the system to be completed successfully.
The requirement specifications are classified according to their categories.
They include: Input, Output, Processes, Hardware, Software, File
specifications etc.
3.9 Justification
The Microsoft Access data has a great flexibility with the Microsoft visual
studio since are made by the same vendors as compared to other database.
There is also reliable and competitive support in the market today as many
people having using them for a long time.
51
3.10 Conclusion
To conclude this chapter it is therefore shown that Phase development
methodology of Rapid Application Development is the feasiable and practical
way to implement this project. As a result the design of this project will take
this route to implement the project inorder to deliver the pharmacy software
system to MEWA Hospital pharmacy.
The Rapid Application Development methodology, due to its flexibilty will
ensure that the project is completed within the required time. The RAD
iterative nature will also ensure that specification and quality of the product is
not compromise in any way.
52
CHAPTER 4
IMPLEMENTAION
4.1 Introduction
The main purpose of this chapter is to turn the above system specification
using the design methodology tools into a running system. The snap shots and
figures are taken from the prototype of the MEWA Pharmacy Software
System. This will involve coding for each module, which will also feature in
this chapter.
The users and the owners were involved during the iterative phase and their
recommendations were immediately implemented.
The design methodology of RAD entails iteration until the users specifications
are meet. Therefore the final deliverables will be achieved once all the users’
specifications are addressed.
4.2 Construction and coding
The Figure 4.1 below shows the pharmacy software prototype of the login
module window. The user has to enter user name and pass word in order to
access the system.
Figure 4.1 MEWA Pharmacy Software Login window (2012)
53
Incorrect pass word or user name triggers a message and denies entry to the
system. The user is given three chances to enter the correct user name and pass
word, after which the system is lock.
The above function can be implemented using the code reference in the
Appendices B.1
The Figure 4.2 below shows the pharmacy software prototype of the main dash
board window. This window has five sub windows with different
functionalities. These windows are the sales window, report window,
administration window, prescription window and purchase window.
Figure 4.2 MEWA Pharmacy Main Dash board window (2012)
The Main Dash Board Window to implement the above module is reference in
the Appendices B.2
The Figure 4.3 below shows the pharmacy software prototype of the Sales
Report window. The sales window report captures the date, invoice id, drug
name, price, quantity sold and total.
54
Figure 4.3 MEWA Pharmacy Sales Report (2012)
The sales generated report can be sorted by date and can be filter to display
report between two dates. The sales report also shows the grand total sales, the
grand total quantity and grand total transfers to other department.
The code that creates the sales report module can be reference from the
Appendices B.3
The Figure 4.4 below shows the pharmacy software prototype of the staff work
load. It consists of the date, total prescription, total sales and total patient
served by a dispenser.
55
Figure 4.4 MEWA Pharmacy Staff Workload (2012)
The staff workload module can be implemented using the code reference in the
Appendices B.4
The Figure 4.5 below shows the pharmacy software prototype of the stock
level. It consist of the drug id which is the primary key uniquely identifying the
drug, the drug name, the quantity of drugs in stock, the cost price, sales price,
discount price, the storage type, date of purchase, drug formulation, drug
balance and the reorder level.
56
Figure 4.5 MEWA Pharmacy Stock level (2012)
The reorder level helps the pharmacist in inventory control. The drug
formulation entails classification of drugs in the route of administration. The
tables or capsules, injectables, infusions, creams, virginal pessaries, lozenges
and syrups to mention a few.
The code to implement the above stock level module can be reference in the
Appendences B.5
The Figure 4.3 below shows the pharmacy software prototype of the
administration window. The window entails change of password of the user. It
has three text boxes, for old password, new password and confirm password.
Figure 4.6 MEWA Pharmacy Administration (2012)
The two buttons are also incooperated one the change the password and other
to clear the text box for any errors during entries. The Administration module
can be implement using the code referencing the Appendices B.6
57
The Figure 4.7 below shows the pharmacy software prototype of the
prescription. It contains three parts, patient information, drug information and
dispense prescription.
Figure 4.7 MEWA Pharmacy Prescription (2012)
The patient information features the name of the patient, date, patient name
doctors name, patient number and prescription number. The drug information
consists of drug name, drug cost, drug balance, quantity dispensed and total
cost.
There is also two buttons one for calculating the total drug cost and another
dispensed which populate the prescription with prescription number, patient
name, drug name, price, quantity, total price and doctors name.
The implementation of the prescription module can be reference in the
Appendices B.7
The Figure 4.8 below shows the pharmacy software prototype of the Purchase
Invoice.
58
Figure 4.8 MEWA Pharmacy Purchase Invoice (2012)
The purchase invoice consists of two section, vendors’ information and drugs
information. The vendors’ information consists of vendors’ name, telephone
number and the email address. While the drug information consist of the drug
code, drug description, quantity, unit, unit price, discount and total.
The above pharmacy purchase invoice module can be implemented using the
code reference to the Appendices B.8
4.3 Findings and Results
The users and the owners were involved during the iterative phase and their
recommendations were immediately implemented. The prototype
functionalities have satisfied the users’ specification at this point; although
there are some suggestions from user to further improve the system.
The system has been received well by the users, with respect to usability and
ease of learning because all the processes of the old system have be integrated
in to new system.
59
The system has also been flexible and scalable; where the user and owners had
their changes are addressed immediately. The found the system to dynamic that
it can integrate any expansions of the system in future.
60
CHAPTER 5
CONCLUSIONS AND RECOMMENDATIONS
5.1 Introduction
This chapter deals with the overall findings of the project. The developer
attempts to review the objectives and the purpose of this project by
presenting the summary of findings, conclusion and possible
recommendations.
5.2 Summary
The project analysed and evaluated the old Pharmacy system of MEWA
Hospital Pharmacy department, and carried out a feasibility as well as
developed a new proposed compuer based system to the deparment and
organization
MEWA Hospital was founded in 1985 in Mombasa and its principle
objective is to promote, encourage and improve the medical, educational,
socio-economical and cultural welfare of all Kenyans.
The project was designed using Phase Development Methodology of Rapid
Application Development (RAD). It involved the analysis of the
methodology the technique put in use to aid in the creation of the system
and the successful development and implementation of the system.
The project implementation was done using the various implementation and
development tools. Therefore, since the system run on windows platform,
Microsoft Visual Studio 2008 programming language was used to
61
implement the graphical user interface (GUI) and the business logic, while
the Microsoft Access 2007 was used as database of choice, to implement the
service side where the data is stored.
The users and the owners were involved and consulted during the project
and especially during the implementation of the product in the iterative
phase, where their recommendations and comments were acted upon
immediately to affect changes. Users and owners changes where aim at the
project specification to be achieved and hand over the deliverables.
5.3 Conclusions
From the above discussion it can be noted that, the new MEWA pharmacy
system was well received by the stalk holders. The main objective of the
project of implementing computer based system was realized as the work
load of the users is drastically reduced.
The patient waiting time has also reduced leading to good customer service
hence improved profit to the organization. The user standard operating
procedures (SOP’s) were completely changed, giving a digital age to
pharmacy professional of MEWA hospital pharmacist.
5.4 Recommendations
From the above discussion it can be recommended that although pharmacy
system has been computerized, after gap analysis and literature review there
are many areas of improvement.
62
Currently, the pharmacist has to reference to various materials for drug
reaction and interaction, in order to advice the patient on the medication.
This functionality and automatic dosage calculation are the areas of future
improvement for the MEWA pharmacy system.
63
REFERENCE
ApotheSoft, (2001). ApotheSoft Pharmacy Management Software:
Retrieved 08, July, 2012, from http://www.apothesoft.com/index.html
Biohealthmatics.com, (2012). Pharmacy Information System: Retrieved
18th
July 2012 from
http://www.biohealthmatics.com/technologies/his/pis.aspx
Care Right Tech, (2006). MedRight Medication Management Software:
Retrieved 03, July, 2012, from http://www.carerighttech.com/
Cellnet Ltd Mombasa, Ali Asgar, Sales Manager (2012)
Damle, P. & Puri K. (2007). The Right Pharmacy Management System:
Retrieved June 04, 2012, from
http://www.infosys.com/industries/retail/white-
papers/Documents/pharmacy-management-system.pdf
EtonDigital, (2004). Rapid Application Development: Retrieved 04, July,
2012, from http://www.etondigital.com/blog/
Laudon, K. & Laudon, J. (2000). Management Information Systems:
Organisation and technology. In a networked enterprise. 6th ed. New
Jersey, Prentice Hall.
Maner, W. (1997). Rapid Application Development: from Sun: Retrieved
June 04, 2012, from http://csweb.cs.bgsu.edu/maner/domains/RAD.htm
64
MEWA, (2000). MEWA Office Secretariat: Retrieved 07, July, 2012, from
http://[email protected]
Nyandiere, C. (2007). Increasing role of computer‐based information syste
ms in the management of higher education institutions (Unpublished
master dissertation) University of Nairobi, Nairobi, Kenya.
O’Brien, J.(1999) Management Information Systems: Managing
Information Technology. In the Internetworked Enterprise. 4th Ed. Boston,
McGraw Hill- Irwin inc.
Troiano, D. (1999). A primer on Pharmacy Information System: Retrieved
07, July, 2012, from http://www.himss.org/content/files/jhim/13-
3/him13305.pdf
Wiras Adi, (2008).System Development: Retrieved 04, July, 2012, from
http://www.slepi.net/blog/
65
APPENDICES A
A.1 Project Budget
Market analysis to procure the resources needed for this project yielded the
following best quotation
Kshs. 20,000.00 Kshs. 9,000.00
RESOURCE BUDGET COST
Figure 1.0 Resource budget cost (2012)
66
Since MEWA Hospital is non-profit institution and heavily depends on
donation, the above Figure 1.0 shows the budget of the project which is subject
to donors contributions
A.2 Expected Completion Time
The Expected Time (µ/Te) = 1/6(a + 4m + b) where a = optimistic time, m =
most likely time and b = pessimistic time,
Therefore if a = 4 months, b = 6 months & m = 8 months then the expected
completion time is 1/6(4 + 4x8 + 6) = 7 Months
CALENDER OF ACTIVITIES
Figure 1.1 MEWA Pharmacy development activities (2012)
The above Figure 1.2 show the calender of activies of the project and how long
will the whole project be completed to give it deliverables
67
GANTT CHART
Figure 1.2 MEWA Pharmacy Software Schedule (2012)
The above Figure 1.2 shows graphical the activies of the project against the
duration of each activites to give the deliverables. The project starts with
project identification and it duration of 8 days as shown in Figure 1.1 and ends
with project implementation and its duration of 30 days as shown in Figure 1.1
above.
0 20 40 60 80 100 120 140
Project Identification
Project Analysis
Project Design
Project Development
Project Testing
Project Implementation
Time Schedule Gantt Chart
Duration
68
APPENDICES B
B.1 The Log in System Code
Function chsckUserPass, it checks the validity of user password which is store
in the mewa database table login
Function chsckServerUserPass, it checks the validity of bothe user name and
password are present in the server database.
Imports System.Data.OleDb
Public Class frmLogin
Dim Count As Integer = 0
Dim userOK As Boolean
Private Sub btExit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btExit.Click
End
End Sub
Function chsckUserPass() As Boolean
Dim srn As String
Dim myPassCommand As OleDbCommand
Try
strSql = "SELECT * FROM tblLogin WHERE Username =
'" & (txtUsername.Text) & "' AND Password = '" &
(txtPassword.Text) & "'"
MainContainer.MainProgress.Value = 1
myPassCommand = New OleDbCommand
MainContainer.MainProgress.Value = 2
myPassCommand.CommandText = strSql
MainContainer.MainProgress.Value = 3
myPassCommand.Connection = myCon
myCon.Open()
myDR = myPassCommand.ExecuteReader
MainContainer.MainProgress.Value = 5
myDR.Read()
srn = (myDR("Surname"))
MainContainer.MainProgress.Value = 7
GlobalV.Surname = srn
GlobalV.Firstname = (myDR("Firstname"))
' MsgBox("Your Surname is " & srn)
frmPharmacy.Show()
MainContainer.tslStatus.Text = (srn & " Logged In
Successfully")
MainContainer.MainProgress.Value = 10
MainContainer.LogoutToolStripMenuItem.Enabled =
True
69
MainContainer.MainProgress.Value = 0
myCon.Close()
Me.Close()
myCon.Close()
Return True
Catch ex As Exception
MsgBox("Incorrect Username and/or Password")
myCon.Close()
Return False
End Try
End Function
Function chsckServerUserPass() As Boolean
Dim srn As String
Dim myPassCommand As OleDbCommand
Try
strSql = "SELECT * FROM tblLogin WHERE Username =
'" & (txtUsername.Text) & "' AND Password = '" &
(txtPassword.Text) & "'"
myPassCommand = New OleDbCommand
myPassCommand.CommandText = strSql
myPassCommand.Connection = serverCon
serverCon.Open()
myDR = myPassCommand.ExecuteReader
myDR.Read()
srn = (myDR("Surname"))
GlobalV.Surname = srn
GlobalV.Firstname = (myDR("Firstname"))
' MainContainer.lblStatus.Text = (srn & " Logged In
Successfully")
' MsgBox("Your Surname is " & srn)
serverCon.Close()
Me.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
serverCon.Close()
Return False
End Try
70
End Function
Private Sub btLogin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLogin.Click
If cbServer.Checked = True Then
If (Count <= 2) Then
chsckServerUserPass()
Count = Count + 1
txtPassword.Clear()
Else
CheckUsernameServer()
If userOK = True Then
GlobalV.Username = txtUsername.Text
frmSecurity.Show()
End If
End If
ElseIf cbServer.Checked = False Then
If (Count <= 2) Then
chsckUserPass()
Count = Count + 1
txtPassword.Clear()
Else
CheckUsername()
If userOK = True Then
GlobalV.Username = txtUsername.Text
frmSecurity.Show()
End If
End If
End If
' txtPassword.Clear()
End Sub
Function CheckUsername() As Boolean
Dim srn As String
Dim myPassCommand As OleDbCommand
Try
strSql = "SELECT * FROM tblLogin WHERE Username =
'" & (txtUsername.Text) & "'" ' AND Password = '" &
(txtPassword.Text) & "'"
myPassCommand = New OleDbCommand
myPassCommand.CommandText = strSql
myPassCommand.Connection = serverCon
serverCon.Open()
myDR = myPassCommand.ExecuteReader
myDR.Read()
71
srn = (myDR("Surname"))
GlobalV.Surname = srn
GlobalV.Firstname = (myDR("Firstname"))
' MsgBox("Your Surname is " & srn)
serverCon.Close()
userOK = True
Return True
Catch ex As Exception
' MsgBox(ex.Message)
serverCon.Close()
Return False
End Try
End Function
Function CheckUsernameServer() As Boolean
Dim srn As String
Dim myPassCommand As OleDbCommand
Try
strSql = "SELECT * FROM tblLogin WHERE Username =
'" & (txtUsername.Text) & "'" ' AND Password = '" &
(txtPassword.Text) & "'"
myPassCommand = New OleDbCommand
myPassCommand.CommandText = strSql
myPassCommand.Connection = serverCon
serverCon.Open()
myDR = myPassCommand.ExecuteReader
myDR.Read()
srn = (myDR("Surname"))
GlobalV.Surname = srn
GlobalV.Firstname = (myDR("Firstname"))
' MsgBox("Your Surname is " & srn)
serverCon.Close()
userOK = True
Return True
Catch ex As Exception
' MsgBox(ex.Message)
serverCon.Close()
Return False
End Try
End Function
72
Private Sub Label2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub frmLogin_Load(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Me.Load
Me.MdiParent = MainContainer
End Sub
End Class
B.2 The Main Dash Board Window Code
The following is the code that validates the above logic and consists of the
modules
Public Class MainContainer
Private Sub MainContainer_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
frmLogin.MdiParent = Me
frmSecurity.MdiParent = Me
frmLogin.Show()
LogoutToolStripMenuItem.Enabled = False
MainProgress.Minimum = 0
MainProgress.Maximum = 10
MainProgress.Value = 0
End Sub
Private Sub LoginToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
LoginToolStripMenuItem.Click
End
End Sub
Private Sub LogoutToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
LogoutToolStripMenuItem.Click
frmPharmacy.Close()
frmLogin.StartPosition = FormStartPosition.CenterScreen
' frmLogin.WindowState.Normal()
frmLogin.Show()
End Sub
Private Sub MainTimer_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MainTimer.Tick
73
theClock.Text = Now.ToString
End Sub
Private Sub MainContainer_MouseMove(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
Me.MouseMove
End Sub
End Class
B.3 The Sales Report Module Code
The following is the code that shows the child list view ( lvStock) that created
the sales report module:
Imports System.Data.OleDb
Public Class frmReports
Private Sub frmReports_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.MdiParent = MainContainer
End Sub
Private Sub btLoadAll_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAll.Click
LoadStockReport()
End Sub
Function LoadStockReport() As Boolean
Try
strSql = "SELECT * FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStock.Items.Clear()
While (myDR.Read())
With lvStock.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("CostPrice"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("DiscountPrice"))
.subitems.add(myDR("StorageType"))
.subitems.add(myDR("DateOfPurchase"))
.subitems.add(myDR("Formulation"))
.subitems.add(myDR("DrugBalance"))
.subitems.add(myDR("ReOrder"))
End With
74
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function LoadSalesReport() As Boolean
Try
strSql = "SELECT * FROM tbSales WHERE Paid = TRUE"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
.subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAllSales.Click
'TheListView = lvSales
'ExportListViewToExcel()
LoadSalesReport()
End Sub
Private Sub lvSales_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvSales.SelectedIndexChanged
End Sub
End Class
75
B.4 Staff work load Code
The following is the code that implements the modules of the staff work load.
Imports System.Data.OleDb
Public Class frmReports
Private Sub frmReports_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.MdiParent = MainContainer
End Sub
Private Sub btLoadAll_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAll.Click
LoadStockReport()
End Sub
Function LoadStockReport() As Boolean
Try
strSql = "SELECT * FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStock.Items.Clear()
While (myDR.Read())
With lvStock.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("CostPrice"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("DiscountPrice"))
.subitems.add(myDR("StorageType"))
.subitems.add(myDR("DateOfPurchase"))
.subitems.add(myDR("Formulation"))
.subitems.add(myDR("DrugBalance"))
.subitems.add(myDR("ReOrder"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function LoadSalesReport() As Boolean
Try
strSql = "SELECT * FROM tbSales WHERE Paid = TRUE"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
76
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
.subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAllSales.Click
'TheListView = lvSales
'ExportListViewToExcel()
LoadSalesReport()
End Sub
Private Sub lvSales_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvSales.SelectedIndexChanged
End Sub
Private Sub tpStaff_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles tpStaff.Click
End Sub
End Class
B.5 Stock level
The following code implement the stock level module and it functionalities
Imports System.Data.OleDb
Public Class frmPharmacy
Dim FullName As String
Dim DName As String
77
Public SalesQuantity As Integer
Public Price As Integer
Dim TotalSales As Integer
Dim InvoiceID As String
Dim theCount As Integer
Dim QuoteQty As Integer
Dim theIndex As Integer
Dim prenum As Integer
Private Sub frmPharmacy_Load(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Me.Load
Me.MdiParent = MainContainer
lblDate.Text = Date.Now.ToShortDateString
FullName = String.Concat(Firstname, " ", Surname)
txtDispencerName.Text = FullName.ToUpper
LoadQue()
lblInvoiceDate.Text = Date.Now.ToShortDateString
LoadSuppliers()
End Sub
Public Function GrandTotal() As Boolean
Dim StartBalance As Integer
Dim newBalance As Integer
Try
StartBalance = txtGrandTotal.Text
newBalance = StartBalance + TotalSales
txtGrandTotal.Text = newBalance
Catch ex As Exception
End Try
End Function
Public Function DrugBalance() As Boolean
Try
strSql = "UPDATE tbStock SET [DrugBalance] =
[DrugBalance] - " & (SalesQuantity) & " WHERE DrugName = '" &
(lvSales.SelectedItems(0).SubItems(1).Text) & "'"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Public Function DrugBalanceAdd() As Boolean
Try
QuoteQty =
lvQuotation.SelectedItems(0).SubItems(1).Text
MsgBox(QuoteQty)
78
strSql = "UPDATE tbStock SET [DrugBalance] =
[DrugBalance] + " & (QuoteQty) & " WHERE DrugName = '" &
(lvQuotation.SelectedItems(0).SubItems(0).Text) & "'"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Public Function CalculateSales() As Boolean
Dim newDrugBalance As Integer
newDrugBalance =
lvSales.SelectedItems(0).SubItems(5).Text - SalesQuantity
TotalSales = SalesQuantity * Price
Try
With
lvQuotation.Items.Add(lvSales.SelectedItems(0).SubItems(1).Text
)
.SubItems.Add(SalesQuantity)
.SubItems.Add(Price)
.SubItems.Add(TotalSales)
End With
With
frmCheckOut.lvCheckout.Items.Add(lvSales.SelectedItems(0).SubIt
ems(1).Text)
.SubItems.Add(TotalSales)
.SubItems.Add(newDrugBalance)
End With
GrandTotal()
AddSaletoDB()
theCount = theCount + 1
Catch ex As Exception
End Try
End Function
Function OldPassword() As Boolean
Try
strSql = "SELECT * FROM tblLogin WHERE Password ='"
& (GlobalV.Password) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
79
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
Dim oldpass As String
oldpass = txtOldPassword.Text
If (GlobalV.Password = oldpass) Then
End If
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
MsgBox(ex.Message)
Return False
End Try
End Function
Function UpdatePassword() As Boolean
Try
strSql = "UPDATE tblLogin SET [Password] = '" &
(txtNewPassword.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function ConfirmPassword() As Boolean
Dim confirmpass As String
confirmpass = txtConfirmPassword.Text
Try
If (OldPassword() = confirmpass) Then
UpdatePassword()
MsgBox("Your password has successful change")
Return True
Else
txtNewPassword.Clear()
txtConfirmPassword.Clear()
MsgBox("Your password was wrong")
End If
Catch ex As Exception
MsgBox(ex.Message)
80
Return False
End Try
End Function
Private Sub btClear_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btClear.Click
txtConfirmPassword.Clear()
txtNewPassword.Clear()
txtOldPassword.Clear()
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.PaintEventArgs) Handles
Panel1.Paint
End Sub
Private Sub txtNewPassword_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtNewPassword.TextChanged
End Sub
Private Sub txtConfirmPassword_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtConfirmPassword.TextChanged
End Sub
Private Sub btChangePass_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btChangePass.Click
If (OldPassword() = True) Then
'End If
ConfirmPassword()
End If
End Sub
Private Sub tpPrescription_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
tpPrescription.Click
End Sub
Private Sub txtDrugName_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtDrugName.TextChanged
SearchDrugs()
End Sub
Function SearchDrugs() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName LIKE
'%" & (txtDrugName.Text) & "%'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lbDrugs.Items.Clear()
81
While (myDR.Read())
lbDrugs.Items.Add(myDR("DrugName"))
' .subitems.add(myDR("DrugID"))
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchMoreDrug() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName ='"
& (DName) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtAmount.Text = (myDR("SalePrice"))
txtDrugBalance.Text = (myDR("DrugBalance"))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub lbDrugs_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lbDrugs.SelectedIndexChanged
DName = lbDrugs.SelectedItem.ToString
txtDrugName.Text = DName
SearchMoreDrug()
End Sub
Private Sub btCalculate_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btCalculate.Click
Dim Cost As Integer
Dim Qty As Integer
Dim Total As Integer
Cost = txtAmount.Text
82
Qty = txtQuantityDispenced.Text
Total = Cost * Qty
txtTotalCost.Text = Total
End Sub
Private Sub btLoadAllToday_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllToday.Click
LoadDayPrescription()
End Sub
Function LoadDayPrescription() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE Dates
= " & (String.Concat("#", Date.Now.ToShortDateString, "#")) &
""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function GeneratePrescriptonNo() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions ORDER BY
PrescriptionNo DESC"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
prenum = (myDR("PrescriptionNo"))
MsgBox(prenum)
myCon.Close()
83
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function CAllLAtestPrescripton() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientNo = '" & (txtPatientNo.Text) & "' ORDER BY
PrescriptionNo DESC"
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
prenum = (myDR("PrescriptionNo"))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function LoadPresc() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientsNo = '" & (txtPatientNo.Text) & "' AND PrescriptionNo =
" & (preNum) & ""
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
84
myCon.Close()
Return False
End Try
End Function
Function LoadByDate() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE Dates
= " & (String.Concat("#", dtpOld.Value.ToShortDateString, "#"))
& ""
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function LoadByPrescriptionNo() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE
PrescriptionNo = " & (txtPrescriptionNo.Text) & ""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
85
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btOldPrescription_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btOldPrescription.Click
LoadByDate()
End Sub
Private Sub btPrescriptmberionNu_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btPrescriptmberionNu.Click
LoadByPrescriptionNo()
End Sub
Private Sub btDispensee_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btDispensee.Click
'GeneratePrescriptonNo()
Dispense()
UpdateDrugBalance()
'CAllLAtestPrescripton()
LoadPresc()
If CheckDate() = True Then
myCon.Close()
UpdateStaffWorkload()
Else
myCon.Close()
AddNEwDate()
myCon.Close()
UpdateStaffWorkload()
End If
End Sub
Function AddNEwDate() As Boolean
Try
strSql = "INSERT INTO
tbStaffWorkload([Dispenser],[Dates],[TotalSale],[TotalPrescript
ions],[TotalPatients],[TotalPrescriptionItems]) VALUES('" &
(String.Concat(Firstname, " ", Surname)) & "'," &
(String.Concat("#", Date.Today.ToShortDateString, "#")) &
",0,0,0,0)"
MsgBox(strSql)
86
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdateStaffWorkload() As Boolean
Dim totalsale As Integer
Dim qty As Integer
totalsale = txtTotalCost.Text
qty = txtQuantityDispenced.Text
Try
strSql = "UPDATE tbStaffWorkload SET [TotalSale] =
[TotalSale] + " _
& (totalsale) & ",[TotalPrescriptions] =
[TotalPrescriptions] + 1,[TotalPatients] = [TotalPatients] +
1,[TotalPrescriptionItems] = [TotalPrescriptionItems] + " _
& (qty) & " WHERE [Dates] = " & (String.Concat("#",
Date.Today.ToShortDateString, "#")) & " AND [Dispenser] = '" &
(String.Concat(Firstname, " ", Surname)) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function CheckDate() As Boolean
Try
strSql = "SELECT * FROM tbStaffWorkload WHERE Dates
= " & (String.Concat("#", Date.Today.ToShortDateString, "#")) &
""
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
87
myDR.Read()
' Dim dater As Date
If IsDBNull(myDR("Dates")) Then
myCon.Close()
AddNEwDate()
UpdateStaffWorkload()
Else
myCon.Close()
UpdateStaffWorkload()
End If
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdateDrugBalance() As Boolean
Try
strSql = "UPDATE tbStock SET [DrugBalance] =
[DrugBalance] -" & (txtQuantityDispenced.Text) & " WHERE
[DrugName] = '" & (txtDrugName.Text) & "'"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function Dispense() As Boolean
Try
strSql = "INSERT INTO
tbPrescriptions([PatientsNo],[PrescriptionNo],[Dates],[DrugName
],[Quantity],[TotalCost],[DoctorsName],[Dispensed],[Dispenser],
[Remarks],[Price],[PatientName]) VALUES('" _
& (txtPatientNo.Text) & "','" _
& (prenum) & "'," _
88
& (String.Concat("#", Date.Now.ToShortDateString,
"#")) & ",'" _
& (txtDrugName.Text) & "'," _
& (txtQuantityDispenced.Text) & "," _
& (txtTotalCost.Text) & ",'" _
& (txtDoctorName.Text) & "',TRUE,'" _
& (txtDispencerName.Text) & "','" _
& (txtRemarks.Text) & "'," _
& (txtAmount.Text) & ",'" _
& (txtPatientName.Text) & "')"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchSalesByName() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName LIKE
'%" & (txtSalesDrugName.Text) & "%'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("ReOrder"))
.subitems.add(myDR("DrugBalance"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
89
Function SearchSalesByName2() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbStock WHERE DrugName = '"
& (txtSalesDrugName.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
' lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("ReOrder"))
.subitems.add(myDR("DrugBalance"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchSalesByID() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugID LIKE
'%" & (txtSalesDrugID.Text) & "%'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("ReOrder"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
90
Return False
End Try
End Function
Private Sub txtSalesDrugName_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtSalesDrugName.TextChanged
SearchSalesByName()
End Sub
Private Sub txtSalesDrugID_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtSalesDrugID.TextChanged
SearchSalesByID()
End Sub
Private Sub lvSales_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvSales.SelectedIndexChanged
' CreatInvoiceID()
frmQuantity.Show()
End Sub
Function CreatInvoiceID() As Boolean
Try
Dim Datedstr As String
Datedstr = Date.Now
' Datedstr.Remove(Char "/")
'Dim str As String = "to## remove' all"" special^&
characters from string"
Dim sb As New System.Text.StringBuilder
For Each ch As Char In Datedstr
If Char.IsLetterOrDigit(ch) Then
sb.Append(ch)
End If
Next
' MsgBox(sb.ToString)
InvoiceID = sb.ToString
Catch ex As Exception
End Try
End Function
Public Function AddSaletoDB() As Boolean
' Dim var1 As String = lv
' Dim var2 As Integer
' Dim var3 As Integer
' Dim var4 As Integer
Try
91
strSql = "INSERT INTO
tbSales([InvoiceID],[DrugName],[Price],[Quantity],[Total],[Date
s]) VALUES('" _
& (InvoiceID) & "','" _
& (lvQuotation.Items(theCount).SubItems(0).Text) &
"','" _
& (lvQuotation.Items(theCount).SubItems(1).Text) &
"','" _
& (lvQuotation.Items(TheCount).SubItems(2).Text) &
"','" _
& (lvQuotation.Items(theCount).SubItems(3).Text) &
"'," _
& (String.Concat("#", Date.Now.ToShortDateString,
"#")) & ")"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btRemoveItems_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btRemoveItems.Click
DrugBalanceAdd()
RemovefromTable()
RemoveItem()
End Sub
Function Deduct() As Boolean
Dim startingBalance As Integer
Dim EndBalance As Integer
Dim DeductBalance As Integer
Try
DeductBalance =
lvQuotation.SelectedItems(0).SubItems(3).Text
startingBalance = txtGrandTotal.Text
EndBalance = startingBalance - DeductBalance
txtGrandTotal.Text = EndBalance
Catch ex As Exception
92
End Try
End Function
Function RemoveItem() As Boolean
Deduct()
lvQuotation.SelectedItems(0).Remove()
End Function
Private Sub btBegin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btBegin.Click
CreatInvoiceID()
lvSales.Enabled = True
End Sub
Function RemovefromTable() As Boolean
Try
strSql = "DELETE * FROM tbSales WHERE InvoiceID =
'" & (InvoiceID) & "' AND DrugName = '" &
(lvQuotation.SelectedItems(0).SubItems(0).Text) & "'"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub lvQuotation_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
lvQuotation.SelectedIndexChanged
End Sub
Private Sub cmdCheckout_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmdCheckout.Click
frmCheckOut.Show()
End Sub
Private Sub btNewPre_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btNewPre.Click
GeneratePrescriptonNo()
prenum = prenum + 1
txtPrescriptionNo.Text = prenum
93
End Sub
Function LoadQue() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbPrescriptions WHERE
Dispensed = FALSE"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
Dim DA As New OleDbDataAdapter(strSql, myCon)
Dim DS As New DataSet
DA.Fill(DS, "tbPrescription")
Dim dt As New DataTable
dt = DS.Tables(0)
Dim dr As DataRow
For Each dr In dt.Rows()
cmbQue.Items.Add(dr("PatientName"))
Next
cmbQue.SelectedIndex = -1
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub cmbQue_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbQue.SelectedIndexChanged
myCon.Close()
LoadArray()
End Sub
Function LoadArray() As Boolean
' Dim Drugs() As String
myCon.Close()
Try
myCon.Close()
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientName = '" & (cmbQue.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
'Drugs = (myDR("DrugName"))
94
' myCon.Close()
' MsgBox(Drugs)
txtDrugName.Text = (myDR("DrugName"))
SearchSalesByName2()
myCon.Close()
txtDrugName.Clear()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
frmReports.Show()
End Sub
Private Sub btLoadAllStock_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllStock.Click
LoadStockReport()
End Sub
Function LoadStockReport() As Boolean
Try
strSql = "SELECT * FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStock.Items.Clear()
While (myDR.Read())
With lvStock.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("CostPrice"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("DiscountPrice"))
.subitems.add(myDR("StorageType"))
.subitems.add(myDR("DateOfPurchase"))
.subitems.add(myDR("Formulation"))
95
.subitems.add(myDR("DrugBalance"))
.subitems.add(myDR("ReOrder"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function TotalDrugs() As Boolean
Try
strSql = "SELECT SUM(DrugBalance) FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalDrugStock.Text = (myDR.GetValue(0))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btLoadAll_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAll.Click
LoadStockReport()
TotalDrugs()
End Sub
Function LoadSalesReport() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSalesReport.Items.Clear()
While (myDR.Read())
With lvSalesReport.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
96
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
' .subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SumTotalSale() As Boolean
Try
myCon.Close()
strSql = "SELECT SUM(Total) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalSales.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Function TotalQuantitySale() As Boolean
Try
myCon.Close()
strSql = "SELECT SUM(Quantity) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalQuantity.Text = myDR.GetValue(0)
myCon.Close()
Return True
97
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Function CountTotalSale() As Boolean
Try
myCon.Close()
strSql = "SELECT Count(Total) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalTransaction.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Private Sub btLoadAllSales_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllSales.Click
loadsalesreport()
SumTotalSale()
CountTotalSale()
TotalQuantitySale()
End Sub
Function LoadSalesByDate() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbSales WHERE Dates BETWEEN
" & (String.Concat("#", dtpFrom.Value.ToShortDateString, "#"))
& " AND " & (String.Concat("#", dtpTo.Value.ToShortDateString,
"#")) & ""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSalesReport.Items.Clear()
While (myDR.Read())
With lvSalesReport.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
98
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
' .subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btByDate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btByDate.Click
LoadSalesByDate()
End Sub
Function LoadStaffWorkLoad() As Boolean
Try
strSql = "SELECT * FROM tbStaffWorkload WHERE
Dispenser = '" & (String.Concat(Firstname, " ", Surname)) & "'"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStaff.Items.Clear()
While (myDR.Read())
With lvStaff.Items.Add(myDR("Dates"))
.subitems.add(myDR("TotalSale"))
.subitems.add(myDR("TotalPrescriptions"))
.subitems.add(myDR("TotalPrescriptionItems"))
.subitems.add(myDR("TotalPatients"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
99
End Try
End Function
Private Sub btSTaffWorkload_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btSTaffWorkload.Click
LoadStaffWorkLoad()
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
TheListView = lvStock
ExportListViewToExcel()
' Return True
Catch ex As Exception
' MsgBox(ex.Message)
End Try
End Sub
Private Sub Label29_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
End Sub
Private Sub TabPage3_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage3.Click
End Sub
Function SearchVendor() As Boolean
Try
strSql = "SELECT * FROM tbVendors WHERE VendorName
= '" & (txtVendor.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtVendor.Text = myDR("VendorName")
txtPTelephone.Text = myDR("Telephone")
txtPEmail.Text = myDR("Email")
txtPContactName.Text = myDR("ContactName")
txtVCreditLimit.Text = myDR("CreditLimit")
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
100
Return False
End Try
End Function
Private Sub cmdSearchVendor_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmdSearchVendor.Click
SearchVendor()
End Sub
Function AddNewPurchase() As Boolean
Try
strSql = "INSERT INTO
tbVendors([VendorName],[Telephone],[Email],[CreditLimit],[Conta
ctName]) VALUES('" & (txtVendor.Text) & "','" _
& (txtPTelephone.Text) & "','" _
& (txtPEmail.Text) & "'," _
& (txtVCreditLimit.Text) & ",'" _
& (txtPContactName.Text) & "')"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdatePurchase() As Boolean
Try
strSql = "UPDATE tbVendors SET [CreditLimit] = " &
(txtVCreditLimit.Text) & " WHERE [VendorName] = '" &
(txtVendor.Text) & "'"
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
MsgBox("Credit Limit successfully changed to " &
txtVCreditLimit.Text)
Return True
Catch ex As Exception
MsgBox(ex.Message)
101
myCon.Close()
Return False
End Try
End Function
Private Sub btPAddNew_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btPAddNew.Click
AddNewPurchase()
End Sub
Private Sub btPEdit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btPEdit.Click
UpdatePurchase()
End Sub
Function LoadSuppliers() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbVendors"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
Dim DA As New OleDbDataAdapter(strSql, myCon)
Dim DS As New DataSet
DA.Fill(DS, "tbVendors")
Dim dt As New DataTable
dt = DS.Tables(0)
Dim dr As DataRow
For Each dr In dt.Rows()
cmbSupplier.Items.Add(dr("VendorName"))
Next
cmbSupplier.SelectedIndex = -1
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub PrintDocument1_PrintPage(ByVal sender As
System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
End Sub
Private Sub cmbSupplier_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
cmbSupplier.SelectedIndexChanged
102
PopulateVendorDetails()
End Sub
Function PopulateVendorDetails() As Boolean
Try
strSql = "SELECT * FROM tbVendors WHERE VendorName
= '" & (cmbSupplier.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtCreditLimit.Text = myDR("CreditLimit")
txtPDiscount.Text = myDR("Discount")
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchUnit() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName = '"
& (txtPUnit.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtPAmount.Text = myDR("CostPrice")
myCon.Close()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub txtPUnit_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtPUnit.TextChanged
If txtPUnit.TextLength > 2 Then
SearchUnit()
End If
End Sub
103
Private Sub TabPage2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage2.Click
End Sub
Private Sub tpAdmin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles tpAdmin.Click
End Sub
End Class
B.6 Administration Module Code
The following code will implement the Pharmacy Administration module
Function OldPassword() As Boolean
Try
strSql = "SELECT * FROM tblLogin WHERE Password ='"
& (GlobalV.Password) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
Dim oldpass As String
oldpass = txtOldPassword.Text
If (GlobalV.Password = oldpass) Then
End If
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
MsgBox(ex.Message)
Return False
End Try
End Function
Function UpdatePassword() As Boolean
Try
strSql = "UPDATE tblLogin SET [Password] = '" &
(txtNewPassword.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
104
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function ConfirmPassword() As Boolean
Dim confirmpass As String
confirmpass = txtConfirmPassword.Text
Try
If (OldPassword() = confirmpass) Then
UpdatePassword()
MsgBox("Your password has successful change")
Return True
Else
txtNewPassword.Clear()
txtConfirmPassword.Clear()
MsgBox("Your password was wrong")
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
Private Sub btClear_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btClear.Click
txtConfirmPassword.Clear()
txtNewPassword.Clear()
txtOldPassword.Clear()
End Sub
Function ConfirmPassword() As Boolean
Dim confirmpass As String
confirmpass = txtConfirmPassword.Text
Try
If (OldPassword() = confirmpass) Then
UpdatePassword()
MsgBox("Your password has successful change")
Return True
Else
txtNewPassword.Clear()
txtConfirmPassword.Clear()
MsgBox("Your password was wrong")
End If
105
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
Private Sub btClear_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btClear.Click
txtConfirmPassword.Clear()
txtNewPassword.Clear()
txtOldPassword.Clear()
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.PaintEventArgs) Handles
Panel1.Paint
End Sub
Private Sub txtNewPassword_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtNewPassword.TextChanged
End Sub
Private Sub txtConfirmPassword_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtConfirmPassword.TextChanged
End Sub
Private Sub btChangePass_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btChangePass.Click
If (OldPassword() = True) Then
'End If
ConfirmPassword()
End If
End Sub
Private Sub tpPrescription_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
tpPrescription.Click
End Sub
Private Sub txtDrugName_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtDrugName.TextChanged
SearchDrugs()
End Sub
B.7 Prescription Module Code
106
The following is the code use to implement the prototype interface of the
prescription module.
Imports System.Data.OleDb
Public Class frmPharmacy
Dim FullName As String
Dim DName As String
Public SalesQuantity As Integer
Public Price As Integer
Dim TotalSales As Integer
Dim InvoiceID As String
Dim theCount As Integer
Dim QuoteQty As Integer
Dim theIndex As Integer
Dim prenum As Integer
Private Sub frmPharmacy_Load(ByVal sender As Object, ByVal
e As System.EventArgs) Handles Me.Load
Me.MdiParent = MainContainer
lblDate.Text = Date.Now.ToShortDateString
FullName = String.Concat(Firstname, " ", Surname)
txtDispencerName.Text = FullName.ToUpper
LoadQue()
lblInvoiceDate.Text = Date.Now.ToShortDateString
LoadSuppliers()
End Sub
Public Function GrandTotal() As Boolean
Dim StartBalance As Integer
Dim newBalance As Integer
Try
StartBalance = txtGrandTotal.Text
newBalance = StartBalance + TotalSales
txtGrandTotal.Text = newBalance
Catch ex As Exception
End Try
End Function
Public Function DrugBalance() As Boolean
Try
strSql = "UPDATE tbStock SET [DrugBalance] =
[DrugBalance] - " & (SalesQuantity) & " WHERE DrugName = '" &
(lvSales.SelectedItems(0).SubItems(1).Text) & "'"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
107
myCon.Close()
Return False
End Try
End Function
Public Function DrugBalanceAdd() As Boolean
Try
QuoteQty =
lvQuotation.SelectedItems(0).SubItems(1).Text
MsgBox(QuoteQty)
strSql = "UPDATE tbStock SET [DrugBalance] =
[DrugBalance] + " & (QuoteQty) & " WHERE DrugName = '" &
(lvQuotation.SelectedItems(0).SubItems(0).Text) & "'"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Public Function CalculateSales() As Boolean
Dim newDrugBalance As Integer
newDrugBalance =
lvSales.SelectedItems(0).SubItems(5).Text - SalesQuantity
TotalSales = SalesQuantity * Price
Try
With
lvQuotation.Items.Add(lvSales.SelectedItems(0).SubItems(1).Text
)
.SubItems.Add(SalesQuantity)
.SubItems.Add(Price)
.SubItems.Add(TotalSales)
End With
With
frmCheckOut.lvCheckout.Items.Add(lvSales.SelectedItems(0).SubIt
ems(1).Text)
.SubItems.Add(TotalSales)
.SubItems.Add(newDrugBalance)
End With
GrandTotal()
AddSaletoDB()
theCount = theCount + 1
Catch ex As Exception
108
End Try
End Function
Function OldPassword() As Boolean
Try
strSql = "SELECT * FROM tblLogin WHERE Password ='"
& (GlobalV.Password) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
Dim oldpass As String
oldpass = txtOldPassword.Text
If (GlobalV.Password = oldpass) Then
End If
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
MsgBox(ex.Message)
Return False
End Try
End Function
Function UpdatePassword() As Boolean
Try
strSql = "UPDATE tblLogin SET [Password] = '" &
(txtNewPassword.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function ConfirmPassword() As Boolean
Dim confirmpass As String
confirmpass = txtConfirmPassword.Text
109
Try
If (OldPassword() = confirmpass) Then
UpdatePassword()
MsgBox("Your password has successful change")
Return True
Else
txtNewPassword.Clear()
txtConfirmPassword.Clear()
MsgBox("Your password was wrong")
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
Private Sub btClear_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btClear.Click
txtConfirmPassword.Clear()
txtNewPassword.Clear()
txtOldPassword.Clear()
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.PaintEventArgs) Handles
Panel1.Paint
End Sub
Private Sub txtNewPassword_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtNewPassword.TextChanged
End Sub
Private Sub txtConfirmPassword_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtConfirmPassword.TextChanged
End Sub
Private Sub btChangePass_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btChangePass.Click
If (OldPassword() = True) Then
'End If
ConfirmPassword()
End If
End Sub
Private Sub tpPrescription_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
tpPrescription.Click
End Sub
110
Private Sub txtDrugName_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtDrugName.TextChanged
SearchDrugs()
End Sub
Function SearchDrugs() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName LIKE
'%" & (txtDrugName.Text) & "%'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lbDrugs.Items.Clear()
While (myDR.Read())
lbDrugs.Items.Add(myDR("DrugName"))
' .subitems.add(myDR("DrugID"))
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchMoreDrug() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName ='"
& (DName) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtAmount.Text = (myDR("SalePrice"))
txtDrugBalance.Text = (myDR("DrugBalance"))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
111
Private Sub lbDrugs_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lbDrugs.SelectedIndexChanged
DName = lbDrugs.SelectedItem.ToString
txtDrugName.Text = DName
SearchMoreDrug()
End Sub
Private Sub btCalculate_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btCalculate.Click
Dim Cost As Integer
Dim Qty As Integer
Dim Total As Integer
Cost = txtAmount.Text
Qty = txtQuantityDispenced.Text
Total = Cost * Qty
txtTotalCost.Text = Total
End Sub
Private Sub btLoadAllToday_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllToday.Click
LoadDayPrescription()
End Sub
Function LoadDayPrescription() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE Dates
= " & (String.Concat("#", Date.Now.ToShortDateString, "#")) &
""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
112
myCon.Close()
Return False
End Try
End Function
Function GeneratePrescriptonNo() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions ORDER BY
PrescriptionNo DESC"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
prenum = (myDR("PrescriptionNo"))
MsgBox(prenum)
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function CAllLAtestPrescripton() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientNo = '" & (txtPatientNo.Text) & "' ORDER BY
PrescriptionNo DESC"
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
prenum = (myDR("PrescriptionNo"))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function LoadPresc() As Boolean
Try
113
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientsNo = '" & (txtPatientNo.Text) & "' AND PrescriptionNo =
" & (preNum) & ""
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function LoadByDate() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE Dates
= " & (String.Concat("#", dtpOld.Value.ToShortDateString, "#"))
& ""
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
114
Return False
End Try
End Function
Function LoadByPrescriptionNo() As Boolean
Try
strSql = "SELECT * FROM tbPrescriptions WHERE
PrescriptionNo = " & (txtPrescriptionNo.Text) & ""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvPrescriptions.Items.Clear()
While (myDR.Read())
With
lvPrescriptions.Items.Add(myDR("PrescriptionNo"))
.subitems.add(myDR("PatientName"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("TotalCost"))
.subitems.add(myDR("DoctorsName"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btOldPrescription_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btOldPrescription.Click
LoadByDate()
End Sub
Private Sub btPrescriptmberionNu_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btPrescriptmberionNu.Click
LoadByPrescriptionNo()
End Sub
Private Sub btDispensee_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btDispensee.Click
'GeneratePrescriptonNo()
Dispense()
UpdateDrugBalance()
115
'CAllLAtestPrescripton()
LoadPresc()
If CheckDate() = True Then
myCon.Close()
UpdateStaffWorkload()
Else
myCon.Close()
AddNEwDate()
myCon.Close()
UpdateStaffWorkload()
End If
End Sub
Function AddNEwDate() As Boolean
Try
strSql = "INSERT INTO
tbStaffWorkload([Dispenser],[Dates],[TotalSale],[TotalPrescript
ions],[TotalPatients],[TotalPrescriptionItems]) VALUES('" &
(String.Concat(Firstname, " ", Surname)) & "'," &
(String.Concat("#", Date.Today.ToShortDateString, "#")) &
",0,0,0,0)"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdateStaffWorkload() As Boolean
Dim totalsale As Integer
Dim qty As Integer
totalsale = txtTotalCost.Text
qty = txtQuantityDispenced.Text
Try
strSql = "UPDATE tbStaffWorkload SET [TotalSale] =
[TotalSale] + " _
& (totalsale) & ",[TotalPrescriptions] =
[TotalPrescriptions] + 1,[TotalPatients] = [TotalPatients] +
1,[TotalPrescriptionItems] = [TotalPrescriptionItems] + " _
116
& (qty) & " WHERE [Dates] = " & (String.Concat("#",
Date.Today.ToShortDateString, "#")) & " AND [Dispenser] = '" &
(String.Concat(Firstname, " ", Surname)) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function CheckDate() As Boolean
Try
strSql = "SELECT * FROM tbStaffWorkload WHERE Dates
= " & (String.Concat("#", Date.Today.ToShortDateString, "#")) &
""
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
' Dim dater As Date
If IsDBNull(myDR("Dates")) Then
myCon.Close()
AddNEwDate()
UpdateStaffWorkload()
Else
myCon.Close()
UpdateStaffWorkload()
End If
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdateDrugBalance() As Boolean
117
Try
strSql = "UPDATE tbStock SET [DrugBalance] =
[DrugBalance] -" & (txtQuantityDispenced.Text) & " WHERE
[DrugName] = '" & (txtDrugName.Text) & "'"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function Dispense() As Boolean
Try
strSql = "INSERT INTO
tbPrescriptions([PatientsNo],[PrescriptionNo],[Dates],[DrugName
],[Quantity],[TotalCost],[DoctorsName],[Dispensed],[Dispenser],
[Remarks],[Price],[PatientName]) VALUES('" _
& (txtPatientNo.Text) & "','" _
& (prenum) & "'," _
& (String.Concat("#", Date.Now.ToShortDateString,
"#")) & ",'" _
& (txtDrugName.Text) & "'," _
& (txtQuantityDispenced.Text) & "," _
& (txtTotalCost.Text) & ",'" _
& (txtDoctorName.Text) & "',TRUE,'" _
& (txtDispencerName.Text) & "','" _
& (txtRemarks.Text) & "'," _
& (txtAmount.Text) & ",'" _
& (txtPatientName.Text) & "')"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchSalesByName() As Boolean
Try
118
strSql = "SELECT * FROM tbStock WHERE DrugName LIKE
'%" & (txtSalesDrugName.Text) & "%'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("ReOrder"))
.subitems.add(myDR("DrugBalance"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchSalesByName2() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbStock WHERE DrugName = '"
& (txtSalesDrugName.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
' lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("ReOrder"))
.subitems.add(myDR("DrugBalance"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
119
End Try
End Function
Function SearchSalesByID() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugID LIKE
'%" & (txtSalesDrugID.Text) & "%'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSales.Items.Clear()
While (myDR.Read())
With lvSales.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("ReOrder"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub txtSalesDrugName_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtSalesDrugName.TextChanged
SearchSalesByName()
End Sub
Private Sub txtSalesDrugID_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtSalesDrugID.TextChanged
SearchSalesByID()
End Sub
Private Sub lvSales_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lvSales.SelectedIndexChanged
' CreatInvoiceID()
frmQuantity.Show()
End Sub
120
Function CreatInvoiceID() As Boolean
Try
Dim Datedstr As String
Datedstr = Date.Now
' Datedstr.Remove(Char "/")
'Dim str As String = "to## remove' all"" special^&
characters from string"
Dim sb As New System.Text.StringBuilder
For Each ch As Char In Datedstr
If Char.IsLetterOrDigit(ch) Then
sb.Append(ch)
End If
Next
' MsgBox(sb.ToString)
InvoiceID = sb.ToString
Catch ex As Exception
End Try
End Function
Public Function AddSaletoDB() As Boolean
' Dim var1 As String = lv
' Dim var2 As Integer
' Dim var3 As Integer
' Dim var4 As Integer
Try
strSql = "INSERT INTO
tbSales([InvoiceID],[DrugName],[Price],[Quantity],[Total],[Date
s]) VALUES('" _
& (InvoiceID) & "','" _
& (lvQuotation.Items(theCount).SubItems(0).Text) &
"','" _
& (lvQuotation.Items(theCount).SubItems(1).Text) &
"','" _
& (lvQuotation.Items(TheCount).SubItems(2).Text) &
"','" _
& (lvQuotation.Items(theCount).SubItems(3).Text) &
"'," _
& (String.Concat("#", Date.Now.ToShortDateString,
"#")) & ")"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
121
End Function
Private Sub btRemoveItems_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btRemoveItems.Click
DrugBalanceAdd()
RemovefromTable()
RemoveItem()
End Sub
Function Deduct() As Boolean
Dim startingBalance As Integer
Dim EndBalance As Integer
Dim DeductBalance As Integer
Try
DeductBalance =
lvQuotation.SelectedItems(0).SubItems(3).Text
startingBalance = txtGrandTotal.Text
EndBalance = startingBalance - DeductBalance
txtGrandTotal.Text = EndBalance
Catch ex As Exception
End Try
End Function
Function RemoveItem() As Boolean
Deduct()
lvQuotation.SelectedItems(0).Remove()
End Function
Private Sub btBegin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btBegin.Click
CreatInvoiceID()
lvSales.Enabled = True
End Sub
Function RemovefromTable() As Boolean
Try
strSql = "DELETE * FROM tbSales WHERE InvoiceID =
'" & (InvoiceID) & "' AND DrugName = '" &
(lvQuotation.SelectedItems(0).SubItems(0).Text) & "'"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
122
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub lvQuotation_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
lvQuotation.SelectedIndexChanged
End Sub
Private Sub cmdCheckout_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmdCheckout.Click
frmCheckOut.Show()
End Sub
Private Sub btNewPre_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btNewPre.Click
GeneratePrescriptonNo()
prenum = prenum + 1
txtPrescriptionNo.Text = prenum
End Sub
Function LoadQue() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbPrescriptions WHERE
Dispensed = FALSE"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
Dim DA As New OleDbDataAdapter(strSql, myCon)
Dim DS As New DataSet
DA.Fill(DS, "tbPrescription")
Dim dt As New DataTable
dt = DS.Tables(0)
Dim dr As DataRow
For Each dr In dt.Rows()
cmbQue.Items.Add(dr("PatientName"))
Next
cmbQue.SelectedIndex = -1
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
123
Private Sub cmbQue_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbQue.SelectedIndexChanged
myCon.Close()
LoadArray()
End Sub
Function LoadArray() As Boolean
' Dim Drugs() As String
myCon.Close()
Try
myCon.Close()
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientName = '" & (cmbQue.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
'Drugs = (myDR("DrugName"))
' myCon.Close()
' MsgBox(Drugs)
txtDrugName.Text = (myDR("DrugName"))
SearchSalesByName2()
myCon.Close()
txtDrugName.Clear()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
frmReports.Show()
End Sub
Private Sub btLoadAllStock_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllStock.Click
LoadStockReport()
End Sub
124
Function LoadStockReport() As Boolean
Try
strSql = "SELECT * FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStock.Items.Clear()
While (myDR.Read())
With lvStock.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("CostPrice"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("DiscountPrice"))
.subitems.add(myDR("StorageType"))
.subitems.add(myDR("DateOfPurchase"))
.subitems.add(myDR("Formulation"))
.subitems.add(myDR("DrugBalance"))
.subitems.add(myDR("ReOrder"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function TotalDrugs() As Boolean
Try
strSql = "SELECT SUM(DrugBalance) FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalDrugStock.Text = (myDR.GetValue(0))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btLoadAll_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAll.Click
LoadStockReport()
TotalDrugs()
125
End Sub
Function LoadSalesReport() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSalesReport.Items.Clear()
While (myDR.Read())
With lvSalesReport.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
' .subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SumTotalSale() As Boolean
Try
myCon.Close()
strSql = "SELECT SUM(Total) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalSales.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
126
Function TotalQuantitySale() As Boolean
Try
myCon.Close()
strSql = "SELECT SUM(Quantity) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalQuantity.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Function CountTotalSale() As Boolean
Try
myCon.Close()
strSql = "SELECT Count(Total) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalTransaction.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Private Sub btLoadAllSales_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllSales.Click
loadsalesreport()
SumTotalSale()
CountTotalSale()
TotalQuantitySale()
End Sub
Function LoadSalesByDate() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbSales WHERE Dates BETWEEN
" & (String.Concat("#", dtpFrom.Value.ToShortDateString, "#"))
127
& " AND " & (String.Concat("#", dtpTo.Value.ToShortDateString,
"#")) & ""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSalesReport.Items.Clear()
While (myDR.Read())
With lvSalesReport.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
' .subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btByDate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btByDate.Click
LoadSalesByDate()
End Sub
Function LoadStaffWorkLoad() As Boolean
Try
strSql = "SELECT * FROM tbStaffWorkload WHERE
Dispenser = '" & (String.Concat(Firstname, " ", Surname)) & "'"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStaff.Items.Clear()
While (myDR.Read())
With lvStaff.Items.Add(myDR("Dates"))
.subitems.add(myDR("TotalSale"))
.subitems.add(myDR("TotalPrescriptions"))
.subitems.add(myDR("TotalPrescriptionItems"))
.subitems.add(myDR("TotalPatients"))
128
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btSTaffWorkload_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btSTaffWorkload.Click
LoadStaffWorkLoad()
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
TheListView = lvStock
ExportListViewToExcel()
' Return True
Catch ex As Exception
' MsgBox(ex.Message)
End Try
End Sub
Private Sub Label29_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
End Sub
Private Sub TabPage3_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage3.Click
End Sub
Function SearchVendor() As Boolean
Try
strSql = "SELECT * FROM tbVendors WHERE VendorName
= '" & (txtVendor.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtVendor.Text = myDR("VendorName")
txtPTelephone.Text = myDR("Telephone")
txtPEmail.Text = myDR("Email")
129
txtPContactName.Text = myDR("ContactName")
txtVCreditLimit.Text = myDR("CreditLimit")
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub cmdSearchVendor_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmdSearchVendor.Click
SearchVendor()
End Sub
Function AddNewPurchase() As Boolean
Try
strSql = "INSERT INTO
tbVendors([VendorName],[Telephone],[Email],[CreditLimit],[Conta
ctName]) VALUES('" & (txtVendor.Text) & "','" _
& (txtPTelephone.Text) & "','" _
& (txtPEmail.Text) & "'," _
& (txtVCreditLimit.Text) & ",'" _
& (txtPContactName.Text) & "')"
MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdatePurchase() As Boolean
Try
strSql = "UPDATE tbVendors SET [CreditLimit] = " &
(txtVCreditLimit.Text) & " WHERE [VendorName] = '" &
(txtVendor.Text) & "'"
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
130
MsgBox("Credit Limit successfully changed to " &
txtVCreditLimit.Text)
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btPAddNew_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btPAddNew.Click
AddNewPurchase()
End Sub
Private Sub btPEdit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btPEdit.Click
UpdatePurchase()
End Sub
Function LoadSuppliers() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbVendors"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
Dim DA As New OleDbDataAdapter(strSql, myCon)
Dim DS As New DataSet
DA.Fill(DS, "tbVendors")
Dim dt As New DataTable
dt = DS.Tables(0)
Dim dr As DataRow
For Each dr In dt.Rows()
cmbSupplier.Items.Add(dr("VendorName"))
Next
cmbSupplier.SelectedIndex = -1
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub PrintDocument1_PrintPage(ByVal sender As
System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
End Sub
131
Private Sub cmbSupplier_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
cmbSupplier.SelectedIndexChanged
PopulateVendorDetails()
End Sub
Function PopulateVendorDetails() As Boolean
Try
strSql = "SELECT * FROM tbVendors WHERE VendorName
= '" & (cmbSupplier.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtCreditLimit.Text = myDR("CreditLimit")
txtPDiscount.Text = myDR("Discount")
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchUnit() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName = '"
& (txtPUnit.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtPAmount.Text = myDR("CostPrice")
myCon.Close()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub txtPUnit_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtPUnit.TextChanged
If txtPUnit.TextLength > 2 Then
SearchUnit()
End If
End Sub
132
Private Sub TabPage2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage2.Click
End Sub
Private Sub tpAdmin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles tpAdmin.Click
End Sub
End Class
B.8 Purchase Invoice Code
The following is the code that will implement the Pharmacy Purchase Invoice
Module using the following code as shown below.
Function CreatInvoiceID() As Boolean
Try
Dim Datedstr As String
Datedstr = Date.Now
' Datedstr.Remove(Char "/")
'Dim str As String = "to## remove' all"" special^&
characters from string"
Dim sb As New System.Text.StringBuilder
For Each ch As Char In Datedstr
If Char.IsLetterOrDigit(ch) Then
sb.Append(ch)
End If
Next
' MsgBox(sb.ToString)
InvoiceID = sb.ToString
Catch ex As Exception
End Try
End Function
Public Function AddSaletoDB() As Boolean
' Dim var1 As String = lv
' Dim var2 As Integer
' Dim var3 As Integer
' Dim var4 As Integer
Try
strSql = "INSERT INTO
tbSales([InvoiceID],[DrugName],[Price],[Quantity],[Total],[Date
s]) VALUES('" _
& (InvoiceID) & "','" _
& (lvQuotation.Items(theCount).SubItems(0).Text) &
"','" _
& (lvQuotation.Items(theCount).SubItems(1).Text) &
"','" _
& (lvQuotation.Items(TheCount).SubItems(2).Text) &
"','" _
133
& (lvQuotation.Items(theCount).SubItems(3).Text) &
"'," _
& (String.Concat("#", Date.Now.ToShortDateString,
"#")) & ")"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btRemoveItems_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btRemoveItems.Click
DrugBalanceAdd()
RemovefromTable()
RemoveItem()
End Sub
Function Deduct() As Boolean
Dim startingBalance As Integer
Dim EndBalance As Integer
Dim DeductBalance As Integer
Try
DeductBalance =
lvQuotation.SelectedItems(0).SubItems(3).Text
startingBalance = txtGrandTotal.Text
EndBalance = startingBalance - DeductBalance
txtGrandTotal.Text = EndBalance
Catch ex As Exception
End Try
End Function
Function RemoveItem() As Boolean
Deduct()
lvQuotation.SelectedItems(0).Remove()
End Function
134
Private Sub btBegin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btBegin.Click
CreatInvoiceID()
lvSales.Enabled = True
End Sub
Function RemovefromTable() As Boolean
Try
strSql = "DELETE * FROM tbSales WHERE InvoiceID =
'" & (InvoiceID) & "' AND DrugName = '" &
(lvQuotation.SelectedItems(0).SubItems(0).Text) & "'"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub lvQuotation_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
lvQuotation.SelectedIndexChanged
End Sub
Private Sub cmdCheckout_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmdCheckout.Click
frmCheckOut.Show()
End Sub
Private Sub btNewPre_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btNewPre.Click
GeneratePrescriptonNo()
prenum = prenum + 1
txtPrescriptionNo.Text = prenum
End Sub
Function LoadQue() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbPrescriptions WHERE
Dispensed = FALSE"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
135
myCon.Open()
Dim DA As New OleDbDataAdapter(strSql, myCon)
Dim DS As New DataSet
DA.Fill(DS, "tbPrescription")
Dim dt As New DataTable
dt = DS.Tables(0)
Dim dr As DataRow
For Each dr In dt.Rows()
cmbQue.Items.Add(dr("PatientName"))
Next
cmbQue.SelectedIndex = -1
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub cmbQue_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmbQue.SelectedIndexChanged
myCon.Close()
LoadArray()
End Sub
Function LoadArray() As Boolean
' Dim Drugs() As String
myCon.Close()
Try
myCon.Close()
strSql = "SELECT * FROM tbPrescriptions WHERE
PatientName = '" & (cmbQue.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
'Drugs = (myDR("DrugName"))
' myCon.Close()
' MsgBox(Drugs)
txtDrugName.Text = (myDR("DrugName"))
SearchSalesByName2()
myCon.Close()
txtDrugName.Clear()
136
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
frmReports.Show()
End Sub
Private Sub btLoadAllStock_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllStock.Click
LoadStockReport()
End Sub
Function LoadStockReport() As Boolean
Try
strSql = "SELECT * FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStock.Items.Clear()
While (myDR.Read())
With lvStock.Items.Add(myDR("DrugID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("ExpiryDate"))
.subitems.add(myDR("CostPrice"))
.subitems.add(myDR("SalePrice"))
.subitems.add(myDR("DiscountPrice"))
.subitems.add(myDR("StorageType"))
.subitems.add(myDR("DateOfPurchase"))
.subitems.add(myDR("Formulation"))
.subitems.add(myDR("DrugBalance"))
.subitems.add(myDR("ReOrder"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
137
Function TotalDrugs() As Boolean
Try
strSql = "SELECT SUM(DrugBalance) FROM tbStock"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalDrugStock.Text = (myDR.GetValue(0))
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btLoadAll_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btLoadAll.Click
LoadStockReport()
TotalDrugs()
End Sub
Function LoadSalesReport() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSalesReport.Items.Clear()
While (myDR.Read())
With lvSalesReport.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
' .subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
138
End Try
End Function
Function SumTotalSale() As Boolean
Try
myCon.Close()
strSql = "SELECT SUM(Total) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalSales.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Function TotalQuantitySale() As Boolean
Try
myCon.Close()
strSql = "SELECT SUM(Quantity) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtTotalQuantity.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Function CountTotalSale() As Boolean
Try
myCon.Close()
strSql = "SELECT Count(Total) FROM tbSales"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
139
myDR.Read()
txtTotalTransaction.Text = myDR.GetValue(0)
myCon.Close()
Return True
Catch ex As Exception
myCon.Close()
Return False
End Try
End Function
Private Sub btLoadAllSales_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btLoadAllSales.Click
loadsalesreport()
SumTotalSale()
CountTotalSale()
TotalQuantitySale()
End Sub
Function LoadSalesByDate() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbSales WHERE Dates BETWEEN
" & (String.Concat("#", dtpFrom.Value.ToShortDateString, "#"))
& " AND " & (String.Concat("#", dtpTo.Value.ToShortDateString,
"#")) & ""
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvSalesReport.Items.Clear()
While (myDR.Read())
With lvSalesReport.Items.Add(myDR("InvoiceID"))
.subitems.add(myDR("DrugName"))
.subitems.add(myDR("Price"))
.subitems.add(myDR("Quantity"))
.subitems.add(myDR("Total"))
.subitems.add(myDR("Dates"))
' .subitems.add(myDR("Dispenser"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
140
Private Sub btByDate_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btByDate.Click
LoadSalesByDate()
End Sub
Function LoadStaffWorkLoad() As Boolean
Try
strSql = "SELECT * FROM tbStaffWorkload WHERE
Dispenser = '" & (String.Concat(Firstname, " ", Surname)) & "'"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
lvStaff.Items.Clear()
While (myDR.Read())
With lvStaff.Items.Add(myDR("Dates"))
.subitems.add(myDR("TotalSale"))
.subitems.add(myDR("TotalPrescriptions"))
.subitems.add(myDR("TotalPrescriptionItems"))
.subitems.add(myDR("TotalPatients"))
End With
End While
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btSTaffWorkload_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btSTaffWorkload.Click
LoadStaffWorkLoad()
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
TheListView = lvStock
ExportListViewToExcel()
' Return True
Catch ex As Exception
' MsgBox(ex.Message)
141
End Try
End Sub
Private Sub Label29_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
End Sub
Private Sub TabPage3_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage3.Click
End Sub
Function SearchVendor() As Boolean
Try
strSql = "SELECT * FROM tbVendors WHERE VendorName
= '" & (txtVendor.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtVendor.Text = myDR("VendorName")
txtPTelephone.Text = myDR("Telephone")
txtPEmail.Text = myDR("Email")
txtPContactName.Text = myDR("ContactName")
txtVCreditLimit.Text = myDR("CreditLimit")
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub cmdSearchVendor_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cmdSearchVendor.Click
SearchVendor()
End Sub
Function AddNewPurchase() As Boolean
Try
strSql = "INSERT INTO
tbVendors([VendorName],[Telephone],[Email],[CreditLimit],[Conta
ctName]) VALUES('" & (txtVendor.Text) & "','" _
& (txtPTelephone.Text) & "','" _
& (txtPEmail.Text) & "'," _
& (txtVCreditLimit.Text) & ",'" _
& (txtPContactName.Text) & "')"
MsgBox(strSql)
142
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function UpdatePurchase() As Boolean
Try
strSql = "UPDATE tbVendors SET [CreditLimit] = " &
(txtVCreditLimit.Text) & " WHERE [VendorName] = '" &
(txtVendor.Text) & "'"
'MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myCmd.ExecuteNonQuery()
myCon.Close()
MsgBox("Credit Limit successfully changed to " &
txtVCreditLimit.Text)
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub btPAddNew_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btPAddNew.Click
AddNewPurchase()
End Sub
Private Sub btPEdit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btPEdit.Click
UpdatePurchase()
End Sub
Function LoadSuppliers() As Boolean
Try
myCon.Close()
strSql = "SELECT * FROM tbVendors"
' MsgBox(strSql)
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
143
Dim DA As New OleDbDataAdapter(strSql, myCon)
Dim DS As New DataSet
DA.Fill(DS, "tbVendors")
Dim dt As New DataTable
dt = DS.Tables(0)
Dim dr As DataRow
For Each dr In dt.Rows()
cmbSupplier.Items.Add(dr("VendorName"))
Next
cmbSupplier.SelectedIndex = -1
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub PrintDocument1_PrintPage(ByVal sender As
System.Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
End Sub
Private Sub cmbSupplier_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
cmbSupplier.SelectedIndexChanged
PopulateVendorDetails()
End Sub
Function PopulateVendorDetails() As Boolean
Try
strSql = "SELECT * FROM tbVendors WHERE VendorName
= '" & (cmbSupplier.Text) & "'"
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtCreditLimit.Text = myDR("CreditLimit")
txtPDiscount.Text = myDR("Discount")
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Function SearchUnit() As Boolean
Try
strSql = "SELECT * FROM tbStock WHERE DrugName = '"
& (txtPUnit.Text) & "'"
144
myCmd = New OleDbCommand
myCmd.CommandText = strSql
myCmd.Connection = myCon
myCon.Open()
myDR = myCmd.ExecuteReader
myDR.Read()
txtPAmount.Text = myDR("CostPrice")
myCon.Close()
Return True
Catch ex As Exception
' MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
Private Sub txtPUnit_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtPUnit.TextChanged
If txtPUnit.TextLength > 2 Then
SearchUnit()
End If
End Sub
Private Sub TabPage2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage2.Click
End Sub
Private Sub tpAdmin_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles tpAdmin.Click
End Sub
Private Sub TabPage4_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TabPage4.Click
End Sub
End Class
145
APPENDICES C
C.1 User Acceptance Test Form
USER ACCEPTANCE TEST SCRIPT
MEWA PHARMACY SOFTWARE SYSTEM
MAIN DASH BOARD
VERSION NO 1.0
1. Test Scenario
No. Test Script No.
Description
1. Main Menu 1.0 Successful login opens main menu
2. Main Menu 1.1
Main menu should consists of 5 tabs – Sales, Report,
Administration, Price and Purchase
3. Main Menu 1.2 Sales
4. Main Menu 1.3 Report
5. Main Menu 1.4 Administration
6. Main Menu 1.5 Price
7. Main Menu 1.6 Purchase
Test Script No: Login 1.0
Start Date: 9/27/2012
146
Scenario: Logging in to access the main menu
No. Step Test Data
(Input Data)
Test
Condition
Expected
Results
1. 1 Login
Username and Password
Verify the username and
password
To access the main
menu
2. Login
Username and Password
Given wrong username or password
Access denial to
the main menu
3. Login
Username and Password
Given wrong username or password for 3 times
The program log
off and exit
147
C.2 Letter to Organization
148
C.3 Questionnaire
QUESTIONNAIRE
MEWA PHARMACY SOFTWARE SYSTEM
Section A: Personal Information
(Please Tick or Cross on appropriate check box of your choice)
This questionnaire is presented to you with the objective of understanding the
current MEWA Pharmacy System and also get your recommendation and input for
the proposed MEWA Pharmacy Software System.
In this regard, a request is made to you to give a feedback by answering the
questions below. You are required to check the appropriate box with an option best
fit your recommendation.
The information generated by this questionnaire will be treated confidentially and
only be used for the intended purpose and will not in any way be used against you,
the respondent.
Name (Optional)
Gender Female Male
Section of Work Outpatient Ph Inpatient Ph
HTC Ph Theatre Ph
Drug Store Surgical
Procurement Administration
149
1 2 3 4 5 (Scale)
Work Duration in MEWA 1 yrs & below 2 yrs & below
3 yrs & below 4 yrs & above
Position or Post Held Administrator
Departmental Head
Sectional Head
Dispenser
Section B: Current Pharmacy System
(On a scale of 1 to 5, 1 being the Lowest and 5 the Highest, please tick or cross on an
appropriate check box of your choice)
The current system is effective
My workload is manageable
Patient service satisfaction
Ease of retrieval of drug prices
Ease of retrieval of patient record
150
Be able to manage inventory easily
Be able to manage inventory easily
Section C: Proposed Pharmacy System
(On a scale of 1 to 5, 1 being the Lowest and 5 the Highest, please tick or cross on
an appropriate check box of your choice)
Ease of retrieval of reorder level
There are no queues
1 2 3 4 5 (Scale)
There is a need for automation
There will be queue reduction
There will be workload reduction
Be able to use updated drug prices
Kindly give any recommendation not capture by the questionnaire, which you
think will help to bring satisfaction for both patients and employees here
Thank you for taking time to complete this questionnaire
MEWA Hospital Pharmacy Department – [email protected]