Escolar Documentos
Profissional Documentos
Cultura Documentos
CLINIC
MANAGEMENT
SYSTEM
NAME
ROLL NO.
THE
THE
INTRODUCTION/OBJECTIVE
INTRODUCTION/OBJECTIVE
OF
OF PROJECT
PROJECT
Silent
Features
of
the
CLINIC
MANAGEMENT
SYSTEM Software :
NAME
ROLL NO.
OBJECTIVE OF PROJECT
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
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
ROLL NO.
study of the existing manual system and all problem areas. Salient
features of this computer based systems are:
NAME
ROLL NO.
PROJECT
PROJECTCATEGORY
CATEGORY
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
NAME
ROLL NO.
Distributed
Dynamic
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.
NAME
ROLL NO.
SQL*PLUS
B.
INTRACTIVE SQL
C.
PL/SQL
(A)
SQL*PLUS
SQL
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
Querying data.
NAME
ROLL NO.
10
Construct that help in the development of modular code functions and procedures.
SYSTEM
SYSTEMANALYSIS
ANALYSIS
SYSTEM STUDY
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 &cant be edited easily. Thus I conclude that
NAME
ROLL NO.
11
SYSTEM ANALYSIS
In this phase, software developers carry out a detailed study of
users requirements. They then arrive at the proposed system to be
built. This phase generates functional specifications, which contain:
Output to be produced.
Audit and control the requirements that the user can use to
monitor the proper functioning of the system.
Acceptance test to list the tests that the user can carry out to
ensure that the system is acceptable.
12
its
functional
requirements.
Each
functional
Risks:
Describes
the
circumstances
under
which
this
NAME
ROLL NO.
13
Others as appropriate
2. Interface Requirements
This section describes how the software interfaces with other
Specifies any constraints for the design team using this document.
Standards Compliance
Hardware Limitations
Others as appropriate
OTHER
NON-FUNCTIONAL ATTRIBUTES
14
Security
Binary Compatibility
Reliability
Maintainability
Portability
Extensibility
Requirement Specification
An 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
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
NAME
ROLL NO.
15
1
CMS
1.1
Level 1 DFD
Registration
Patient
Details
Enquiries
NAME Patient: Pawan kumar Singh
ROLL NO. : 520827293
1.2
16
Patient Query
Reports
Service
Details
Money Receipt
1.3
Charges/
Billing
Bill_Master
level 2 DFDs
1.2.1
Registration_master
Patient
Query
Service_master
Enquiry
Report
1.2.2
Services
Provides
Patient
Issue /Enquiry
Money
Receipt
NAME
ROLL NO.
1.2.3
Service Charges/
Billing/
Refunds
17
Service_charges
Request
1.1.1
Admit Detail
Bed_master
ER-DIAGRAM
CONSUL
TANTNT_
ID
ADDRESS
CONSULTANT
collec
ts
DISEASE_INFO
APPOIN
TMENT
REGISTRATION
SERVICE_MASTER
billin
g
NAME
ROLL NO.
SERV
ES
DRUG_MASTER
: Pawan kumar Singh
: 520827293
18
ADVANCE_RECEIPT
ADVANCE_R
ECEIPT_DET
AIL
GENERIC_MASTER
PAY_DETAI
L
PAYMENT_DETAIL
In mode
of
PAYMENTMODE_MASTE
CREDITCARD_MASTER
FIG:-
In mode
of
DATATYPE
CONSTRAINTS
BILL_NO
PATIENT_ID
VACHAR (6)
NUMBER (8)
BILL_DATE
AMOUNT_PAID
AMOUNT_PAYABLE
DISCOUNT
BALANCE
PAY_MODE
DATE
NUMBER (6,2)
NUMBER (6,2)
NUMBER (6,2)
NUMBER (6,2)
VARCHAR2 (2)
PRIMARY KEY
NOT NULL REFERENCES REGISTRATION
(PATIENT_ID)
DEFAULT SYSDATE
PAY_NO
VALID_UPTO
VARCHAR2 (50)
DATE
NAME
ROLL NO.
REFERENCES PAYMENTMODE_MASTER
(CODE)
19
2 . ADVANCE_RECEIPT_DETAILS:
COLUMN
DATATYPE
CONSTRAINTS
BILL_NO
VARCHAR (6)
SERVICE_ID
VARCHAR (6)
QTY
NUMBER (4)
3. APPOINTMENT:
COLUMN
DATATYPE
CONSTRAINTS
APPOINTMENT_ID
VARCHAR (6)
PRIMARY KEY
PATIENT_ID
NUMBER (8)
CONSULTANT_ID
VARCHAR (6)
APPT_DATE_TIME
DATE
NOT NULL
STATUS
VARCHAR2 (1)
4.
USER_MASTER:
COLUMN
DATATYPE
CONSTRAINTS
USER_NAME
PASSWORD
VARCHAR2 (20)
VARCHAR2 (50)
PRIMARY KEY
NOT NULL
5.
BILLING_CLASS:
COLUMN
DATATYPE
CONSTRAINTS
BILLING_CLASS_ID
VARCHAR (6)
DESCRIPTION
VARCHAR2 (50)
PRIMARY KEY
NOT NULL
DISCOUNT_PERCENTAGE
EFFECTIVE_FROM
EFFECTIVE_TO
ACTIVE
NUMBER (4,2)
DATE
DATE
VARCHAR2 (1)
6.
CONSULTANT :
COLUMN
DATATYPE
CONSTRAINTS
CONSULTANT_ID
VARCHAR (6)
PRIMARY KEY
NAME
ROLL NO.
20
CONSULTANT_NAME
VARCHAR2 (50)
NOT NULL
MEDICAL_REG_ID
CONSULTANT_NATURE
CONSULTANT_TYPE
MOBILE_NO
PHONE_NO
ADDRESS
EMAIL
DOB
DOJ
VARCHAR2
VARCHAR2
VARCHAR2
VARCHAR2
VARCHAR2
VARCHAR2
VARCHAR2
DATE
DATE
NOT NULL
NOT NULL
NOT NULL
7.
(20)
(20)
(20)
(15)
(15)
(50)
(50)
PAYMENT_DETAILS :
COLUMN
DATATYPE
CONSTRAINTS
BILL_NO
PAY_AMT
PAY_DATE
VARCHAR (6)
NUMBER (6,2)
DATE
8.
REGISTRATION:
COLUMN
DATATYPE
CONSTRAINTS
PATIENT_ID
NUMBER (8)
PRIMARY KEY
REG_CATEGORY
PATIENT_TYPE
REG_DT
DEPT
CONSULTANT_ID
VARCHAR2 (10)
VARCHAR2 (10)
DATE
VARCHAR2 (50)
VARCHAR (6)
NOT NULL
NOT NULL
NOT NULL
FNAME
MNAME
LNAME
DOB
GENDER
MARITAL _STATUS
VARCHAR2
VARCHAR2
VARCHAR2
DATE
VARCHAR2
VARCHAR2
(20)
(20)
(20)
OCCUPATION
REMARKRS
ADDRESS
MOBILE_NO
VARCHAR2
VARCHAR2
VARCHAR2
VARCHAR2
(20)
(50)
(200)
(15)
9.
(1)
(1)
SERVICE_MASTER :
COLUMN
SERVICE_ID
DESCRIPTION
NAME
ROLL NO.
DATATYPE
VARCHAR (6)
VARCHAR2 (50)
CONSTRAINTS
PRIMARY KEY
NOT NULL
21
TYPE
ACTIVE
RATE
MINAMT
EFFFROM
EFFTO
10.
VARCHAR2 (10)
VARCHAR2 (1)
NUMBER (6,2)
NUMBER (6,2)
DATE
DATE
DRUGS_MASTER :
COLUMN
CODE
NAME
COMPANY_NAME
UNIT_OF_MEASURE
STOCK_ON_HAND
MANUFACTURE_DT
EXPIRY_DT
SHAPE
11.
CONSTRAINTS
PRIMARY KEY
NOT NULL
NOT NULL
NOT NULL
NOT NULL
NOT NULL
NOT NULL
DATATYPE
VARCHAR2 (6)
VARCHAR2 (20)
VARCHAR2 (20)
NUMBER (6)
NUMBER (4)
CONSTRAINTS
PRIMARY KEY
NOT NULL
NOT NULL
NOT NULL
CREDITCARD_MASTER :
COLUMN
CODE
DESCRIPTION
13.
DATATYPE
VARCHAR2 (6)
VARCHAR2 (20)
VARCHAR2 (20)
NUMBER (6)
NUMBER (4)
DATE
DATE
VARCHAR2 (15)
GENERIC_MASTER :
COLUMN
CODE
NAME
COMPANY_NAME
UNIT_OF_MEASURE
STOCK_ON_HAND
12.
DATATYPE
VARCHAR2 (6)
VARCHAR2 (20)
CONSTRAINTS
PRIMARY KEY
PAYMENTMODE_MASTER :
COLUMN
CODE
DESCRIPTION
NAME
ROLL NO.
DATATYPE
VARCHAR2 (6)
VARCHAR2 (20)
CONSTRAINTS
PRIMARY KEY
22
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,
Stock_on_Hand Number(4)
NAME
ROLL NO.
23
)
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
ROLL NO.
24
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'))
)
NAME
ROLL NO.
25
26
)
CREATE TABLE Payment_Details (
Bill_No varchar(6)not null references Advance_Receipt(Bill_No),
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;
NAME
ROLL NO.
27
con=frm.getContentPane();
panel=new JPanel();
panel.setFont(plain);
msg=new JLabel("CLINIC MANAGEMENT
SYSTEM");
con.setLayout(grid);
panel.setBorder(BorderFactory.createTitledBorder(BorderFacto
ry.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);
NAME
ROLL NO.
28
gbc.ipadx=10;
gbc.ipady=5;
gbc.gridx=0;
gbc.gridy=0;
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);
NAME
ROLL NO.
29
frm.show();
//..........ActionListener
add.............................................
cont.addActionListener(this);
cancel.addActionListener(this);
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.
{
NAME
ROLL NO.
30
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;
NAME
ROLL NO.
31
String log,pass;
String userName="";
String password="";
public Login()
{}
public void displayLogin()
{
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);
NAME
ROLL NO.
32
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;
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;
NAME
ROLL NO.
33
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);
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("");
NAME
ROLL NO.
34
}
public void cancel()
{
frm.dispose();
}
//......................actionPerformed
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
if (str.equals("Login"))
{
login();
}
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)
NAME
ROLL NO.
35
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)
{
NAME
ROLL NO.
36
37
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");
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");
NAME
ROLL NO.
38
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");
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");
NAME
ROLL NO.
39
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);
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);
NAME
ROLL NO.
40
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)
{
new Registration();
}
});
Consultant.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
new Consultant();
}
});
Appointment.addActionListener(new ActionListener()
{
NAME
ROLL NO.
41
42
{
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 ()
{
public void actionPerformed(ActionEvent e)
{
new Service_Master();
}
});
Drug.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent e)
{
new Drug_Master();
NAME
ROLL NO.
43
}
});
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)
{
changeLogin log=new
changeLogin();
log.displayLogin();
}
});
Quit.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent e)
NAME
ROLL NO.
44
{
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)
{
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+"'");
NAME
ROLL NO.
45
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)
{
String input=JOptionPane.showInputDialog("Enter Date in (MM-DDYY) Form");
rpt=new Report();
NAME
ROLL NO.
46
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)
{
String input=JOptionPane.showInputDialog("Enter Date in
(MM-DD-YY) Form");
rpt=new Report();
NAME
ROLL NO.
47
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+"' ");
}
});
AdvPat.addActionListener(new ActionListener ()
{
NAME
ROLL NO.
48
49
50
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
ROLL NO.
51
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;
NAME
ROLL NO.
52
JTextField
txtpid,txtrc,txtpt,txtdate,txtdept,txtfname,txtmname,txtlname,txtdo
b;
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));
NAME
ROLL NO.
53
lbpid.setFont(new Font("Courier
new",Font.BOLD,15));
txtpid=new JTextField(10);
gbc.gridx=1; gbc.gridy=0;
gbc.ipadx=10;
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));
NAME
ROLL NO.
54
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;
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);
NAME
ROLL NO.
55
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);
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));
NAME
ROLL NO.
56
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));
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);
NAME
ROLL NO.
57
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));
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));
NAME
ROLL NO.
58
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.");
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;
NAME
ROLL NO.
59
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));
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));
NAME
ROLL NO.
60
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);
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));
61
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);
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);
NAME
ROLL NO.
62
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");
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);
NAME
ROLL NO.
63
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);
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 ()
{
NAME
ROLL NO.
64
public void
onPerformed(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
ROLL NO.
65
}
});
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);
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");
NAME
ROLL NO.
66
67
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);
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();
NAME
ROLL NO.
68
}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();
}
}
}
catch (Exception e)
}
public void clear()
{
txtpid.setText("");
txtrc.setText("");
NAME
ROLL NO.
69
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();
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();
NAME
ROLL NO.
70
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=?,C
onsultant_ID=?,FName=?,MName=?,LName=?,DOB=?,Gender=?,M
arital_Status=?,Occupation=?,Remarks=?,Address=?,Mobile_No=?
where Patient_Id='"+id+"'");
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);
NAME
ROLL NO.
71
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_SENSI
TIVE,ResultSet.CONCUR_UPDATABLE);
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)
NAME
ROLL NO.
72
{ 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)+co
nn.sysDate().substring(6,8)+id;
txtpid.setText(i);
conn.rs.beforeFirst();
}
Else
txtpid.setText(conn.sysDate().substring(3,5)+conn.sysDate().substr
ing(0,2)+conn.sysDate().substring(6,8)+"01");
}catch(Exception e){}
}
public void search()
{
String input=JOptionPane.showInputDialog("Enter the Pataient
ID").toUpperCase();
ResultSet rst=conn.getResult("select * from
Registration where Patient_Id='"+input+"'");
NAME
ROLL NO.
73
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
cmbms.setSelectedIndex(1);
loadConsultant();
NAME
ROLL NO.
74
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){}
public void windowIconified(WindowEvent we){}
NAME
ROLL NO.
75
if(cmbcid.getItemCount()<1)
loadConsultant();
}
public void windowDeactivated(WindowEvent
we)
{
cmbcid.removeAllItems(); }
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
ROLL NO.
76
{
}
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()
{
NAME
ROLL NO.
77
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)
NAME
ROLL NO.
78
{
txt.setText("");
text=false;
}
}
}
}
public void generateID(JTextField txt,String sql,String
startAs)
{
try{
connect();
st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,Result
Set.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);
NAME
ROLL NO.
79
else
if(String.valueOf(n).length()<4)
id="0"+String.valueOf(n);
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{
NAME
ROLL NO.
80
connect();
st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,Result
Set.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();
NAME
ROLL NO.
81
Consultant()
{
display();
}
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));
NAME
ROLL NO.
82
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);
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));
NAME
ROLL NO.
83
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);
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;
NAME
ROLL NO.
84
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;
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));
NAME
ROLL NO.
85
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));
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");
NAME
ROLL NO.
86
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);
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));
NAME
ROLL NO.
87
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);
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);
NAME
ROLL NO.
88
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);
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;
NAME
ROLL NO.
89
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--------------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)
{
NAME
ROLL NO.
90
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 ()
{
91
{
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)
{
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();
NAME
ROLL NO.
92
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();
}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
NAME
ROLL NO.
93
{
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()
{
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();
NAME
ROLL NO.
94
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=?,Consultan
t_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();
JOptionPane.showMessageDialog(null,"Updated !");
}catch(Exception e)
{System.out.println(e.getMessage());}
}
public void search()
{
NAME
ROLL NO.
95
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);
found=true;
}catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Sorry !\nNo match
found !");
}
}
public void keyPressed(KeyEvent ke)
NAME
ROLL NO.
96
{
conn.shouldNumber(txtmob,ke);
}
public void keyReleased(KeyEvent ke){}
public void keyTyped(KeyEvent ke){}
public static void main(String agrs[])
{
new Consultant();
}
}
ADMINSTARATOR
CLASS
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Administrator implements ActionListener
{
NAME
ROLL NO.
97
98
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);
con.add(passwordfield);
passwordfield.setForeground(new Color(0,0,0));
passwordfield.setFont(new Font("Courier
new",Font.BOLD,15));
NAME
ROLL NO.
99
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);
frm.setLocation(250,190);
frm.setVisible(true);
NAME
ROLL NO.
100
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();
}
}
public void login()
{
NAME
ROLL NO.
101
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;
public class Adv_Rec_Det implements
WindowListener,KeyListener
NAME
ROLL NO.
102
{
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);
lbcode.setForeground(new Color(0,0,255));
NAME
ROLL NO.
103
104
gbc.ipadx=0;gbc.ipady=0;
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);
NAME
ROLL NO.
105
btSearch=new JButton("Search");
gbc.gridx=2;gbc.gridy=3;
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 ()
NAME
ROLL NO.
106
{
public void actionPerformed(ActionEvent
ae)
{
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 ()
{
NAME
ROLL NO.
107
NAME
ROLL NO.
108
}
public void loadService()
{
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{
NAME
ROLL NO.
109
pst=conn.con.prepareStatement("insert into
Advance_Receipt_Details values(?,?,?)");
pst.setObject(1,bno);
pst.setObject(2,sid);
pst.setString(3,qty);
pst.executeUpdate();
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();
NAME
ROLL NO.
110
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()
{
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();
NAME
ROLL NO.
111
JOptionPane.showMessageDialog(null,"Updated !");
}catch(Exception e){}
}
public void search()
{
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;
NAME
ROLL NO.
112
}
}
for(int i=0;i<=20;i++)
{
String cm=cmbsid.getItemAt(i).toString();
if(sid.equals(cm))
{
cmbsid.setSelectedIndex(i);
break;
}
}
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.*;
NAME
ROLL NO.
113
import javax.swing.JOptionPane;
import javax.swing.text.JTextComponent;
public class Appointment implements WindowListener
{
Connecting conn=new Connecting();
Appointment()
{
display();
}
PreparedStatement pst;
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;
NAME
ROLL NO.
114
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);
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;
NAME
ROLL NO.
115
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);
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;
NAME
ROLL NO.
116
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));
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;
NAME
ROLL NO.
117
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);
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);
NAME
ROLL NO.
118
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);
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);
NAME
ROLL NO.
119
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)
{
search();
}
});
btDelete.addActionListener(new ActionListener ()
{
NAME
ROLL NO.
120
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();
String dt=txtadt.getText();
Object act=cmbstatus.getSelectedItem();
if(dt.equals(""))
JOptionPane.showMessageDialog(null,"Date Time can't be
blank !");
else
{
conn.connect();
NAME
ROLL NO.
121
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();
conn.st=conn.con.createStatement();
if(found)
{
int
d=JOptionPane.showConfirmDialog(null,"Are you sure to delete ?");
if(d==0)
{
NAME
ROLL NO.
122
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);
pst.setString(4,dt);
pst.setObject(5,act);
pst.executeUpdate();
JOptionPane.showMessageDialog(null,"Updated !");
clear();
NAME
ROLL NO.
123
}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();
loadConsultant();
for(int i=0;i<=cmbpid.getItemCount();i+
+)
{
String cm=cmbpid.getItemAt(i).toString();
NAME
ROLL NO.
124
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 !");
}
}}
{
new Appointment();
}
}
BILLING CLASS
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
NAME
ROLL NO.
125
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;
gbc.insets=new Insets(10,20,0,0);
grid.setConstraints(lbbcid,gbc);
cont.add(lbbcid);
NAME
ROLL NO.
126
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
ROLL NO.
127
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
ROLL NO.
128
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);
NAME
ROLL NO.
129
gbc.gridx=1; gbc.gridy=5;
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");
NAME
ROLL NO.
130
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,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();
NAME
ROLL NO.
131
}
});
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();
}
});
btEdit.addActionListener(new ActionListener ()
{
NAME
ROLL NO.
132
133
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();
}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();
NAME
ROLL NO.
134
}
}
}
catch (Exception e)
}
public void clear()
{
txtbcid.setText("");
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=?,Effec
tive_To=?,Active=? where ID='"+id+"'");
pst.setString(1,id);
NAME
ROLL NO.
135
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 !");
}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"))
NAME
ROLL NO.
136
cmbact.setSelectedIndex(0);
else
cmbact.setSelectedIndex(1);
found=true;
}catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Sorry !\nNo match
found !");
}
}
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();
}
}
137
import java.sql.*;
import javax.swing.*;
import javax.swing.JOptionPane;
public class CrMaster
{
Connecting conn=new Connecting();
CrMaster()
{
display();
}
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);
NAME
ROLL NO.
138
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);
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));
NAME
ROLL NO.
139
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");
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;
NAME
ROLL NO.
140
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);
frm.show();
//---------Button Add Event Handler-------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
ROLL NO.
141
{
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(txtCode,"select Code from
CreditCard_Master","CC");
NAME
ROLL NO.
142
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();
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+"'";
NAME
ROLL NO.
143
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()
{
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());
NAME
ROLL NO.
144
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();
txtCode.setText(rst.getString(1));
txtDes.setText(rst.getString(2));
txtDes.select(0,0);
found=true;
}catch(Exception e)
{
NAME
ROLL NO.
145
}
public static void main(String agrs[])
{
CrMaster c=new CrMaster();
}
}
DRUG CLASS
import java.awt.*;
import java.awt.event.*;
NAME
ROLL NO.
146
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()
{
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);
NAME
ROLL NO.
147
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);
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));
NAME
ROLL NO.
148
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));
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));
NAME
ROLL NO.
149
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);
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;
NAME
ROLL NO.
150
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;
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));
NAME
ROLL NO.
151
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;
gbc.ipadx=0;
gbc.insets=new Insets(25,37,0,0);
NAME
ROLL NO.
152
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
frm.setVisible(true);
frm.setResizable(false);
frm.show();
NAME
ROLL NO.
153
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();
}
});
btDelete.addActionListener(new ActionListener ()
NAME
ROLL NO.
154
{
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();
String shape=txtshape.getText();
NAME
ROLL NO.
155
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
ROLL NO.
156
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
NAME
ROLL NO.
157
Code=?,Name=?,Company_Name=?,Unit_of_Measure=?,Stock_on_
Hand=?,Manufacture_Dt=?,Expiry_Dt=?,Shape=? where
Code='"+id+"'");
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();
}
}
NAME
ROLL NO.
158
GENERIC CLASS
import java.awt.*;
import java.awt.event.*;
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;
NAME
ROLL NO.
159
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);
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);
NAME
ROLL NO.
160
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));
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);
NAME
ROLL NO.
161
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=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;
NAME
ROLL NO.
162
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);
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;
NAME
ROLL NO.
163
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
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)
NAME
ROLL NO.
164
{
clear();
}
});
btSearch.addActionListener(new ActionListener
()
{
public void actionPerformed(ActionEvent
ae)
{
frm.dispose();
conn.connect();
sc.search();
}
});
btDelete.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent
ae)
{
delete();
}
});
btEdit.addActionListener(new ActionListener
()
{
public void actionPerformed(ActionEvent
ae)
{
edit();
}
NAME
ROLL NO.
165
});
}
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();
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+"'";
NAME
ROLL NO.
166
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 clear()
{
txtcode.setText("");
txtname.setText("");
txtcn.setText("");
txtuom.setText("");
txtstock.setText("");
found=false;
}
public void edit()
{
String id=txtcode.getText();
NAME
ROLL NO.
167
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_
Hand=? where Code='"+id+"'");
pst.setString(1,id);
pst.setString(2,name);
pst.setString(3,cn);
pst.setObject(4,uom);
pst.setString(5,stock);
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();
}
}
NAME
ROLL NO.
168
NAME
ROLL NO.
169
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));
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);
NAME
ROLL NO.
170
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;
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;
NAME
ROLL NO.
171
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;
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);
NAME
ROLL NO.
172
frm.show();
btAdd.addActionListener(new ActionListener
()
{
public void actionPerformed(ActionEvent
ae)
{
add();
clear();
}
});
btClear.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent
ae)
{
clear();
}
});
btSearch.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent
ae)
{
frm.dispose();
conn.connect();
searchPayDetail sc=new
searchPayDetail();
sc.search();
NAME
ROLL NO.
173
}
});
btDelete.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent
ae)
{
delete();
}
});
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);
}
NAME
ROLL NO.
174
}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()
{
txtamt.setText("");
txtdate.setText("");
cmbbno.setSelectedIndex(0);
found=false;
}
public void delete()
{
Object str=cmbbno.getSelectedItem();
NAME
ROLL NO.
175
}
public void edit()
{
String code=txtamt.getText();
String name=txtamt.getText();
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);
NAME
ROLL NO.
176
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
ROLL NO.
177
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();
ResultSet rs=st.executeQuery(sql);
ResultSetMetaData md=rs.getMetaData();
int col=md.getColumnCount();
for(int i=1;i<=col;i++)
NAME
ROLL NO.
178
{
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();
}
else
JOptionPane.showMessageDialog(null,"Sorry ! \nNo Match
Found !");
NAME
ROLL NO.
179
}
public static void main(String agrs[])
{
Report frame=new Report();
frame.ReportDisplay("Select * From Consultant");
}};
NAME
ROLL NO.
180
NAME
ROLL NO.
181
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);
cont.add(lbdes);
lbdes.setForeground(new Color(0,0,255));
NAME
ROLL NO.
182
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
ROLL NO.
183
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
ROLL NO.
184
txtrate.setBackground(new
Color(255,175,175));
JLabel
NAME
ROLL NO.
185
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);
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);
NAME
ROLL NO.
186
cont.add(btEdit);
btDelete=new
JButton("Delete");
gbc.gridx=3;gbc.gridy=6;
gbc.ipadx=10;
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 ()
{
NAME
ROLL NO.
187
NAME
ROLL NO.
188
{
public void actionPerformed(ActionEvent
ae)
{
edit();
}
});
}
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{
NAME
ROLL NO.
189
NAME
ROLL NO.
190
}
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=?,EF
Ffrom=?,EFFto=? where Service_ID='"+id+"'");
pst.setString(1,id);
NAME
ROLL NO.
191
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();
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();
}
}
NAME
ROLL NO.
192
USER CLASS
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class User
{
Connecting conn=new Connecting();
User()
{
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");
NAME
ROLL NO.
193
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;
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;
NAME
ROLL NO.
194
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;
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);
NAME
ROLL NO.
195
frm.setResizable(false);
//Resized the
window...
frm.show();
btAdd.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent
ae)
{
add();
}
});
btDelete.addActionListener(new ActionListener ()
{
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(""))
NAME
ROLL NO.
196
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();
}
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");
NAME
ROLL NO.
197
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)
{
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{
NAME
ROLL NO.
198
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();
}
}
PAYMENT MODE
NAME
ROLL NO.
199
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;
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;
NAME
ROLL NO.
200
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);
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));
NAME
ROLL NO.
201
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");
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);
NAME
ROLL NO.
202
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);
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)
{
clear();
}
});
btSearch.addActionListener(new ActionListener ()
{
public void actionPerformed(ActionEvent ae)
{
frm.dispose();
NAME
ROLL NO.
203
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();
}
});
}
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");
NAME
ROLL NO.
204
}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)
{
conn.st.executeUpdate(sp);
clear();
}
}
}
catch (Exception e)
}
NAME
ROLL NO.
205
NAME
ROLL NO.
206
}}
Login Page
NAME
ROLL NO.
207
Menu Page
NAME
ROLL NO.
208
Registration
Billing Class
NAME
ROLL NO.
209
Advance Receipt
NAME
ROLL NO.
210
Appointment
Consultant Details
NAME
ROLL NO.
211
Credit card
Drug Master
NAME
ROLL NO.
212
Generic Master
Payment Mode
NAME
ROLL NO.
213
Service Master
Payment details
NAME
ROLL NO.
214
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
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.
NAME
ROLL NO.
215
Integration testing
Unit testing
Code
Design
Requirement
System engineers
NAME
ROLL NO.
216
Unit testing:Unit testing focus verification afford on the smallest unit of the
software
design-the
software
component
module.
Using
NAME
ROLL NO.
217
the
testing
program
is
structure
systematic
while
at
technique
the
same
for
time
that
demonstrates
conformity
with
requirements.
Each
NAME
ROLL NO.
218
A. alpha testing :The alpha test is conducted at the developers 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
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.
219
NAME
ROLL NO.
220
Debugging
Unit testing
Integration Testing
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
THERE ARE FOLLOWING ERROR IN SYNTEX AND CONNECTION.
NAME
ROLL NO.
221
NAME
ROLL NO.
222
REPORT
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_
PERCENTAGE","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;
NAME
ROLL NO.
223
PageFormat pageFormat;
Dimension screensize;
Connection connection;
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);
NAME
ROLL NO.
224
screensize=Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screensize.width-750)/2,(screensize.height550)/2,750,550);
setVisible(true);
setResizable(false);
NAME
ROLL NO.
225
connect();
load();
}
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");
}
}
NAME
ROLL NO.
226
i++;
}
NAME
ROLL NO.
227
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_SC
ROLLBAR_NEVER);
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++;
}
NAME
ROLL NO.
228
}
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();
}
}
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);
NAME
ROLL NO.
229
}
}
}
}
}
public class setupListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String cmd = e.getActionCommand();
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
ROLL NO.
230
NAME
ROLL NO.
231
NAME
ROLL NO.
232
Tools/Platform
Environmental Characteristics:
Minimum Hardware required For the Proposed System.
Software Used:
NAME
ROLL NO.
233
Limitations of Project
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
ROLL NO.
234
NAME
ROLL NO.
235
BIBLIOGRAPHY
1. DATABASE SYSTEMS CONCEPT KORTH, SUDARSHAN
2. SYSTEM ANALYSIS AND DESIGN E. M. AWARD
3. ORACLE PL/SQL PROGRAMMING OREILLY 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
ROLL NO.
236