Hospital Management Project Report

Embed Size (px)

Citation preview

  • 8/12/2019 Hospital Management Project Report

    1/99

    P a g e | 1

    A PROJECT REPORT

    Submitted By

    TANUJIT MAITY, BIKRAM DEV ROY, ASIM DAS, SOURAV CHOWDHURY

    JYTIRMOY SARKAR & BODHISHATTA ROY CHOWDHURY

    in partial fulfillment for the award of the degree

    of

    DIPLOMA

    in

    COMPUTER SCIENCE AND TECNOLOGY

    Under the guidance of

    MR. SYED MASUD SHAHRYAR

    HOD, Computer Science & Technology Dept.

    DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY

    NIBEDITA INSTITUTE OF TECHNOLOGY

    NARASINGHPUR, JALANGI

    MAY, 2014

  • 8/12/2019 Hospital Management Project Report

    2/99

    P a g e | 2

    DECLARATION

    We hereby declare that the project entitled HOSPITAL MANAGEMENT SYSTEM submitted

    for the Diploma in CST is my original work and the project has not formed the basis for the award of

    any degree, associateship, fellowship.

    Signature of the Students

    Place:

    Date:

  • 8/12/2019 Hospital Management Project Report

    3/99

  • 8/12/2019 Hospital Management Project Report

    4/99

    P a g e | 4

    ACKNOWLEDGEMENTS

    A project is a golden opportunity for learning and self development. We consider

    ourselves very lucky and honoured to have so many wonderful people lead me through in

    completion of this project.

    We are greatly thankful to our beloved sir, Mr Syed Masud Shahryar, HOD of the

    department of Computer Science & Technology, NIT for giving us the opportunity to work

    under him and lending every support at every stage of this project work. We truly

    appreciate and value his esteemed guidance and encouragement from the beginning to the

    end of this project. We are indebted to him for having helped us to shape the problem and

    providing insights towards the solution. His trust and support inspired us in the most

    important moments of making right decisions and we are glad to work with him.

    We are very much indebted to the department of Computer Sc. and Technology of Nibedita

    Institute of Technology, for giving us a solid foundation in Computer Science.

    Signature of the Students ..........

    ..........

    ..........

    ..........

    ..........

    ..........

  • 8/12/2019 Hospital Management Project Report

    5/99

    P a g e | 5

    TABLES OF CONTENT

    Abstract 2

    Problem Description 3

    System Specification 4

    System Study 5

    DFD 9

    E-R Diagram 12

    Software Description 13

    Database Design 28

    Sample Coding 32

    Output 83

    Conclusion 91

    Bibliography 93

  • 8/12/2019 Hospital Management Project Report

    6/99

    P a g e | 6

    ABSTRACT

    Our project Hospital Management system includes registration of patients, storing their

    details into the system, and also computerized billing in the pharmacy, and labs. Our software has

    the facility to give a unique id for every patient and stores the details of every patient and the staff

    automatically. It includes a search facility to know the current status of each room. User can

    search availability of a doctor and the details of a patient using the id.

    The Hospital Management System can be entered using a username and password.

    It is accessible either by an administrator or receptionist. Only they can add data into the database.

    The data can be retrieved easily. The interface is very user-friendly. The data are well protected

    for personal use and makes the data processing very fast.

  • 8/12/2019 Hospital Management Project Report

    7/99

    P a g e | 7

    INTRODUCTION

    Hospital Management System is powerful, flexible, and easy to use and is designed and developed

    to deliver real conceivable benefits to hospitals.

    Hospital Management System is designed for multispeciality hospitals, to cover a wide range of

    hospital administration and management processes. It is an integrated end-to-end Hospital

    Management System that provides relevant information across the hospital to support effective

    decision making for patient care, hospital administration and critical financial accounting, in a

    seamless flow.

    Hospital Management System is a software product suite designed to improve the quality and

    management of hospital management in the areas of clinical process analysis and activity-based

    costing. Hospital Management System enables you to develop your organization and improve its

    effectiveness and quality of work. Managing the key processes efficiently is critical to the success

    of the hospital helps you manage your processes.

    PROBLEM INTRODUCTION

    Lack of immediate retrievals: -

    The information is very difficult to retrieve and to find particular information like- E.g. - To find

    out about the patients history, the user has to go through various registers. This results in

    inconvenience and wastage of time.

    Lack of immediate information storage: -

    The information generated by various transactions takes time and efforts to be stored at right

    place.

    Lack of prompt updating: -

    Various changes to information like patient details or immunization details of child are difficult

    to make as paper work is involved.

    Error prone manual calculation: -

  • 8/12/2019 Hospital Management Project Report

    8/99

    P a g e | 8

    Manual calculations are error prone and take a lot of time this may result in incorrect information.

    For example calculation of patients bill based on various treatments.

    5. Preparation of accurate and prompt reports: -

    This becomes a difficult task as information is difficult to collect from various registers.

    ESTABLISH THE NEED OF NEW SYSTEM

    1. Problem of Reliability: Current system is not reliable. It seems to vary in quality from onemonth to the, next. Sometimes it gives good output, but some times the output is worst.

    2. Problem of Accuracy: There are too many mistakes in reports.3. Problem of timeliness: In the current system the reports and output produced is mostly late and

    in most of the cases it is useless because it is not on time.

    4. Problem of Validity: The output and reports mostly contains misleading information. Thecustomer's information is sometimes not valid.

    5. Problem of Economy: The current system is very costly. We have to spend lots of money tokeep the system up and going, but still not get the desired results.

    6. Problem of Capacity: The current system is suffering from problem of capacity also. The stafffor organization is very less and the workload is too much. Few peoples cannot handle all the

    work.

    PROPOSED SYSTEM

    l. Employee Details:The new proposed system stores and maintains all the employees details.

    2. Calculations:The new proposed system calculates salary and income tax automatically and

    it is very fast and accurate.

    3. Registers: There is no need of keeping and maintaining salary and employee register

    manually. It remembers each and every record and we can get any report related to employee

    and salary at any time.

    4. Speed:The new proposed system is very fast with 100% accuracy and saves time.

  • 8/12/2019 Hospital Management Project Report

    9/99

  • 8/12/2019 Hospital Management Project Report

    10/99

    P a g e | 1 0

    under the administrator and the other members have the rights to just see the records not to change

    any transaction or entry.

    Security: Security is the main criteria for the proposed system. Since illegal access may corrupt

    the database and it will affect not only the hospital but also it also affects the patients life. So

    security has to be given in this project.

    SYSTEM SPECIFICATION

    1. Hardware Requirements

    Processor : Intel core i3 2.4 GHZ or above

    Clock speed : 500 MHZ

    System bus : 64 bits

    RAM : 2GB of RAM

    HDD : 40 GB or higher

    2. Software Requirements

    OS : MS WINDOWS 7

    Front End : Visual Basic 6.0

    Back End : Microsoft Access 2007

  • 8/12/2019 Hospital Management Project Report

    11/99

    P a g e | 1 1

    SYSTEM ANALYSIS

    PRINCIPLES OF SYSTEM ANALYSIS:

    PRINCIPLES:

    Understand the problem before you begin to create the analysis model. Develop prototypes that enable a user to understand how human machine interaction will

    occur.

    Record the origin of and the reason for every requirement. Use multiple views of requirements like building data, function and behavioral models. Work to eliminate ambiguity

    System Analysis is a separation of a substance into parts for study and their implementation and

    detailed examination.

    Before designing any system it is important that the nature of the business and the way itcurrently operates are clearly understood. The detailed examination provides the specific data

    required during designing in order to ensure that all the client's requirements are fulfilled. The

    investigation or the study conducted during the analysis phase is largely based on the feasibility

    study. Rather it would not be wrong to say that the analysis and feasibility phases overlap. High-

    level analysis begins during the feasibility study. Though analysis is represented as one phase of

    the system development life cycle (SDLC), this is not true. Analysis begins with system

    initialization and continues until its maintenance. Even after successful implementation of the

    system, analysis may play its role for periodic maintenance and up gradation of the system. One

    of the main causes of project failures is inadequate understanding, and one of the main causes of

    inadequate understanding of the requirements is the poor planning of system analysis.

    Analysis requires us to recall the objectives of the project and consider following three

    questions:

    What type of information is required?

  • 8/12/2019 Hospital Management Project Report

    12/99

  • 8/12/2019 Hospital Management Project Report

    13/99

    P a g e | 1 3

    A request to take assistance from information system can be made for many reasons, but in each

    case someone in the organisation initiates the request is made, the first system activity the

    preliminary investigation begins. This activity has three parts:

    1) Request clarification2) Feasibility study3) Request approval

    Request clarification: Many requests from employees and users in the organisations are not

    clearly defined, Therefore it becomes necessary that project request must be eximined and

    clarified properly before considering systems investigation.

    FEASIBILITY STUDY:

    The feasibility study proposes one or more conceptual solution to the problem set of the project.

    In fact, it is an evaluation of whether it is worthwhile to proceed with project or not.

    1. Evaluation of feasibility of such solutions. Such evaluation often indicates shortcomings in theinitial goals. This step is repeated as the goals are adjusted and the alternative solutions are

    evaluated.

    Feasibility analysis usually considers a number of project alternatives, one that is chosen as the

    most satisfactory solution. These alternatives also need to be evaluated in a broad way without

    committing too many resources. Various steps involved in feasibility analysis are:

    2. To propose a set of solution that can realize the project goal. These solutions are usuallydescriptions of what the new system should look like.

    Four primary areas of interest in feasibility study are:

  • 8/12/2019 Hospital Management Project Report

    14/99

    P a g e | 1 4

    1. ECONOMIC FEASIBILITY:An evaluation of development cost weighed against the ultimate income of benefit derived from

    the development system of product. In economic feasibility, cost benefit analysis is done in which

    expected cost and benefits are evaluated.

    COST AND BENEFIT ANALYSIS:

    Developing an IT application is an investment. Since after developing that application it provides

    the organization with profits. Profits can be monetary or in the form of an improved working

    environment. However, it carries risks, because in some cases an estimate can be wrong. And the

    project might not actually turn out to be beneficial.

    Cost benefit analysis helps to give management a picture of the cost, benefits and risks. It usually

    involves comparing alternate investments.

    Cost benefit determines the benefits and savings that are expected from the system and compares

    them with the expected costs.

    In performing cost and benefit analysis it is important to identify cost and benefits factors. Cost

    and benefits can be categorized into the following categories:

    1. Development Costs Development costs is the costs that are incurred during thedevelopment of the system. It is one time investment.

    2. Operating Costs Operating Costs are the expenses required for the day to day running ofthe system. Examples of Operating Costs are Wages, Supplies and Overheads.

    3. Hardware/Software Costs It includes the cost of purchasing or leasing of computers andits peripherals. Software costs involves required S/W costs.

    4. Personnel Costs It is the money spent on the people involved in the development of thesystem.

    5. Facility Costs Expenses that are incurred during the preparation of the physical site wherethe system will be operational. These can be wiring, flooring, acoustics, lightning, and air-

    conditioning.

    6. Supply Costs These are variable costs that are very proportionately with the amount of useof paper, ribbons, disks, and the like.

  • 8/12/2019 Hospital Management Project Report

    15/99

    P a g e | 1 5

    BENEFITS

    We can define benefits as Profit or Benefit = Income Costs

    Benefits can be accrued by:

    Increasing income, or Decreasing costs, or Both

    2. TECHNICAL FEASIBILITY:Technical Feasibility includes existing and new H/W and S/W requirements that are required to

    operate the project using JSP. The basic S/W requirement is J2EE in which the front end of the

    online hospital management project has been done. The basic entry forms are developed in JSP

    and the data is stored in the MY SQL.

    3. OPERATIONAL FEASIBILITY:Operational feasibility is mainly concerned with issues like whether the system will be used if it isdeveloped and implemented. Whether there will be resistance from users that will affect the

    possible application benefits? The essential questions that help in testing the technical feasibility

    of a system are following:

    Does management support the project? Are the users not happy with current business practices? Will it reduce the time considerably?

    If yes, then they will welcome the change and the new system.

    Have the users involved in the planning and development of the project? Early involvementreduced the probability of resistance towards the new system.

    Will the proposed system really benefit the organization? Does the overall response increase?Will accessibility of information be lost? Will the system affect the customers in considerable

    way?

    LEGAL FEASIBILITY:

  • 8/12/2019 Hospital Management Project Report

    16/99

  • 8/12/2019 Hospital Management Project Report

    17/99

    P a g e | 1 7

    DATA FLOW DIAGRAMS

    DFD for Login Module

    DFD for Medical Advice

    Data base

    Ok

    Rejected

    User Name

    Password Verifying UserName and

    Password

    Administrator

    Enter Administrator/User

    Login File

    User Name

    Password

    Patient

    1. Read the

    Data from

    atient

    2. Search for

    disease from

    Knowled e

    3. CopySelected Record

  • 8/12/2019 Hospital Management Project Report

    18/99

    P a g e | 1 8

    DFD for patient Appointment

    Database

    DFD for Patient Search

    Database

    1. Read

    patient

    re uest

    2. Search

    from Doctor

    Data base

    3. Give the

    Time and

    Output UNIT

    Patient 1. Read the

    Data from

    atient

    2. Search the

    patient in

    patient-ID

    3. Copy

    SelectedOutput Unit

  • 8/12/2019 Hospital Management Project Report

    19/99

  • 8/12/2019 Hospital Management Project Report

    20/99

    P a g e | 2 0

    DFD For Online Searching For Patient

    Data base

    DFD For Searching a Doctors

    Data Base

    User

    Read

    Patient

    Patient Data

    CRT

    User

    Read the

    Data of Doctor &

    S ecialisation

    Doctors

    With Specialties

    CRT

  • 8/12/2019 Hospital Management Project Report

    21/99

    P a g e | 2 1

  • 8/12/2019 Hospital Management Project Report

    22/99

  • 8/12/2019 Hospital Management Project Report

    23/99

    P a g e | 2 3

    ENTITY RELATIONSHIP DIAGRAM

    Works

    OnEmployee Department

    Date-Started

    Dept number

    Dept Name

    Emp- Number

    Name

    Address

    Controls

    Administrator

    HOD

    Doctor

    Dr-ID

    Name

    Address

    Works

    On

    Name

    Treat

    ed byPatient

    Patient ID

    Name

    Address

  • 8/12/2019 Hospital Management Project Report

    24/99

  • 8/12/2019 Hospital Management Project Report

    25/99

    P a g e | 2 5

    Starting Visual Basic

    To start Visual Basic:

    Click on the Startbutton on the Windows task bar. Select Programs, then MicrosoftVisualBasic#(where # is your version of

    Visual Basic).

    Click on Visual Basic #(where again # is your version)

    At the top of the screen is the Visual Basic MainWindow. At the top of the main window is the

    TitleBar. The title bar gives us information about what program were using and what Visual

    Basic program we are working with. Under the main menu is the Toolbar. Here little buttons

    with pictures also allow us to control Visual Basic, much like the main menu. If you put the

    mouse cursor over one of these buttons for a second or so, a little tool tip will pop up and tell

    you what that particular button does.

    Title Bar Main Menu Toolbar

  • 8/12/2019 Hospital Management Project Report

    26/99

    P a g e | 2 6

    Parts of a Visual Basic Project

    There are three major components in a Visual Basic project: the project itself, the form,

    and the controls. Project is the word used to encompass everything in a Visual Basic project.

    Other words used to describe a project are applicationor program. The Form is the window

    where you create the interface between the user and the computer. Controls are graphicalfeatures or tools that are placed on forms to allow user interaction (text boxes, labels, scroll bars,

    command buttons). Recall the form itself is a control. Controls are also referred to as objects.

    Pictorially, a project is:

    Project consists of a form containing several controls. In looking around your computers file

    directory, you may find some files associated with a Visual Basic project. Two primary files are

    used to save a Visual Basic project. The project file will have an extension of vbp(in addition,

    there is sometimes a file with a vbw extension). The form file has an extension of frm (in

    addition, there is sometimes a form file with an frx extension).

    An important concept concerning a Visual Basic project is that of a property. Every

    characteristic of a control (including the form itself) is specified by a property. Example

    properties include names, captions, sizes, colors, position on the form, and contents.

    Visual Basic is an event-driven language. Visual Basic is governed by an event

    processor. That means that nothing happens in a Visual Basic project until some event occurs.

    Once an event is detected, the project finds a series of instructions related to that event, called an

    eventprocedure. That procedure is executed, and then program control is returned to the event:

    Control

    Control

    Control

    Control

    Project

    Form

  • 8/12/2019 Hospital Management Project Report

    27/99

    P a g e | 2 7

    EVENT

    Event procedures are where we do the actual computer programming and are saved with

    the form in the file with the frm extension. These procedures are where we write BASIC

    language statements. You will learn a lot of programming and BASIC language in this course.

    The BASIC you will learn is very similar to the original BASIC used by Bill Gates and Paul Allen

    when starting Microsoft.

    Parts of the Visual Basic Program

    Visual Basic is more than just a computer language. It is a project building environment.

    Within this one environment, we can begin and build our project, run and test our project,

    eliminate errors (if any) in our project, and save our project for future use. With other computer

    languages, many times you need a separate text editor to write your program, something called a

    compiler to create the program, and then a different area to test your program. Visual Basic

    integrates each step of the project building process into one environment. Lets look at the parts

    of the Visual Basic environment.

    Main Window

    Event processor

    Event Event Event

  • 8/12/2019 Hospital Management Project Report

    28/99

    P a g e | 2 8

    Start Visual Basic using the procedure learned in Class 1. Notice that several windows

    appear. The Main Windowis used to control most aspects of the Visual Basic project building

    and running process.

    The main window consists of the title bar, menu bar, and toolbar. The title bar indicates the

    project name and the current Visual Basic operating mode (design, break, run). The menu bar has

    drop-down menus from which you control the operation of the Visual Basic environment.

    Form Window

    TheForm Window is central to developing Visual Basic applications. It is where youdevelop your application.

    If the form window is not present on the screen:

    Properties

    Like all controls, the form has many (over 40) properties. Fortunately, we only have to

    know about some of them. The properties we will be concerned with are:

    Property Description

    Name Name used to identify form. Three letter prefix for form names is frm.

  • 8/12/2019 Hospital Management Project Report

    29/99

    P a g e | 2 9

    Caption Text that appears in the title bar of form.

    Icon Reference to icon that appears in title bar of form.

    Left Distance from left side of computer screen to left side of form.

    Top Distance from top side of computer screen to top side of form.

    Width Width of the form in twips.

    Height Height of form in twips.

    Back Color Background color of form.

    Border Style Form can either be sizable (can resize using the mouse) or fixe size.

    Form Events

    The form primarily acts as a container for other controls, but it does support events. That

    is, it can respond to some user interactions. We will only be concerned with two form events in

    this course:

    Event Description

    Click Event executed when user clicks on the form with the mouse.

    Load Event executed when the form first loads into the computers

    memory. This is a good place to set initial values for various

    properties and other project values.

  • 8/12/2019 Hospital Management Project Report

    30/99

  • 8/12/2019 Hospital Management Project Report

    31/99

    P a g e | 3 1

    2. OLE Features.

    3. Windows API Features.

    4. 32 bit Programming Languages.

    5. Data Management

    6. Online Help

    7. Data Access.

    Areas of Application

    The term "Personal Programming" refers to the idea that, wherever you work, whatever you do,

    you can expand your computer's usefulness by writing applications to use in your own job.

    Personal Programming is what Visual Basic is all about.

    Using Visual Basic's tools, you quickly translate an abstract idea into a program design you can

    actually see on the screen. VB encourages you to experiment, revise, correct, and network your

    design until the new project meets your requirements. However, most of all, it inspires your

    imagination and creativity.

    Visual Basic is ideal for developing applications that run in the new Windows 95 operating

    system. VB presents a 3-step approach for creating programs:

    1. Design the appearance of your application.2. Assign property settings to the objects of your program.3. Write the code to direct specific tasks at runtime.

    Visual Basic can and is used in a number of different areas, for example:

    Education Research Medicine Business Commerce Marketing and Sales Accounting

  • 8/12/2019 Hospital Management Project Report

    32/99

    P a g e | 3 2

    Consulting Law Science

    MICROSOFT ACCESS 2007.

    Microsoft Access is the default database of Microsoft Visual Basic. Microsoft Access

    2007 provides many new features that make working with data and designing a database even

    easier. Microsoft Access Database is a collection of data and objects related to particular topic or

    purpose. Microsoft Access Database may contain tables; queries, forms, reports, macros modules

    and shortcuts top data access pages.

    Microsoft Access is a Relational Database Management System. Using Access we can

    organize our data according to subject and can store information about how different subject are

    related. In general MS-Access database can have several small tables.

    Microsoft Office Access, previously known as Microsoft Access, is a relational database

    management system from Microsoft that combines the relational Microsoft Jet Database Engine

    with a graphical user interface and software development tools. It is a member of the 2007

    Microsoft Office system.

    Access can use data stored in Access/Jet, Microsoft SQL Server, Oracle, or any ODBC-compliant

    data container (including MySQL and PostgreSQL). Skilled software developers and data

    architects use it to develop application software. Relatively unskilled programmers and non-

    programmer "power users" can use it to build simple applications. It supports some object-

    oriented techniques but falls short of being a fully object-oriented development tool.

    Access was also the name of a communications program from Microsoft, meant to compete with

    ProComm and other programs. This proved a failure and was dropped. Years later Microsoft

    reused the name for its database software.

    Access is used by small businesses, within departments of large corporations, and by hobby

    programmers to create ad hoc customized desktop systems for handling the creation and

    manipulation of data. Access can be used as a database for basic web based applications hosted on

    Microsoft's Internet Information Services and utilizing Microsoft Active Server Pages ASP. Most

    typical web applications should use tools like ASP/Microsoft SQL Server or the LAMP stack.

  • 8/12/2019 Hospital Management Project Report

    33/99

    P a g e | 3 3

    Some professional application developers use Access for rapid application development,

    especially for the creation of prototypes and standalone applications that serve as tools for on-the-

    road salesmen. Access does not scale well if data access is via a network, so applications that are

    used by more than a handful of people tend to rely on Client-Server based solutions. However, an

    Access "front end" (the forms, reports, queries and VB code) can be used against a host of

    database back ends, including JET (file-based database engine, used in Access by default),

    Microsoft SQL Server, Oracle, and any other ODBC-compliant product.

    Features

    One of the benefits of Access from a programmer's perspective is its relative compatibility with

    SQL (structured query language) queries may be viewed and edited as SQL statements, and

    SQL statements can be used directly in Macros and VBA Modules to manipulate Access tables.

    Users may mix and use both VBA and "Macros" for programming forms and logic and offers

    object-oriented possibilities.

    MSDE (Microsoft SQL Server Desktop Engine) 2000, a mini-version of MS SQL Server 2000, is

    included with the developer edition of Office XP and may be used with Access as an alternative to

    the Jet Database Engine.

  • 8/12/2019 Hospital Management Project Report

    34/99

    P a g e | 3 4

    Unlike a modern RDBMS, the Access and the Jet Engine implements database triggers and stored

    procedures in a non-standard way. Stored Procedures are implemented in VBA, and Triggers are

    only available from embedded Forms. Both Triggers and Stored procedures are only available to

    applications built completely within the Access database management system. Client applications

    built with VB or C++ are not able to access these features. Starting in MS Access 2007 (Jet 4.0),

    there is a new syntax for creating queries with parameters, in a way that looks like creating stored

    procedures, but these procedures are still limited to one statement per procedure. Microsoft

    Access does allow forms to contain code that is triggered as changes are made to the underlying

    table (as long as the modifications are done only with that form), and it is common to use pass-

    through queries and other techniques in Access to run stored procedures in RDBMSs that support

    these.

    In ADP files (supported in MS Access 2007 and later), the database-related features are entirely

    different, because this type of file connects to a MSDE or Microsoft SQL Server, instead of using

    the Jet Engine. Thus, it supports the creation of nearly all objects in the underlying server (tables

    with constraints and triggers, views, stored procedures and UDF-s). However, only forms, reports,

    macros and modules are stored in the ADP file (the other objects are stored in the back-end

    database).

    DATABASE DESIGN

    The general theme behind a database is to handle information as an integrated whole. A database

    is a collection of interrelated data stored with minimum redundancy to serve many users quickly

    and effectively. After designing the input and output, the analyst must concentrate on database

    design or how data should be organized around user requirements. The general objective is to

    make information access, easy, quick, inexpensive and flexible for other users. During database

    design, the following objectives are concerned:-

    Controlled redundancy Easy to learn and use More information and low cost Accuracy

    Integrity

  • 8/12/2019 Hospital Management Project Report

    35/99

    P a g e | 3 5

    DATA MODELING:

    Table.Channaling_Appointments

    Table.Medical_Treatments

    Table.Companies_Maintenance

    FieldName DataType DescriptionCompanyId Text

    CompnyFullName Text

    companyShortName Text

    CompanyAddress Memo

    ContactPerson TextPhoneNumber Text

    DiscountAllowed Text

    F ield Name Data Type DescriptionDoctorID Text

    ChosenDate Date/Time

    TokenNo Text

    Specialization Text

    ChannalingCharges Text

    AppointmentDuration Text

    ChosenDay Text

    StartTime Date/Time

    EndTime Date/TimeAppointmentStartTime Date/Time

    AppointmentEndTime Date/Time

    FirstName Text

    LastName Text

    ContactNo Text

    TodaysDate Date/Time

    FieldName DataType DescriptionTreatmentID Text

    PatientID Text

    FirstName Text

    SurName Text

    MedicineID Text

    MedicineName Text

    DateofIssue Date/Time

    UnitPrice Text

    Qty Text

    Total Text

  • 8/12/2019 Hospital Management Project Report

    36/99

    P a g e | 3 6

    Table.Department_Maintenance

    FieldName DataType DescriptionDepartmentID Text

    DepartmentName Text

    RoomRate Text

    AdditionalNotes Memo

    Table.Discharge_Maintenance

    FieldName DataType DescriptionDischargeID Text

    AdmissionID Text

    PatientId Text

    FirstName Text

    SurName Text

    AdmissionDate Date/Time

    AdmissionTime Date/TimeDischargeDate Date/Time

    DischargeTime Date/Time

    AdditionalNotes Memo

    Discharged Yes/No

    TableDoctor_Visits

    FieldName DataType DescriptionVisitID Autonumber

    VisitDate Date/Time

    VisitTime Date/Time

    DoctorID Text

    DoctorName Text

    DoctorCharges Text

    PatientID Text

    PatientName Text

    AdditionalNotes Memo

  • 8/12/2019 Hospital Management Project Report

    37/99

    P a g e | 3 7

    Table.Doctor_Maintenance

    FieldName DataType Description

    DoctorID Text

    FirstName TextSurName Text

    Gender Text

    DateofBirth Data/Time

    NICNumber Text

    Address Memo

    Phone NoHome Text

    PhoneNoMob Text

    LicenceNo Text

    Specialization TextDoctorCatagory Text

    ServiceCharge Text

    ChannalingCharges Text

    AppointmentDuration Text

    ReferringCharges Text

    Table Doctors_Schedules

    F ieldName DataType Descripction

    ScheduleID Autonumber

    DoctorID Text

    MondayStart Time Date/Time

    MondayEndTime Date/Time

    TuesdayStartTime Date/Time

    TuesdayEndTime Date/Time

    WednesdayStart Time Date/Time

    WednesdayEndTime Date/Time

    ThursdayStart Time Date/Time

    ThursdayEndTime Date/Time

    FridayStart Time Date/Time

    FridayEndTime Date/Time

    SaturdayStart Time Date/Time

    SaturdayEndTime Date/Time

    SundayStart Time Date/Time

    SundayEndTime Date/Time

  • 8/12/2019 Hospital Management Project Report

    38/99

  • 8/12/2019 Hospital Management Project Report

    39/99

  • 8/12/2019 Hospital Management Project Report

    40/99

  • 8/12/2019 Hospital Management Project Report

    41/99

    P a g e | 4 1

    Table..Medical_Treatments_Out

    FieldName DataType Description

    TreatmentID Text

    PatientID TextFirstName Text

    SurName Text

    MedicineID Text

    MedicineName Text

    DateofIssue Date/Time

    Unitprice Text

    Qty Text

    Total Text

    Table.Medicines_maintenance

    FieldName DataType descriptionMedicineID Text

    MedicineName Text

    DosageForm Text

    UnitPrice Text

    UnitInStock Text

    ReorderLevel Text

    AdditionalNotes Memo

  • 8/12/2019 Hospital Management Project Report

    42/99

  • 8/12/2019 Hospital Management Project Report

    43/99

    P a g e | 4 3

    SCREENSHOT

    SPLASH SCREEN

    SPLASH PAGE CODING:

    Option Explicit

    Private Sub Form_KeyPress(KeyAscii As Integer)Unload Me

    End Sub

    Private Sub Form_Load()

    ' lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision

    ' lblProductName.Caption = App.Title

    End Sub

    Private Sub Frame1_Click()

    Unload Me

    End Sub

    Private Sub Timer1_Timer()

  • 8/12/2019 Hospital Management Project Report

    44/99

    P a g e | 4 4

    Static ictr As Integer

    'Run the timer and check the condition

    'when the condition is false

    'stop the timer and disply the login form

    If ictr

  • 8/12/2019 Hospital Management Project Report

    45/99

    P a g e | 4 5

    Private Sub Form_Initialize()

    Call Connection 'Calling the Connection Procedure.

    'Creating a New Recordset To Be Used For Login Purposes Only

    Set rsLogin = New ADODB.Recordset

    With rsLogin.CursorType = adOpenDynamic

    .LockType = adLockOptimistic

    .ActiveConnection = conn

    .CursorLocation = adUseClient

    End With

    iLoginFailure = 1 ' When a login attempt is unsuccessful, I decrement this variable's value.

    End Sub

    Private Sub txtUsername_Change()

    'This block of code will enable or disable the "Go" button accordingly

    If txtUserName.Text = "" Then

    cmdGo.Enabled = False

    Else

    cmdGo.Enabled = True

    End If

    End Sub

    Private Sub txtUserName_keypress(KeyAscii As Integer)

    'This block of code prevents the user from using "Copy-Paste" (Ctrl+C, Ctrl+V) functions.

    If KeyAscii = 3 Or KeyAscii = 22 Or KeyAscii = 24 Then

    KeyAscii = 0

    ElseIf KeyAscii = 13 Then 'This is for using the Enter key

    KeyAscii = 0SendKeys "{Tab}"

    End If

    End Sub

    Private Sub txtPassword_Keypress(KeyAscii As Integer)

    'This block of code prevents the user from using "Copy-Paste" (Ctrl+C, Ctrl+V) functions.

    If KeyAscii = 3 Or KeyAscii = 22 Or KeyAscii = 24 Then

    KeyAscii = 0ElseIf KeyAscii = 13 Then 'This is for using the Enter keyKeyAscii = 0

    SendKeys "{Tab}"

  • 8/12/2019 Hospital Management Project Report

    46/99

  • 8/12/2019 Hospital Management Project Report

    47/99

    P a g e | 4 7

    userName = .Fields(1).Value & " " & .Fields(2).Value

    accessLevel = "Inpatient Staff"

    userID = .Fields(0).Value

    frmMDI.Show

    Unload Me

    ElseIf .Fields(4) = "Outpatient Staff" Then 'Checking Designation

    'Passing Necessary Values To Global Variables

    userName = .Fields(1).Value & " " & .Fields(2).Value

    accessLevel = "Outpatient Staff"

    userID = .Fields(0).Value

    frmMDI.Show

    Unload Me

    ElseIf .Fields(4) = "Receptionist" Then 'Checking Designation

    'Passing Necessary Values To Global Variables

    userName = .Fields(1).Value & " " & .Fields(2).ValueaccessLevel = "Receptionist"

    userID = .Fields(0).Value

    frmMDI.Show

    Unload Me

    End If

    Else

    'Error Mesage For Invalid Password

    iLoginFailure = iLoginFailure + 1 'Decrementing The Value Of i On Each

    Unsuccessful Login Attempt

    MsgBox "Sorry! Invalid Password! Please Try Again!", vbCritical, "Invalid Login!"

    txtPassword.BackColor = &H80000018 'Highlighting The Textbox With The Error

    txtUserName.BackColor = &H80000005 'Highlighting The Textbox With The Error

    txtPassword.Text = ""

    txtPassword.SetFocus

    End If

    End If

    .Close 'Closing Recordset

    End With

    Else

    'Error Message If User's Login Attempt Is Unsuccesful On Three

    'Consecutive Occasions

    MsgBox "Sorry! You Have To Login Within Three Tries! Unloading...", vbCritical,

    "Login Failure"

    End

    End If

  • 8/12/2019 Hospital Management Project Report

    48/99

    P a g e | 4 8

    End Sub

    Private Sub cmdExit_Click()

    'This block of code will be executed if the user decides to quit the application

    'from the Login page

    Dim ans As Variant

    ans = MsgBox("Are You Sure You Wish To Quit The Application?", vbYesNo + vbQuestion,

    "Quit Application?")

    If ans = vbYes Then

    End

    End If

    End Sub

    MDI Main Page

  • 8/12/2019 Hospital Management Project Report

    49/99

    P a g e | 4 9

    MDI main page coding:

    Option Explicit

    Dim iExitReply As Integer 'This variable will hold the user's choice, once he has been asked

    whether he wants to exit or not

    Dim iLogOutReply As Integer 'This variable will hold the user's choice, once he has been asked

    whether he wants to log out or not

    Private Sub MDIForm_Load()

    'In the following lines of code, I am checking the user access level

    'and appropriately disabling certain restricted functions

    lblDisplayTimeIn.Caption = DateTime.TimeIf accessLevel = "Administrator" Then

    lblDesignation.Caption = "Welcome, Administrator"

    frmQuickLaunch.lblDesignation.Caption = "Administrator"

    Call Enable_Controls 'Calling a User Defined Function In Order To Enable All

    Components

    ElseIf accessLevel = "Cashier" Then

    lblDesignation.Caption = "Welcome, Cashier"frmQuickLaunch.lblDesignation.Caption = "Cashier"

    Call Enable_Controls 'Calling a User Defined Function In Order To Enable All

    Components

    lblShortcut(0).Enabled = False

    lblShortcut(1).Enabled = False

    lblShortcut(2).Enabled = False

    lblShortcut(4).Enabled = False

    lblShortcut(5).Enabled = False

    mnuPatientAdmission.Enabled = False

    mnuTreatment.Enabled = False

    mnuDischargePatient.Enabled = False

    mnuOutpatientsMaintenance.Enabled = False

    mnuTreatments.Enabled = False

    mnuChanneling.Enabled = False

    mnuReports.Enabled = False

    mnuManageUserAccounts.Enabled = False

    mnuMaintenance.Enabled = False

    mnuSearchEngine.Enabled = False

    mnuBackupDatabase.Enabled = False

  • 8/12/2019 Hospital Management Project Report

    50/99

    P a g e | 5 0

    ElseIf accessLevel = "Receptionist" Then

    lblDesignation.Caption = "Welcome, Receptionist"

    frmQuickLaunch.lblDesignation.Caption = "Receptionist"

    Call Enable_Controls 'Calling a User Defined Function In Order To Enable AllComponents

    lblShortcut(0).Enabled = False

    lblShortcut(1).Enabled = False

    lblShortcut(3).Enabled = False

    lblShortcut(4).Enabled = False

    mnuInpatients.Enabled = False

    mnuOutpatients.Enabled = False

    mnuPayments.Enabled = False

    mnuReports.Enabled = FalsemnuManageUserAccounts.Enabled = False

    mnuMaintenance.Enabled = False

    mnuBackupDatabase.Enabled = False

    ElseIf accessLevel = "Inpatient Staff" Then

    lblDesignation.Caption = "Welcome, Inpatient Staff"

    frmQuickLaunch.lblDesignation.Caption = "Inpatient Staff"

    Call Enable_Controls 'Calling a User Defined Function In Order To Enable All

    Components

    lblShortcut(1).Enabled = False

    lblShortcut(2).Enabled = False

    lblShortcut(3).Enabled = False

    lblShortcut(4).Enabled = False

    lblShortcut(5).Enabled = False

    mnuOutpatients.Enabled = False

    mnuChanneling.Enabled = False

    mnuPayments.Enabled = FalsemnuReports.Enabled = False

    mnuMaintenance.Enabled = False

    mnuManageUserAccounts.Enabled = False

    mnuSearchEngine.Enabled = False

    mnuBackupDatabase.Enabled = False

    ElseIf accessLevel = "Outpatient Staff" Then

    lblDesignation.Caption = "Welcome, Outpatient Staff"

    frmQuickLaunch.lblDesignation.Caption = "Outpatient Staff"

    Call Enable_Controls 'Calling a User Defined Function In Order To Enable AllComponents

  • 8/12/2019 Hospital Management Project Report

    51/99

    P a g e | 5 1

    lblShortcut(0).Enabled = False

    lblShortcut(2).Enabled = False

    lblShortcut(3).Enabled = False

    lblShortcut(4).Enabled = False

    lblShortcut(5).Enabled = False

    mnuInpatients.Enabled = False

    mnuChanneling.Enabled = FalsemnuPayments.Enabled = False

    mnuReports.Enabled = False

    mnuMaintenance.Enabled = False

    mnuManageUserAccounts.Enabled = False

    mnuSearchEngine.Enabled = False

    mnuBackupDatabase.Enabled = False

    End If

    frmQuickLaunch.Show

    lblDateTime.Caption = "Today is " & FormatDateTime(Now, vbLongDate)

    BottomStatusBar.Panels(4).Text = userName

    BottomStatusBar.Panels(5).Text = accessLevel

    End Sub

    Private Function Enable_Controls()

    'This is a User Defined Function That Will Enable All The Components On The Screen.

    'Here, I am running a For loop to include all the controls on the interface and then

    'I enable them all, with one line of code

    Dim ctrl As Control

    On Error Resume Next

    For Each ctrl In Controls

    ctrl.Enabled = True

    Next

    End Function

    Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    'This event occurs when the user tries to quit the application by clicking the

    'standard red cross button, on the top left hand corner of the interface

    If UnloadMode = 0 Then

    iExitReply = MsgBox(userName & ", Are You Sure You Wish To Exit The Application?",

    vbYesNo + vbQuestion, "Exit Application?")

    If iExitReply = vbNo ThenCancel = 1

    End If

    End If

  • 8/12/2019 Hospital Management Project Report

    52/99

    P a g e | 5 2

    End Sub

    Private Sub lblShortcut_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As

    Single, Y As Single)

    'Here, I am creating Rollover Effects For Each Button On The Shortcut Panel

    Select Case (Index)

    Case 0: 'Manage User Accounts Button

    lblShortcut(0).ForeColor = &H800000

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006

    lblShortcut(7).ForeColor = &H80000006

    lblShortcut(8).ForeColor = &H80000006lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = True

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = False

    lblShortcut(9).FontUnderline = False

    Case 1: 'Manage Inpatients Button

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H800000

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006

    lblShortcut(7).ForeColor = &H80000006lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = True

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = FalselblShortcut(9).FontUnderline = False

    Case 2: 'Manage Outpatients Button

  • 8/12/2019 Hospital Management Project Report

    53/99

    P a g e | 5 3

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H800000

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006

    lblShortcut(7).ForeColor = &H80000006lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = True

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = FalselblShortcut(9).FontUnderline = False

    Case 3: 'Channeling Services Button

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H800000

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006

    lblShortcut(7).ForeColor = &H80000006

    lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = True

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = FalselblShortcut(8).FontUnderline = False

    lblShortcut(9).FontUnderline = False

    Case 4: 'Reports Quick Launch Button

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H800000

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006lblShortcut(7).ForeColor = &H80000006lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

  • 8/12/2019 Hospital Management Project Report

    54/99

    P a g e | 5 4

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = True

    lblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = FalselblShortcut(8).FontUnderline = False

    lblShortcut(9).FontUnderline = False

    Case 5: 'Search Engine Button

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H800000

    lblShortcut(6).ForeColor = &H80000006lblShortcut(7).ForeColor = &H80000006

    lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = True

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = False

    lblShortcut(9).FontUnderline = False

    Case 6: 'Change Password Button

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H800000

    lblShortcut(7).ForeColor = &H80000006

    lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = FalselblShortcut(6).FontUnderline = TruelblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = False

  • 8/12/2019 Hospital Management Project Report

    55/99

  • 8/12/2019 Hospital Management Project Report

    56/99

    P a g e | 5 6

    lblShortcut(7).ForeColor = &H80000006

    lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H800000

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = FalselblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = False

    lblShortcut(9).FontUnderline = True

    End Select

    End Sub

    Private Sub imgRecordExplorer_MouseMove(Button As Integer, Shift As Integer, X As Single, YAs Single)

    'The Following Block Of Code Ensures That The Mouse Pointer

    'Returns To Normal When It Is Not Over A Button

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006

    lblShortcut(7).ForeColor = &H80000006

    lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = FalselblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = False

    lblShortcut(9).FontUnderline = False

    End Sub

    Private Sub imgUserAccount_MouseMove(Button As Integer, Shift As Integer, X As Single, Y

    As Single)

    'The Following Block Of Code Ensures That The Mouse Pointer'Returns To Normal When It Is Not Over A Button

  • 8/12/2019 Hospital Management Project Report

    57/99

    P a g e | 5 7

    lblShortcut(0).ForeColor = &H80000006

    lblShortcut(1).ForeColor = &H80000006

    lblShortcut(2).ForeColor = &H80000006

    lblShortcut(3).ForeColor = &H80000006

    lblShortcut(4).ForeColor = &H80000006

    lblShortcut(5).ForeColor = &H80000006

    lblShortcut(6).ForeColor = &H80000006

    lblShortcut(7).ForeColor = &H80000006lblShortcut(8).ForeColor = &H80000006

    lblShortcut(9).ForeColor = &H80000006

    lblShortcut(0).FontUnderline = False

    lblShortcut(1).FontUnderline = False

    lblShortcut(2).FontUnderline = False

    lblShortcut(3).FontUnderline = False

    lblShortcut(4).FontUnderline = False

    lblShortcut(5).FontUnderline = False

    lblShortcut(6).FontUnderline = False

    lblShortcut(7).FontUnderline = False

    lblShortcut(8).FontUnderline = FalselblShortcut(9).FontUnderline = False

    End Sub

    Private Sub mnuAbout_Click()

    frmAbout.Show

    End Sub

    Private Sub mnuAddMedicalTreatment_Click()

    frmAddMedicalTreatmentsOut.Show

    End Sub

    Private Sub mnuAddMedicalTreatments_Click()

    frmAddMedicalTreatmentsIn.Show

    End Sub

    Private Sub mnuAddServiceTreatment_Click()

    frmAddServiceTreatmentsOut.Show

    End Sub

    Private Sub mnuAddServiceTreatments_Click()frmAddServiceTreatmentsIn.Show

    End Sub

    Private Sub mnuBackupDatabase_Click()

    frmBackupDatabase.Show

    End Sub

    Private Sub mnuCalendar_Click()

    frmCalendar.Show

    End Sub

    Private Sub mnuCascade_Click()Me.Arrange vbCascade

    End Sub

  • 8/12/2019 Hospital Management Project Report

    58/99

    P a g e | 5 8

    Private Sub mnuCloseAll_Click()

    Me.Arrange vbCascade

    End Sub

    Private Sub mnuCorporateMaintenance_Click()

    frmCompaniesMaintenance.Show

    End Sub

    Private Sub mnuCredits_Click()

    frmCredits.Show

    End Sub

    Private Sub mnuEditMedicalTreatment_Click()

    frmMedicalTreatmentsOut.ShowEnd Sub

    Private Sub mnuEditMedicalTreatmentRecords_Click()

    frmMedicalTreatmentsMaintenance.Show

    End Sub

    Private Sub mnuEditServiceTreatmentRecord_Click()

    frmServiceTreatmentsMaintenance.Show

    End Sub

    Private Sub mnuEditServiceTreatmentRecords_Click()

    frmServiceTreatmentsOut.Show

    End Sub

    Private Sub mnuHelpFile_Click()

    '---Opening the Help Guide File with the Common Dialog Object

    On Error GoTo e

    Const cdlHelpPartialKey = &H105 ' Calls the search engine in Windows Help

    CommonDialog.HelpCommand = cdlHelpPartialKey

    CommonDialog.Action = 6Exit Sub

    e:

    MsgBox Err.Description

    'MsgBox "Error! The Help Guide does not exist!", vbCritical, "Help File Does Not Exist!"

    End Sub

    Private Sub mnuLogOff_Click()

    iLogOutReply = MsgBox(userName & ", Are You Sure You Wish To Log Out Of Your

    Account?", vbYesNo + vbQuestion, "Log Out?")If iLogOutReply = vbYes Then

    frmLogin.Show

    Unload Me

  • 8/12/2019 Hospital Management Project Report

    59/99

    P a g e | 5 9

    End If

    End Sub

    Private Sub mnuMicrosoftMagnifier_Click() 'Opens Up The Magnifier Utility

    On Error GoTo errcode

    Dim a As Double

    a = Shell("C:\WINDOWS\System32\magnify.exe", vbNormalFocus)Exit Sub

    errcode:

    MsgBox "Unable to run Microsoft Magnifier on your computer", vbError, "Error Loading

    Microsoft Magnifier!"

    Resume Next

    End Sub

    Private Sub mnuMicrosoftNarrator_Click() 'Opens Up The Narrator Utility

    On Error GoTo errcode

    Dim a As Double

    a = Shell("C:\WINDOWS\System32\narrator.exe", vbNormalFocus)Exit Sub

    errcode:

    MsgBox "Unable to run Microsoft Narrator on your computer", vbError, "Error Loading

    Microsoft Narrator!"

    Resume Next

    End Sub

    Private Sub mnuRoomsMaintenance_Click()

    frmRoomsMaintenance.Show

    End Sub

    Private Sub mnuSearchEngine_Click()

    frmSearchEngine.Show

    End Sub

    Private Sub mnuSystemCalculator_Click() 'Opens Up The Calculator Utility

    On Error GoTo errcodeDim a As Double

    a = Shell("C:\WINDOWS\System32\calc.exe", vbNormalFocus)

    Exit Sub

    errcode:

    MsgBox "Unable to run the Calculator Utility on your computer", vbError, "Error Loading

    Calculator!"

    Resume Next

    End Sub

    Private Sub mnuSystemMediaPlayer_Click() 'Opens Up The System Media Player Utility

    On Error GoTo errcodeDim a As Doublea = Shell("C:\WINDOWS\System32\dvdplay.exe", vbNormalFocus)

    Exit Sub

  • 8/12/2019 Hospital Management Project Report

    60/99

  • 8/12/2019 Hospital Management Project Report

    61/99

    P a g e | 6 1

    Private Sub lblShortcut_Click(Index As Integer)

    'The following block of code illustrates which interfaces are displayed on click of

    'each respective button

    Select Case (Index)

    Case 0: 'Manage Inpatients ButtonCall Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact

    with the recordset

    frmInpatientsMaintenance.Show

    Case 1: 'Manage Outpatients Button

    frmOutpatientsMaintenance.Show

    Case 2: 'Channeling Services Button

    frmChannelingAppointments.Show

    Case 3: 'Payments ButtonfrmPaymentOptions.Show

    Case 4: 'Reports Quick Launch Button

    frmReportsQuickLaunch.Show

    Case 5: 'Search Engine Button

    frmSearchEngine.Show

    Case 6: 'Change Password Button

    frmChangePassword.Show

    Case 7: 'Log Off / Exit Button

    frmTurnOff.Show

    frmMDI.Enabled = False

    Case 8: 'Log Off Button

    iLogOutReply = MsgBox(userName & ", Are You Sure You Wish To Log Out Of Your

    Account?", vbYesNo + vbQuestion, "Log Out?")

    If iLogOutReply = vbYes Then

    frmLogin.Show

    Unload Me

    End If

    Case 9: 'Exit Button

    iExitReply = MsgBox(userName & ", Are You Sure You Wish To Quit The

    Application?", vbYesNo + vbQuestion, "Quit Application?")

    If iExitReply = vbYes Then

    End

    End If

    End Select

    End Sub

    Private Sub mnuChangePassword_Click()

  • 8/12/2019 Hospital Management Project Report

    62/99

    P a g e | 6 2

    frmChangePassword.Show

    End Sub

    Private Sub mnuCompanyMaintenance_Click()

    frmCompaniesMaintenance.Show

    End Sub

    Private Sub mnuDepartmentsMaintenance_Click()frmDepartmentsMaintenance.Show

    End Sub

    Private Sub mnuDischargePatient_Click()

    frmDischargeDetailsMaintenance.Show

    End Sub

    Private Sub mnuDoctorScheduleMaintenance_Click()

    frmDoctorScheduleMaintenance.Show

    End Sub

    Private Sub mnuDoctorsMaintenance_Click()

    frmDoctorsMaintenance.Show

    End Sub

    Private Sub mnuDoctorsVisitMaintenance_Click()

    frmDoctorVisitsMaintenance.Show

    End Sub

    Private Sub mnuDoctorVisitMaintenance_Click()

    frmDoctorVisitsMaintenance.Show

    End Sub

    Private Sub mnuExit_Click()

    If MsgBox(userName & ", Are You Sure You Wish To Quit The Application?", vbYesNo +

    vbQuestion, "Quit Application?") = vbYes Then

    End

    End If

    End Sub

    Private Sub mnuGuardiansMaintenance_Click()

    Call Guardians_Maintenance

    Set frmGuardiansMaintenance.dgrdGuardiansInfo.DataSource = rsGuardiansMaintenance

    frmGuardiansMaintenance.Show

    End Sub

    Private Sub mnuHopitalServicesMaintenance_Click()

    frmServicesMaintenance.Show

    End Sub

    Private Sub mnuInpatientsMaintenance_Click()Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact with

    the recordset

    frmInpatientsMaintenance.Show

  • 8/12/2019 Hospital Management Project Report

    63/99

    P a g e | 6 3

    End Sub

    Private Sub mnuManageAppointments_Click()

    frmChannelingAppointments.Show

    End Sub

    Private Sub mnuManagePatientBill_Click()

    frmIPDOverallBilling.ShowEnd Sub

    Private Sub mnuManagePatientsBill_Click()

    frmOPDOverallBilling.Show

    End Sub

    Private Sub mnuManageUserAccounts_Click()

    frmManageUserAccounts.Show

    End Sub

    Private Sub mnuMedicinesMaintenance_Click()frmMedicinesMaintenance.Show

    End Sub

    Private Sub mnuOSearchPayments_Click()

    frmSearchOutpatientPayments.Show

    End Sub

    Private Sub mnuOutpatientsMaintenance_Click()

    frmOutpatientsMaintenance.Show

    End Sub

    Private Sub mnuRegisterAdmitPatient_Click()

    Call Inpatients_Admission

    frmAdmitPatient.Show

    End Sub

    Private Sub mnuSearchPayments_Click()

    frmSearchPayments.Show

    End Sub

    Private Sub mnuViewOverallPatientBill_Click()

    frmOPDOverallBilling.cmdSave.Enabled = False

    frmOPDOverallBilling.cmdGoToPayments.Enabled = False

    frmOPDOverallBilling.Show

    End Sub

    Private Sub mnuViewOveralPatientBill_Click()

    frmIPDOverallBilling.cmdSave.Enabled = False

    frmIPDOverallBilling.cmdGoToPayments.Enabled = False

    frmIPDOverallBilling.Show

    End Sub

    Private Sub mnuWardsMaintenance_Click()

  • 8/12/2019 Hospital Management Project Report

    64/99

    P a g e | 6 4

    frmWardsMaintenance.Show

    End Sub

    '----------------------------REPORTS MDI---------------------------------------------------

    Private Sub mnuAllCompaniesMasterReport_Click()

    RptAllCompaniesMaster.Show

    End Sub

    Private Sub mnuAllDoctors_Click()

    RptDoctorsMaster.Show

    End Sub

    Private Sub mnuAllDoctorsSchedulesMasterReport_Click()

    RptAllDoctorsShedule.Show

    End Sub

    Private Sub mnuChannelingPatientsMasterReport_Click()

    frmReportChannelingMaster.ShowEnd Sub

    Private Sub mnuDepartmentsMasterReport_Click()

    RptDepartmentMaster.Show

    End Sub

    Private Sub mnuDoctorsVisitsMasterReport_Click()

    RptVisitingDoctorsShedule.Show

    End Sub

    Private Sub mnuIndividualDoctorsScheduleReport_Click()

    RptAllDoctorsShedule.Show

    End Sub

    Private Sub mnuInpatientsInvoice_Click()

    frmReportInpatientInvoice.Show

    End Sub

    Private Sub mnuInpatientsMasterReport_Click()

    frmReportInpatientMaster.Show

    End Sub

    Private Sub mnuMedicalServicesMasterReport_Click()

    RptMedicalServicesMaster.Show

    End Sub

    Private Sub mnuMedicinesMasterReport_Click()

    RptMedicinesMaster.Show

    End Sub

    Private Sub mnuOutpatientsMasterReport_Click()

    frmReportOutpatientMaster.ShowEnd Sub

    Private Sub mnuPatientAdmissionMasterReport_Click()

  • 8/12/2019 Hospital Management Project Report

    65/99

    P a g e | 6 5

    frmReportPatientAdmission.Show

    End Sub

    Private Sub mnuPatientDischargeMasterReport_Click()

    frmReportPatientDischarge.Show

    End Sub

    Private Sub mnuRoomsMasterReport_Click()RptRoomsMaster.Show

    End Sub

    Private Sub mnuInpatientMedicines_Click()

    frmReportInpatientMedicalTreatment.Show

    End Sub

    Private Sub mnuOutpatientsMedicines_Click()

    frmReportOutpatientMedicalTreatments.Show

    End Sub

    Private Sub mnuInpatientsServices_Click()

    frmReportInpatientServiceTreatments.Show

    End Sub

    Private Sub mnuOutpatientsServices_Click()

    frmReportOutPatientPatientServiceTreatements.Show

    End Sub

    Private Sub mnuDoctorsChannelingSchedule_Click()

    RptAllDoctorsShedule.Show

    End Sub

    Private Sub mnuIndividualCompanyOutpatients_Click()

    RptIndividualCompanyOutpatients.Show

    End Sub

    Private Sub mnuIndividualCompanyInpatients_Click()

    RptIndividualCompanyInpatients.Show

    End Sub

    Private Sub mnuInpatientsRevenueReports_Click()

    frmReportInpatientRevenue.ShowEnd Sub

    Private Sub mnuOutpatientsRevenueReports_Click()

    frmReportOutpatientRevenue.Show

    End Sub

    Private Sub mnuDoctorEarningsReports_Click()

    frmReportDoctorsEarnings.Show

    End Sub

    Private Sub mnuBillStatusReport_Click()frmReportAging.Show

    End Sub

  • 8/12/2019 Hospital Management Project Report

    66/99

    P a g e | 6 6

    Inpatient Maintenance Coding:

    Option Explicit

    Dim eachField As Control 'Declaring a Control Variable for all Fields

    Dim eachButton As Control 'Declaring a Control Variable fot all Command Buttons

    'The Following Boolean Variable is being used to determine

    'if the data the user enters is valid or not

    Dim Flag As Boolean

    'The following Boolean Variable will determine if the Doctor's Date Of Birth

    'entered by the user is valid

    Dim dateFlag As Boolean

    'The following variables will be used to autogenerate the Doctor ID

    Dim iNumOfRecords As Integer 'This variable holds the number of records in the table

    Dim strCode As String 'This variable will eventually hold the Doctor ID to be autogenerated

    'The following variables will be used to autogenerate the Guardian ID to be'displayed on the Guardians Maintenance form on form load

    Dim iNumOfGuardians As Integer 'This variable holds the number of records in the table

  • 8/12/2019 Hospital Management Project Report

    67/99

  • 8/12/2019 Hospital Management Project Report

    68/99

    P a g e | 6 8

    With rsInpatientMaintenance

    If .RecordCount = 0 Then 'If there are no records in the table

    strCode = "INP0001"

    Else

    'Calculating the number of records and storing in a variable

    iNumOfRecords = .RecordCount

    iNumOfRecords = iNumOfRecords + 1 'incrementing the number by 1

    'The following block of code will generate the ID according

    'to the number of records in the Inpatients_Maintenance Table

    If iNumOfRecords < 10 Then

    strCode = "INP000" & iNumOfRecords

    ElseIf iNumOfRecords < 100 Then

    strCode = "INP00" & iNumOfRecords

    ElseIf iNumOfRecords < 1000 ThenstrCode = "INP0" & iNumOfRecords

    ElseIf iNumOfRecords < 10000 Then

    strCode = "INP" & iNumOfRecords

    End If

    End If

    .Requery 'Requerying the Table

    .AddNew 'Adding a new recordset

    End With

    'The following line of code will enter the autogenerated Patient ID

    'into the Patient ID textfield

    txtPatientID.Text = strCode

    End Sub

    Private Sub cmdClose_Click()

    If MsgBox(userName & ", Are You Sure You Wish To Close This Interface?", vbYesNo +

    vbQuestion, "Close Interface?") = vbYes Then

    Unload Me

    End If

    End Sub

    Private Sub cmdCompanySearchWizard_Click()

    frmCompanySearchWizard.Show

    End Sub

  • 8/12/2019 Hospital Management Project Report

    69/99

    P a g e | 6 9

    Private Sub cmdDelete_Click() 'This function will delete a record from the database

    'Check for the record selection

    If txtPatientID.Text = "" Then

    MsgBox "Error! No Record Has Been Selected", vbCritical, "No Record Selected!"

    Else

    With rsInpatientMaintenance

    'Confirm the Delete procedure with the user

    If MsgBox("Are You Sure You Wish To Delete Patient ID " & txtPatientID.Text & "'s

    Record?", vbYesNo + vbQuestion, "Delete Record?") = vbYes Then

    .Delete 'Delete the record from the database

    'Display Success Message

    MsgBox "The Record Has Been Deleted Successfully!", vbInformation, "SuccessfulDelete Procedure!"

    Form_Load 'Calling the Form_Load Procedure

    clearAllFields 'Calling a Private Function To Clear All Fields

    Else

    'Display 'Delete Procedure Cancelled' Message

    MsgBox "The Delete Procedure Was Cancelled!", vbExclamation, "Delete Procedure

    Cancelled!"

    Form_Load 'Calling the Form_Load Procedure

    clearAllFields 'Calling a Private Function To Clear All Fields

    End If

    .Requery 'Requerying the Table

    End With

    End If

    End Sub

    Private Sub cmdLaunchInpatientSearch_Click() 'This function is fired when the Launch Inpatient

    Search Wizard Command Button is Clicked. It opens up the Inpatient Search Wizard

    enableAllFields 'Calling a Private Function To Enable All Fields

    enableAllButtons 'Calling a Private Function To Enable All Command Buttons

    cmdSave.Enabled = False 'Disabling the Save Command Button

  • 8/12/2019 Hospital Management Project Report

    70/99

    P a g e | 7 0

    frmInpatientSearchWizard.Show 'Displays the Doctor Search Wizard

    'Disabling the "Step" Buttons

    cmdStep1.Enabled = False

    cmdStep3.Enabled = False

    End Sub

    Private Sub cmdSave_Click() 'This function will save all the user's data in the database

    'Checking if the Phone Number (Home) textfield and the Phone Number (Mob) textfield are

    empty

    If txtPhoneHome.Text = "-" And txtPhoneMob.Text = "-" Then

    txtPhoneHome.BackColor = &H80000018 'Highlighting the textfield in a different colour

    txtPhoneMob.BackColor = &H80000018 'Highlighting the textfield in a different colour

    MsgBox "Error! Both Phone Number Textfields Cannot Be Empty! At Least One Has To Be

    Provided!", vbCritical, "Error In Phone Numbers!"

    Exit SubElse

    txtPhoneHome.BackColor = &H80000004 'Bringing the textfield BackColour back to

    normal

    txtPhoneMob.BackColor = &H80000004 'Bringing the textfield BackColour back to normal

    End If

    'Checking the return value of the function that validates the user's data

    If textfieldsValidations = False Then

    'Validation To Ensure That The NIC Number is 10 Characters In Length

    If txtNICNumber.Text "-" Then

    If Len(txtNICNumber.Text) 10 Then

    MsgBox "Error! The NIC Number Has To Consist Of 10 Characters!", vbCritical,

    "Error In NIC Number!"

    txtNICNumber.BackColor = &H80000018 'Highlighting the textfield in a different

    colour

    Exit Sub

    Else

    txtNICNumber.BackColor = &H80000004End If

    End If

    'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length

    If txtPhoneHome.Text "-" Then

    If Len(txtPhoneHome.Text) > 15 Then

    MsgBox "Error! The Phone No (Home) Textfield Cannot Consist Of More Than 15

    Digits!", vbCritical, "Error In Phone No (Home)!"

    txtPhoneHome.BackColor = &H80000018

    Exit SubElse

    txtPhoneHome.BackColor = &H80000004

    End If

  • 8/12/2019 Hospital Management Project Report

    71/99

  • 8/12/2019 Hospital Management Project Report

    72/99

    P a g e | 7 2

    txtCompanyName.Text = "-"

    End If

    strPatientID = txtPatientID.Text

    'Save the user-entered data into the recordset

    .Fields(0) = txtPatientID.Text

    .Fields(1) = txtFirstName.Text

    .Fields(2) = txtSurname.Text

    .Fields(3) = cboGender.Text

    .Fields(4) = dtpDateOfBirth.Value

    .Fields(5) = txtNICNumber.Text

    .Fields(6) = txtAddress.Text

    .Fields(7) = txtPhoneHome.Text

    .Fields(8) = txtPhoneMob.Text

    .Fields(9) = txtPatientOccupation.Text

    .Fields(10) = cboCivilStatus.Text

    .Fields(11) = cboAccountType.Text

    .Fields(12) = txtCompanyID.Text

    .Fields(13) = txtCompanyName.Text

    .Update

    'Display Success Message

    MsgBox "The Record Was Saved Successfully! You Will Now Be Taken To Step 2!",

    vbInformation, "Succesful Save Procedure!"

    loadGuardiansMaintenance 'Calling a public function to prepare the Guardians

    Maintenance form

    Unload Me

    frmGuardiansMaintenance.Show

    Else

    'Display 'No Modifications' Message

    MsgBox "No Modifications Have Taken Place!", vbInformation, "No Modifications!"

    .CancelUpdate 'Cancel the Save Procedure

    Form_Load 'Calling the Form_Load Procedure

    clearAllFields 'Calling a Private Function To Clear All Fields

    End If

    .Requery 'Requerying the Table

    End With

    End If

  • 8/12/2019 Hospital Management Project Report

    73/99

    P a g e | 7 3

    End Sub

    Private Function loadGuardiansMaintenance()

    frmGuardiansMaintenance.enableAllFields 'Calling a Private Function To Enable All Fields

    frmGuardiansMaintenance.clearAllFields 'Calling a Private Function To Clear All Fields

    frmGuardiansMaintenance.disableAllButtons 'Calling a Private Function To Disable AllCommand Buttons

    frmGuardiansMaintenance.txtNICNumber.Text = "-" 'Since this textfield is not compulsory

    frmGuardiansMaintenance.txtPhoneMob.Text = "-" 'Since this textfield is not always

    compulsory

    frmGuardiansMaintenance.txtPhoneHome.Text = "-" 'Since this textfield is not always

    compulsory

    'Enabling the Save Command Button

    frmGuardiansMaintenance.cmdSave.Enabled = True

    'Disbaling the Search Frame

    frmGuardiansMaintenance.lblCriteria.Enabled = False

    frmGuardiansMaintenance.cboSearchType.Enabled = False

    frmGuardiansMaintenance.lblSearchText.Enabled = False

    frmGuardiansMaintenance.txtSearch.Enabled = False

    Call Guardians_Maintenance 'Calling the Guardians_Maintenance Procedure to interact with

    the recordset

    'Generate Guardian ID By Utilizing the Guardians_Maintenance Table

    With rsGuardiansMaintenance

    If .RecordCount = 0 Then 'If there are no records in the table

    strDisplayID = "GRD0001"

    Else

    'Calculating the number of records and storing in a variableiNumOfGuardians = .RecordCount

    iNumOfGuardians = iNumOfGuardians + 1 'incrementing the number by 1

    'The following block of code will generate the ID according

    'to the number of records in the Guardians_Maintenance Table

    If iNumOfGuardians < 10 Then

    strDisplayID = "GRD000" & iNumOfGuardians

    ElseIf iNumOfGuardians < 100 Then

    strDisplayID = "GRD00" & iNumOfGuardians

    ElseIf iNumOfGuardians < 1000 Then

    strDisplayID = "GRD0" & iNumOfGuardiansElseIf iNumOfGuardians < 10000 Then

    strDisplayID = "GRD" & iNumOfGuardians

    End If

  • 8/12/2019 Hospital Management Project Report

    74/99

    P a g e | 7 4

    End If

    .Requery 'Requerying the Table

    .AddNew 'Adding a new recordset

    End With

    'The following line of code will enter the autogenerated Guardian ID

    'into the Guardian ID textfield

    frmGuardiansMaintenance.txtGuardianID.Text = strDisplayID

    frmGuardiansMaintenance.txtPatientID.Text = strPatientID 'Global Variable

    frmGuardiansMaintenance.dgrdGuardiansInfo.Enabled = False

    End Function

    Private Sub cmdStep2_Click()

    Call Guardians_Maintenance

    With rsGuardiansMaintenance

    .MoveFirst

    Do While .EOF = False

    If .Fields(1).Value = txtPatientID.Text Then

    'Entering the values in the particular record into the fields on the interface

    frmGuardiansMaintenance.txtGuardianID.Text = .Fields(0).Value

    frmGuardiansMaintenance.txtPatientID.Text = .Fields(1).Value

    frmGuardiansMaintenance.txtFirstName.Text = .Fields(2).Value

    frmGuardiansMaintenance.txtSurname.Text = .Fields(3).Value

    frmGuardiansMaintenance.cboGender.Text = .Fields(4).Value

    frmGuardiansMaintenance.txtNICNumber.Text = .Fields(5).Value

    frmGuardiansMaintenance.txtAddress.Text = .Fields(6).ValuefrmGuardiansMaintenance.txtPhoneHome.Text = .Fields(7).Value

    frmGuardiansMaintenance.txtPhoneMob.Text = .Fields(8).Value

    frmGuardiansMaintenance.txtOccupation.Text = .Fields(9).Value

    frmGuardiansMaintenance.txtRelationToPatient.Text = .Fields(10).Value

    Exit Do

    Else

    .MoveNext

    End If

    Loop

  • 8/12/2019 Hospital Management Project Report

    75/99

    P a g e | 7 5

    End With

    'Enabling / Diabling the Navigation Buttons as necessary

    frmGuardiansMaintenance.cmdFirst.Enabled = False

    frmGuardiansMaintenance.cmdLast.Enabled = True

    frmGuardiansMaintenance.cmdPrevious.Enabled = False

    frmGuardiansMaintenance.cmdNext.Enabled = True

    'Enabling the Update Button

    frmGuardiansMaintenance.cmdUpdate.Enabled = True

    'Enabling the "Step" Buttons

    frmGuardiansMaintenance.cmdStep1.Enabled = True

    frmGuardiansMaintenance.cmdStep3.Enabled = True

    frmGuardiansMaintenance.enableAllFields

    Unload Me

    frmGuardiansMaintenance.Show

    End Sub

    Private Sub cmdUpdate_Click() 'This function will update a record after the user has edited it

    'Checking if the Phone Number (Home) textfield and the Phone Number (Mob) textfield are

    empty

    If txtPhoneHome.Text = "-" And txtPhoneMob.Text = "-" Then

    txtPhoneHome.BackColor = &H80000018 'Highlighting the textfield in a different colour

    txtPhoneMob.BackColor = &H80000018 'Highlighting the textfield in a different colour

    MsgBox "Error! Both Phone Number Textfields Cannot Be Empty! At Least One Has To Be

    Provided!", vbCritical, "Error In Phone Numbers!"

    Exit SubElse

    txtPhoneHome.BackColor = &H80000004 'Bringing the textfield BackColour back to

    normal

    txtPhoneMob.BackColor = &H80000004 'Bringing the textfield BackColour back to normal

    End If

    'Checking the return value of the function that validates the user's data

    If textfieldsValidations = False Then

    'Validation To Ensure That The NIC Number is 10 Characters In Length

    If txtNICNumber.Text "-" Then

  • 8/12/2019 Hospital Management Project Report

    76/99

    P a g e | 7 6

    If Len(txtNICNumber.Text) 10 Then

    MsgBox "Error! The NIC Number Has To Consist Of 10 Characters!", vbCritical,

    "Error In NIC Number!"

    txtNICNumber.BackColor = &H80000018 'Highlighting the textfield in a different

    colour

    Exit Sub

    Else

    txtNICNumber.BackColor = &H80000004End If

    End If

    'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length

    If txtPhoneHome.Text "-" Then

    If Len(txtPhoneHome.Text) > 15 Then

    MsgBox "Error! The Phone No (Home) Textfield Cannot Consist Of More Than 15

    Digits!", vbCritical, "Error In Phone No (Home)!"

    txtPhoneHome.BackColor = &H80000018

    Exit SubElse

    txtPhoneHome.BackColor = &H80000004

    End If

    End If

    'Validation To Ensure That The Phone Numbers are not Greater than 15 Digits in Length

    If txtPhoneMob.Text "-" Then

    If Len(txtPhoneMob.Text) > 15 Then

    MsgBox "Error! The Phone No (Mob) Textfield Cannot Consist Of More Than 15

    Digits!", vbCritical, "Error In Phone No (Mob)!"

    txtPhoneMob.BackColor = &H80000018

    Exit Sub

    Else

    txtPhoneMob.BackColor = &H80000004

    End If

    End If

    'Validation To Ensure That The Patient Occupation is not Greater than 30 Characters in

    LengthIf Len(txtPatientOccupation.Text) > 30 Then

    MsgBox "Error! The Patient Occupation Textfield Cannot Consist Of More Than 30

    Characters", vbCritical, "Error In Patient Occupation!"

    txtPatientOccupation.BackColor = &H80000018

    Exit Sub

    Else

    txtPatientOccupation.BackColor = &H80000004

    End If

    With rsInpatientMaintenance

    'Making sure that the user wants to update the record

  • 8/12/2019 Hospital Management Project Report

    77/99

    P a g e | 7 7

    If MsgBox("Are You Sure You Wish To Update This Record?", vbYesNo + vbQuestion,

    "Update This Record?") = vbYes Then

    'The following block of if else conditions ensure that no

    'textfield will be completely blank when saving in the database.

    'This has been done in order to avoid errors.

    If txtNICNumber.Text = "" Then

    txtNICNumber.Text = "-"End If

    If txtPhoneMob.Text = "" Then

    txtPhoneMob.Text = "-"

    End If

    If txtPhoneHome.Text = "" Then

    txtPhoneHome.Text = "-"

    End If

    If txtCompanyID.Text = "" ThentxtCompanyID.Text = "-"

    End If

    If txtCompanyName.Text = "" Then

    txtCompanyName.Text = "-"

    End If

    'Save the user-entered data into the recordset

    .Fields(0) = txtPatientID.Text

    .Fields(1) = txtFirstName.Text

    .Fields(2) = txtSurname.Text

    .Fields(3) = cboGender.Text

    .Fields(4) = dtpDateOfBirth.Value

    .Fields(5) = txtNICNumber.Text

    .Fields(6) = txtAddress.Text

    .Fields(7) = txtPhoneHome.Text

    .Fields(8) = txtPhoneMob.Text

    .Fields(9) = txtPatientOccupation.Text

    .Fields(10) = cboCivilStatus.Text

    .Fields(11) = cboAccountType.Text.Fields(12) = txtCompanyID.Text

    .Fields(13) = txtCompanyName.Text

    .Update

    'Display Success Message

    MsgBox "The Record Was Updated Successfully!", vbInformation, "Succesful Update

    Procedure"

    Form_Load 'Calling the Form_Load Procedure

    clearAllFields 'Calling a Private Function To Clear All Fields

  • 8/12/2019 Hospital Management Project Report

    78/99

    P a g e | 7 8

    Else

    'Display 'No Modifications' Message

    MsgBox "No Modifications Have Taken Place!", vbInformation, "No Modifications!"

    .CancelUpdate 'Cancel the Update Procedure

    Form_Load 'Calling the Form_Load Procedure

    clearAllFields 'Calling a Private Function To Clear All Fields

    End If

    .Requery 'Requerying the Table

    End With

    End If

    End Sub

    Public Sub Form_Load()

    Call Connection 'Calling the Connection Procedure

    disableAllFields 'Calling a Private Function To Disable All Fields

    disableAllButtons 'Calling a Private Function To Disable All Command Buttons

    'Enabling the First Button and the Last Button

    cmdFirst.Enabled = True

    cmdLast.Enabled = True

    'Enabling the Add New Button & the Close Button

    cmdAddNew.Enabled = True

    cmdClose.Enabled = True

    'Enabling the LaunchDoctorSearch Wizard Button

    cmdLaunchInpatientSearch.Enabled = True

    End Sub

    Private Function disableAllFields() 'This function will disable all fields on the interface

    On Error Resume Next

    For Each eachField In Me.Controls 'Running a Loop through all the Controls

    'The following If Condition will disable all TextBoxes and ComboBoxes

    If TypeOf eachField Is TextBox Or TypeOf eachField Is ComboBox Then

    eachField.Enabled = False

    End If

    Next

  • 8/12/2019 Hospital Management Project Report

    79/99

    P a g e | 7 9

    dtpDateOfBirth.Enabled = False 'Disabling the Date Of Birth Date Time Picker

    End Function

    Public Function enableAllFields() 'This function will enable all fields on the interface

    On Error Resume Next

    For Each eachField In Me.Controls 'Running a Loop through all the Controls

    'The following If Condition will enable all TextBoxes and ComboBoxes

    If TypeOf eachField Is TextBox Or TypeOf eachField Is ComboBox Then

    eachField.Enabled = True

    End If

    Next

    dtpDateOfBirth.Enabled = True 'Enabling the Date Of Birth Date Time Picker

    End Function

    Private Function disableAllButtons() 'This function will disable all command buttons on the

    interface

    On Error Resume Next

    For Each eachButton In Me.Controls 'Running a Loop through all the Controls

    'The following If Condition will disable all Command Buttons

    If TypeOf eachButton Is CommandButton Then

    eachButton.Enabled = False

    End If

    Next

    End Function

    Private Function enableAllButtons() 'This function will enable all command buttons on the

    interface

    On Error Resume Next

    For Each eachButton In Me.Controls 'Running a Loop through all the Controls

    'The following If Condition will enable all Command Buttons

    If TypeOf eachButton Is CommandButton TheneachButton.Enabled = True

    End If

  • 8/12/2019 Hospital Management Project Report

    80/99

    P a g e | 8 0

    Next

    'Disabling the Step 1 Button

    cmdStep1.Enabled = False

    End Function

    Public Function clearAllFields() 'This function will clear all fields on the interface

    On Error Resume Next

    For Each eachField In Me.Controls 'Running a Loop through all the Controls

    'The following If Condition will clear all TextBoxes

    If TypeOf eachField Is TextBox Then

    eachField.Text = ""

    End If

    Next

    'The following lines will set the normal display values of the Gender

    'ComboBox, Doctor Category ComboBox and the Date Of Birth Date Time Picker

    cboGender.Text = "----------SELECT-----------"

    cboCivilStatus.Text = "----------SELECT-----------"

    cboAccountType.Text = "----------SELECT-----------"

    dtpDateOfBirth.Value = "4/14/2008"

    End Function

    Private Sub cmdFirst_Click() 'This function will Navigate to the First Record

    'Enabling / Diabling the Navigation Buttons as necessary

    cmdFirst.Enabled = False

    cmdLast.Enabled = True

    cmdPrevious.Enabled = False

    cmdNext.Enabled = True

    'Enabling the Update Button and the Delete ButtoncmdUpdate.Enabled = True

    cmdDelete.Enabled = True

    'Enabling the "Step" Buttons

    cmdStep2.Enabled = True

    'Enabling the Company Search Wizard

    cmdCompanySearchWizard.Enabled = True

    Call Inpatients_Maintenance 'Calling the Inpatients_Maintenance Procedure to interact withthe recordset

    With rsInpatientMaintenance

  • 8/12/2019 Hospital Management Project Report

    81/99

    P a g e | 8 1

    .MoveFirst 'Moving to the first record

    'Entering the values in the particular record into the fields on the interface

    txtPatientID.Text = .Fields(0).Value

    txtFirstName.Text = .Fields(1).Value

    txtSurname.Text = .Fields(2).ValuecboGender.Text = .Fields(3).Value

    dtpDateOfBirth.Value = .Fields(4).Value

    txtNICNumber.Text = .Fields(5).Value

    txtAddress.Text = .Fields(6).Value

    txtPhoneHome.Text = .Fields(7).Value

    txtPhoneMob.Text = .Fields(8).Value

    txtPatientOccupation.Text = .Fields(9).Value

    cboCivilStatus.Text = .Fields(10).Value

    cboAccountType.Text = .Fields(11).Value

    txtCompanyID.Text = .Fields(12).Value

    txtCompanyName.Text = .Fields(13).Value

    End With

    enableAllFields 'Calling a Private Function To Enable All Fields

    End Sub

    Private Sub cmdPrevious_Click() 'This function wi