286
Clinic Management System TITLE OF THE PROJECT CLINIC MANAGEMENT SYSTEM NAME : Pawan kumar Singh ROLL NO. : 520827293 1

Project Report

Embed Size (px)

DESCRIPTION

khbjjgj

Citation preview

Clinic Management System

TITLE OF THE PROJECT

CLINIC MANAGEMENT

SYSTEM

NAME : Pawan kumar SinghROLL NO. : 520827293

1

Clinic Management System

Clinic (Nursing Home) is an institution that provides medical,

surgical or psychiatric care & treatment for the sick & injured.

CLINIC MANAGEMENT SYSTEM, entirely different and reliable

software built for “Raj clinic”, Patna.

Silent Features of the CLINIC MANAGEMENT

SYSTEM Software :-

Easy to maintain and upgrade.

Object Oriented features.

Proper data validation.

Faster query retrieval.

Reports are easily generated and more attractive.

Proper data back up.

Window based, hence user-friendly.

Database enhancements to provide decision support on

maintenance.

Can be re-modified for further higher version with more

features.

NAME : Pawan kumar SinghROLL NO. : 520827293

2

THE INTRODUCTION/OBJECTIVE OF PROJECT

THE INTRODUCTION/OBJECTIVE OF PROJECT

Clinic Management System

Two hours training is sufficient to us the system whether computer

literate or illiterate.

Our objective is to develop CLINIC MANAGEMENT SYSTEM Software

for the management of “Raj Clinic” Ashok Rajpath , Patna that

fulfils Registration, Patient Detail, Billing, Report related

requirements of the hospital. Our other objective are to provide

exact & quick result, to generate various types of details & Reports

that depends upon the requirement of the user; To provide facility

of authorized user i.e. unauthorized user must not use our software,

categories of user has been created which provide facility for

accessing software in a standalone as well as network system i.e.

more than one user may use our software at a time.

Finally, our most important objective is to make it more

efficient & flexible which are the main criteria for popular and

successful software.

PROPOSED COMPUTER BASED SYSTEM:-

Current era can be interpreted as computer age. Computer is such a

device, which can be utilized, in different walks in life. In increasing

trend in modern science, hardware and software gradually getting

new to newer version with faster processing capability with larger

memory size to fulfill the needs of society. In availing the facility, a

computer based system for CSMA has been developed after rigorous

NAME : Pawan kumar SinghROLL NO. : 520827293

3

OBJECTIVE OF PROJECT

Clinic Management System

study of the existing manual system and all problem areas. Salient

features of this computer based systems are:

A Comprehensive application Package that has been designed to

be user-friendly with JAVA (Swing).

Front End 32-bit multithreading

A powerful Back End RDBMS i.e. SQL Server.

Total 64-bit architecture on server i.e. Operating System, RDBMS

& Application.

State-of-Art Technology i.e. Connectivity of Front End to Back End

is on ODBC Direct.

Easy to maintain and upgrade.

Object oriented features.

Proper data validation.

Faster query retrieval.

Password based levels of security.

Proper data back up.

Window based, hence user-friendly.

Variety reports to decision making at all levels.

Database enhancements to provide decision support on

maintenance.

Supports multiple activity records.

Can be re-modified for further higher version with more features.

Two hours training is sufficient to us the system whether

computer literate or illiterate.

NAME : Pawan kumar SinghROLL NO. : 520827293

4

Clinic Management System

This project has been developing in JAVA. Hence the category of

the project comes into WBA (Web Based Application) and it is an

Object Oriented System. So relation database management system

(RDBMS) is used java is a power full programming language to

develop sophisticated window very quickly.

Our project is delicately falls in Relational

Database Management system (RDBMS) environment; RDBMS is

one of the important environments for commercial data.

Processing in the world. The oracle enterprise version

takes care of the following:

1) Updating the database

2) Retrieving information from the data base

3) Accepting query language statement

4) Enforcing security specification

5) Enforcing data integrity specification

6) Enforcing information consistency

7) Managing data sharing

8) Optimizing query

9) Managing system catalog

NAME : Pawan kumar SinghROLL NO. : 520827293

5

PROJECT CATEGORY

PROJECT CATEGORY

Clinic Management System

PROPERTIES OF JAVA (FRONT END):-

JAVA is pure object oriented programming language, which has

derived C syntax and C++ object oriented programming features. Is

compiled and interpreted language and is platform independent and

can do graphics, networking, multithreading. It was initially called as

OAK. Java was conceived by James Gosling, Patrick Naughton, Chris

Warth, Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. in

1991. Java can used to create two types of programs: application

and applets. Application is a program that runs on your computer,

under the operating system of that computer. That is an application

created by Java is more or less like one created using C or C++. An

applet is an application designed to be transmitted over the Internet

and executed by a Java-compatible Web browser. Java provides the

Java Virtual Machine (JVM).

Java are following list of buzzwords:-

Simple

Secure

Portable

Object-oriented

Robust

Multithreading

Architecture-neutral

Interpreted

High Performance

Distributed

Dynamic

NAME : Pawan kumar SinghROLL NO. : 520827293

6

Clinic Management System

PROPERTIES OF RDBMS-ORACLE (BACK-END):-

As we know that the worlds longest selling are the DBMS product.

Oracle work groups or enterprise server account major percentage

of RDBMS engine sold worldwide. The natural

programming language of this product is SQL/PLSQL the creation of

user defined function procedure database trigger and other specific

database processing PLSQL for commercial application will always

related to oracle related to oracle engine.

Oracle has introduced a large number of new features such as

analysis queries, scalar sub-queries, joins, pivot insert statement

and merger statement. Object oriented feature such as inheritance,

Polymorphism, undo table space and various PLSQL packages. It

continues to provide the most secure application development and

deployment platform in the industry. Exception handling Oracle

locating and user defined locking are fully supported. It also

provides the key concept such as primary key, unique key and

foreign key.

Oracle can run across different platforms. They can also transfer

data from various hardware platforms without any conversions of

programs. They, thus satisfy the feature of having open architecture

and distributed data management capability. This database have

industry standard SQL & Report writer which are 4GL tools. This not

only facilitates faster development, but also enhances professional

productivity.

Oracle has a query optimizer. The main function of a query

optimizer is to determine automatically the fastest method in which

a database request can be handled.

As a result of this programmers and end users do no need any

additional training to obtain good RDBMS performance. These

databases have servers or data mangers, which minimize both

NAME : Pawan kumar SinghROLL NO. : 520827293

7

Clinic Management System

memory and CPU resource utilization. This ensures high

performance during transaction processing.

Oracle 10G

ORCALE is an acronym for

O - Oak

R - Ridge

A - Automatic

C - Computing

L - Logical

E - Engine

Oracle 10g Product and Utility

ORCALE is a kernel package that has a number of tools that can be purchased separately and integrated the kernel and “add-ons”. The tools allows the user to create database objects, like procedure, trigger function etc. some of tools are:

A. SQL*PLUS

B. INTRACTIVE SQL

C. PL/SQL

The ORCALE RDBMS is a central ORCALE product. It includes the

database manager and several tools intended to assist the users

and DBA in the maintenance and use of data. The core of RDBMS is

the kernel.

The kernel handles the following task:

1. Manages storage and definition of data.

2. Controls and limits data access and concurring.

3. Allows backup and recovery of data

4. Interprets SQL and PL/SQL

( A ) SQL*PLUS

NAME : Pawan kumar SinghROLL NO. : 520827293

8

Clinic Management System

SQL*PLUS is an interactive tool which establishes an interaction

between the user and the server. It takes Query as input and sends

it on to the server to be interpreted by the SQL Engine and waits for

the result unless until the server process entertains query and sends

the result back to this interactive tool. Finally it displays the result to

the user. It is the command line interface to the oracle database. It

is a powerful oracle product that can take your instruction for oracle,

Check them for correctness, submit them to oracle and then modify

or reformat the response oracle gives, based on orders or directions

that you have set in place. It interacts with you, which means you

can “talk” back. You can give directions, and it will follow them

precisely. It will tell user if it doesn’t understand something users

have told it to do.

As we get started, just think of SQL*PLUS as a co-worker-an

assistant follows your instructions and helps us do our works more

quickly.

( B ) SQL

SQL is a data sub-language. That is to say, the purpose of SQL is to

interface to a relational database such as oracle7 and all SQL

statement are instructions to the database. In this it differs from

general purposes programming language like C and BASIC.

Some of the important features of SQL are as following: -

1. It provides sets of data as groups rather than as individual

units.

2. It provides automatic navigation to the data.

3. It uses statements that are complex and powerful individually, nd

that therefore stand-alone. The flow-control statements of

4. most programming languages are absent in SQL, although they

are provided in Oracle’s extension to standard SQL called PL/SQL.

NAME : Pawan kumar SinghROLL NO. : 520827293

9

Clinic Management System

SQL provides commands for a variety of tasks including: -

1. Querying data.

2. Inserting, updating and deleting rows in a table.

3. Creating, replacing altering and dropping objects.

4. Controlling access to the database and its objects.

5. Guaranteeing database consistency and integrity.

( C ) PL/SQLPL/SQL stands for “Procedural Language Extension to SQL”.

PL/SQL available primary as an “Enabling Technology” within

other softer products, it does not exit as a stand along language.

PL/SQL is powerful language,

which incorporate many of most advance elements of procedural

languages including:

A full range of data types.

Explicit block structure.

Conditional and sequential control statements.

Loops of various kinds.

Exception handlers for use in event-based error handling.

Construct that help in the development of modular code -

functions and procedures.

SYSTEM STUDY

NAME : Pawan kumar SinghROLL NO. : 520827293

10

SYSTEM ANALYSIS SYSTEM ANALYSIS

Clinic Management System

In this stage, studding the current to find out how it works and

where improvement should be made. System studies results in

evaluation of how current methods are working and where

adjustment is necessary and impossible.

Existing System

The Existing system for clinic is not computerized it is handled

manually. It is very time consuming & need no. of people to do the

jobs of the system.The existing System has many problems

like,users have to do lots of paper work for data entry, report

generation. The retrieval of data from the register is very tough task

and every calculation on that data is not very simple as manual

calculation is very slow in comparison of computerised system .

Here in this case too many times consume, even a single mistake

may create a problem &can’t be edited easily. Thus I conclude that

existing system not reliable for the organization. hence it require a

perfect computerised system.

SYSTEM ANALYSIS

In this phase, software developers carry out a detailed study of

user’s requirements. They then arrive at the proposed system to be

built. This phase generates functional specifications, which contain:

Output to be produced.

Inputs that need to be received.

Procedure that will get the output from the input.

Audit and control the requirements that the user can use to

monitor the proper functioning of the system.

Retrieving the data, calculation on the data and the report

generation will take less time.

Acceptance test to list the tests that the user can carry out to

ensure that the system is acceptable.

SCOPE OF THIS DOCUMENT

NAME : Pawan kumar SinghROLL NO. : 520827293

11

Clinic Management System

Describe the scope of this requirements definition effort. Introduces

the requirements elicitation team, including users, customers,

system engineers, and developers.

This section also details any constraints that were placed upon the

requirements elicitation process, such as schedules, costs, or the

software engineering environment used to develop requirements.

BUSINESS CONTEXT

Provide an overview of the Hospitality. This overview should include

the business's mission statement and its organizational objectives

or goals.

This section describes the set of objectives and requirements for the

system from the user's perspective. It may include a "wish list" of

desirable characteristics, along with more feasible solutions that are

in line with the business objectives.

GENERAL CONSTRAINTS

Lists general constraints placed upon the design team, including

speed requirements, industry protocols, hardware platforms, and so

forth.

REQUIEMENT ANALYSIS

This section lists the functional requirements in ranked order.

Functional requirements describe the possible effects of a software

system, in other words, what the system must accomplish. Other

kinds of requirements (such as interface requirements, performance

requirements, or reliability requirements) describe how the system

accomplishes its functional requirements. Each functional

requirement should be specified in a format similar to the following:

Short imperative sentence stating highest ranked Functional

Requirement.

Description: A full description of the requirement.

NAME : Pawan kumar SinghROLL NO. : 520827293

12

Clinic Management System

Criticality: Describes how essential this requirement is to the

overall system.

Technical-Issues: Describes any design or implementation

issues involved in satisfying this requirement.

Cost-and-schedule: Describes the relative or absolute costs

associated with this issue.

Risks: Describes the circumstances under which this

requirement might not able to be satisfied, and what actions can

be taken to reduce the probability of this occurrence.

Dependencies with Other Requirements: Describes

interactions with other requirements.

Others as appropriate

2. Interface Requirements

This section describes how the software interfaces with other

software products or users for input or output. Examples of such

interfaces include library routines, token streams, shared memory,

data streams, and so forth.

User-Interfaces: Describes how this product interfaces with the

user.

GUI: Describes the graphical user interface if present. This ection

should include a set of screen dumps or mockups to

illustrate user interface features. If the system is menu-driven, a

description of all menus and their components should be

provided.

3. Design Constraints

Specifies any constraints for the design team using this document.

Standards Compliance

NAME : Pawan kumar SinghROLL NO. : 520827293

13

Clinic Management System

Hardware Limitations

…Others as appropriate

OTHER NON-FUNCTIONAL ATTRIBUTES

Specifies any other particular non-functional attributes required by

the system. Examples are provided below.

Security

Binary Compatibility

Reliability

Maintainability

Portability

Extensibility

Requirement SpecificationAn information system is intended to meet the need of the

organization. So this step is to specify the needs or requirements.

The software developer to gather the information should evolve a

clear strategy. The strategy consist of

Identifying the system resources.

Forms and documents used by concern.

Various queries from the management and the user.

Various report used in the organization.

The system should generate different type of report to

support the management.

It is also expected that information maintained should be

secured and not accessible in an unauthorized manner.

It is also expected that proper manual should be provided

including how to work with the system.

System should be user friendly.

NAME : Pawan kumar SinghROLL NO. : 520827293

14

Clinic Management System

FEASIBILITY STUDY

Feasibility study is a procedure that identifies, describes and

evaluates the proposed system and selects the best possible action

for job. An initial investigation culminates in a proposal that

determines whether an alternative system is feasible or not. A

summarized thinking of analyst is presented to the user for

reviewing. When approved, the proposal initiates a feasibility study

that describes and evaluates the best system to choose in terms of

Economic, Technical, Operational and Social Feasibility.

Economic Feasibility

Evaluating the effectiveness and determining the monetary benefits

and savings is called economic feasibility. Since the proposed

system improves the efficiency and also the benefits counts more

than cost, the system proposed is economically feasible.

Technical Feasibility

This feasibility is concerned with specifying hardware and software

that will satisfy the user requirements.

Context Analysis Diagram (Level 0 DFD)

Details/Enquires

Service

Level 1 DFD

NAME : Pawan kumar SinghROLL NO. : 520827293

15

DATA FLOW DIAGRAM

1

CMS Patient

1.1

Registration

Clinic Management System

Patient Details

Enquiries

Reports

Service Details

Money Receipt

level 2 DFDs

Enquiry

Report

NAME : Pawan kumar SinghROLL NO. : 520827293

16

Patient 1.2

Patient Query

1.3

Charges/Billing

Bill_Master

1.2.1

Patient Query

1.2.2

Services Provides

Patient

Registration_master

Service_master

Clinic Management System

Issue /Enquiry

Money Receipt

Request

NAME : Pawan kumar SinghROLL NO. : 520827293

17

1.1.1

Admit Detail

1.2.3Service Charges/Billing/Refunds

Service_charges

Bed_master

ER-DIAGRAM

CONSULTANT

APPOINTMENT

CONSULTANTNT_ID ADDRESS

collects

DISEASE_INFO

Clinic Management System

FIG:- ER-DIAGRAM OF CLINIC MANAGMENT SYSTEM

In my project (clinic management system) total 13 Table

exists. They are as follows:

1. ADVANCE_RECEIPT:

COLUMN DATATYPE CONSTRAINTSBILL_NO VACHAR (6) PRIMARY KEYPATIENT_ID NUMBER (8) NOT NULL REFERENCES REGISTRATION

(PATIENT_ID)BILL_DATE DATE DEFAULT SYSDATEAMOUNT_PAID NUMBER (6,2)AMOUNT_PAYABLE NUMBER (6,2)DISCOUNT NUMBER (6,2)BALANCE NUMBER (6,2)

NAME : Pawan kumar SinghROLL NO. : 520827293

18

REGISTRATION

ADVANCE_RECEIPT

PAY_DETAIL

PAYMENT_DETAIL

billing

ADVANCE_RECEIPT_DETAIL

DRUG_MASTER

GENERIC_MASTER

SERVICE_MASTER SERVES

In mode of

PAYMENTMODE_MASTE

In mode of

CREDITCARD_MASTER

DATA STRUCTURE AND DATA DICTIONARY

Clinic Management System

PAY_MODE VARCHAR2 (2) REFERENCES PAYMENTMODE_MASTER (CODE)

PAY_NO VARCHAR2 (50)VALID_UPTO DATE

2 . ADVANCE_RECEIPT_DETAILS:

COLUMN DATATYPE CONSTRAINTSBILL_NO VARCHAR (6) NOT NULL REFERENCES

ADVANCE_RECEIPT (BILL_NO)SERVICE_ID VARCHAR (6) NOT NULL REFERENCES

SERVICE_MASTER (SERVICE_ID)QTY NUMBER (4)

3. APPOINTMENT:

COLUMN DATATYPE CONSTRAINTSAPPOINTMENT_ID VARCHAR (6) PRIMARY KEYPATIENT_ID NUMBER (8) NOT NULL REFERENCES REGISTRATION

(PATIENT_ID)CONSULTANT_ID VARCHAR (6) NOT NULL REFERENCES CONSULTANT

(CONSULTANT_ID)APPT_DATE_TIME DATE NOT NULLSTATUS VARCHAR2 (1) CHECK (STATUS IN (‘P’,’C’,’X’))

4. USER_MASTER:

COLUMN DATATYPE CONSTRAINTSUSER_NAME VARCHAR2 (20) PRIMARY KEYPASSWORD VARCHAR2 (50) NOT NULL

5. BILLING_CLASS:

COLUMN DATATYPE CONSTRAINTSBILLING_CLASS_ID VARCHAR (6) PRIMARY KEYDESCRIPTION VARCHAR2 (50) NOT NULLDISCOUNT_PERCENTAGE NUMBER (4,2)EFFECTIVE_FROM DATEEFFECTIVE_TO DATEACTIVE VARCHAR2 (1) CHECK (ACTIVE IN (‘Y’,’N’))

6. CONSULTANT :

NAME : Pawan kumar SinghROLL NO. : 520827293

19

Clinic Management System

COLUMN DATATYPE CONSTRAINTSCONSULTANT_ID VARCHAR (6) PRIMARY KEYCONSULTANT_NAME VARCHAR2 (50) NOT NULLMEDICAL_REG_ID VARCHAR2 (20) NOT NULLCONSULTANT_NATURE VARCHAR2 (20) NOT NULLCONSULTANT_TYPE VARCHAR2 (20) NOT NULLMOBILE_NO VARCHAR2 (15)PHONE_NO VARCHAR2 (15)ADDRESS VARCHAR2 (50)EMAIL VARCHAR2 (50)DOB DATEDOJ DATE

7. PAYMENT_DETAILS :

COLUMN DATATYPE CONSTRAINTSBILL_NO VARCHAR (6) NOT NULL ADVANCE_RECEIPT (BILL_NO)PAY_AMT NUMBER (6,2)PAY_DATE DATE

8. REGISTRATION:

COLUMN DATATYPE CONSTRAINTSPATIENT_ID NUMBER (8) PRIMARY KEYREG_CATEGORY VARCHAR2 (10) NOT NULLPATIENT_TYPE VARCHAR2 (10) NOT NULLREG_DT DATE NOT NULLDEPT VARCHAR2 (50)CONSULTANT_ID VARCHAR (6) NOT NULL REFERENCES CONSULTANT

(CONSULTANT_ID)FNAME VARCHAR2 (20)MNAME VARCHAR2 (20)LNAME VARCHAR2 (20)DOB DATEGENDER VARCHAR2 (1) CHECK (GENDER IN (‘M’,’F’))MARITAL _STATUS VARCHAR2 (1) CHECK (MARITAL_STATUS IN

(‘M’,’U’,’W’,’D’))OCCUPATION VARCHAR2 (20)REMARKRS VARCHAR2 (50)ADDRESS VARCHAR2 (200)MOBILE_NO VARCHAR2 (15)

9. SERVICE_MASTER :

NAME : Pawan kumar SinghROLL NO. : 520827293

20

Clinic Management System

COLUMN DATATYPE CONSTRAINTSSERVICE_ID VARCHAR (6) PRIMARY KEYDESCRIPTION VARCHAR2 (50) NOT NULLTYPE VARCHAR2 (10)ACTIVE VARCHAR2 (1) CHECK (ACTIVE IN (‘Y’,’N’))RATE NUMBER (6,2)MINAMT NUMBER (6,2)EFFFROM DATEEFFTO DATE

10. DRUGS_MASTER :

COLUMN DATATYPE CONSTRAINTSCODE VARCHAR2 (6) PRIMARY KEYNAME VARCHAR2 (20) NOT NULLCOMPANY_NAME VARCHAR2 (20) NOT NULLUNIT_OF_MEASURE NUMBER (6) NOT NULLSTOCK_ON_HAND NUMBER (4)MANUFACTURE_DT DATE NOT NULLEXPIRY_DT DATE NOT NULLSHAPE VARCHAR2 (15) NOT NULL

11. GENERIC_MASTER :

COLUMN DATATYPE CONSTRAINTSCODE VARCHAR2 (6) PRIMARY KEYNAME VARCHAR2 (20) NOT NULLCOMPANY_NAME VARCHAR2 (20) NOT NULLUNIT_OF_MEASURE NUMBER (6) NOT NULLSTOCK_ON_HAND NUMBER (4)

12. CREDITCARD_MASTER :

COLUMN DATATYPE CONSTRAINTSCODE VARCHAR2 (6) PRIMARY KEYDESCRIPTION VARCHAR2 (20)

13. PAYMENTMODE_MASTER :

COLUMN DATATYPE CONSTRAINTSCODE VARCHAR2 (6) PRIMARY KEYDESCRIPTION VARCHAR2 (20)

NAME : Pawan kumar SinghROLL NO. : 520827293

21

Clinic Management System

Coding

Table Code

create table PaymentMode_Master(

Code varchar(2) primary key,

Description varchar(20)

)

create table CreditCard_Master(

Code varchar(6)primary key,

Description varchar(5)

)

create table Generic_Master(

Code Varchar(6)primary key,

Name varchar(20)not null,

Company_Name varchar(20)not null,

Unit_of_Measure Number(6)not null,

NAME : Pawan kumar SinghROLL NO. : 520827293

22

Clinic Management System

Stock_on_Hand Number(4)

)

create table Drug_Master(

Code varchar(6)primary key,

Name varchar(20)not null,

Company_Name varchar(20)not null,

Unit_of_Measure Number(6)not null,

Stock_on_Hand Number(4),

Manufacture_Dt date not null,

Expiry_Dt date not null,

Shape varchar(15)not null

)

create table Service_Master(

Service_ID varchar(6)primary key,

Description varchar(50)not null,

Type varchar(10),

Active varchar(1)check(Active in('Y','N')),

Rate number(6,2),

MinAmt number(6,2),

EFFfrom date,

EFFto date

)

create table Consultant(

Consultant_ID varchar(6) primary key,

Consultant_Name varchar(50) not null,

Medical_Reg_ID varchar(20)not null,

Consultant_Nature varchar(20)not null,

Consultant_Type varchar(20)not null,

Mobile_No varchar(15),

Phone_No varchar(15),

Address varchar(50),

NAME : Pawan kumar SinghROLL NO. : 520827293

23

Clinic Management System

Email varchar(50),

DOB date,

DOJ date

)

Create Table Registration(

Patient_Id number(8)primary key,

Reg_Category varchar(10)not null,

Patient_Type varchar(10)not null,

Reg_Dt date not null,

Dept varchar(50),

Consultant_ID varchar(6)not null references

Consultant(Consultant_ID),

FName varchar(20),

MName varchar(20),

LName varchar(20),

DOB date,

Gender varchar(1) Check(Gender in('M','F')),

Marital_Status varchar(1) check(Marital_Status in('M','U')),

Occupation varchar(20),

Remarks varchar(50),

Address varchar(50),

Mobile_No varchar(15),

)

Create table Billing_Class(

ID varchar(6)primary key,

Description varchar(50)not null,

Discount_Percentage number(4,2),

Effective_From date,

Effective_To date,

Active varchar(1)check(Active in('Y','N'))

)

create table Advance_Receipt(

NAME : Pawan kumar SinghROLL NO. : 520827293

24

Clinic Management System

Bill_No varchar(6)primary key,

Patient_ID numeric(6)not null references Registration(Patient_ID),\

Bill_Date date,

Amount_Paid number(6,2),

Amount_Payable number(6,2),

Discount number(6,2),

Balance number(6,2),

Pay_Mode varchar(2)not null references

PaymentMode_Master(Code),

Pay_No varchar(50),

Valid_Upto date

)

create table Advance_Receipt_Details(

Bill_No varchar(6)not null references Advance_Receipt(Bill_No),

Service_ID varchar(6)not null references Service_Master(Service_ID),

Qty numeric(4)

)

create table Appointment(

Appointment_ID varchar(6)primary key,

Patient_ID number(6)not null references Registration(Patient_ID),

Consultant_ID number(6)not null references

Consultant(Consultant_ID),

Appt_Date_Time date not null,

Status varchar(1)check(Status in('P','C','X'))

)

create table User_Master(

User_Name varchar(20)primary key,

Password varchar(50) not null,

)

CREATE TABLE Payment_Details (

Bill_No varchar(6)not null references Advance_Receipt(Bill_No),

NAME : Pawan kumar SinghROLL NO. : 520827293

25

Clinic Management System

Pay_Amt number(6,2),

Pay_Date date )

Home Class

import java.awt.*;

import java.applet.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

// Start window to welcome to project

public class Home extends JFrame implements ActionListener

{

Login lg=new Login(); //Loging is class

JFrame frm;

JLabel msg,wellmsg;

JButton cont,cancel;

Container con;

JPanel panel;

Font plain=new Font("courier

new",Font.PLAIN,22);

Font bold=new Font("courier new",Font.BOLD,50);

NAME : Pawan kumar SinghROLL NO. : 520827293

26

Clinic Management System

//..................Home constructor

define............................................

public Home()

{ }

public void displayHome()

{

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm=new JFrame("CLINIC MANAGEMENT

SYSTEM"); con=frm.getContentPane();

panel=new JPanel();

panel.setFont(plain);

msg=new JLabel("CLINIC MANAGEMENT

SYSTEM");

con.setLayout(grid);

panel.setBorder(BorderFactory.createTitledBorder(BorderFact

ory.createEtchedBorder(),""));

msg.setFont(bold);

msg.setForeground(Color.blue);

panel.setBackground(Color.yellow);

panel.add(msg);

con.add(panel);

wellmsg=new JLabel("WELCOME TO");

wellmsg.setFont(bold);

wellmsg.setForeground(Color.blue);

gbc.ipadx=10;

gbc.ipady=5;

gbc.gridx=0;

gbc.gridy=0;

NAME : Pawan kumar SinghROLL NO. : 520827293

27

Clinic Management System

gbc.insets=new Insets(-250,0,0,0);

grid.setConstraints(wellmsg,gbc);

con.add(wellmsg);

cont=new JButton("Continue");

gbc.fill=GridBagConstraints.BOTH;

gbc.ipadx=25;

gbc.ipady=10;

gbc.insets=new Insets(50,450,0,500);

gbc.gridx=0;

gbc.gridy=2;

gbc.gridwidth=0;

gbc.gridheight=1;

grid.setConstraints(cont,gbc);

con.add(cont);

cancel=new JButton("Cancel");

gbc.fill=GridBagConstraints.BOTH;

gbc.ipadx=25;

gbc.ipady=10;

gbc.insets=new Insets(20,450,0,500);

gbc.gridx=0;

gbc.gridy=3;

grid.setConstraints(cancel,gbc);

con.add(cancel);

//..........Frame define......................................................

frm.setSize(1000,650);

frm.setVisible(true);

frm.show();

//..........ActionListener add.............................................

cont.addActionListener(this);

cancel.addActionListener(this);

NAME : Pawan kumar SinghROLL NO. : 520827293

28

Clinic Management System

frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

// ...actionPerformed is method of ActionListener where

that work the action event

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if (str.equals("Continue"))

{

lg.displayLogin();

frm.dispose();

}

else if (str.equals("Cancel"))

{

System.exit(0);

}

}

public void cancel()

{

System.exit(0);

}

public static void main(String[] args) // main class

define.

{

Home h=new Home();

h.displayHome();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

29

Clinic Management System

LOGIN CLASS

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class Login implements ActionListener

{

Connecting conn=new Connecting();

Menu mn;

JFrame frm;

JLabel logname,lpassword;

Container con;

JButton blogin,bcancel,bclear,welcome;

JTextField txtlogname;

JPasswordField passwordfield;

JPanel panel;

JTabbedPane tpan;

String log,pass;

String userName="";

String password="";

public Login()

{}

public void displayLogin()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

30

Clinic Management System

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm=new JFrame("Login into CMS ");

panel=new JPanel();

frm.setLayout(grid);

con=frm.getContentPane();

logname=new JLabel("User Name");

gbc.ipadx=10;

gbc.ipady=5;

gbc.insets=new Insets(15,0,0,0);

gbc.gridx=0;

gbc.gridy=0;

grid.setConstraints(logname,gbc);

con.add(logname);

logname.setForeground(new Color(0,0,255));

logname.setFont(new Font("Courier

new",Font.BOLD,15));

txtlogname=new JTextField(12);

gbc.gridx=1;

gbc.gridy=0;

grid.setConstraints(txtlogname,gbc);

con.add(txtlogname);

txtlogname.setForeground(new Color(0,0,0));

txtlogname.setFont(new Font("Courier

new",Font.BOLD,15));

txtlogname.setBackground(new

Color(255,175,175));

lpassword=new JLabel("Password");

gbc.gridx=0;

gbc.gridy=1;

NAME : Pawan kumar SinghROLL NO. : 520827293

31

Clinic Management System

grid.setConstraints(lpassword,gbc);

con.add(lpassword);

lpassword.setForeground(new Color(0,0,255));

lpassword.setFont(new Font("Courier

new",Font.BOLD,15));

passwordfield=new JPasswordField(12);

gbc.gridx=1;

gbc.gridy=1;

grid.setConstraints(passwordfield,gbc);

con.add(passwordfield);

passwordfield.setForeground(new

Color(0,0,0));

passwordfield.setFont(new Font("Courier

new",Font.BOLD,15));

passwordfield.setBackground(new

Color(255,175,175));

blogin=new JButton("Login");

gbc.gridx=0;gbc.gridy=2;

gbc.ipady=0;

gbc.insets=new Insets(20,15,0,10);

gbc.anchor=GridBagConstraints.WEST;

grid.setConstraints(blogin,gbc);

con.add(blogin);

bclear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=2;

gbc.insets=new Insets(20,-5,0,0);

grid.setConstraints(bclear,gbc);

con.add(bclear);

bcancel=new JButton("Cancel");

gbc.gridx=2;gbc.gridy=2;

gbc.ipadx=0;

NAME : Pawan kumar SinghROLL NO. : 520827293

32

Clinic Management System

gbc.insets=new Insets(20,-73,0,0);

grid.setConstraints(bcancel,gbc);

con.add(bcancel);

//......................ActionListener ... ...

blogin.addActionListener(this);

bclear.addActionListener(this);

bcancel.addActionListener(this);

frm.setSize(300,200);

frm.setResizable(false);

frm.setLocation(250,190);

frm.setVisible(true);

frm.show();

frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public void clear()

{

txtlogname.setText("");

passwordfield.setText("");

}

public void cancel()

{

frm.dispose();

}

//......................actionPerformed

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if (str.equals("Login"))

{

login();

NAME : Pawan kumar SinghROLL NO. : 520827293

33

Clinic Management System

}

if (str.equals("Clear"))

{

clear();

}

if (str.equals("Cancel"))

{

cancel();

}

}

public void login()

{

log=txtlogname.getText();

pass=passwordfield.getText();

int rec=conn.rsCount("Select User_Name,Password

from User_Master where User_Name='"+log+"' and

Password='"+pass+"'");

if(rec!=1)

JOptionPane.showMessageDialog(null,"Sorry ! \nInvalid User

Name or Password");

else if(rec==1)

{

frm.dispose();

mn=new Menu();

mn.f.setTitle("CLINIC Management

System"+" / User-"+log);

mn.Patient.remove(mn.Exit);

mn.Exit=new JMenuItem("Log Off "+log);

mn.Patient.add(mn.Exit);

}

NAME : Pawan kumar SinghROLL NO. : 520827293

34

Clinic Management System

mn.Exit.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent ae)

{

mn.f.dispose();

Login lg=new Login();

lg.displayLogin();

}

});

}

public static void main(String args[])

{

Connecting conn=new Connecting();

int rec=conn.rsCount("Select * from

User_Master");

if(rec!=0)

{

Login lg=new Login();

lg.displayLogin();

}else{

JOptionPane.showMessageDialog(null,"There is no any

user ! \nYou have to create atleat\none user to start this

project!","Welcome to CMS",JOptionPane.INFORMATION_MESSAGE);

User u=new User();

u.btDelete.setEnabled(false);

}

}

}

MENU CLASS

import java.awt.*;

NAME : Pawan kumar SinghROLL NO. : 520827293

35

Clinic Management System

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

class Menu

{

Login log=new Login();

Report rpt;

JFrame f;

JMenuBar menubar;

JMenuItem

Patient,Billing,Service,Admin,Report,Exit,Payment,Quit;

JMenuItem

Consultant,Registration,Appointment,AdvRec,AdvRecDet;

JMenuItem

CrCard,PayMode,PayDet,SerMas,Drug,Generic,Bill,CrUser;

JMenuItem

rptConsultant,rptConAll,rptConType,rptPatient,rptPatDay,PatMonth,r

ptPatDate,before,after,patDept;

JMenuItem

rptAdvRec,AdvPat,AdvDate,AdvDay,AdvBefore,AdvAfter,AdvMY,chLo

g;

String sql="";

Menu()

{

f=new JFrame();

f.setLayout(null);

menubar=new JMenuBar();

Patient=new JMenu("Patient");

Billing=new JMenu("Billing");

Service=new JMenu("Services");

NAME : Pawan kumar SinghROLL NO. : 520827293

36

Clinic Management System

Report=new JMenu("Reports");

Admin=new JMenu("Administrator");

Payment=new JMenu("Payment");

rptConsultant=new JMenu("Consultant");

rptPatient=new JMenu("Patient");

rptPatDate=new JMenu("Registration");

rptAdvRec=new JMenu("Advance Receipt");

AdvDate=new JMenu("Billing");

//......................Patient Menu.......................................

Registration=new JMenuItem("Registartion");

Patient.add(Registration);

Appointment=new JMenuItem("Appointment");

Patient.add(Appointment);

Patient.add(new JSeparator());

Exit=new JMenuItem("Exit");

Patient.add(Exit);

Quit=new JMenuItem("Exit");

Patient.add(Quit);

//...............Billing Menu.......................................

Bill=new JMenuItem("Billing Class");

Billing.add(Bill);

AdvRec=new JMenuItem("Advance Receipt");

Billing.add(AdvRec);

AdvRecDet=new JMenuItem("Advance Receipt Detail");

Billing.add(AdvRecDet);

//............... Payment Menu.........................................

CrCard=new JMenuItem("Credit Card");

Payment.add(CrCard);

PayMode=new JMenuItem("Payment Mode");

Payment.add(PayMode);

PayDet=new JMenuItem("Payment Detail");

NAME : Pawan kumar SinghROLL NO. : 520827293

37

Clinic Management System

Payment.add(PayDet);

//........... Service Menu

SerMas=new JMenuItem("Service");

Service.add(SerMas);

Drug=new JMenuItem("Drugs");

Service.add(Drug);

Generic=new JMenuItem("Generic");

Service.add(Generic);

//.....................Adminstrator

Consultant=new JMenuItem("Consultant");

Admin.add(Consultant);

CrUser=new JMenuItem("Create / Delete User");

Admin.add(CrUser);

chLog=new JMenuItem("Change Password");

Admin.add(chLog);

/*-----------REPORT MENU---------*/

rptConAll=new JMenuItem("All");

rptConsultant.add(rptConAll);

rptConType=new JMenuItem("Type");

rptConsultant.add(rptConType);

Report.add(rptConsultant);

patDept=new JMenuItem("Department");

rptPatient.add(patDept);

rptPatDay=new JMenuItem("Date");

rptPatDate.add(rptPatDay);

before=new JMenuItem("Before Date");

rptPatDate.add(before);

after=new JMenuItem("After Date");

rptPatDate.add(after);

PatMonth=new JMenuItem("Month & Year");

rptPatDate.add(PatMonth);

NAME : Pawan kumar SinghROLL NO. : 520827293

38

Clinic Management System

rptPatient.add(rptPatDate);

Report.add(rptPatient);

AdvPat=new JMenuItem("Patient");

rptAdvRec.add(AdvPat);

AdvDay=new JMenuItem("Date");

AdvDate.add(AdvDay);

AdvBefore=new JMenuItem("Before Date");

AdvDate.add(AdvBefore);

AdvAfter=new JMenuItem("After Date");

AdvDate.add(AdvAfter);

AdvMY=new JMenuItem("Month & Year");

AdvDate.add(AdvMY);

rptAdvRec.add(AdvDate);

Report.add(rptAdvRec);

/*.....Add Menubar To Form.....*/

menubar.add(Patient);

menubar.add(Billing);

menubar.add(Payment);

menubar.add(Service);

menubar.add(Admin);

menubar.add(Report);

JLabel dev=new JLabel("Developed By :- Pawan kumar

singh ");

dev.setBounds(5,500,200,20);

f.add(dev);

/*.......annonymous class…*/

Registration.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent a)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

39

Clinic Management System

new Registration();

}

});

Consultant.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

new Consultant();

}

});

Appointment.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent ae)

{

new Appointment();

}

});

AdvRec.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new Advance_Receipt();

}

});

AdvRecDet.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new Adv_Rec_Det();

}

});

NAME : Pawan kumar SinghROLL NO. : 520827293

40

Clinic Management System

Bill.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new Billing();

}

});

PayMode.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new PaymentMode();

}

});

PayDet.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new PayDetail();

}

});

CrCard.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new CrMaster();

}

});

SerMas.addActionListener(new ActionListener ()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

41

Clinic Management System

public void actionPerformed(ActionEvent e)

{

new Service_Master();

}

});

Drug.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new Drug_Master();

}

});

Generic.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new Generic_Master();

}

});

CrUser.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

new Administrator();

}

});

chLog.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

42

Clinic Management System

changeLogin log=new

changeLogin();

log.displayLogin();

}

});

Quit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

System.exit(0);

}

});

rptConAll.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

rpt=new Report();

rpt.ReportDisplay("select

Consultant_ID,Consultant_Name,Consultant_Type,Mobile_No,Addres

s,Email,DOB,DOJ from Consultant")

rpt.frm.setTitle("All Consultant Report");

}

});

rptConType.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

43

Clinic Management System

String input=JOptionPane.showInputDialog("Enter Consultant

Type");

rpt=new Report();

rpt.ReportDisplay("Select

Consultant_ID,Consultant_Name,Consultant_Type,Mobile_No,Addres

s,Email,DOB,DOJ from Consultant where

Consultant_Type='"+input+"'");

rpt.frm.setTitle(("Consultant Report of '" +input+"' Department

").toUpperCase());

}

});

patDept.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

String

input=JOptionPane.showInputDialog("Enter Department Name");

rpt=new Report();

rpt.ReportDisplay("Select

Patient_Id,FName,MName,LName,Reg_Category,Consultant_ID,DOB,

Mobile_No,Address,Reg_Dt from Registration where

Dept='"+input+"'");

rpt.frm.setTitle(("Patient Report of '" +input+"' Department

").toUpperCase());

}

});

rptPatDay.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

NAME : Pawan kumar SinghROLL NO. : 520827293

44

Clinic Management System

{

String input=JOptionPane.showInputDialog("Enter Date in (MM-DD-

YY) Form");

rpt=new Report();

rpt.ReportDisplay("Select

Patient_Id,FName,MName,LName,Reg_Category,Consultant_ID,DOB,

Mobile_No,Address,Reg_Dt from Registration where

Reg_Dt='"+input+"'");

rpt.frm.setTitle("Patient Report Who Registered On '" +input+"' ");

}

});

before.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

String input=JOptionPane.showInputDialog("Enter Date in

(MM-DD-YY) Form");

rpt=new Report();

rpt.ReportDisplay("Select

Patient_Id,FName,MName,LName,Reg_Category,Consultant_ID,DOB,

Mobile_No,Address,Reg_Dt from Registration where

Reg_Dt<'"+input+"'");

rpt.frm.setTitle("Patient Report Who Registered Before '" +input+"'

");

}

});

after.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

NAME : Pawan kumar SinghROLL NO. : 520827293

45

Clinic Management System

{

String input=JOptionPane.showInputDialog("Enter Date in

(MM-DD-YY) Form");

rpt=new Report();

rpt.ReportDisplay("Select

Patient_Id,FName,MName,LName,Reg_Category,Consultant_ID,DOB,

Mobile_No,Address,Reg_Dt from Registration where

Reg_Dt>'"+input+"'");

rpt.frm.setTitle("Patient Report Who Registered After '" +input+"' ");

}

});

PatMonth.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

String input=JOptionPane.showInputDialog("Enter Month & Year in

(MM-YY) Form");

String y=input.substring(3,5);

String m=input.substring(0,2);

String my=m+"-11-"+y;

rpt=new Report();

rpt.ReportDisplay("Select

Patient_Id,FName,MName,LName,Reg_Category,Consultant_ID,DOB,

Mobile_No,Address,Reg_Dt from Registration where

datepart(mm,Reg_Dt)=datepart(mm,'"+my+"') and

datepart(yy,Reg_Dt)=datepart(yy,'"+my+"')");

rpt.frm.setTitle("Patient Report Who Registered in Month '" +m+"' of

Year '"+y+"' ");

}

});

NAME : Pawan kumar SinghROLL NO. : 520827293

46

Clinic Management System

AdvPat.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

String input=JOptionPane.showInputDialog("Enter Patient ID");

rpt=new Report();

rpt.ReportDisplay("Select * from Advance_Receipt where

Patient_ID='"+input+"'");rpt.frm.setTitle(("Advance Receipt of

Patient ID '" +input+"'").toUpperCase());

}

});

AdvDay.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

String input=JOptionPane.showInputDialog("Enter Date in (MM-DD-

YY) Form");

rpt=new Report();

rpt.ReportDisplay("Select * from Advance_Receipt where

Bill_Date='"+input+"'");

rpt.frm.setTitle("Advance Receipt Which Generated On '" +input+"'

");

}

});

AdvBefore.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

NAME : Pawan kumar SinghROLL NO. : 520827293

47

Clinic Management System

{

String input=JOptionPane.showInputDialog("Enter Date in

(MM-DD-YY) Form");

rpt=new Report();

rpt.ReportDisplay("Select * from Advance_Receipt where

Bill_Date<'"+input+"'");

rpt.frm.setTitle("Advance Receipt Which Generated in Before

'" +input+"' ");

}

});

AdvAfter.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent e)

{

String input=JOptionPane.showInputDialog("Enter Date in

(MM-DD-YY) Form");

rpt=new Report();

rpt.ReportDisplay("Select * from Advance_Receipt where

Bill_Date>'"+input+"'");

rpt.frm.setTitle("Advance Receipt Which Generated After '"

+input+"' ");

}

});

AdvMY.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

e)

{

String input=JOptionPane.showInputDialog("Enter Month & Year in

(MM-YY) Form");

NAME : Pawan kumar SinghROLL NO. : 520827293

48

Clinic Management System

String y=input.substring(3,5);

String m=input.substring(0,2);

String my=m+"-11-"+y;

rpt=new Report();

rpt.ReportDisplay("Select * from Advance_Receipt where

datepart(mm,Bill_Date)=datepart(mm,'"+my+"') and

datepart(yy,Bill_Date)=datepart(yy,'"+my+"')");

rpt.frm.setTitle("Advance Receipt Which Generated in Month '"

+m+"' of Year '"+y+"' ");

}

});

/*..........Display Frame .............................................*/

Container con=f.getContentPane();

f.setJMenuBar(menubar);

f.pack();

f.setTitle("CLINIC MANAGEMENT SYSTEM");

f.setVisible(true);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setSize(800,590);

f.show();

}

public static void main(String args[])

{

Menu m=new Menu();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

49

Clinic Management System

REGISTRATION CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

import java.util.*;

public class Registration implements WindowListener,KeyListener

{

Connecting conn=new Connecting();

Registration()

{

display();

}

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField

txtpid,txtrc,txtpt,txtdate,txtdept,txtfname,txtmname,txtlname,txtdo

b;

NAME : Pawan kumar SinghROLL NO. : 520827293

50

Clinic Management System

JTextField txtocc,txtrem,txtadd,txtmob;

JFrame frm;

JComboBox cmbcid,cmbgender,cmbms;

String []gender={"Male","Female"};

String []ms={"Maried","Unmaried"};

String sex="",mstatus="";

boolean found=false;

boolean text=false;

public void display()

{

frm=new JFrame("Registration....");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbpid=new JLabel("Patient ID");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbpid,gbc);

cont.add(lbpid);

lbpid.setForeground(new

Color(0,0,255));

lbpid.setFont(new Font("Courier

new",Font.BOLD,15));

txtpid=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

NAME : Pawan kumar SinghROLL NO. : 520827293

51

Clinic Management System

grid.setConstraints(txtpid,gbc);

txtpid.setEnabled(false);

cont.add(txtpid);

txtpid.setForeground(new Color(0,0,0));

txtpid.setFont(new Font("Courier

new",Font.BOLD,15));

txtpid.setBackground(new

Color(255,175,175));

JLabel lbcat=new JLabel("Reg. Category");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbcat,gbc);

cont.add(lbcat);

lbcat.setForeground(new

Color(0,0,255));

lbcat.setFont(new Font("Courier

new",Font.BOLD,15));

txtrc=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtrc,gbc);

cont.add(txtrc);

txtrc.setForeground(new

Color(0,0,0));

txtrc.setFont(new Font("Courier

new",Font.BOLD,15));

txtrc.setBackground(new

Color(255,175,175));

JLabel lbpt=new JLabel("Patient Type");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

NAME : Pawan kumar SinghROLL NO. : 520827293

52

Clinic Management System

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbpt,gbc);

cont.add(lbpt);

lbpt.setForeground(new

Color(0,0,255));

lbpt.setFont(new Font("Courier

new",Font.BOLD,15));

txtpt=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

grid.setConstraints(txtpt,gbc);

cont.add(txtpt);

txtpt.setForeground(new

Color(0,0,0));

txtpt.setFont(new Font("Courier

new",Font.BOLD,15));

txtpt.setBackground(new

Color(255,175,175));

JLabel lbdep=new JLabel("Department");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbdep,gbc);

cont.add(lbdep);

lbdep.setForeground(new

Color(0,0,255));

lbdep.setFont(new Font("Courier

new",Font.BOLD,15));

txtdept=new JTextField(10);

gbc.gridx=1; gbc.gridy=3;

grid.setConstraints(txtdept,gbc);

cont.add(txtdept);

NAME : Pawan kumar SinghROLL NO. : 520827293

53

Clinic Management System

txtdept.setForeground(new Color(0,0,0));

txtdept.setFont(new Font("Courier

new",Font.BOLD,15));

txtdept.setBackground(new

Color(255,175,175));

JLabel lbcid=new

JLabel("Consultant ID");

gbc.gridx=0; gbc.gridy=4;

grid.setConstraints(lbcid,gbc);

cont.add(lbcid);

lbcid.setForeground(new Color(0,0,255));

lbcid.setFont(new Font("Courier

new",Font.BOLD,15));

cmbcid=new JComboBox();

gbc.gridx=1; gbc.gridy=4;

gbc.ipadx=50;gbc.ipady=-0;

grid.setConstraints(cmbcid,gbc);

cont.add(cmbcid);

cmbcid.setForeground(new Color(0,0,0));

cmbcid.setFont(new Font("Courier

new",Font.BOLD,15));

cmbcid.setBackground(new

Color(255,175,175));

JLabel lbfn=new JLabel("First Name");

gbc.gridx=0; gbc.gridy=5;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(lbfn,gbc);

cont.add(lbfn);

lbfn.setForeground(new Color(0,0,255));

lbfn.setFont(new Font("Courier

new",Font.BOLD,15));

NAME : Pawan kumar SinghROLL NO. : 520827293

54

Clinic Management System

txtfname=new JTextField(10);

gbc.gridx=1; gbc.gridy=5;

grid.setConstraints(txtfname,gbc);

cont.add(txtfname);

txfname.setForeground(new Color(0,0,0));

txtfname.setFont(new Font("Courier

new",Font.BOLD,15));

txtfname.setBackground(new

Color(255,175,175));

JLabel lbmn=new JLabel("Middle Name");

gbc.gridx=0; gbc.gridy=6;

gbc.ipadx=10;

grid.setConstraints(lbmn,gbc);

cont.add(lbmn);

lbmn.setForeground(new Color(0,0,255));

lbmn.setFont(new Font("Courier

new",Font.BOLD,15));

txtmname=new JTextField(10);

gbc.gridx=1; gbc.gridy=6;

grid.setConstraints(txtmname,gbc);

cont.add(txtmname);

txtmname.setForeground(new Color(0,0,0));

txtmname.setFont(new Font("Courier

new",Font.BOLD,15));

txtmname.setBackground(new

Color(255,175,175));

JLabel lbln=new JLabel("Last Name");

gbc.gridx=0; gbc.gridy=7;

gbc.ipadx=10;

grid.setConstraints(lbln,gbc);

cont.add(lbln);

lbln.setForeground(new Color(0,0,255));

NAME : Pawan kumar SinghROLL NO. : 520827293

55

Clinic Management System

lbln.setFont(new Font("Courier

new",Font.BOLD,15));

txtlname=new JTextField(10);

gbc.gridx=1; gbc.gridy=7;

grid.setConstraints(txtlname,gbc);

cont.add(txtlname);

txtlname.setForeground(new Color(0,0,0));

txtlname.setFont(new Font("Courier

new",Font.BOLD,15));

txtlname.setBackground(new

Color(255,175,175));

JLabel lbdate=new JLabel("Date");

gbc.gridx=2; gbc.gridy=0;

gbc.ipadx=10;

grid.setConstraints(lbdate,gbc);

cont.add(lbdate);

lbdate.setForeground(new Color(0,0,255));

lbdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtdate=new JTextField(10);

gbc.gridx=3; gbc.gridy=0;

txtdate.setEnabled(false);

txtdate.setBackground(Color.blue);

grid.setConstraints(txtdate,gbc);

cont.add(txtdate);

txtdate.setForeground(new Color(0,0,0));

txtdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtdate.setBackground(new

Color(255,175,175));

JLabel lbdob=new JLabel("D.O.B.");

NAME : Pawan kumar SinghROLL NO. : 520827293

56

Clinic Management System

gbc.gridx=2; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbdob,gbc);

cont.add(lbdob);

lbdob.setForeground(new Color(0,0,255));

lbdob.setFont(new Font("Courier

new",Font.BOLD,15));

txtdob=new JTextField(10);

gbc.gridx=3; gbc.gridy=1;

grid.setConstraints(txtdob,gbc);

cont.add(txtdob);

txtdob.setForeground(new Color(0,0,0));

txtdob.setFont(new Font("Courier

new",Font.BOLD,15));

txtdob.setBackground(new

Color(255,175,175));

JLabel lbgen=new JLabel("Gender");

gbc.gridx=2; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbgen,gbc);

cont.add(lbgen);

lbgen.setForeground(new Color(0,0,255));

lbgen.setFont(new Font("Courier

new",Font.BOLD,15));

cmbgender=new JComboBox(gender);

gbc.gridx=3; gbc.gridy=2;

gbc.ipadx=54;gbc.ipady=0;

grid.setConstraints(cmbgender,gbc);

cont.add(cmbgender);

cmbgender.setForeground(new Color(0,0,0));

NAME : Pawan kumar SinghROLL NO. : 520827293

57

Clinic Management System

cmbgender.setFont(new Font("Courier

new",Font.BOLD,15));

cmbgender.setBackground(new

Color(255,175,175));

JLabel lbms=new JLabel("Marital Status");

gbc.gridx=2; gbc.gridy=3;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(lbms,gbc);

cont.add(lbms);

lbms.setForeground(new Color(0,0,255));

lbms.setFont(new Font("Courier

new",Font.BOLD,15));

cmbms=new JComboBox(ms);

gbc.gridx=3; gbc.gridy=3;

gbc.ipadx=40;gbc.ipady=0;

grid.setConstraints(cmbms,gbc);

cont.add(cmbms);

cmbms.setForeground(new Color(0,0,0));

cmbms.setFont(new Font("Courier

new",Font.BOLD,15));

cmbms.setBackground(new Color(255,175,175));

JLabel lbocc=new JLabel("Occupation");

gbc.gridx=2; gbc.gridy=4;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(lbocc,gbc);

cont.add(lbocc);

lbocc.setForeground(new Color(0,0,255));

lbocc.setFont(new Font("Courier new",Font.BOLD,15));

txtocc=new JTextField(10);

gbc.gridx=3; gbc.gridy=4;

grid.setConstraints(txtocc,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

58

Clinic Management System

cont.add(txtocc);

txtocc.setForeground(new Color(0,0,0));

txtocc.setFont(new Font("Courier new",Font.BOLD,15));

txtocc.setBackground(new Color(255,175,175));

JLabel lbadd=new JLabel("Address");

gbc.gridx=2; gbc.gridy=5;

gbc.ipadx=10;

grid.setConstraints(lbadd,gbc);

cont.add(lbadd);

lbadd.setForeground(new Color(0,0,255));

lbadd.setFont(new Font("Courier

new",Font.BOLD,15));

txtadd=new JTextField(10);

gbc.gridx=3; gbc.gridy=5;

grid.setConstraints(txtadd,gbc);

cont.add(txtadd);

txtadd.setForeground(new Color(0,0,0));

txtadd.setFont(new Font("Courier

new",Font.BOLD,15));

txtadd.setBackground(new Color(255,175,175));

JLabel lbmob=new JLabel("Mobile");

gbc.gridx=2; gbc.gridy=6;

gbc.ipadx=10;

grid.setConstraints(lbmob,gbc);

cont.add(lbmob);

lbmob.setForeground(new Color(0,0,255));

lbmob.setFont(new Font("Courier

new",Font.BOLD,15));

txtmob=new JTextField(10);

NAME : Pawan kumar SinghROLL NO. : 520827293

59

Clinic Management System

gbc.gridx=3; gbc.gridy=6;

grid.setConstraints(txtmob,gbc);

cont.add(txtmob);

txtmob.setForeground(new Color(0,0,0));

txtmob.setFont(new Font("Courier new",Font.BOLD,15));

txtmob.setBackground(new Color(255,175,175));

JLabel lbrem=new JLabel("Remarks");

gbc.gridx=2; gbc.gridy=7;

gbc.ipadx=10;

grid.setConstraints(lbrem,gbc);

cont.add(lbrem);

lbrem.setForeground(new Color(0,0,255));

lbrem.setFont(new Font("Courier

new",Font.BOLD,15));

txtrem=new JTextField(10);

gbc.gridx=3; gbc.gridy=7;

grid.setConstraints(txtrem,gbc);

cont.add(txtrem);

txtrem.setForeground(new Color(0,0,0));

txtrem.setFont(new Font("Courier

new",Font.BOLD,15));

txtrem.setBackground(new Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=9;

gbc.ipadx=29;gbc.ipady=0;

gbc.insets=new

Insets(15,35,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

NAME : Pawan kumar SinghROLL NO. : 520827293

60

Clinic Management System

gbc.gridx=1;gbc.gridy=9;

gbc.ipadx=24;

gbc.insets=new Insets(15,10,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=9;

gbc.ipadx=9;

gbc.insets=new Insets(15,-

37,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=3;gbc.gridy=9;

gbc.ipadx=29;

gbc.insets=new Insets(15,-53,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=3;gbc.gridy=9;

gbc.ipadx=19;

gbc.insets=new

Insets(15,40,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

NAME : Pawan kumar SinghROLL NO. : 520827293

61

Clinic Management System

frm.addWindowListener(this);

frm.pack();

frm.setSize(600,465);

frm.setLocation(100,60);

frm.setVisible(true);

frm.setResizable(false);

frm.show();

txtmob.addKeyListener(this);

btAdd.addActionListener(new

ActionListener ()

{

public void

onPerformed(ActionEvent ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener

()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

62

Clinic Management System

public void actionPerformed(ActionEvent

ae)

{

search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void loadConsultant()

{

String str="select Consultant_ID from Consultant order by

Consultant_ID";

conn.connect();

try{

conn.st=conn.con.createStatement();

conn.rs=conn.st.executeQuery(str);

NAME : Pawan kumar SinghROLL NO. : 520827293

63

Clinic Management System

while(conn.rs.next())

{

String item=conn.rs.getString(1);

cmbcid.addItem(item);

}

}catch(Exception e){}

}

public boolean check()

{

conn.setRequire(txtrc,"Registration Category");

conn.setRequire(txtpt,"Patient Type");

if(conn.rsCount("select * from Consultant")==0)

{

JOptionPane.showMessageDialog(null,"There is no

Consultant !");

return false;

}

else

return true;

}

public void add()

{

generateID();

if(check())

{

String id=txtpid.getText();

String rc=txtrc.getText();

String pt=txtpt.getText();

String date=txtdate.getText();

String dept=txtdept.getText();

Object cid=cmbcid.getSelectedItem();

String fn=txtfname.getText();

NAME : Pawan kumar SinghROLL NO. : 520827293

64

Clinic Management System

String mn=txtmname.getText();

String ln=txtlname.getText();

String dob=txtdob.getText();

String occ=txtocc.getText();

String rem=txtrem.getText();

String add=txtadd.getText();

String mob=txtmob.getText();

int gender=cmbgender.getSelectedIndex();

if(gender==0)

sex="M";

else

sex="F";

int ms=cmbms.getSelectedIndex();

if(ms==0)

mstatus="M";

else

mstatus="U";

conn.connect();

try{

pst=conn.con.prepareStatement("insert

into Registration values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

pst.setString(1,id);

pst.setString(2,rc);

pst.setString(3,pt);

pst.setString(4,date);

pst.setString(5,dept);

pst.setObject(6,cid);

pst.setString(7,fn);

pst.setString(8,mn);

pst.setString(9,ln);

pst.setString(10,dob);

pst.setString(11,sex);

NAME : Pawan kumar SinghROLL NO. : 520827293

65

Clinic Management System

pst.setString(12,mstatus);

pst.setString(13,occ);

pst.setString(14,rem);

pst.setString(15,add);

pst.setString(16,mob);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Record Added !\nThe Patient

ID is "+id);

clear();

}catch(Exception e){System.out.println(e.getMessage());}

}

}

public void delete()

{

String str=txtpid.getText();

String sp="delete from Registration where

Patient_ID='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?\

n"+str);

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

66

Clinic Management System

}

}

catch (Exception e) { }

}

public void clear()

{

txtpid.setText("");

txtrc.setText("");

txtpt.setText("");

txtdate.setText("");

txtdept.setText("");

txtfname.setText("");

txtmname.setText("");

txtlname.setText("");

txtdob.setText("");

txtocc.setText("");

txtrem.setText("");

txtadd.setText("");

txtdob.setText("");

txtmob.setText("");

cmbcid.setSelectedIndex(0);

cmbgender.setSelectedIndex(0);

cmbms.setSelectedIndex(0);

found=false;

}

public void edit()

{

String id=txtpid.getText();

String rc=txtrc.getText();

String pt=txtpt.getText();

String date=txtdate.getText();

NAME : Pawan kumar SinghROLL NO. : 520827293

67

Clinic Management System

String dept=txtdept.getText();

Object cid=cmbcid.getSelectedItem();

String fn=txtfname.getText();

String mn=txtmname.getText();

String ln=txtlname.getText();

String dob=txtdob.getText();

String occ=txtocc.getText();

String rem=txtrem.getText();

String add=txtadd.getText();

String mob=txtmob.getText();

int gender=cmbgender.getSelectedIndex();

if(gender==0)

sex="M";

else

sex="F";

int ms=cmbms.getSelectedIndex();

if(ms==0)

mstatus="M";

else

mstatus="U";

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Registration set

Patient_ID=?,Reg_Category=?,Patient_Type=?,Reg_Dt=?,Dept=?,Co

nsultant_ID=?,FName=?,MName=?,LName=?,DOB=?,Gender=?,Mar

ital_Status=?,Occupation=?,Remarks=?,Address=?,Mobile_No=?

where Patient_Id='"+id+"'");

pst.setString(1,id);

pst.setString(2,rc);

pst.setString(3,pt);

NAME : Pawan kumar SinghROLL NO. : 520827293

68

Clinic Management System

pst.setString(4,date);

pst.setString(5,dept);

pst.setObject(6,cid);

pst.setString(7,fn);

pst.setString(8,mn);

pst.setString(9,ln);

pst.setString(10,dob);

pst.setString(11,sex);

pst.setString(12,mstatus);

pst.setString(13,occ);

pst.setString(14,rem);

pst.setString(15,add);

pst.setString(16,mob);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

clear();

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void generateID()

{

txtdate.setText(conn.sysDate());

try{

conn.connect();

conn.st=conn.con.createStatement(ResultSet.TYPE_SCROLL_SENSITI

VE,ResultSet.CONCUR_UPDATABLE);

NAME : Pawan kumar SinghROLL NO. : 520827293

69

Clinic Management System

conn.rs=conn.st.executeQuery("select

Patient_Id from Registration where Reg_Dt='"+conn.sysDate()+"'");

int row=0;

while(conn.rs.next())

{row++;}

if(row!=0)

{ conn.rs.last();

String id=conn.rs.getString(1);

String pid=id.substring(6,8);

int n=Integer.parseInt(pid);

n++;

if(String.valueOf(n).length()<2)

id=0+String.valueOf(n);

else

id=String.valueOf(n);

String

i=conn.sysDate().substring(3,5)+conn.sysDate().substring(0,2)+con

n.sysDate().substring(6,8)+id;

txtpid.setText(i);

conn.rs.beforeFirst();

}

Else

txtpid.setText(conn.sysDate().substring(3,5)+conn.sysDate().substri

ng(0,2)+conn.sysDate().substring(6,8)+"01");

}catch(Exception e){}

}

public void search()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

70

Clinic Management System

String input=JOptionPane.showInputDialog("Enter the Pataient

ID").toUpperCase();

ResultSet rst=conn.getResult("select * from

Registration where Patient_Id='"+input+"'");

try{

rst.first();

txtpid.setText(rst.getString(1));

txtrc.setText(rst.getString(2));

txtpt.setText(rst.getString(3));

txtdate.setText(rst.getString(4).substring(0,10));

txtdept.setText(rst.getString(5));

String cid=rst.getString(6);

txtfname.setText(rst.getString(7));

txtmname.setText(rst.getString(8));

txtlname.setText(rst.getString(9));

txtdob.setText(rst.getString(10).substring(0,10));

String gen=rst.getString(11);

String ms=rst.getString(12);

txtocc.setText(rst.getString(13));

txtrem.setText(rst.getString(14));

txtadd.setText(rst.getString(15));

txtmob.setText(rst.getString(16));

if(gen.equals("M"))

cmbgender.setSelectedIndex(0);

else

cmbgender.setSelectedIndex(1);

if(ms.equals("M"))

cmbms.setSelectedIndex(0);

else

NAME : Pawan kumar SinghROLL NO. : 520827293

71

Clinic Management System

cmbms.setSelectedIndex(1);

loadConsultant();

for(int

i=0;i<=cmbcid.getItemCount();i++)

{

String cm=cmbcid.getItemAt(i).toString();

if(cid.equals(cm))

{

cmbcid.setSelectedIndex(i);

break;

}

}

txtdept.select(0,0);

txtadd.select(0,0);

txtrem.select(0,0);

txtocc.select(0,0);

found=true;

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,"Sorry !\nNo match

found !");

}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtmob,ke);

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

public void windowOpened(WindowEvent we){}

public void windowClosed(WindowEvent we){}

NAME : Pawan kumar SinghROLL NO. : 520827293

72

Clinic Management System

public void windowIconified(WindowEvent we){}

public void windowDeiconified(WindowEvent we){}

public void windowActivated(WindowEvent we)

{ if(cmbcid.getItemCount()<1)

loadConsultant();

}

public void windowDeactivated(WindowEvent

we)

{ cmbcid.removeAllItems(); }

public void windowClosing(WindowEvent we){}

public static void main(String agrs[])

{

new Registration();

}

}

CONNECTING CLASS

import java.sql.*;

import java.util.Date;

import javax.swing.*;

import java.awt.event.*;

class Connecting

{

Connection con;

Statement st;

ResultSet rs;

boolean constate=false,text=false;

public Connecting()

NAME : Pawan kumar SinghROLL NO. : 520827293

73

Clinic Management System

{

}

public void connect()

{

Try

{

if(!constate)

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con=DriverManager.getConnection("jdbc:odbc: pawan

",”pawan”,”pawan”);

System.out.println("Connected");

constate=true;

}

}catch (Exception e){}

}

public int rsCount(String sql)

{

int m=0;

try{

connect();

st=con.createStatement();

rs=st.executeQuery(sql);

while(rs.next())

{ m++;}

}catch(Exception e){}

return m;

}

public String sysDate()

{

Date dt=new Date();

NAME : Pawan kumar SinghROLL NO. : 520827293

74

Clinic Management System

int day=dt.getDate();

int mon=dt.getMonth();

int y=dt.getYear();

mon++;

String m=String.valueOf(mon);

if(m.length()<2)

m=0+m;

String ye=String.valueOf(y);

ye=ye.substring(1,3);

String date=m+"-"+day+"-"+ye;

return(date);

}

public void shouldNumber(JTextField txt,KeyEvent ke)

{

int key=ke.getKeyCode();

boolean

textBox=ke.getComponent().equals(txt);

if(textBox)

{

if((key>57 || key<48) && (key>105 || key<96) && key!=8 && key!

=110)

{

txt.setText("");

text=true;

}

else

{

if(text)

{

txt.setText("");

NAME : Pawan kumar SinghROLL NO. : 520827293

75

Clinic Management System

text=false;

}

}

}

}

public void generateID(JTextField txt,String sql,String

startAs)

{

try{

connect();

st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultS

et.CONCUR_UPDATABLE);

rs=st.executeQuery(sql);

int row=0;

while(rs.next())

{row++;}

if(row!=0)

{ rs.last();

String id=rs.getString(1);

String pid=id.substring(2,6);

int n=Integer.parseInt(pid);

n++;

if(String.valueOf(n).length()<2)

id="000"+String.valueOf(n);

else

if(String.valueOf(n).length()<3)

id="00"+String.valueOf(n);

else

if(String.valueOf(n).length()<4)

id="0"+String.valueOf(n);

NAME : Pawan kumar SinghROLL NO. : 520827293

76

Clinic Management System

else

id=String.valueOf(n);

String i=startAs+id;

txt.setText(i);

rs.beforeFirst();

}

else

txt.setText(startAs+"0001");

}catch(Exception e){}

}

public boolean setRequire(JTextField txt,String message)

{

if(txt.getText().equals(""))

{

JOptionPane.showMessageDialog(null,message+"

can't be blank !","Data

Required",JOptionPane.INFORMATION_MESSAGE);

return false;

}

else

return true;

}

public ResultSet getResult(String sql)

{

try{

connect();

NAME : Pawan kumar SinghROLL NO. : 520827293

77

Clinic Management System

st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultS

et.CONCUR_UPDATABLE);

rs=st.executeQuery(sql);

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,e.getMessage(),"Error",JOptio

nPane.ERROR_MESSAGE);

}

return rs;

}

public static void main(String agrs[])

{

Connecting c=new Connecting();

}

}

CONSULTANT CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Consultant implements KeyListener

{

Connecting conn=new Connecting();

Consultant()

{

display();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

78

Clinic Management System

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField

txtcid,txtname,txtmrid,txtcn,txtct,txtmob,txtph,txtadd,txtemail,txtd

ob,txtdoj;

JFrame frm;

boolean found=false;

public void display()

{

frm=new JFrame("Consultant Details");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbcid=new JLabel("ID");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbcid,gbc);

cont.add(lbcid);

lbcid.setForeground(new Color(0,0,255));

lbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtcid=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

txtcid.setEnabled(false);

NAME : Pawan kumar SinghROLL NO. : 520827293

79

Clinic Management System

txtcid.setBackground(Color.BLUE);

grid.setConstraints(txtcid,gbc);

cont.add(txtcid);

txtcid.setForeground(new Color(0,0,0));

txtcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtcid.setBackground(new Color(255,175,175));

JLabel lbname=new JLabel("Name");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbname,gbc);

cont.add(lbname);

lbname.setForeground(new Color(0,0,255));

lbname.setFont(new Font("Courier

new",Font.BOLD,15));

txtname=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtname,gbc);

cont.add(txtname);

xtname.setForeground(new Color(0,0,0));

txtname.setFont(new Font("Courier

new",Font.BOLD,15));

txtname.setBackground(new

Color(255,175,175));

JLabel lbmrid=new JLabel("MR ID");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbmrid,gbc);

cont.add(lbmrid);

NAME : Pawan kumar SinghROLL NO. : 520827293

80

Clinic Management System

lbmrid.setForeground(new Color(0,0,255));

lbmrid.setFont(new Font("Courier

new",Font.BOLD,15));

txtmrid=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

grid.setConstraints(txtmrid,gbc);

cont.add(txtmrid);

txtmrid.setForeground(new Color(0,0,0));

txtmrid.setFont(new Font("Courier

new",Font.BOLD,15));

txtmrid.setBackground(new

Color(255,175,175));

JLabel lbnature=new JLabel("Nature");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbnature,gbc);

cont.add(lbnature);

lbnature.setForeground(new Color(0,0,255));

lbnature.setFont(new Font("Courier

new",Font.BOLD,15));

txtcn=new JTextField(10);

gbc.gridx=1; gbc.gridy=3;

grid.setConstraints(txtcn,gbc);

cont.add(txtcn);

txtcn.setForeground(new Color(0,0,0));

txtcn.setFont(new Font("Courier

new",Font.BOLD,15));

txtcn.setBackground(new Color(255,175,175));

JLabel lbtype=new JLabel("Type");

gbc.gridx=0; gbc.gridy=4;

NAME : Pawan kumar SinghROLL NO. : 520827293

81

Clinic Management System

gbc.ipadx=10;

grid.setConstraints(lbtype,gbc);

cont.add(lbtype);

lbtype.setForeground(new Color(0,0,255));

lbtype.setFont(new Font("Courier

new",Font.BOLD,15));

txtct=new JTextField(10);

gbc.gridx=1; gbc.gridy=4;

grid.setConstraints(txtct,gbc);

cont.add(txtct);

txtpid.setForeground(new Color(0,0,0));

txtct.setFont(new Font("Courier

new",Font.BOLD,15));

txtct.setBackground(new

Color(255,175,175));

JLabel lbmob=new JLabel("Mobile");

gbc.gridx=0; gbc.gridy=5;

gbc.ipadx=10;

grid.setConstraints(lbmob,gbc);

cont.add(lbmob);

lbmob.setForeground(new Color(0,0,255));

lbmob.setFont(new Font("Courier

new",Font.BOLD,15));

txtmob=new JTextField(10);

gbc.gridx=1; gbc.gridy=5;

grid.setConstraints(txtmob,gbc);

cont.add(txtmob);

txtmob.setForeground(new

Color(0,0,0));

NAME : Pawan kumar SinghROLL NO. : 520827293

82

Clinic Management System

txtmob.setFont(new Font("Courier

new",Font.BOLD,15));

txtmob.setBackground(new Color(255,175,175));

JLabel lbph=new JLabel("Phone");

gbc.gridx=2; gbc.gridy=0;

gbc.ipadx=10;

grid.setConstraints(lbph,gbc);

cont.add(lbph);

lbph.setForeground(new Color(0,0,255));

lbph.setFont(new Font("Courier

new",Font.BOLD,15));

txtph=new JTextField(10);

gbc.gridx=3; gbc.gridy=0;

grid.setConstraints(txtph,gbc);

cont.add(txtph);

txtph.setForeground(new Color(0,0,0));

txtph.setFont(new Font("Courier

new",Font.BOLD,15));

txtph.setBackground(new Color(255,175,175));

JLabel lbadd=new JLabel("Address");

gbc.gridx=2; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbadd,gbc);

cont.add(lbadd);

lbadd.setForeground(new Color(0,0,255));

lbadd.setFont(new Font("Courier

new",Font.BOLD,15));

txtadd=new JTextField(10);

gbc.gridx=3; gbc.gridy=1;

grid.setConstraints(txtadd,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

83

Clinic Management System

cont.add(txtadd);

txtadd.setForeground(new Color(0,0,0));

txtadd.setFont(new Font("Courier

new",Font.BOLD,15));

txtadd.setBackground(new Color(255,175,175));

JLabel lbemail=new JLabel("E-Mail");

gbc.gridx=2; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbemail,gbc);

cont.add(lbemail);

lbemail.setForeground(new Color(0,0,255));

lbemail.setFont(new Font("Courier

new",Font.BOLD,15));

txtemail=new JTextField(10);

gbc.gridx=3; gbc.gridy=2;

grid.setConstraints(txtemail,gbc);

cont.add(txtemail);

txtemail.setForeground(new Color(0,0,0));

txtemail.setFont(new Font("Courier

new",Font.BOLD,15));

txtemail.setBackground(new

Color(255,175,175));

JLabel lbdob=new JLabel("D.O.B.");

gbc.gridx=2; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbdob,gbc);

cont.add(lbdob);

lbdob.setForeground(new Color(0,0,255));

lbdob.setFont(new Font("Courier

new",Font.BOLD,15));

txtdob=new JTextField(10);

NAME : Pawan kumar SinghROLL NO. : 520827293

84

Clinic Management System

gbc.gridx=3; gbc.gridy=3;

grid.setConstraints(txtdob,gbc);

cont.add(txtdob);

txtdob.setForeground(new Color(0,0,0));

txtdob.setFont(new Font("Courier new",Font.BOLD,15));

txtdob.setBackground(new Color(255,175,175));

JLabel lbdoj=new JLabel("D.O.J.");

gbc.gridx=2; gbc.gridy=4;

gbc.ipadx=10;

grid.setConstraints(lbdoj,gbc);

cont.add(lbdoj);

txtdoj=new JTextField(10);

gbc.gridx=3; gbc.gridy=4;

grid.setConstraints(txtdoj,gbc);

cont.add(txtdoj);

txtpid.setForeground(new Color(0,0,0));

txtdoj.setFont(new Font("Courier

new",Font.BOLD,15));

txtdoj.setBackground(new Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=6;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new

Insets(15,35,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=6;

gbc.ipadx=15;

gbc.insets=new Insets(15,10,0,0);

NAME : Pawan kumar SinghROLL NO. : 520827293

85

Clinic Management System

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=6;

gbc.ipadx=0;

gbc.insets=new Insets(15,-

45,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=3;gbc.gridy=6;

gbc.ipadx=20;

gbc.insets=new Insets(15,-37,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=3;gbc.gridy=6;

gbc.ipadx=10;

gbc.insets=new

Insets(15,50,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

// ------------------Frame Properties---------------

NAME : Pawan kumar SinghROLL NO. : 520827293

86

Clinic Management System

txtmob.addKeyListener(this);

frm.pack();

frm.setSize(500,370); //Size of window

frm.setLocation(160,110); //set the

window

frm.setVisible(true);

frm.setResizable(false); //Resized the

window...

frm.show();

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

search();

NAME : Pawan kumar SinghROLL NO. : 520827293

87

Clinic Management System

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void add()

{

txtdoj.setText(conn.sysDate());

conn.generateID(txtcid,"select Consultant_ID from

Consultant","CN");

boolean fill=conn.setRequire(txtname,"Name");

fill=conn.setRequire(txtmrid,"MR ID");

fill=conn.setRequire(txtcn,"Cosultant Nature");

fill=conn.setRequire(txtct,"Cosultant Type");

if(fill)

NAME : Pawan kumar SinghROLL NO. : 520827293

88

Clinic Management System

{

String id=txtcid.getText();

String name=txtname.getText();

String mrid=txtmrid.getText();

String cn=txtcn.getText();

String ct=txtct.getText();

String mob=txtmob.getText();

String ph=txtph.getText();

String add=txtadd.getText();

String email=txtemail.getText();

String dob=txtdob.getText();

String doj=txtdoj.getText();

conn.connect();

try{

pst=conn.con.prepareStatement("insert

into Consultant values(?,?,?,?,?,?,?,?,?,?,?)");

pst.setString(1,id);

pst.setString(2,name);

pst.setString(3,mrid);

pst.setString(4,cn);

pst.setString(5,ct);

pst.setString(6,mob);

pst.setString(7,ph);

pst.setString(8,add);

pst.setString(9,email);

pst.setString(10,dob);

pst.setString(11,doj);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Record Added !\nThe

Consultant ID is "+id);

clear();

NAME : Pawan kumar SinghROLL NO. : 520827293

89

Clinic Management System

}catch(Exception e)

{System.out.println(e.getMessage());}

}

}

public void delete()

{

String str=txtcid.getText();

String sp="delete from Consultant where

Consultant_ID='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?\

n"+str);

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void edit()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

90

Clinic Management System

String id=txtcid.getText();

String name=txtname.getText();

String mrid=txtmrid.getText();

String cn=txtcn.getText();

String ct=txtct.getText();

String mob=txtmob.getText();

String ph=txtph.getText();

String add=txtadd.getText();

String email=txtemail.getText();

String dob=txtdob.getText();

String doj=txtdoj.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Consultant set

Consultant_ID=?,Consultant_Name=?,Medical_Reg_ID=?,Consultant

_Nature=?,Consultant_Type=?,Mobile_No=?,Phone_No=?,Address=?

,Email=?,DOB=?,DOJ=? where Consultant_ID='"+id+"'");

pst.setString(1,id);

pst.setString(2,name);

pst.setString(3,mrid);

pst.setString(4,cn);

pst.setString(5,ct);

pst.setString(6,mob);

pst.setString(7,ph);

pst.setString(8,add);

pst.setString(9,email);

pst.setString(10,dob);

pst.setString(11,doj);

pst.executeUpdate();

NAME : Pawan kumar SinghROLL NO. : 520827293

91

Clinic Management System

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void search()

{

String input=JOptionPane.showInputDialog("Enter

the Cosultant ID").toUpperCase();

ResultSet rst=conn.getResult("select * from Consultant where

Consultant_ID='"+input+"'");

try{

rst.first();

txtcid.setText(rst.getString(1));

txtname.setText(rst.getString(2));

txtmrid.setText(rst.getString(3));

txtcn.setText(rst.getString(4));

txtct.setText(rst.getString(5));

txtmob.setText(rst.getString(6));

txtph.setText(rst.getString(7));

txtadd.setText(rst.getString(8));

txtadd.select(0,0);

txtemail.setText(rst.getString(9));

txtemail.select(0,0);

txtdob.setText(rst.getString(10).substring(0,10));

txtdoj.setText(rst.getString(11).substring(0,10));

txtname.select(0,0);

NAME : Pawan kumar SinghROLL NO. : 520827293

92

Clinic Management System

found=true;

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,"Sorry !\nNo match

found !");

}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtmob,ke);

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

public static void main(String agrs[])

{

new Consultant();

}

}

ADMINSTARATOR CLASS

NAME : Pawan kumar SinghROLL NO. : 520827293

93

Clinic Management System

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class Administrator implements ActionListener

{

Connecting conn=new Connecting();

JFrame frm;

JLabel logname,password;

Container con;

JButton blogin,bcancel,bclear,welcome;

JTextField txtlogname;

JPasswordField passwordfield;

JPanel panel;

JTabbedPane tpan;

String log="admin",pass="welcome";

Administrator()

{

displayLogin();

}

public void displayLogin()

{

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm=new JFrame("Administrtor Login Required");

frm.setLayout(grid);

con=frm.getContentPane();

logname=new JLabel("User Name");

gbc.ipadx=10;

NAME : Pawan kumar SinghROLL NO. : 520827293

94

Clinic Management System

gbc.ipady=5;

gbc.insets=new Insets(15,0,0,0);

gbc.gridx=0;

gbc.gridy=0;

grid.setConstraints(logname,gbc);

con.add(logname);

logname.setForeground(new Color(0,0,255));

logname.setFont(new Font("Courier

new",Font.BOLD,15));

txtlogname=new JTextField(12);

gbc.gridx=1;

gbc.gridy=0;

grid.setConstraints(txtlogname,gbc);

con.add(txtlogname);

txtlogname.setForeground(new Color(0,0,0));

txtlogname.setFont(new Font("Courier

new",Font.BOLD,15));

txtlogname.setBackground(new

Color(255,175,175));

password=new JLabel("Password");

gbc.gridx=0;

gbc.gridy=1;

grid.setConstraints(password,gbc);

con.add(password);

password.setForeground(new Color(0,0,255));

password.setFont(new Font("Courier

new",Font.BOLD,15));

passwordfield=new JPasswordField(12);

gbc.gridx=1;

gbc.gridy=1;

grid.setConstraints(passwordfield,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

95

Clinic Management System

con.add(passwordfield);

passwordfield.setForeground(new Color(0,0,0));

passwordfield.setFont(new Font("Courier

new",Font.BOLD,15));

passwordfield.setBackground(new

Color(255,175,175));

blogin=new JButton("Login");

gbc.gridx=0;gbc.gridy=2;

gbc.ipady=0;

gbc.insets=new Insets(20,15,0,10);

gbc.anchor=GridBagConstraints.WEST;

grid.setConstraints(blogin,gbc);

con.add(blogin);

bclear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=2;

gbc.insets=new Insets(20,-5,0,0);

grid.setConstraints(bclear,gbc);

con.add(bclear);

bcancel=new JButton("Cancel");

gbc.gridx=2;gbc.gridy=2;

gbc.ipadx=0;

gbc.insets=new Insets(20,-73,0,0);

grid.setConstraints(bcancel,gbc);

con.add(bcancel);

//......................ActionListener

blogin.addActionListener(this);

bclear.addActionListener(this);

bcancel.addActionListener(this);

//.......................Frame

frm.setSize(300,200);

frm.setResizable(false);

NAME : Pawan kumar SinghROLL NO. : 520827293

96

Clinic Management System

frm.setLocation(250,190);

frm.setVisible(true);

frm.show();

}

public void clear()

{

txtlogname.setText("");

passwordfield.setText("");

}

public void cancel()

{

frm.dispose();

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if (str.equals("Login"))

{

login();

}

if (str.equals("Clear"))

{

clear();

}

if (str.equals("Cancel"))

{

cancel();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

97

Clinic Management System

public void login()

{

String userName=txtlogname.getText();

String password=passwordfield.getText();

if(userName.equals(log)&&

password.equals(pass))

{

JOptionPane.showMessageDialog(null,"Welcome !\n"+"

Sir");

frm.dispose();

new User();

}

else

JOptionPane.showMessageDialog(null,"Sorry ! \nInvalid User Name

Or Password");

}

public static void main(String args[])

{

new Administrator();

}

}

Adv_Rec_Det CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

NAME : Pawan kumar SinghROLL NO. : 520827293

98

Clinic Management System

public class Adv_Rec_Det implements

WindowListener,KeyListener

{

Connecting conn=new Connecting();

Adv_Rec_Det()

{

display();

}

JLabel lbcode,lbname,lbccode;

JComboBox cmbbno,cmbsid;

JTextField txtqty;

JFrame frm;

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

boolean found=false;

public void display()

{

frm=new JFrame("Advace Receipt Deails");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

lbcode=new JLabel("Bill NO");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=0;

gbc.insets=new Insets(10,-30,0,0);

grid.setConstraints(lbcode,gbc);

cont.add(lbcode);

NAME : Pawan kumar SinghROLL NO. : 520827293

99

Clinic Management System

lbcode.setForeground(new Color(0,0,255));

lbcode.setFont(new Font("Courier new",Font.BOLD,15));

cmbbno=new JComboBox();

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=32;

grid.setConstraints(cmbbno,gbc);

cont.add(cmbbno);

cmbbno.setForeground(new Color(0,0,0));

cmbbno.setFont(new Font("Courier new",Font.BOLD,15));

cmbbno.setBackground(new Color(255,175,175));

lbname=new JLabel("Service ID");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=38;gbc.ipady=0;

grid.setConstraints(lbname,gbc);

cont.add(lbname);

lbname.setForeground(new Color(0,0,255));

lbname.setFont(new Font("Courier new",Font.BOLD,15));

cmbsid=new JComboBox();

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(cmbsid,gbc);

cont.add(cmbsid);

cmbsid.setForeground(new Color(0,0,0));

cmbsid.setFont(new Font("Courier

new",Font.BOLD,15));

cmbsid.setBackground(new Color(255,175,175));

lbccode=new JLabel("Quantity");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=0;gbc.ipady=0;

NAME : Pawan kumar SinghROLL NO. : 520827293

100

Clinic Management System

grid.setConstraints(lbccode,gbc);

cont.add(lbccode);

lbccode.setForeground(new Color(0,0,255));

lbccode.setFont(new Font("Courier

new",Font.BOLD,15));

txtqty=new JTextField();

gbc.gridx=1; gbc.gridy=2;

gbc.ipadx=80; gbc.ipady=5;

grid.setConstraints(txtqty,gbc);

cont.add(txtqty);

txtqty.setForeground(new Color(0,0,0));

txtqty.setFont(new Font("Courier

new",Font.BOLD,15));

txtqty.setBackground(new Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new Insets(10,-30,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=3;

gbc.ipadx=15;

gbc.insets=new Insets(10,-33,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new JButton("Search");

gbc.gridx=2;gbc.gridy=3;

NAME : Pawan kumar SinghROLL NO. : 520827293

101

Clinic Management System

gbc.ipadx=0;

gbc.insets=new Insets(10,-35,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=0;gbc.gridy=4;

gbc.ipadx=20;

gbc.insets=new Insets(2,5,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new JButton("Delete");

gbc.gridx=1;gbc.gridy=4;

gbc.ipadx=10;

gbc.insets=new Insets(2,2,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

txtqty.addKeyListener(this);

//------------Frame Properties----------

frm.addWindowListener(this);

frm.pack();

frm.setSize(300,250); //Size of window

frm.setLocation(250,150); //set the window

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

NAME : Pawan kumar SinghROLL NO. : 520827293

102

Clinic Management System

{

add();

clear();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

NAME : Pawan kumar SinghROLL NO. : 520827293

103

Clinic Management System

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void loadBill()

{

String str="select Bill_No from Advance_Receipt order by Bill_No";

conn.connect();

try{

conn.st=conn.con.createStatement();

conn.rs=conn.st.executeQuery(str);

while(conn.rs.next())

{

String item=conn.rs.getString(1);

cmbbno.addItem(item);

}

}catch(Exception e){}

}

public void loadService()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

104

Clinic Management System

String str="select Service_ID from Service_Master order by

Service_ID";

conn.connect();

try{

conn.st=conn.con.createStatement();

conn.rs=conn.st.executeQuery(str);

while(conn.rs.next())

{

String item=conn.rs.getString(1);

cmbsid.addItem(item);

}

}catch(Exception e){}

}

public void add()

{

Object bno=cmbbno.getSelectedItem();

Object sid=cmbsid.getSelectedItem();

String qty=txtqty.getText();

boolean fill=conn.setRequire(txtqty,"Quantity");

if(fill)

{

conn.connect();

try{

pst=conn.con.prepareStatement("insert into

Advance_Receipt_Details values(?,?,?)");

pst.setObject(1,bno);

pst.setObject(2,sid);

pst.setString(3,qty);

pst.executeUpdate();

NAME : Pawan kumar SinghROLL NO. : 520827293

105

Clinic Management System

JOptionPane.showMessageDialog(null,"Record

Added !");

clear();

System.out.println("Record Added");

}catch(Exception e){}

}

}

public void clear()

{

cmbbno.setSelectedIndex(0);

cmbsid.setSelectedIndex(0);

txtqty.setText("");

found=false;

}

public void delete()

{

Object str=cmbbno.getSelectedItem();

String sp="delete from Advance_Receipt_Details where

Bill_No='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?");

if(d==0)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

106

Clinic Management System

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void edit()

{

Object bno=cmbbno.getSelectedItem();

Object sid=cmbsid.getSelectedItem();

String qty=txtqty.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Advance_Receipt_Details set Bill_No=?,Service_ID=?,Qty=? where

Bill_No='"+bno+"'");

pst.setObject(1,bno);

pst.setObject(2,sid);

pst.setString(3,qty);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e){}

}

public void search()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

107

Clinic Management System

String

input=JOptionPane.showInputDialog("Enter the Bill

Numner").toUpperCase();

ResultSet rst=conn.getResult("select * from

Advance_Receipt_Details where Bill_No='"+input+"'");

try{

rst.first();

String bno=rst.getString(1);

String sid=rst.getString(2);

txtqty.setText(rst.getString(3));

loadBill();

loadService();

for(int i=0;i<=20;i++)

{

String cm=cmbbno.getItemAt(i).toString();

if(bno.equals(cm))

{

cmbbno.setSelectedIndex(i);

break;

}

}

for(int i=0;i<=20;i++)

{

String cm=cmbsid.getItemAt(i).toString();

if(sid.equals(cm))

{

cmbsid.setSelectedIndex(i);

break;

}

NAME : Pawan kumar SinghROLL NO. : 520827293

108

Clinic Management System

}

found=true;

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,"Sorry !\nNo match

found !");

}

}

public static void main(String agrs[])

{

new Adv_Rec_Det();

}

}

APPOINTMENT CLASS

import javax.swing.InputVerifier;

import javax.swing.JComponent;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

import javax.swing.text.JTextComponent;

public class Appointment implements WindowListener

{

Connecting conn=new Connecting();

Appointment()

{

display();

}

PreparedStatement pst;

NAME : Pawan kumar SinghROLL NO. : 520827293

109

Clinic Management System

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField txtaid,txtadt;

JComboBox cmbstatus,cmbpid,cmbcid;

JFrame frm;

String active[]={"P","C","X"};

boolean found=false;

public void display()

{

frm=new JFrame("Appointment...");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbbcid=new JLabel("Appointment

ID");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbbcid,gbc);

cont.add(lbbcid);

lbbcid.setForeground(new Color(0,0,255));

lbbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtaid=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

gbc.insets=new Insets(10,-10,0,0);

NAME : Pawan kumar SinghROLL NO. : 520827293

110

Clinic Management System

grid.setConstraints(txtaid,gbc);

cont.add(txtaid);

txtaid.setForeground(new Color(0,0,0));

txtaid.setFont(new Font("Courier

new",Font.BOLD,15));

txtaid.setBackground(new Color(255,175,175));

JLabel lbdes=new JLabel("Patient ID");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbdes,gbc);

cont.add(lbdes);

lbdes.setForeground(new Color(0,0,255));

lbdes.setFont(new Font("Courier

new",Font.BOLD,15));

cmbpid=new JComboBox();

gbc.gridx=1; gbc.gridy=1;

gbc.ipadx=38; gbc.ipady=0;

gbc.insets=new Insets(10,-10,0,0);

grid.setConstraints(cmbpid,gbc);

cont.add(cmbpid);

cmbpid.setForeground(new Color(0,0,0));

cmbpid.setFont(new Font("Courier

new",Font.BOLD,15));

cmbpid.setBackground(new Color(255,175,175));

gbc.ipadx=53;

gbc.insets=new Insets(10,20,0,0);

JLabel lbdis=new JLabel("Consultant ID");

gbc.gridx=0; gbc.gridy=2;

gbc.insets=new Insets(10,20,0,0);

NAME : Pawan kumar SinghROLL NO. : 520827293

111

Clinic Management System

grid.setConstraints(lbdis,gbc);

cont.add(lbdis);

lbpid.setForeground(new Color(0,0,255));

lbpid.setFont(new Font("Courier

new",Font.BOLD,15));

cmbcid=new JComboBox();

gbc.gridx=1; gbc.gridy=2;

gbc.ipadx=50; gbc.ipady=0;

gbc.insets=new Insets(10,-10,0,0);

grid.setConstraints(cmbcid,gbc);

cont.add(cmbcid);

cmbcid.setForeground(new Color(0,0,0));

cmbcid.setFont(new Font("Courier

new",Font.BOLD,15));

cmbcid.setBackground(new Color(255,175,175));

JLabel lbefdate=new JLabel("Date & Time");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbefdate,gbc);

cont.add(lbefdate);

lbefdate.setForeground(new Color(0,0,255));

cmbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtadt=new JTextField(10);

gbc.gridx=1; gbc.gridy=3;

gbc.ipady=5;

gbc.insets=new Insets(10,-10,0,0);

grid.setConstraints(txtadt,gbc);

cont.add(txtadt);

txtadt.setForeground(new Color(0,0,0));

NAME : Pawan kumar SinghROLL NO. : 520827293

112

Clinic Management System

txtadt.setFont(new Font("Courier

new",Font.BOLD,15));

txtadt.setBackground(new Color(255,175,175));

JLabel lbact=new JLabel("Status");

gbc.gridx=0; gbc.gridy=4;

gbc.ipadx=10;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbact,gbc);

cont.add(lbact);

lbact.setForeground(new Color(0,0,255));

lbact.setFont(new Font("Courier

new",Font.BOLD,15));

cmbstatus=new JComboBox(active);

gbc.gridx=1; gbc.gridy=4;

gbc.ipadx=0;gbc.ipady=-3;

gbc.insets=new Insets(10,-10,0,0);

grid.setConstraints(cmbstatus,gbc);

cont.add(cmbstatus);

cmbstatus.setForeground(new Color(0,0,0));

cmbstatus.setFont(new Font("Courier

new",Font.BOLD,15));

cmbstatus.setBackground(new

Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=6;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new

Insets(10,15,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

NAME : Pawan kumar SinghROLL NO. : 520827293

113

Clinic Management System

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=6;

gbc.ipadx=15;

gbc.insets=new Insets(10,-50,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=6;

gbc.ipadx=0;

gbc.insets=new Insets(10,-

78,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=0;gbc.gridy=7;

gbc.ipadx=20;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=1;gbc.gridy=7;

gbc.ipadx=10;

gbc.insets=new Insets(10,-

50,0,0);

grid.setConstraints(btDelete,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

114

Clinic Management System

cont.add(btDelete);

// ------------------Frame Properties---------------

frm.addWindowListener(this);

frm.pack();

frm.setSize(400,350); //Size of window

frm.setLocation(160,110); //set the

window

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new

ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

NAME : Pawan kumar SinghROLL NO. : 520827293

115

Clinic Management System

{

public void actionPerformed(ActionEvent

ae)

{

search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{ edit(); }

});

}

public void add()

{

conn.generateID(txtaid,"select Appointment_ID from

Appointment","AP");

String id=txtaid.getText();

Object pid=cmbpid.getSelectedItem();

Object cid=cmbcid.getSelectedItem();

NAME : Pawan kumar SinghROLL NO. : 520827293

116

Clinic Management System

String dt=txtadt.getText();

Object act=cmbstatus.getSelectedItem();

if(dt.equals(""))

JOptionPane.showMessageDialog(null,"Date Time can't be

blank !");

else

{

conn.connect();

try{

pst=conn.con.prepareStatement("insert into Appointment

values(?,?,?,?,?)");

pst.setString(1,id);

pst.setObject(2,pid);

pst.setObject(3,cid);

pst.setString(4,dt);

pst.setObject(5,act);

pst.executeUpdate();

System.out.println("Record Added");

clear();

}catch(Exception e){System.out.println(e.getMessage());}

}

}

public void delete()

{

String str=txtaid.getText();

String sp="delete from Appointment where

Appointment_ID='"+str+"'";

try

{

conn.connect();

NAME : Pawan kumar SinghROLL NO. : 520827293

117

Clinic Management System

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?");

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void edit()

{

String id=txtaid.getText();

Object pid=cmbpid.getSelectedItem();

Object cid=cmbcid.getSelectedItem();

String dt=txtadt.getText();

Object act=cmbstatus.getSelectedItem();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Appointment set

Appointment_ID=?,Patient_ID=?,Consultant_ID=?,Appt_Date_Time=

?,Status=? where Appointment_ID='"+id+"'");

pst.setString(1,id);

pst.setObject(2,pid);

pst.setObject(3,cid);

NAME : Pawan kumar SinghROLL NO. : 520827293

118

Clinic Management System

pst.setString(4,dt);

pst.setObject(5,act);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

clear();

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void search()

{

String input=JOptionPane.showInputDialog("Enter

the Appointment ID").toUpperCase();

ResultSet rst=conn.getResult("select * from Appointment

where Appointment_ID='"+input+"'");

try{

rst.first();

txtaid.setText(rst.getString(1));

String s=rst.getString(2);

String ps=rst.getString(3);

txtadt.setText(rst.getString(4).substring(0,10));

String act=rst.getString(5);

if(act.equals("P"))

cmbstatus.setSelectedIndex(0);

else if(act.equals("C"))

cmbstatus.setSelectedIndex(1);

else

cmbstatus.setSelectedIndex(2);

loadPatient();

NAME : Pawan kumar SinghROLL NO. : 520827293

119

Clinic Management System

loadConsultant();

for(int i=0;i<=cmbpid.getItemCount();i++)

{

String cm=cmbpid.getItemAt(i).toString();

if(s.equals(cm))

{

cmbpid.setSelectedIndex(i);

break;

}

}

for(int i=0;i<=cmbcid.getItemCount();i++)

{

String cm=cmbcid.getItemAt(i).toString();

if(ps.equals(cm))

{

cmbcid.setSelectedIndex(i);

break;

}

}

found=true;

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,"Sorry !\nNo match

found !");

}

}} public static void main(String agrs[])

{

new Appointment();

}

}

BILLING CLASS

NAME : Pawan kumar SinghROLL NO. : 520827293

120

Clinic Management System

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Billing implements KeyListener

{

Connecting conn=new Connecting();

Billing()

{

display();

}

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField txtbcid,txtdes,txtdis,txtefdate,txtetdate;

JComboBox cmbact;

JFrame frm;

String active[]={"Y","N"};

boolean found=false;

public void display()

{

frm=new JFrame("Billing...");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbbcid=new JLabel("Billing ID");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

NAME : Pawan kumar SinghROLL NO. : 520827293

121

Clinic Management System

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbbcid,gbc);

cont.add(lbbcid);

lbbcid.setForeground(new Color(0,0,255));

lbbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtbcid=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

grid.setConstraints(txtbcid,gbc);

cont.add(txtbcid);

txtbcid.setEnabled(false);

txtbcid.setForeground(new

Color(0,0,0));

txtbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtbcid.setBackground(new

Color(255,175,175));

JLabel lbdes=new JLabel("Description");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbdes,gbc);

cont.add(lbdes);

lbdes.setForeground(new Color(0,0,255));

lbdes.setFont(new Font("Courier

new",Font.BOLD,15));

txtdes=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtdes,gbc);

cont.add(txtdes);

txtdes.setForeground(new Color(0,0,0));

NAME : Pawan kumar SinghROLL NO. : 520827293

122

Clinic Management System

txtdes.setFont(new Font("Courier new",Font.BOLD,15));

txtdes.setBackground(new Color(255,175,175));

gbc.insets=new Insets(10,20,0,0);

JLabel lbdis=new JLabel("Discount(%)");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbdis,gbc);

cont.add(lbdis);

lbdis.setForeground(new Color(0,0,255));

lbdis.setFont(new Font("Courier new",Font.BOLD,15));

txtdis=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

grid.setConstraints(txtdis,gbc);

cont.add(txtdis);

JLabel lbefdate=new JLabel("Effective From");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbefdate,gbc);

cont.add(lbefdate);

lbefdate.setForeground(new Color(0,0,255));

lbefdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtefdate=new JTextField(10);

gbc.gridx=1; gbc.gridy=3;

grid.setConstraints(txtefdate,gbc);

cont.add(txtefdate);

txtefdate.setForeground(new Color(0,0,0));

txtefdate.setFont(new Font("Courier

new",Font.BOLD,15));

NAME : Pawan kumar SinghROLL NO. : 520827293

123

Clinic Management System

txtefdate.setBackground(new

Color(255,175,175));

JLabel lbetdate=new JLabel("Effective To");

gbc.gridx=0; gbc.gridy=4;

gbc.ipadx=10;

grid.setConstraints(lbetdate,gbc);

cont.add(lbetdate);

lbetdate.setForeground(new Color(0,0,255));

lbetdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtetdate=new JTextField(10);

gbc.gridx=1; gbc.gridy=4;

grid.setConstraints(txtetdate,gbc);

cont.add(txtetdate);

txtetdate.setForeground(new Color(0,0,0));

txtetdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtetdate.setBackground(new

Color(255,175,175));

JLabel lbact=new JLabel("Active");

gbc.gridx=0; gbc.gridy=5;

gbc.ipadx=10;

grid.setConstraints(lbact,gbc);

cont.add(lbact);

lbact.setForeground(new Color(0,0,255));

lbact.setFont(new Font("Courier

new",Font.BOLD,15));

cmbact=new JComboBox(active);

gbc.gridx=1; gbc.gridy=5;

NAME : Pawan kumar SinghROLL NO. : 520827293

124

Clinic Management System

gbc.ipadx=0;gbc.ipady=-3;

grid.setConstraints(cmbact,gbc);

cont.add(cmbact);

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=6;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new

Insets(10,15,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=6;

gbc.ipadx=15;

gbc.insets=new Insets(10,0,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=6;

gbc.ipadx=0;

gbc.insets=new Insets(10,-

45,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=0;gbc.gridy=7;

gbc.ipadx=20;

NAME : Pawan kumar SinghROLL NO. : 520827293

125

Clinic Management System

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=1;gbc.gridy=7;

gbc.ipadx=10;

gbc.insets=new

Insets(10,0,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

// ------------------Frame Properties---------------

txtdis.addKeyListener(this);

frm.pack();

frm.setSize(400,350); //Size of window

frm.setLocation(160,110); //set the window

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

126

Clinic Management System

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

NAME : Pawan kumar SinghROLL NO. : 520827293

127

Clinic Management System

public void add()

{

conn.generateID(txtbcid,"select ID from Billing_Class","BL");

String id=txtbcid.getText();

String des=txtdes.getText();

String dis=txtdis.getText();

String ef=txtefdate.getText();

String et=txtetdate.getText();

Object act=cmbact.getSelectedItem();

if(dis.equals(""))

dis="0";

boolean

fill=conn.setRequire(txtdes,"Description");

if(fill)

{

conn.connect();

try{

pst=conn.con.prepareStatement("insert into Billing_Class

values(?,?,?,?,?,?)");

pst.setString(1,id);

pst.setString(2,des);

pst.setString(3,dis);

pst.setString(4,ef);

pst.setString(5,et);

pst.setObject(6,act);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Record Added !\nThe Billing

ID is "+id);

System.out.println("Record Added");

clear();

NAME : Pawan kumar SinghROLL NO. : 520827293

128

Clinic Management System

}catch(Exception e)

{System.out.println(e.getMessage());}

}

}

public void delete()

{

String str=txtbcid.getText();

String sp="delete from Billing_Class where

ID='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?\

n"+str);

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void clear()

{

txtbcid.setText("");

NAME : Pawan kumar SinghROLL NO. : 520827293

129

Clinic Management System

txtdes.setText("");

txtdis.setText("");

txtefdate.setText("");

txtetdate.setText("");

cmbact.setSelectedIndex(0);

found=false;

}

public void edit()

{

String id=txtbcid.getText();

String des=txtdes.getText();

String dis=txtdis.getText();

String ef=txtefdate.getText();

String et=txtetdate.getText();

Object act=cmbact.getSelectedItem();

try{

conn.connect();

pst=conn.con.prepareStatement("Update Billing_Class

set

ID=?,Description=?,Discount_Percentage=?,Effective_From=?,Effect

ive_To=?,Active=? where ID='"+id+"'");

pst.setString(1,id);

pst.setString(2,des);

pst.setString(3,dis);

pst.setString(4,ef);

pst.setString(5,et);

pst.setObject(6,act);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,id+"\

nUpdated !");

NAME : Pawan kumar SinghROLL NO. : 520827293

130

Clinic Management System

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void search()

{

String

input=JOptionPane.showInputDialog("Enter the Billing

ID").toUpperCase();

ResultSet rst=conn.getResult("select * from

Billing_Class where ID='"+input+"'");

try{

rst.first();

txtbcid.setText(rst.getString(1));

txtdes.setText(rst.getString(2));

txtdes.select(0,0);

txtdis.setText(rst.getString(3));

txtefdate.setText(rst.getString(4).substring(0,10));

txtetdate.setText(rst.getString(5).substring(0,10));

String act=rst.getString(6);

if(act.equals("Y"))

cmbact.setSelectedIndex(0);

else

cmbact.setSelectedIndex(1);

found=true;

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,"Sorry !\nNo match

found !");

NAME : Pawan kumar SinghROLL NO. : 520827293

131

Clinic Management System

}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtdis,ke);

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

public static void main(String agrs[])

{

new Billing();

}

}

CREDIT MASTER CLASS

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

import javax.swing.JOptionPane;

public class CrMaster

{

Connecting conn=new Connecting();

CrMaster()

{

display();

NAME : Pawan kumar SinghROLL NO. : 520827293

132

Clinic Management System

}

JLabel lbCode,lbName;

JTextField txtCode,txtDes;

PreparedStatement pst;

JFrame frm;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

boolean found=false;

public void display()

{

frm=new JFrame("Credit Card");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

lbCode=new JLabel("Code");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbCode,gbc);

cont.add(lbCode);

lbcode.setForeground(new Color(0,0,255));

lbcode.setFont(new Font("Courier

new",Font.BOLD,15));

txtCode=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=-20;

txtCode.setEnabled(false);

txtCode.setBackground(Color.BLUE);

grid.setConstraints(txtCode,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

133

Clinic Management System

cont.add(txtCode);

txtcode.setForeground(new Color(0,0,0));

txtcode.setFont(new Font("Courier

new",Font.BOLD,15));

txtcode.setBackground(new Color(255,175,175));

lbName=new JLabel("Description");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbName,gbc);

cont.add(lbName);

lbName.setForeground(new Color(0,0,255));

lbName.setFont(new Font("Courier

new",Font.BOLD,15));

txtDes=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtDes,gbc);

cont.add(txtDes);

txtDes.setForeground(new Color(0,0,0));

txtDes.setFont(new Font("Courier

new",Font.BOLD,15));

txtDes.setBackground(new Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=2;

NAME : Pawan kumar SinghROLL NO. : 520827293

134

Clinic Management System

gbc.ipadx=15;

gbc.insets=new Insets(10,8,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new JButton("Search");

gbc.gridx=2;gbc.gridy=2;

gbc.ipadx=0;

gbc.insets=new Insets(10,-45,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=0;gbc.gridy=3;

gbc.ipadx=20;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new JButton("Delete");

gbc.gridx=1;gbc.gridy=3;

gbc.ipadx=10;

gbc.insets=new Insets(10,8,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

//------------Frame Properties----------

frm.pack();

frm.setSize(350,250); //Size of window

frm.setLocation(160,110); //set the window

frm.setVisible(true);

frm.setResizable(false); //Resized the window...

frm.show();

//---------Button Add Event Handler--------

NAME : Pawan kumar SinghROLL NO. : 520827293

135

Clinic Management System

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

NAME : Pawan kumar SinghROLL NO. : 520827293

136

Clinic Management System

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void add()

{

conn.generateID(txtCode,"select Code from

CreditCard_Master","CC");

String code=txtCode.getText();

String name=txtDes.getText();

boolean fill=conn.setRequire(txtDes,"Description");

if(fill)

{

conn.connect();

try{

pst=conn.con.prepareStatement("insert into

CreditCard_Master values(?,?)");

pst.setString(1,code.toUpperCase());

pst.setString(2,name.toUpperCase());

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Record

Added !");

clear();

NAME : Pawan kumar SinghROLL NO. : 520827293

137

Clinic Management System

System.out.println("Record Added");

}catch(Exception e){}

}

}

public void clear()

{

txtCode.setText("");

txtDes.setText("");

found=false;

}

public void delete()

{

String str=txtCode.getText();

String sp="delete from CreditCard_Master where

Code='"+str+"'";

Try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?\

n"+str);

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

138

Clinic Management System

}

}

catch (Exception e) { }

}

public void edit()

{

String code=txtCode.getText();

String name=txtDes.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

CreditCard_Master set Code=?,Description=? where

Code='"+code+"'");

pst.setString(1,code.toUpperCase());

pst.setString(2,name.toUpperCase());

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

clear();

}catch(Exception e){}

}

public void search()

{

String input=JOptionPane.showInputDialog("Enter the

Code").toUpperCase();

ResultSet rst=conn.getResult("select *

from CreditCard_Master where Code='"+input+"'");

try{

rst.first();

NAME : Pawan kumar SinghROLL NO. : 520827293

139

Clinic Management System

txtCode.setText(rst.getString(1));

txtDes.setText(rst.getString(2));

txtDes.select(0,0);

found=true;

}catch(Exception e)

{

JOptionPane.showMessageDialog(null,"Sorry !\nNo match

found !");

}

}

public static void main(String agrs[])

{

CrMaster c=new CrMaster();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

140

Clinic Management System

DRUG CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Drug_Master implements KeyListener

{

Connecting conn=new Connecting();

Drug_Master()

{

display();

}

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField

txtcode,txtname,txtcn,txtuom,txtstock,txtman,txtex,txtshape;

JFrame frm;

boolean found=false;

public void display()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

141

Clinic Management System

frm=new JFrame("Drug Master...");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbbcid=new JLabel("Code");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbbcid,gbc);

cont.add(lbbcid);

lbbcid.setForeground(new Color(0,0,255));

lbbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtcode=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

txtcode.setEnabled(false);

txtcode.setBackground(Color.BLUE);

grid.setConstraints(txtcode,gbc);

cont.add(txtcode);

txtcode.setForeground(new Color(0,0,0));

txtcode.setFont(new Font("Courier

new",Font.BOLD,15));

txtcode.setBackground(new

Color(255,175,175));

JLabel lbdes=new JLabel("Name");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbdes,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

142

Clinic Management System

cont.add(lbdes);

lbdes.setForeground(new Color(0,0,255));

lbdes.setFont(new Font("Courier

new",Font.BOLD,15));

txtname=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtname,gbc);

cont.add(txtname);

txtname.setForeground(new Color(0,0,0));

txtname.setFont(new Font("Courier

new",Font.BOLD,15));

txtname.setBackground(new

Color(255,175,175));

gbc.insets=new Insets(10,20,0,0);

JLabel lbtype=new JLabel("Company

Name");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbtype,gbc);

cont.add(lbtype);

lbtype.setForeground(new Color(0,0,255));

lbtype.setFont(new Font("Courier

new",Font.BOLD,15));

txtcn=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

grid.setConstraints(txtcn,gbc);

cont.add(txtcn);

txtcn.setForeground(new Color(0,0,0));

NAME : Pawan kumar SinghROLL NO. : 520827293

143

Clinic Management System

txtcn.setFont(new Font("Courier new",Font.BOLD,15));

txtcn.setBackground(new Color(255,175,175));

JLabel lbact=new JLabel("Unit of Measure");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbact,gbc);

cont.add(lbact);

lbact.setForeground(new Color(0,0,255));

lbact.setFont(new Font("Courier new",Font.BOLD,15));

txtuom=new JTextField(10);

gbc.gridx=1; gbc.gridy=3;

gbc.ipady=5;

grid.setConstraints(txtuom,gbc);

cont.add(txtuom);

txtuom.setForeground(new Color(0,0,0));

txtuom.setFont(new Font("Courier

new",Font.BOLD,15));

txtuom.setBackground(new Color(255,175,175));

JLabel lbrate=new JLabel("Stock");

gbc.gridx=2; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(lbrate,gbc);

cont.add(lbrate);

lbrate.setForeground(new Color(0,0,255));

lbrate.setFont(new Font("Courier new",Font.BOLD,15));

txtstock=new JTextField(10);

gbc.gridx=3; gbc.gridy=0;

grid.setConstraints(txtstock,gbc);

cont.add(txtstock);

NAME : Pawan kumar SinghROLL NO. : 520827293

144

Clinic Management System

txtstock.setForeground(new Color(0,0,0));

txtstock.setFont(new Font("Courier

new",Font.BOLD,15));

txtstock.setBackground(new Color(255,175,175));

JLabel lbma=new JLabel("Manufacture Date");

gbc.gridx=2; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbma,gbc);

cont.add(lbma);

lbma.setForeground(new Color(0,0,255));

lbma.setFont(new Font("Courier

new",Font.BOLD,15));

txtman=new JTextField(10);

gbc.gridx=3; gbc.gridy=1;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(txtman,gbc);

cont.add(txtman);

txtman.setForeground(new Color(0,0,0));

txtman.setFont(new Font("Courier

new",Font.BOLD,15));

txtman.setBackground(new Color(255,175,175));

JLabel lbefdate=new JLabel("Expiry Date");

gbc.gridx=2; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbefdate,gbc);

cont.add(lbefdate);

lbefdate.setForeground(new Color(0,0,255));

lbefdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtex=new JTextField(10);

gbc.gridx=3; gbc.gridy=2;

NAME : Pawan kumar SinghROLL NO. : 520827293

145

Clinic Management System

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(txtex,gbc);

cont.add(txtex);

txtex.setForeground(new Color(0,0,0));

txtex.setFont(new Font("Courier

new",Font.BOLD,15));

txtex.setBackground(new Color(255,175,175));

JLabel lbetdate=new JLabel("Shape");

gbc.gridx=2; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbetdate,gbc);

cont.add(lbetdate);

lbetdate.setForeground(new Color(0,0,255));

lbetdate.setFont(new Font("Courier

new",Font.BOLD,15));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=6;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new

Insets(25,35,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=6;

gbc.ipadx=15;

gbc.insets=new Insets(25,10,0,0);

cont.add(btClear);

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=6;

NAME : Pawan kumar SinghROLL NO. : 520827293

146

Clinic Management System

gbc.ipadx=0;

gbc.insets=new Insets(25,-

37,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=3;gbc.gridy=6;

gbc.ipadx=25;

gbc.insets=new Insets(25,-74,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=3;gbc.gridy=6;

gbc.ipadx=10;

gbc.insets=new

Insets(25,24,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

txtstock.addKeyListener(this);

// ------------------Frame Properties---------------

frm.pack();

frm.setSize(550,300); //Size of window

frm.setLocation(160,110); //set the

window

NAME : Pawan kumar SinghROLL NO. : 520827293

147

Clinic Management System

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

frm.dispose();

conn.connect();

searchDrug sc=new

searchDrug();

sc.search();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

148

Clinic Management System

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void add()

{

conn.generateID(txtcode,"select Code from

Drug_Master","DR");

String id=txtcode.getText();

String name=txtname.getText();

String cn=txtcn.getText();

String uom=txtuom.getText();

String stock=txtstock.getText();

String md=txtman.getText();

String ed=txtex.getText();

NAME : Pawan kumar SinghROLL NO. : 520827293

149

Clinic Management System

String shape=txtshape.getText();

conn.connect();

try{

pst=conn.con.prepareStatement("insert

into Drug_Master values(?,?,?,?,?,?,?,?)");

pst.setString(1,id);

pst.setString(2,name);

pst.setString(3,cn);

pst.setObject(4,uom);

pst.setString(5,stock);

pst.setString(6,md);

pst.setString(7,ed);

pst.setString(8,shape);

pst.executeUpdate();

System.out.println("Record Added");

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void delete()

{

String str=txtcode.getText();

String sp="delete from Drug_Master where

Code='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

150

Clinic Management System

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?");

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void edit()

{

String id=txtcode.getText();

String name=txtname.getText();

String cn=txtcn.getText();

String uom=txtuom.getText();

String stock=txtstock.getText();

String md=txtman.getText();

String ed=txtex.getText();

String shape=txtshape.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Drug_Master set

Code=?,Name=?,Company_Name=?,Unit_of_Measure=?,Stock_on_H

and=?,Manufacture_Dt=?,Expiry_Dt=?,Shape=? where

Code='"+id+"'");

NAME : Pawan kumar SinghROLL NO. : 520827293

151

Clinic Management System

pst.setString(1,id);

pst.setString(2,name);

pst.setString(3,cn);

pst.setObject(4,uom);

pst.setString(5,stock);

pst.setString(6,md);

pst.setString(7,ed);

pst.setString(8,shape);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e){System.out.println(e.getMessage());}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtstock,ke);

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

public static void main(String agrs[])

{

new Drug_Master();

}

}

GENERIC CLASS

import java.awt.*;

import java.awt.event.*;

NAME : Pawan kumar SinghROLL NO. : 520827293

152

Clinic Management System

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Generic_Master implements KeyListener

{

Connecting conn=new Connecting();

Generic_Master()

{

display();

}

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField txtcode,txtname,txtcn,txtuom,txtstock;

JFrame frm;

boolean found=false;

public void display()

{

frm=new JFrame("Generic Master...");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbbcid=new JLabel("Code");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbbcid,gbc);

cont.add(lbbcid);

txtcode=new JTextField(10);

NAME : Pawan kumar SinghROLL NO. : 520827293

153

Clinic Management System

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

txtcode.setEnabled(false);

txtcode.setBackground(Color.BLUE);

grid.setConstraints(txtcode,gbc);

cont.add(txtcode);

txtcode.setForeground(new Color(0,0,0));

txtcode.setFont(new Font("Courier

new",Font.BOLD,15));

txtcode.setBackground(new

Color(255,175,175));

JLabel lbdes=new JLabel("Name");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbdes,gbc);

cont.add(lbdes);

lbdes.setForeground(new Color(0,0,255));

lbdes.setFont(new Font("Courier

new",Font.BOLD,15));

txtname=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtname,gbc);

cont.add(txtname);

txtname.setForeground(new Color(0,0,0));

txtname.setFont(new Font("Courier

new",Font.BOLD,15));

txtname.setBackground(new

Color(255,175,175));

gbc.insets=new Insets(10,20,0,0);

NAME : Pawan kumar SinghROLL NO. : 520827293

154

Clinic Management System

JLabel lbtype=new JLabel("Company

Name");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbtype,gbc);

cont.add(lbtype);

lbtype.setForeground(new Color(0,0,255));

lbtype.setFont(new Font("Courier

new",Font.BOLD,15));

txtcn=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

grid.setConstraints(txtcn,gbc);

cont.add(txtcn);

txtcn.setForeground(new Color(0,0,0));

txtcn.setFont(new Font("Courier

new",Font.BOLD,15));

txtcn.setBackground(new

Color(255,175,175));

JLabel lbact=new JLabel("Unit of Measure");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbact,gbc);

cont.add(lbact);

lbact.setForeground(new Color(0,0,255));

lbact.setFont(new Font("Courier

new",Font.BOLD,15));

txtuom=new JTextField(10);

gbc.gridx=1; gbc.gridy=3;

gbc.ipady=5;

grid.setConstraints(txtuom,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

155

Clinic Management System

cont.add(txtuom);

txtuom.setForeground(new Color(0,0,0));

txtuom.setFont(new Font("Courier

new",Font.BOLD,15));

txtuom.setBackground(new Color(255,175,175));

JLabel lbrate=new JLabel("Stock");

gbc.gridx=0; gbc.gridy=4;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(lbrate,gbc);

cont.add(lbrate);

lbrate.setForeground(new Color(0,0,255));

lbrate.setFont(new Font("Courier

new",Font.BOLD,15));

txtstock=new JTextField(10);

gbc.gridx=1; gbc.gridy=4;

grid.setConstraints(txtstock,gbc);

cont.add(txtstock);

btAdd=new

JButton("Add");

gbc.gridx=0; gbc.gridy=5;

gbc.ipadx=23;gbc.ipady=0;

gbc.insets=new

Insets(15,20,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=5;

gbc.ipadx=15;

gbc.insets=new Insets(15,0,0,0);

cont.add(btClear);

NAME : Pawan kumar SinghROLL NO. : 520827293

156

Clinic Management System

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=5;

gbc.ipadx=0;

gbc.insets=new Insets(15,-

50,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=0;gbc.gridy=6;

gbc.ipadx=25;

gbc.insets=new Insets(15,20,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=1;gbc.gridy=6;

gbc.ipadx=10;

gbc.insets=new

Insets(15,0,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

txtstock.addKeyListener(this);

// ------------------Frame Properties---------------

frm.pack();

frm.setSize(400,320); //Size of window

NAME : Pawan kumar SinghROLL NO. : 520827293

157

Clinic Management System

frm.setLocation(160,110); //set the

window

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new

ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

btSearch.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

frm.dispose();

conn.connect();

NAME : Pawan kumar SinghROLL NO. : 520827293

158

Clinic Management System

sc.search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void add()

{

conn.generateID(txtcode,"select Code from

Generic_Master","GN");

String id=txtcode.getText();

String name=txtname.getText();

String cn=txtcn.getText();

String uom=txtuom.getText();

String stock=txtstock.getText();

conn.connect();

NAME : Pawan kumar SinghROLL NO. : 520827293

159

Clinic Management System

try{

pst=conn.con.prepareStatement("insert into Generic_Master

values(?,?,?,?,?)");

pst.setString(1,id);

pst.setString(2,name);

pst.setString(3,cn);

pst.setObject(4,uom);

pst.setString(5,stock);

pst.executeUpdate();

System.out.println("Record Added");

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void delete()

{

String str=txtcode.getText();

String sp="delete from Generic_Master where

Code='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?");

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

160

Clinic Management System

}

}

catch (Exception e) { }

}

public void clear()

{

txtcode.setText("");

txtname.setText("");

txtcn.setText("");

txtuom.setText("");

txtstock.setText("");

found=false;

}

public void edit()

{

String id=txtcode.getText();

String name=txtname.getText();

String cn=txtcn.getText();

String uom=txtuom.getText();

String stock=txtstock.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Generic_Master set

Code=?,Name=?,Company_Name=?,Unit_of_Measure=?,Stock_on_H

and=? where Code='"+id+"'");

pst.setString(1,id);

pst.setString(2,name);

pst.setString(3,cn);

pst.setObject(4,uom);

pst.setString(5,stock);

NAME : Pawan kumar SinghROLL NO. : 520827293

161

Clinic Management System

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e)

{System.out.println(e.getMessage());}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtstock,ke);

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

public static void main(String agrs[])

{

new Generic_Master();

}

}

PAYMENT DETAIL CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class PayDetail implements WindowListener,KeyListener

{

Connecting conn=new Connecting();

PayDetail()

{

display();

}

JLabel lbamt,lbdate;

JTextField txtamt,txtdate;

NAME : Pawan kumar SinghROLL NO. : 520827293

162

Clinic Management System

JFrame frm;

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JComboBox cmbbno;

boolean found=false;

public void display()

{

frm=new JFrame("Payment Details");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

lbdate=new JLabel("Bill No");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbdate,gbc);

cont.add(lbdate);

lbdate.setForeground(new Color(0,0,255));

lbdate.setFont(new Font("Courier

new",Font.BOLD,15));

cmbbno=new JComboBox();

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=50; gbc.ipady=0;

grid.setConstraints(cmbbno,gbc);

cont.add(cmbbno);

cmbbno.setForeground(new Color(0,0,0));

cmbbno.setFont(new Font("Courier

new",Font.BOLD,15));

NAME : Pawan kumar SinghROLL NO. : 520827293

163

Clinic Management System

cmbbno.setBackground(new

Color(255,175,175));

lbamt=new JLabel("Amount");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbamt,gbc);

cont.add(lbamt);

lbamt.setForeground(new Color(0,0,255));

lbamt.setFont(new Font("Courier

new",Font.BOLD,15));

txtamt=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

gbc.ipadx=10; gbc.ipady=5;

gbc.insets=new Insets(12,20,0,0);

grid.setConstraints(txtamt,gbc);

cont.add(txtamt);

txtamt.setForeground(new Color(0,0,0));

txtamt.setFont(new Font("Courier

new",Font.BOLD,15));

txtamt.setBackground(new Color(255,175,175));

lbdate=new JLabel("Pay Date");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

gbc.insets=new Insets(12,20,0,0);

grid.setConstraints(lbdate,gbc);

cont.add(lbdate);

lbdate.setForeground(new Color(0,0,255));

lbdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtdate=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

NAME : Pawan kumar SinghROLL NO. : 520827293

164

Clinic Management System

grid.setConstraints(txtdate,gbc);

txtdate.setForeground(new Color(0,0,0));

txtdate.setFont(new Font("Courier

new",Font.BOLD,15));

txtdate.setBackground(new Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=3;

gbc.ipadx=15;

gbc.insets=new Insets(10,10,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new JButton("Search");

gbc.gridx=2;gbc.gridy=3;

gbc.ipadx=0;

gbc.insets=new Insets(10,-45,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=0;gbc.gridy=4;

gbc.ipadx=20;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new JButton("Delete");

gbc.gridx=1;gbc.gridy=4;

NAME : Pawan kumar SinghROLL NO. : 520827293

165

Clinic Management System

gbc.ipadx=10;

gbc.insets=new Insets(10,10,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

txtamt.addKeyListener(this);

//------------Frame Properties----------

frm.addWindowListener(this);

frm.pack();

frm.setSize(350,250); //Size of window

frm.setLocation(230,160);

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

add();

clear();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

166

Clinic Management System

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

frm.dispose();

conn.connect();

searchPayDetail sc=new

searchPayDetail();

sc.search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

}

public void loadBill()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

167

Clinic Management System

String str="select Bill_No from Advance_Receipt order by Bill_No";

conn.connect();

try{

conn.st=conn.con.createStatement();

conn.rs=conn.st.executeQuery(str);

while(conn.rs.next())

{

String item=conn.rs.getString(1);

cmbbno.addItem(item);

}

}catch(Exception e){}

}

public void add()

{

Object bno=cmbbno.getSelectedItem();

String b=bno.toString();

String amt=txtamt.getText();

String date=txtdate.getText();

conn.connect();

try{

pst=conn.con.prepareStatement("insert into

Payment_Details values(?,?,?)");

pst.setObject(1,b);

pst.setString(2,amt);

pst.setObject(3,date);

pst.executeUpdate();

System.out.println("Record Added");

}catch(Exception e){}

}

public void clear()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

168

Clinic Management System

txtamt.setText("");

txtdate.setText("");

cmbbno.setSelectedIndex(0);

found=false;

}

public void delete()

{

Object str=cmbbno.getSelectedItem();

String sp="delete from Payment_Details where

Bill_No='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int

d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?");

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void edit()

{

String code=txtamt.getText();

String name=txtamt.getText();

NAME : Pawan kumar SinghROLL NO. : 520827293

169

Clinic Management System

Object c=cmbbno.getSelectedItem();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Payment_Details set Bill_No=?,Pay_Amt=?,Pay_Date=? where

Bill_No='"+code+"'");

pst.setString(1,code);

pst.setString(2,name);

pst.setObject(3,c);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e){}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtamt,ke);

}

public static void main(String agrs[])

{

new PayDetail();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

170

Clinic Management System

REPORT CLASS

import java.awt.*;

import java.awt.event.*;

import java.io.*;

import java.sql.*;

import java.util.*;

import javax.swing.*;

import javax.swing.table.*;

public class Report extends JFrame

{

Connecting conn=new Connecting();

Container cont;

JFrame frm;

JScrollPane scrollPane;

boolean found=false;

public void ReportDisplay(String sql)

{

frm=new JFrame();

cont=frm.getContentPane();

Vector colNames=new Vector();

Vector data=new Vector();

try

{

conn.connect();

Statement st=conn.con.createStatement();

NAME : Pawan kumar SinghROLL NO. : 520827293

171

Clinic Management System

ResultSet rs=st.executeQuery(sql);

ResultSetMetaData md=rs.getMetaData();

int col=md.getColumnCount();

for(int i=1;i<=col;i++)

{

colNames.addElement(md.getColumnName(i));

}

while(rs.next())

{

Vector row=new Vector(col);

for(int i=1;i<=col;i++)

{

row.addElement(rs.getObject(i));

}

data.addElement(row);

found=true;

}

rs.close();

st.close();

}catch(Exception e){}

if(found)

{

JTable table=new JTable(data,colNames);

scrollPane=new JScrollPane(table);

getContentPane().add(scrollPane);

cont.add(scrollPane);

frm.setLocation(5,60);

frm.setSize(790,490);

frm.show();

NAME : Pawan kumar SinghROLL NO. : 520827293

172

Clinic Management System

}

else

JOptionPane.showMessageDialog(null,"Sorry ! \nNo Match

Found !");

}

public static void main(String agrs[])

{

Report frame=new Report();

frame.ReportDisplay("Select * From Consultant");

}};

NAME : Pawan kumar SinghROLL NO. : 520827293

173

Clinic Management System

SERVICE MASTER CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

import javax.swing.JOptionPane;

public class Service_Master implements KeyListener

{

Connecting conn=new Connecting();

Service_Master()

{

display();

}

PreparedStatement pst;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

JTextField

txtsid,txtdes,txttype,txtrate,txtma,txtefdate,txtetdate;

JComboBox cmbact;

JFrame frm;

JLabel lbdes;

String active[]={"Y","N"};

boolean found=false;

public void display()

{

frm=new JFrame("Service Master...");

GridBagLayout grid=new GridBagLayout();

NAME : Pawan kumar SinghROLL NO. : 520827293

174

Clinic Management System

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

JLabel lbbcid=new JLabel("Service ID");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbbcid,gbc);

cont.add(lbbcid);

lbbcid.setForeground(new Color(0,0,255));

lbbcid.setFont(new Font("Courier

new",Font.BOLD,15));

txtsid=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=10;

txtsid.setEnabled(false);

txtsid.setBackground(Color.BLUE);

grid.setConstraints(txtsid,gbc);

cont.add(txtsid);

txtsid.setForeground(new Color(0,0,0));

txtsid.setFont(new Font("Courier

new",Font.BOLD,15));

txtsid.setBackground(new Color(255,175,175));

lbdes=new JLabel("Description");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbdes,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

175

Clinic Management System

cont.add(lbdes);

lbdes.setForeground(new Color(0,0,255));

lbdes.setFont(new Font("Courier

new",Font.BOLD,15));

txtdes=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtdes,gbc);

cont.add(txtdes);

txtdes.setForeground(new Color(0,0,0));

txtdes.setFont(new Font("Courier

new",Font.BOLD,15));

txtdes.setBackground(new Color(255,175,175));

gbc.insets=new Insets(10,20,0,0);

JLabel lbtype=new JLabel("Type");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbtype,gbc);

cont.add(lbtype);

lbtype.setForeground(new Color(0,0,255));

lbtype.setFont(new Font("Courier

new",Font.BOLD,15));

txttype=new JTextField(10);

gbc.gridx=1; gbc.gridy=2;

grid.setConstraints(txttype,gbc);

cont.add(txttype);

JLabel lbact=new JLabel("Active");

gbc.gridx=0; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbact,gbc);

cont.add(lbact);

lbact.setForeground(new Color(0,0,255));

NAME : Pawan kumar SinghROLL NO. : 520827293

176

Clinic Management System

lbact.setFont(new Font("Courier

new",Font.BOLD,15));

cmbact=new

JComboBox(active);

gbc.gridx=1; gbc.gridy=3;

gbc.ipady=-3;

grid.setConstraints(cmbact,gbc);

cont.add(cmbact);

cmbact.setForeground(new Color(0,0,0));

cmbact.setFont(new Font("Courier

new",Font.BOLD,15));

cmbact.setBackground(new Color(255,175,175));

JLabel lbrate=new JLabel("Rate");

gbc.gridx=2; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(lbrate,gbc);

cont.add(lbrate);

lbrate.setForeground(new Color(0,0,255));

lbrate.setFont(new Font("Courier

new",Font.BOLD,15));

txtrate=new JTextField(10);

gbc.gridx=3; gbc.gridy=0;

grid.setConstraints(txtrate,gbc);

cont.add(txtrate);

txrate.setForeground(new Color(0,0,0));

txtrate.setFont(new Font("Courier

new",Font.BOLD,15));

NAME : Pawan kumar SinghROLL NO. : 520827293

177

Clinic Management System

txtrate.setBackground(new Color(255,175,175));

JLabel lbma=new

JLabel("Min. Amount");

gbc.gridx=2; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbma,gbc);

cont.add(lbma);

lbma.setForeground(new Color(0,0,255));

lbma.setFont(new Font("Courier new",Font.BOLD,15));

txtma=new JTextField(10);

gbc.gridx=3; gbc.gridy=1;

gbc.ipadx=10;gbc.ipady=5;

grid.setConstraints(txtma,gbc);

cont.add(txtma);

JLabel lbefdate=new JLabel("Effective From");

gbc.gridx=2; gbc.gridy=2;

gbc.ipadx=10;

grid.setConstraints(lbefdate,gbc);

cont.add(lbefdate);

JLabel lbetdate=new JLabel("Effective To");

gbc.gridx=2; gbc.gridy=3;

gbc.ipadx=10;

grid.setConstraints(lbetdate,gbc);

cont.add(lbetdate);

lbetdate.setForeground(new Color(0,0,255));

lbetdate.setFont(new Font("Courier

new",Font.BOLD,15));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=6;

gbc.ipadx=20;gbc.ipady=0;

NAME : Pawan kumar SinghROLL NO. : 520827293

178

Clinic Management System

gbc.insets=new

Insets(25,35,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=6;

gbc.ipadx=15;

gbc.insets=new Insets(25,10,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new

JButton("Search");

gbc.gridx=2;gbc.gridy=6;

gbc.ipadx=0;

gbc.insets=new Insets(25,-

45,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

gbc.gridx=3;gbc.gridy=6;

gbc.ipadx=25;

gbc.insets=new Insets(25,-70,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new

JButton("Delete");

gbc.gridx=3;gbc.gridy=6;

gbc.ipadx=10;

NAME : Pawan kumar SinghROLL NO. : 520827293

179

Clinic Management System

gbc.insets=new Insets(25,22,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

// ------------------Frame Properties---------------

txtrate.addKeyListener(this);

txtma.addKeyListener(this);

frm.pack();

frm.setSize(520,300); //Size of window

frm.setLocation(160,110); //set the

window

frm.setVisible(true);

frm.setResizable(false);

frm.show();

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

clear();

}

});

NAME : Pawan kumar SinghROLL NO. : 520827293

180

Clinic Management System

btSearch.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

frm.dispose();

conn.connect();

searchService sc=new

searchService();

sc.search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener

()

{

public void actionPerformed(ActionEvent

ae)

{

edit();

}

});

NAME : Pawan kumar SinghROLL NO. : 520827293

181

Clinic Management System

}

public void add()

{

conn.generateID(txtsid,"select Service_ID from

Service_Master","SI");

String id=txtsid.getText();

String des=txtdes.getText();

String type=txttype.getText();

Object act=cmbact.getSelectedItem();

String rate=txtrate.getText();

String ma=txtma.getText();

String ef=txtefdate.getText();

String et=txtetdate.getText();

boolean

fill=conn.setRequire(txtdes,"Description");

fill=conn.setRequire(txtrate,"Rate");

fill=conn.setRequire(txtma,"Minimum

Amout");

if(fill)

{

conn.connect();

try{

pst=conn.con.prepareStatement("insert into Service_Master

values(?,?,?,?,?,?,?,?)");

pst.setString(1,id);

pst.setString(2,des);

pst.setString(3,type);

pst.setObject(4,act);

pst.setString(5,rate);

pst.setString(6,ma);

NAME : Pawan kumar SinghROLL NO. : 520827293

182

Clinic Management System

pst.setString(7,ef);

pst.setString(8,et);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Record

Added");

clear();

}catch(Exception e)

{System.out.println(e.getMessage());}

}

}

public void delete()

{

String str=txtsid.getText();

String sp="delete from Service_Master where

Service_ID='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int d=JOptionPane.showConfirmDialog(null,"Are you sure to

delete ?");

if(d==0)

{

conn.st.executeUpdate(sp);

clear();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

183

Clinic Management System

}

catch (Exception e) { }

}

public void edit()

{

String id=txtsid.getText();

String des=txtdes.getText();

String type=txttype.getText();

Object act=cmbact.getSelectedItem();

String rate=txtrate.getText();

String ma=txtma.getText();

String ef=txtefdate.getText();

String et=txtetdate.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

Service_Master set

Service_ID=?,Description=?,Type=?,Active=?,Rate=?,MinAmt=?,EFF

from=?,EFFto=? where Service_ID='"+id+"'");

pst.setString(1,id);

pst.setString(2,des);

pst.setString(3,type);

pst.setObject(4,act);

pst.setString(5,rate);

pst.setString(6,ma);

pst.setString(7,ef);

pst.setString(8,et);

pst.executeUpdate();

NAME : Pawan kumar SinghROLL NO. : 520827293

184

Clinic Management System

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e){System.out.println(e.getMessage());}

}

public void keyPressed(KeyEvent ke)

{

conn.shouldNumber(txtrate,ke);

conn.shouldNumber(txtma,ke);

}

public void keyReleased(KeyEvent ke){}

public void keyTyped(KeyEvent ke){}

public static void main(String agrs[])

{

new Service_Master();

}

}

USER CLASS

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

public class User

{

Connecting conn=new Connecting();

User()

{

NAME : Pawan kumar SinghROLL NO. : 520827293

185

Clinic Management System

display();

}

JLabel lbuser,lbpass;

JTextField txtuser;

JPasswordField txtpass;

JFrame frm;

PreparedStatement pst;

JButton btAdd,btDelete;

public void display()

{

frm=new JFrame("Create / Delete User");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new

GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

lbuser=new JLabel("User Name");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbuser,gbc);

cont.add(lbuser);

lbuser.setForeground(new Color(0,0,255));

lbuser.setFont(new Font("Courier

new",Font.BOLD,15));

txtuser=new JTextField(10);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=120;

NAME : Pawan kumar SinghROLL NO. : 520827293

186

Clinic Management System

gbc.insets=new Insets(10,-90,0,0);

grid.setConstraints(txtuser,gbc);

cont.add(txtuser);

txtuser.setForeground(new Color(0,0,0));

txtuser.setFont(new Font("Courier

new",Font.BOLD,15));

txtuser.setBackground(new Color(255,175,175));

lbpass=new JLabel("Password");

gbc.gridx=0; gbc.gridy=1;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbpass,gbc);

cont.add(lbpass);

lbpass.setForeground(new Color(0,0,255));

lbpass.setFont(new Font("Courier

new",Font.BOLD,15));

txtpass=new JPasswordField(10);

gbc.gridx=1; gbc.gridy=1;

gbc.ipadx=120;

gbc.insets=new Insets(10,-90,0,0);

grid.setConstraints(txtpass,gbc);

cont.add(txtpass);

txtpass.setForeground(new Color(0,0,0));

txtpass.setFont(new Font("Courier

new",Font.BOLD,15));

txtpass.setBackground(new

Color(255,175,175));

btAdd=new JButton("Create");

gbc.gridx=0; gbc.gridy=3;

NAME : Pawan kumar SinghROLL NO. : 520827293

187

Clinic Management System

gbc.ipadx=10;gbc.ipady=0;

gbc.insets=new Insets(10,30,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btDelete=new JButton("Delete");

gbc.gridx=1; gbc.gridy=3;

gbc.ipadx=10;gbc.ipady=0;

gbc.insets=new Insets(10,-

70,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

//------------Frame Properties----------

frm.pack();

frm.setSize(300,175); //Size of window

frm.setLocation(250,200); //set the window

frm.setVisible(true);

frm.setResizable(false); //Resized the

window...

frm.show();

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

add();

}

});

btDelete.addActionListener(new ActionListener ()

NAME : Pawan kumar SinghROLL NO. : 520827293

188

Clinic Management System

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

}

public void add()

{

boolean fill=true;

String user=txtuser.getText();

String pass=txtpass.getText();

if(user.equals(""))

fill=false;

if(pass.equals(""))

fill=false;

conn.connect();

try{

pst=conn.con.prepareStatement("insert into User_Master

values(?,?)");

pst.setString(1,user);

pst.setString(2,pass);

if(fill)

{

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Cogratulation ..!\n "+"

"+user);

frm.dispose();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

189

Clinic Management System

else

JOptionPane.showMessageDialog(null,"Not Valid User Name

Or Password!");

txtuser.setText("");

txtpass.setText("");

}catch(Exception e){}

}

public void delete()

{

boolean fill=true;

String user=txtuser.getText();

if(user.equals(""))

{

JOptionPane.showMessageDialog(null,"Please Enter User

Name,\nWhich You Want To Delete");

fill=false;

}

String sp="delete from User_Master where

User_Name='"+user+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(fill)

{

int d=JOptionPane.showConfirmDialog(null,"Are you sure to

delete ?\n"+user);

if(d==0)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

190

Clinic Management System

conn.st.executeUpdate(sp);

txtuser.setText("");

JOptionPane.showMessageDialog(null,user+" is

Deleted !");

}

}

}

catch (Exception e) { }

}

public void edit(String input)

{

String user=txtuser.getText();

String pass=txtpass.getText();

try{

conn.connect();

pst=conn.con.prepareStatement("Update

User_Master set User_Name=?,Password=?where

City_Code='"+input+"'");

pst.setString(1,user);

pst.setString(2,pass);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Changed !");

frm.dispose();

}catch(Exception e){}

}

public static void main(String agrs[])

{

new User();

NAME : Pawan kumar SinghROLL NO. : 520827293

191

Clinic Management System

}

}

PAYMENT MODE

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

import javax.swing.JOptionPane;

public class PaymentMode

{

Connecting conn=new Connecting();

PaymentMode()

{

display();

}

JLabel lbCode,lbName;

JTextField txtCode,txtDes;

PreparedStatement pst;

JFrame frm;

JButton btAdd,btClear,btEdit,btDelete,btSearch;

NAME : Pawan kumar SinghROLL NO. : 520827293

192

Clinic Management System

boolean found=false;

public void display()

{

frm=new JFrame("Payment Mode");

GridBagLayout grid=new GridBagLayout();

GridBagConstraints gbc=new GridBagConstraints();

frm.setLayout(grid);

Container cont=frm.getContentPane();

gbc.anchor=GridBagConstraints.WEST;

lbCode=new JLabel("Code");

gbc.gridx=0; gbc.gridy=0;

gbc.ipadx=10;gbc.ipady=5;

gbc.insets=new Insets(10,20,0,0);

grid.setConstraints(lbCode,gbc);

cont.add(lbCode);

lbcode.setForeground(new Color(0,0,255));

lbcode.setFont(new Font("Courier

new",Font.BOLD,15));

txtCode=new JTextField(2);

gbc.gridx=1; gbc.gridy=0;

gbc.ipadx=20;

grid.setConstraints(txtCode,gbc);

cont.add(txtCode);

txtcode.setForeground(new Color(0,0,0));

txtcode.setFont(new Font("Courier

new",Font.BOLD,15));

txtcode.setBackground(new Color(255,175,175));

lbName=new JLabel("Description");

gbc.gridx=0; gbc.gridy=1;

gbc.ipadx=10;

grid.setConstraints(lbName,gbc);

NAME : Pawan kumar SinghROLL NO. : 520827293

193

Clinic Management System

cont.add(lbName);

lbName.setForeground(new Color(0,0,255));

lbName.setFont(new Font("Courier

new",Font.BOLD,15));

txtDes=new JTextField(10);

gbc.gridx=1; gbc.gridy=1;

grid.setConstraints(txtDes,gbc);

cont.add(txtDes);

txtDes.setForeground(new Color(0,0,0));

txtDes.setFont(new Font("Courier

new",Font.BOLD,15));

txtDes.setBackground(new Color(255,175,175));

btAdd=new JButton("Add");

gbc.gridx=0; gbc.gridy=2;

gbc.ipadx=20;gbc.ipady=0;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btAdd,gbc);

cont.add(btAdd);

btClear=new JButton("Clear");

gbc.gridx=1;gbc.gridy=2;

gbc.ipadx=15;

gbc.insets=new Insets(10,8,0,0);

grid.setConstraints(btClear,gbc);

cont.add(btClear);

btSearch=new JButton("Search");

gbc.gridx=2;gbc.gridy=2;

gbc.ipadx=0;

gbc.insets=new Insets(10,-45,0,0);

grid.setConstraints(btSearch,gbc);

cont.add(btSearch);

btEdit=new JButton("Edit");

NAME : Pawan kumar SinghROLL NO. : 520827293

194

Clinic Management System

gbc.gridx=0;gbc.gridy=3;

gbc.ipadx=20;

gbc.insets=new Insets(10,15,0,0);

grid.setConstraints(btEdit,gbc);

cont.add(btEdit);

btDelete=new JButton("Delete");

gbc.gridx=1;gbc.gridy=3;

gbc.ipadx=10;

gbc.insets=new Insets(10,8,0,0);

grid.setConstraints(btDelete,gbc);

cont.add(btDelete);

//------------Frame Properties----------

frm.pack();

frm.setSize(350,250); //Size of window

frm.setLocation(230,160); //set the window

frm.setVisible(true);

frm.setResizable(false); //Resized the window...

frm.show();

//---------Button Add Event Handler--------

btAdd.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

add();

clear();

}

});

btClear.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

NAME : Pawan kumar SinghROLL NO. : 520827293

195

Clinic Management System

{

clear();

}

});

btSearch.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

frm.dispose();

conn.connect();

searchPaymentMode sc=new

searchPaymentMode();

sc.search();

}

});

btDelete.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent

ae)

{

delete();

}

});

btEdit.addActionListener(new ActionListener ()

{

public void actionPerformed(ActionEvent ae)

{

edit();

}

});

}

NAME : Pawan kumar SinghROLL NO. : 520827293

196

Clinic Management System

public void add()

pst=conn.con.prepareStatement("insert into

PaymentMode_Master values(?,?)");

pst.setString(1,code.toUpperCase());

pst.setString(2,name.toUpperCase());

pst.executeUpdate();

System.out.println("Record Added");

}catch(Exception e){System.out.println("Sql

Exception");}

}

public void clear()

{

txtCode.setText("");

txtDes.setText("");

found=false;

}

public void delete()

{

String str=txtCode.getText();

String sp="delete from PaymentMode_Master where

Code='"+str+"'";

try

{

conn.connect();

conn.st=conn.con.createStatement();

if(found)

{

int d=JOptionPane.showConfirmDialog(null,"Are you sure to

delete ?");

if(d==0)

{

NAME : Pawan kumar SinghROLL NO. : 520827293

197

Clinic Management System

conn.st.executeUpdate(sp);

clear();

}

}

}

catch (Exception e) { }

}

public void edit()

{

String code=txtCode.getText();

String name=txtDes.getText();

try{ conn.connect();

pst=conn.con.prepareStatement("Update

PaymentMode_Master set Code=?,Description=? where

Code='"+code+"'");

pst.setString(1,code);

pst.setString(2,name);

pst.executeUpdate();

JOptionPane.showMessageDialog(null,"Updated !");

}catch(Exception e){}

}

public static void main(String agrs[])

{

PaymentMode c=new PaymentMode(); }}

NAME : Pawan kumar SinghROLL NO. : 520827293

198

Clinic Management System

INPUT OUTPUT SCREEN

Home Page

Login Page

NAME : Pawan kumar SinghROLL NO. : 520827293

199

Clinic Management System

Menu Page

NAME : Pawan kumar SinghROLL NO. : 520827293

200

Clinic Management System

Registration

Billing Class

NAME : Pawan kumar SinghROLL NO. : 520827293

201

Clinic Management System

Advance Receipt Details

Advance Receipt

NAME : Pawan kumar SinghROLL NO. : 520827293

202

Clinic Management System

Appointment

Consultant Details

NAME : Pawan kumar SinghROLL NO. : 520827293

203

Clinic Management System

Credit card

Drug Master

NAME : Pawan kumar SinghROLL NO. : 520827293

204

Clinic Management System

Generic Master

NAME : Pawan kumar SinghROLL NO. : 520827293

205

Clinic Management System

Payment Mode

Service Master

Payment details

NAME : Pawan kumar SinghROLL NO. : 520827293

206

Clinic Management System

Testing Approach

Computer s/w has become more complex. The need

for specialized testing approaches has also grown. The “white box”

and “block box testing” methods are applicable across all

environments.

GUI present integrity challenges for software engineers. Because of

reusable components provided, the creation of the user interface

has become less time consuming and more process. But at the

same time the completely of GUI’’ s has grown, leading to more

difficulty is the design and execution of test crises. Finites step

NAME : Pawan kumar SinghROLL NO. : 520827293

207

Clinic Management System

modeling graphs man be used to drive a series of test that address

specific data and programs objects that are relevant to the GUI. Due

to the large no. of permutation associated with GUI operations

testing should be approached using automated fools.

Verification and validation:-

Verification refers to the set of activity that insures

that software correctly implements a specific function. Validation

refresh to a different set of activities that insure that the software

that has built that is traceable customer requirements.

In other words validation provides final assurance

that software meets all functional, behavioral and performance

requires.

“Boebam” states another way:-

Verification: - “Are we building the product right”.

Validation: - “Are we building the right product”.

Verification and validation encompasses a wide array of SQA

(software quality assurance) activities that include formal technical

review, quality and configuration audits, performance monitoring,

simulation, fusibility study, documentation review, development

testing, qualification testing and installation testing.

Software testing strategy:-

NAME : Pawan kumar SinghROLL NO. : 520827293

208

Clinic Management System

A strategy for software testing may also be viewed in the context of the spiral.

Unit testing is begins at the vortex of the spiral and concentration

on each unit (component) of the software as implemented in source

code. Testing programs by moving outward along the spiral to

integrated testing, where the focus is on design and construction of

the software architecture. Taking another term out word on the

spiral be in countered validation testing, where requirements

established as part of software requirement analysis are validated

against the software that has been constructed. Finally we arrive

other at system testing where the s/w , we special out along stream

lines that we spiral the scope of testing with each turned.

Unit testing:-

Unit testing focus verification afford on the smallest unit of the

software design-the software component / module. Using

component level design description as a guide, important control

NAME : Pawan kumar SinghROLL NO. : 520827293

209

Integration testing

Unit testing

Code

Design

Validation testing

Context of system test

Requirement

System engineers

Clinic Management System

paths are tested to uncover within the boundary of the module. The

unite test is white box printed. The test that occurs as parts of unit

tests is illustrated schematically.

The module interface is tested to insure that information properly

follows into and out of the program unit under test. The local data

structure is examined to insure that data stored temporarily

maintains its integrity during all steps in an algorithms execution.

Boundary condition are tested to insure that the module operates

properly at boundaries established to limit or restrict processing. All

independent paths through the control structure are executed at

least once. And finally all error handling paths are tested.

Integration testing:-

Integration testing is a systematic technique for

contracting the program structure while at the same time

conducting tests to uncover error associated with interfacing. A

number of different incremental integration strategies are:-

Components are combining to form clusters 0, 1, 2, & 3. Each of the

cluster is tested using a driver (shown (--) block). Components in

cluster 1 & 2 subordinate to “Ma”. Similarly driver “D3” for cluster

“3” is removed prior to integration with module “Mb”. Both “Ma”

and “Mb” will ultimately bee integrated with component “Mc” and

forth. Integration moves upward.

Validation testing : -

NAME : Pawan kumar SinghROLL NO. : 520827293

210

Clinic Management System

Software validation is achieved through a series of “black box”

tests that demonstrates conformity with requirements. Each

validation test case has been conducted, one of two possible

conditions exists:-

1. The functions or performance characteristics conform

to specification and are accepted.

2. A deviation from specification is uncovered and a

deficiency list is created. Deviation or error

3. discovered at this stage in a project can recovery be

corrected prior to schedule delivery.

There are two type of validation testing are: -

a. Alpha testing

b. Beta testing

A. alpha testing :-The alpha test is conducted at the developer’s site by a customer.

The software is used in natural setting with the developer “looking

over and shoulder” of the user and recording errors and using

problems. Alpha test are conducted in a control environment.

B. Beta testing :-

Beta testing is conducted at one or more costumer site by the end

user of the software. Unlike alpha testing, the developer is generally

not present. There fore the beta test is a “live” application of the

NAME : Pawan kumar SinghROLL NO. : 520827293

211

Clinic Management System

software in an environment that cam not be controlled by the

developer. The customer records all

problems that are encountered during beta testing and

reports these to the developer at regular intervals. As a result of

problems reported during beta tests, software engineers make

modifications and than prepare for relation of the software product

to the enter customer based.

System testing :-

System testing is actually a series of different tests who’s

primary purpose is to fully exercise the computer based system.

Although each test has a different purpose, all work of verify that

system elements have been property integrated and perform

allocated functions.

Recovery Testing :-

Recovery testing is a system test that force the software to fail in a

variety of ways and verifies that recovery is properly perform. If

recovery is automatic (perform by the system itself) reutilization,

check pointing mechanism, data recovery and restart are evaluated

for correctness. If recovery requires human intervention, the mean-

time-to-repair (MTTR) is evaluated to determine whether it is within

acceptable limits.

Security Testing :-

NAME : Pawan kumar SinghROLL NO. : 520827293

212

Clinic Management System

Security testing attempts to verify that protection

mechanism built into a system will infect, protect if form improper

penetration. During security testing the tester plays the role of the

individual who desire to penetrate the system. The role of the

system designer is to make penetration cost more than the value of

the information that will be obtained.

Debugging Process : -

Debugging occurs as a consequence of successful testing.

That is, when a test case uncovers and error, debugging is the

process that results in the removal of the error.

The debugging process will always have one of two outcomes:-

1. The cause will be found and corrected.

2. The cause will not be found.

PRINT SCREEN OF TESTING

NAME : Pawan kumar SinghROLL NO. : 520827293

213

Debugging Unit testing Integration Testing

Clinic Management System

THERE ARE FOLLOWING ERROR IN SYNTEX AND CONNECTION.

ERROR IN METHOD DECLARATION:

NAME : Pawan kumar SinghROLL NO. : 520827293

214

Clinic Management System

REPORT

NAME : Pawan kumar SinghROLL NO. : 520827293

215

Clinic Management System

import java.util.*;

import javax.swing.JTable.*;

import java.lang.String;

import java.util.Vector;

import javax.swing.table.AbstractTableModel;

import java.net.*;

import java.sql.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.io.*;

import java.lang.*;

import java.awt.print.*;

public class bill_report extends JFrame

{

String[]

colhead={"BILLING_CLASS_ID","DESCRIPTION","DISCOUNT_PE

RCENTAGE","EFFECTIVE_FROM","EFFECTIVE_TO"};

Object data[][]=new Object[100][10];

JTable table;

ResultSet rs;

private JPanel p1,p2,p;

private JButton dispall,print,exit,pgSetup;

private JLabel title,l1;

private Container cn;

String scd,dcd,dnm,ddate,carea,nomp,nomla,stc;

int i,r;

PageFormat pageFormat;

Dimension screensize;

Connection connection;

NAME : Pawan kumar SinghROLL NO. : 520827293

216

Clinic Management System

Statement statement;

public bill_report()

{

setTitle("BILLING_DETAILS");

setSize(750,550);

setVisible(true);

p1=new JPanel();

p2=new JPanel();

p=new JPanel();

setLayout(null);

cn=getContentPane();

cn.setBackground(new Color(224,232,248));

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

title =new JLabel("BILLING_DETAILS");

title.setFont(new Font("Engravers MT", 1, 30));

title.setForeground(new Color(247,251,249));

p1.add(title);

p1.setBackground(new Color(145,210,70));

cn.add(p1);

p1.setBounds(0,0,745,50);

dispall=new JButton("DISPLAY ALL");

dispall.setMnemonic('I');

dispall.addActionListener(new dispallListener());

dispall.setBounds(110,110,130,25);

NAME : Pawan kumar SinghROLL NO. : 520827293

217

Clinic Management System

cn.add(dispall);

pgSetup=new JButton("PAGE SETUP");

pgSetup.setMnemonic('G');

pgSetup.addActionListener(new setupListener());

pgSetup.setBounds(240,110,130,25);

cn.add(pgSetup);

print=new JButton("PRINT");

print.setMnemonic('P');

print.addActionListener(new printListener());

print.setBounds(370,110,130,25);

cn.add(print);

exit=new JButton("EXIT");

exit.setMnemonic('E');

exit.setBounds(500,110,130,25);

exit.addActionListener(new exitListener());

cn.add(exit);

screensize=Toolkit.getDefaultToolkit().getScreenSize();

setBounds((screensize.width-750)/2,(screensize.height-

550)/2,750,550);

setVisible(true);

setResizable(false);

connect();

load();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

218

Clinic Management System

public void connect()

{

try

{

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

connection=DriverManager.getConnection("jdbc:odbc: pawan

"," pawan "," pawan ");

statement=connection.createStatement();

}

catch(SQLException sqle)

{

JOptionPane.showMessageDialog(null,sqle);

}

}

catch(Exception e)

{

JOptionPane.showMessageDialog(null,"NOT

CONNECTED");

}

}

public class dispallListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

load();

NAME : Pawan kumar SinghROLL NO. : 520827293

219

Clinic Management System

}

}

public void load()

{

try

{

String

q="",q1="",q2="",q3="",q5="",q4="";

int i=0;

rs=statement.executeQuery("select * from

bill");

while(rs.next())

{

data[i][0]=rs.getString(1);

data[i][1]=rs.getString(2);

data[i][2]=rs.getString(3);

data[i][3]=rs.getString(4);

data[i][4]=rs.getString(5);

i++;

}

table=new JTable(data,colhead);

table.setFont(new Font("Arial",Font.BOLD,12));

table.setForeground(Color.blue);

JScrollPane jsp=new JScrollPane(table);

jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCR

OLLBAR_NEVER);

NAME : Pawan kumar SinghROLL NO. : 520827293

220

Clinic Management System

jsp.setBounds(0,200,740,302);

cn.add(jsp);

}

catch(SQLException sq)

{

JOptionPane.showMessageDialog(null,sq);

}

}

public void clear()

{

int i=0;

while(i<100)

{

data[i][0]="";

data[i][1]="";

data[i][2]="";

data[i][3]="";

data[i][4]="";

i++;

}

}

public class exitListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

int n= JOptionPane.showConfirmDialog(null,"Are You

Sure","Enter Carefully",JOptionPane.WARNING_MESSAGE);

if(n==JOptionPane.YES_OPTION)

dispose();

}

NAME : Pawan kumar SinghROLL NO. : 520827293

221

Clinic Management System

}

public class printListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

String cmd = e.getActionCommand();

if (cmd.equals("PRINT"))

{

PrinterJob printJob = PrinterJob.getPrinterJob();

if (pageFormat == null)

pageFormat = printJob.defaultPage();

if(printJob.printDialog())

{

try

{

printJob.print();

}

catch (PrinterException exception)

{

JOptionPane.showMessageDialog(null, exception);

}

}

}

}

}

public class setupListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

String cmd = e.getActionCommand();

NAME : Pawan kumar SinghROLL NO. : 520827293

222

Clinic Management System

if(cmd.equals("PAGE SETUP"))

{

PrinterJob printJob = PrinterJob.getPrinterJob();

if (pageFormat == null)

pageFormat = printJob.defaultPage();

pageFormat = printJob.pageDialog(pageFormat);

}

}

}

public static void main(String args[])

{

bill_report s=new bill_report();

}

}

NAME : Pawan kumar SinghROLL NO. : 520827293

223

Clinic Management System

NAME : Pawan kumar SinghROLL NO. : 520827293

224

Clinic Management System

NAME : Pawan kumar SinghROLL NO. : 520827293

225

Clinic Management System

Tools/PlatformTools/Platform

Environmental Characteristics:

Minimum Hardware required For the Proposed System.

Pentium 600 MHz. Or higher microprocessor.

VGA 640 x 480 or higher resolution screen supported by

Microsoft Windows.

256 MB RAM for Windows XP, 512 MB RAM for Windows

NT/Windows2000.

10 GB or higher capacity hard disk.

Software Used :

Microsoft Windows xp second edition operating

system.

Core java 1.6 as Front-End

Oracle 10g as Back-End.

Limitations of Project

NAME : Pawan kumar SinghROLL NO. : 520827293

226

Clinic Management System

Although our sample of practices reflected

the practices

participating in the randomized controlled trial,

within practices we

interviewed staffs of the company who

were low users of computers.

The people in

the feedback group were self selecting and likely to

include disproportionately

more of those with strong reactions to the

system. The voice of

the disappointed enthusiast comes across

strongly, and we know

less about the views of those people who

chose not to try the

system. However, although the level of criticism

of the system

varied between staff at different levels in the

company, the nature of the criticisms, in terms

of where the

problems lay with the system, was remarkably

consistent.

NAME : Pawan kumar SinghROLL NO. : 520827293

227

Clinic Management System

Future Scope of the Project

This project has been developed keeping in view the current

requirements of the Clinic. This project eventually automates all A to

Z training related activities, requirements and master file

maintenance of the system. Generates the important report like as

on range of dates. Employee training system got the option of entry,

amendments report generation as well as printing.

Reduces processing time.

Increases efficiency of system.

Emphasis on accuracy of data

Assures security and validity.

Provision for enhancement without distributing the developed

modules.

Object-Oriented design.

GUI based full mouse and keyboard supported forms

Fully automated, Employee training system got the option of

entry, amendments report generation as well as printing.

NAME : Pawan kumar SinghROLL NO. : 520827293

228

Clinic Management System

BIBLIOGRAPHY

1. DATABASE SYSTEMS CONCEPT – KORTH, SUDARSHAN

2. SYSTEM ANALYSIS AND DESIGN – E. M. AWARD

3. ORACLE PL/SQL PROGRAMMING – O’REILLY SERIES

4. AN INTRODUCTION TO DATABASE SYSTEMS – C.J. DATE

5. EXPERT ONE BY ONE BY THOMAS KYTE – WROX.

6. THE COMPLETE REFERENCE JAVA 2 FOURTH EDITION- NAUGHTON

SCHILDT.

7. JAVA2 PLATFORM UNLEASHED (SAMS) TECHMEDIA-JAWORSKI.

8. DATABASE SYSTEM CONCEPTS FIFTH EDITION –SILBERSCHATZ

KORTH SUDARSHAN.

NAME : Pawan kumar SinghROLL NO. : 520827293

229