Académique Documents
Professionnel Documents
Culture Documents
BACHALOR OF SCIENCE IN
INFORMATION TECHNOLOGY
ICS 2304 REPORT
SUPERVISED BY
AISHA MOHAMED
JUNE 2012
STAGE III SEMESTER I 2011/2012
i
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.
Signature
Date_______________________________________________
This report has been submitted for examination with my approval as University
supervisor.
Signature _____________________________________________
Date________________________________________________
ii
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
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
were selected from each outlet where a simple
representatives
were then
distributed to the staffs as per outlet. Each outlet was given three
questionnaires.
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, its 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).
iv
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
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
viii
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.3
Acronyms
MEWA
ATM
HTC
HIV
AIDS
TB
Tubercle Bacillius
LPO
GUI
RAM
MB
Mega Bytes
MHz
Mega Hertz
GB
Giga Bytes
xii
CBIS
PIS
DUR
MIS
RAD
SDLC
4G
Fourth Generation
DRY
TDD
xiii
CHAPTER 1
INTRODUCTION
1.1
Background
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 pharmacists validation of the order. When an order is
entered by anyone other than a pharmacist, it must be given a conditional or
1
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:
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.
MEWA Hospital was founded in 1985 in Mombasa and its principle objective
is to promote, encourage and improve the medical, educational, socioeconomical and cultural welfare of all Kenyans. (MEWA 2000)
1.2
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.
4
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.
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.
v.
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
i.
ii.
iii.
iv.
1.4
Justification
i.
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 doesnt bother to memorize the price,
as it is taken care by the system
iv.
v.
1.5
Project Scope
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.
iv.
v.
vi.
vii.
1.7
Project Limitation
i.
ii.
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.
CHAPTER 2
LITERATURE REVIEW
2.1
Introduction
2.2
Theoretical Review
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 patients age, weight and
9
other physiologic factors. Alerts and flags come up when the system picks up
any of these.
10
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.
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.
11
12
2.3
System Review
2.3.1
i.
ii.
iii.
Inputting Inventory.
iv.
v.
Pricing Table.
vi.
Inputting Compounds.
13
vii.
viii.
Entering Prescriptions.
ix.
Running Reports.
x.
The Figure 2.1 below is the main screen of the ApotheSoft Pharmacy
Management Software, and has the following modules
Figure 2.1
The Figure 2.2 below is the Patient Information screen of the ApotheSoft
Pharmacy Management Software, and has the following modules
Figure 2.2
15
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.
The Figure 2.3 below is the Patient Profile screen of the ApotheSoft Pharmacy
Management Software, and has the following modules
Figure 2.3
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
i.
ii.
Pharmacy integration
iii.
Biometric authentication
iv.
v.
vi.
vii.
viii.
ix.
x.
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
Prescription Generation
The figure 2.4 entails the following functionalities; the doctors or prescribers
name, the date of the prescription, the new treatment or regime prescribed to
18
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
19
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.
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
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.
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
21
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
solution
designed
to
automate
the
activities
of
i.
ii.
iii.
iv.
v.
vi.
Figure 2.8
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.
23
Figure 2.9
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.
24
Figure 2.10
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.
25
2.5
System Adaption
26
CHAPTER 3
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
27
design, development and testing, cause many months to be lost and significant
expense to be incurred for redesigning and redevelopment.
3.2.2
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 whats done in the previous phase. Commonly known
development phases in SDLC are:
28
regarding the system. The deliverables / products of this phase will drive how
the system will be built and guide the developers works.
Implementation: This is probably the most resource-, cost-, and timeconsuming 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.
There are many system development methods known today, but most of them
basically are extended from three main methodologies which are Structured
29
3.2.3
Structured Design
As reported by EtonDigital
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.
30
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.
Figure 3.1
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.
31
3.2.4
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
32
Figure 3.2
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.
33
Prototyping
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
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.
Throw-away Prototyping
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 doesnt 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 timeconsuming than building working prototypes.
35
Figure 3.4
The above Figure 3.4 is based on the users 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
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 Dont
Repeat Yourself (DRY) principle.
And to make sure that the clients 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 thats that's called Test-Driven Development (TDD).
37
Figure 3.5
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
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
38
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
The employees were divided into stratum according to their outlet since the
Population is heterogeneous a stratified random sampling technique was
graphed. Three
simple
representatives
questionnaires
3.4
Requirement Specification
40
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
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.
41
3.5.2
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
42
3.5.3
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
43
Figure 3.9 System Data Flow Diagram, MEWA Pharmacy System (2012)
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 vendors information, and the invoice and
receipt.
3.6
Database Design
The Pharmacy management system entails the following tables of the database:
44
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
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
45
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
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,
Table 3.4
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
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
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
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
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
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.
49
3.8.2
Hardware Specification
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.
50
3.10
Conclusion
51
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
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
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
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.
53
Figure 4.3
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.
54
Figure 4.4
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.
55
Figure 4.5
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
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
56
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
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 Figure 4.8 below shows the pharmacy software prototype of the Purchase
Invoice.
57
Figure 4.8
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
The users and the owners were involved during the iterative phase and their
recommendations
were
immediately
implemented.
The
prototype
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.
59
CHAPTER 5
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
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
60
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 (SOPs) were completely changed, giving a digital age to
pharmacy professional of MEWA hospital pharmacist.
5.4
Recommendations
61
62
REFERENCE
63
MEWA, (2000). MEWA Office Secretariat: Retrieved 07, July, 2012, from
http://www.secretariat@mewa.or.ke
64
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
A.2
CALENDER OF ACTIVITIES
66
GANTT CHART
Project Design
Project Analysis
Project Identification
0
20
40
60
80
100
120
140
67
APPENDICES B
B.1
frmPharmacy.Show()
MainContainer.tslStatus.Text = (srn & " Logged In
Successfully")
MainContainer.MainProgress.Value = 10
MainContainer.LogoutToolStripMenuItem.Enabled =
True
68
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
69
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()
70
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
71
B.2
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
72
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 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
73
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
74
B.4
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
75
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
76
77
78
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)
79
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()
80
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
81
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()
82
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)
83
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
84
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)
85
86
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) & "'," _
87
88
89
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
90
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
91
End Try
End Function
Function RemoveItem() As Boolean
Deduct()
lvQuotation.SelectedItems(0).Remove()
End Function
92
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"))
93
' 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"))
94
.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"))
95
.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
96
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"))
97
.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
98
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()
99
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)
100
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
101
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
102
103
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
104
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
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)
106
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
107
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
108
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
109
myCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
myCon.Close()
Return False
End Try
End Function
110
111
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
112
113
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()
114
'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] + " _
115
116
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
117
118
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
119
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
120
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
121
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
122
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
123
124
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
125
126
127
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")
128
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()
129
130
131
B.8
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) &
"','" _
132
MsgBox(strSql)
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
133
134
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()
135
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
136
137
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
138
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
139
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)
140
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)
141
142
143
144
APPENDICES C
C.1
1.
2.
3.
4.
5.
6.
7.
Sales
Report
Administration
Price
Purchase
145
No.
3.
Test
Expected
(Input Data)
Condition
Results
password
menu
Step
Login
1. 1
2.
Test Data
Login
Login
Username and
Password
Username and
Password
Username and
Password
Access denial to
Given wrong username
or password
146
C.2
Letter to Organization
147
C.3
Questionnaire
QUESTIONNAIRE
MEWA PHARMACY SOFTWARE SYSTEM
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.
Male
Female
Section of Work
Outpatient Ph
HTC Ph
Drug Store
Procurement
Inpatient Ph
Theatre Ph
Surgical
Administration
148
(Scale)
My workload is manageable
149
(Scale)
150