Loan Processing System
Loan Processing System
Loan Processing System
The objective of the project “Loan Processing System” is to make the working of loan
processing for the company smooth and easy. At present the work of company is being done
manually. So sometimes if a staff is absent without giving prior notice it becomes difficult for
the management in processing of loan also some staff make irregularities in loan installment
collections. The software will help the management to check these irregularities.
The Finance Company has a lot of customers, each customer has taken loan for different
goods from different banks, and the management of the company needs to track the loan
payment of each customer. The software will help the management to know the status of the
customers on single click. Some customers do not make their payments on time so a post dated
cheque is taken from these customers in advance. Still some customer don’t have money in their
account in such cases, reminders are given to the customers before their installments date so
that each installment comes in time. To reminders to the customers the management needs to
know the date and amount of installment for each customer. The work is also made easy with
the help of this software. When a customer ask for loan, the details of shops, their item/products
on which loan can be issued by the company is shown to these customers. These details can be
easily given to the customer with the help of this software.
There are some rules and regulations of the company for granting loans, these are given to the
customers through this software.
The banks through which loans are managed for the customer have their own rules and
regulations, different banks have different rates and loan recovery policies, these things must be
made clear by the software to its customer.The bottom line is that all the work of the Finance
Company for granting loan should be made easy to manage by their software.
1
SYSTEM ANALYSIS
System analysis is a structural process for solving problems when there processes are applied to
information system then termed as life cycle methodology.
Earlier “ LOAN PROCESSING SYSTEM ” employees did each and every work manually. By
doing the work manually, there were always great chances of errors and dissatisfactions among
management also. The manual work is tedious and time consuming. It also get pressurize the
employees regarding their efficiency. Therefore there was always need for a kind of software
which can fulfill all the above requirement with accuracy in a minimum amount of time and
sorting all relevant problems using less afford.
There is a need to develop a project for this private Loan provider bank for there faster retrieval
of information, Improve accuracy and reliability , ability to handle large volume of information,
Better security.It may also give complete up to date information performance of " LOAN
PROCESSING SYSTEM FOR ”. The system user can maintain and provide LOANS to the
customer of the " LOAN PROCESSING SYSTEM" under the command.
2
PRELIMINARY INVESTIGATION
Since all the works are done manually, that’s why there is more time requires for little job.
Always there is queue of customers (clients) waiting for their turn. The simple work looks like
cumber some one. As a result employees get pressurize and clients get aggressive, because of
suffering of a lot of time. This creates a little more dissatisfaction among clients. All employees
or clients want quick LOANS, but this can’t be done manually. Therefore management decides
to convert manual system into electronic i.e. computerization is required. By computerization
any type of query regarding loan can be done instantly. Clients get information regarding any
scheme in which they’re interested in few seconds. Simultaneously, information can be viewed
in graphical representation such that easy for understanding. Storing and retrieval of
information are so fast that many jobs can be done in respectively lesser time. This increases
satisfaction level of clients, simultaneously employees feel relax as LOANS is going fast and
hence the efficiency of employees relatively increases. Latest version of Computerization
makes information safer. Also, management can generate several reports, which will help him to
plan future strategy for company behalf.
So, the purpose of the preliminary investigation is to evaluate project requests. The
preliminary investigation should accomplish the objectives i.e. is clarify and understand the
project request, determine the size of the project, asses cost and benefits of alternative
approaches. Determine the technical and operational feasibility of alternative approaches.
3
FEASIBILITY STUDY
Feasibility Study: An important outcome of the preliminary investigation phase is that the
package required is feasible and meets the efficiency criterion, the workability standard; also it
meets the user’s needs. The various types of feasibility are:
Economic Feasibility: This evaluation looks at the financial aspect of the project. To carry out
an economical study it is necessary to place actual money values against any activities needed to
implement the proposed system. It is also necessary to place money values against any benefits
that will come from a new system. Such calculations are often described as cost benefit analysis.
The proposed software is economically feasible, as no big investment is required.
Schedule Feasibility: It is the probability that the developer can complete the development of
the project within the scheduled time i.e. whether the time period is feasible or not.
must then determine the general attitude and skills whether such restructuring of the jobs will be
acceptable to the users. As far as project is concerned, the hardware and software as discussed
before, are enough to run the proposed budget, hence the system is supposed to be feasible
regarding all aspects of feasibility.
4
The proposed system had full capability to be used by one or more
person at a time, i.e. it can be used in a multi-user environment.
Interfaces: The proposed system " LOAN PROCESSING SYSTEM FOR ” matches with the
commonly used window interfaces. Which are user friendly and any one, who knows the basics
of computer can easily handle this proposed application software after connecting the web site of
" LOAN PROCESSING SYSTEM FOR "
Behavioral Description: It describes about the various types of events used in developing "
LOAN PROCESSING SYSTEM FOR ".
PROJECT PLANNING
Project planning and controlling is directed by us with usage of available resources to produce a
new and better ‘ LOAN PROCESSING SYSTEM FOR “
Project planning is the most important management activity because without a proper plan
the monitoring and control is not possible. Many project fails due to poor planning.
Requirement analysis specification is the input to planning process that produce a planned
document describing different aspects and major issues of project like :-
Cost estimation
Schedule and milestones
Personnel plan
Software quality assurance plan
Configuration management plan
Project monitoring plan
Risk management
We use the available resources to produce a new and better “CLIENT TRACKING
SYSTEM”. Project planning for the organization has four main aspects:-
Organizing the resources
5
Scheduling the events
Establishing standards
Only the effective management can complete the project on time, within budget and with
satisfactory results. The objective of project planning is to provide a framework that enables
manager to make responsible estimates of resource, cost and schedule in a limited time frame at
the beginning of the project and should be updated as our project progresses.
PROJECT SCHEDULING
In Project scheduling, a network of software engineering task are created which help to get the
work done on time. Once the network is created, responsibility of each task are assigned to
people make sure it gets done. All these work are done by project manager. In order to build a
complex system like ‘‘ LOAN PROCESSING SYSTEM FOR ’ many task occur in parallel and
one task has effect on others. It is also virtually impossible to access progress without a detailed
schedule.
Task to be schedule in our project are:-
Data processing
System design
Programming
Files and database creation
Program and system testing
Conversion
Documentation
Training
A schedule has two primary functions. These are:-
a) Plan
6
A schedule must be flexible to reflect the changes due to unexpected events. A schedule can
not be so rigid that when an unexpected event occurs subsequent events can not be re-
scheduled. Scheduling can be done with resource constraint or time constraint in mind.
Progress of our project ‘Client tracking system’ can be easily measured in chartered project.
The two charting techniques are:-
Gantt chart (for simple project)
Pert chart (for complex project)
The software requirement specification is produced at the culmination of the analysis task. The
function and performance allocated to software as a part of system engineering are refined by
establishing a complete information description, a detailed functional description, and
representation of the system behavior, an indication of performance requirement and design
constraints appropriate validation criteria, and other information pertinent to requirement.
The requirement specification involves obtaining a clear and throughout
understanding the product to be developed. The introduction of the software requirement
specification states the goal and objectives of the software, describing it in the content of the
computer based system. Actually the introduction may be nothing more than the software scope
of the planning document.
Validation criteria is the most important and often neglected section of the
software require specification, how do we recognize a successful implementation. Yet,
7
specification of validation criteria acts as implicit review of all other requirement. It is essential
that time and attention be given this section.
Use case Diagrams describe what a system does from the standpoint of an external observer. It
emphasis on what a system does rather than how.
Use case diagrams are closely connected to scenarios. A scenario is an example of what happen
when someone interacts with the system.
A Use case is a summery of scenarios for a single task or goal. An actor s who or what initiates
the event involved in that task. Actors are simply roles that people or object play.
Receive Information.
8
use case diagram for manager
Clerk
Give information
about various
Lonas.
Receive Payments.
Provide Receipt to
the Customer.
.
Provide Payment
Report.
Customer
9
Ask for various
loans.
Receive Information
Guaranteer
Help to making
new customer.
Ask for
Customer
Details.
10
E R – DIAGRAM
bank loan
fro
m
cno
idate cloan
instalmentamount payment
fro
m
11
DATA FLOW DIAGRAM
A graphical tool used to describe and analyze the movement of data flow through a system,
manual or automated including the process, stores of data and delays in the system. Dfd is the
control tool and the basis from which other components are developed, these tool is suppose to
be more friendly to the user as any one can easily get a overview of how the system works. Dfd
is the most used tool in every system of the project. As it releases most of the burden from
understanding the complication of the system.
The top-level is often called a context diagram. It contains a single process, but it
plays a very important role in studying the current system.
1. Arrows
2. Circles
4. Squares.
12
0 Level DFD
Loan
Customer Processing Management
System
banks
Customer 2
Loan check loan sanction
Sanction get loan sanction details
System
customer
get loan
Management
13
2nd Level DFD
enquiry ? Bank
1.1
Customer
CustomerEnquiry Product
gets detail System
customer
ask report of non-payment customer 3.1
Bad Customer
gets detail System Payment
Management
3.2 Security
Loan Complete
ask detail for loan complete System Customer
gets detail
ask for security report
return
3.3
Loan Payment makes payment
System
receipt
14
Data dictionary
It is a powerful tool that is extensively used in system analysis. DDs as they are called provide
a detailed reference to every data item the different names by which the item is represented, in
different program modules, different data structures used to represent the item in different
modules, the modules where the data item is generated, where it is stored and destroyed. In
essence it provides a quick snapshot of every data item used by the information system.
Needless to say it is extremely detailed and very useful for consistency checks, system
modification and completeness checking.
Uses of Data Dictionary:
Manage Detail:
Large systems have huge volumes of data flowing through them in the form of documents,
reports and even conversations (but even small systems will seem to carry large quantities of
data). Similarly, many different activities take place that use existing data or create new details.
Communicate Meaning:
Data dictionaries assist in ensuring common meanings for system elements and activities. Data
dictionaries record additional details about the data flow in a system so that all persons involved
can quickly look up the description of data flows, data stores, or processes.
Document System Features:
Documenting the features of an information system is the third reason for using data dictionary
systems. Features include the parts or components and the characteristics that distinguish each.
Having to formally describe system features will produce a more complete understanding. And
once the features have been articulated and recorded, all participants in the project will have
common source for information about the system.
Facilitate Analysis:
The fourth advantage of data dictionaries is to determine whether new features are needed in a
system or whether changes of any type are in order. What question would you ask and what
information would you want to have available for examination?
15
☻Nature of Transactions
The business activities that will be carried on while using the system, including the data needed
to accept, authenticate, and process each activity.
☻Inquiries
Requests for the retrieval of information or processing to generate a specific response.
☻Output and Report Generation
Results of system processing presented to users in an acceptable form.
☻Files and Databases
Details of transactions and master records of concern to the organization.
☻System Capacity
The ability of the system to accept, process, and store transaction and data.
☻Locate Errors and Omissions:
Having information in a dictionary about these system characteristics transactions, inquiries,
data and capacity will tell you a great deal about a system and allow you to evaluate it. But you
need to know the information itself is complete and accurate.
Four symbols and four that govern the construction of data dictionary entries:
1. = Equivalent to
2. + Add
3. [] Either/or
4. () Optional entry
Four rules:
1. Words should be defined to stand for what they mean and not the variable names by
which they may be described in the program; use FIRST-NAME not XYZ or NAME06.
Capitalization of words helps them to stand out and may be of assistance.
2. Each word must be unique; we cannot have two definitions of the same client name.
3. Aliases, or synonyms, are allowed when two or more entries show the same meaning; a
vendor number may also be called a customer number. However, aliases should be used
only when absolutely.
4. Self-defining words should not be decomposed.
16
SYSTEM DESIGN
MODULARISATION DETAILS
Software is divided into separately named and addressable components called modules that
integrated to satisfy problem requirements.
1. Enquiry _system( )
2 Guaranter _system( )
3 Bank_system( )
4 Payment _system( )
5 Product_system( )
6 Customer _system( )
Software is divided into separately named and addressable components called modules that
integrated to satisfy problem requirements.
LOAN PROCESSING SYSTEM FOR has six module:-
1) Enquiry _system:- This module contains the detail of those person who enquiry
about LOAN PROCESSING SYSTEM FOR . They ask for the which kind of loan is
provided by LOAN PROCESSING SYSTEM FOR How much interest is taken by
LOAN PROCESSING SYSTEM FOR .process of taking loan.All the deatails are
provided by the enquire system..
2) Guaranter _ system:- Those who want to loan from LOAN PROCESSING
SYSTEM FOR they need guaranter name address, phone no, all the details was
submitted for LOAN PROCESSING SYSTEM FOR records.
17
3) Bank _ system :- this module contains various types of loans that is provided to
the customer. It also contains details of the customer such as name and address of the
customer.
4) Payment_system :- This module contains the details of all the payments. This
module contain the detail such as C_no, installment amount and enquiry date.
5) Product system: - This module contain the details of all product that is provided
by the bank. It contain the details such as product no, name of the customer, shop no,
shop address .
6) Customer_system:- This module contain the details of all the customer those
who are related to the bank. . It contain the details such as customer no, name
address, phone no, product no, bank no.
18
DATA INTEGRITY AND CONSTRAINTS
Integrity means to maintain the consistency of data, thus integrity constraints providing a means
of ensuring that changes made to the database by authorized users do not result in a loss of data
consistency. Thus, integrity constraints guard against damage to the database.
The integrity constraints are of two types:-
A. Key declaration
B. Form of relationship
1. Candidate Keys
Easy relation have at least one Candidate Key, because relation does not contain duplicate
tuples a Candidate Key could be combination of many attributes also, if necessary.
19
1.2 Foreign Keys
Foreign keys are also defined on set of attributes. Every value of a given foreign key is
required to appear as a value of the matching Candidate key. There is no requirement of that
a Foreign key be a component of the Primary key or of some Candidate Key of its
containing relation.
Foreign keys used in this project are:-
20
DATA BASE DESIGN
Data design:-data design is the first and foremost activity of system design. Data describes a
read-world information recourse i.e important for the application.
Data describes various entities like customer, people asset etc.
The primary objective of data design is to select logical representation of data
items identified in requirement analysis phase.
The data requirements for the application:-
Name of the data item.
General description of the data item.
Ownership of the data item.
Logical events, processes and relationships.
Process Logic
The process logic for the software “Loan Processing System” is as follow:
When a person comes for loan/finance details he is called enquiry by the company. He is given
the details for finance, the interest on loan amount, the term and conditions of the company, the
products on which loan can be given and the banks from which loans are arranged. The
PRODUCT Table is used to give the details of the products on which loan can be arranged by
the company, the BANKS Table is used to show the list of banks from which loans can be
arranged. The term and conditions of the banks are also given the enquiry. His details are stored
in the ENQUIRY Table. This detail helps the company to know list if people who have come to
them and through which sources people are knowing the company.
Once the enquiry get satisfied by the term and conditions he has to sign some documents,
give past dated cheques to the company. The details of the CUSTOMER Table. The customer
21
has to bring a guarantor who takes guarantee of the customer. His detail is stored in the
GUARANTORS table. The company takes about a week in processing of this information
supplied by the customer and arranging loan amount for the customer. It is not necessary that
loan is arranged from banks of the company is save about the customer sometimes, the
company can itself make arrangements for loans. These details are stored in the CUSTOMER
Table. The loan amount, number of installment, payment amount, etc details are decided
according to the rules of the company and stored in the CUSTOMERS Table.
When the customers start making installment payment of a customer is
complete, the customer status is marked ‘C’ in the CUSTOMRES Table. When a customer is
not making his payments on time he is marked as ‘B’. If a customer is making his payments on
time he is marked ‘G’. these marking helps the management to know about the customer that he
is marking his payments on time or not.
Procedural Design
Component-Level design, also called procedural design, occurs after data, architectural, and
interface design have been established. The intent is to translate the design model into
operational software. But the level of abstraction of the existing design model is relatively high,
and the abstracting, opening the door to the introduction of subtle errors that are difficult to find
and correct in later stages of the software process.
What is it ?
Data, architectural, and interface design must be translated into operational software. To
accomplish this, the design must be represented at a level of abstraction that is close to code.
Component-Level design establishes the algorithmic details required to manipulate data
structures, effect communication between software component via their interfaces, and
implement the processing algorithms allocated to each component.
Who does it ?
A software engineer performs component-level design.
22
Why is it important ?
We have to be able to determine whether the program will work before we built it. The
component-level design represents the software in a way that allows us to review the details of
the design for correctness and consistency with earlier design representation(i.e., the data,
architectural, and interface designs). It provides a means for assessing whether data structures,
interfaces, and algorithms will work.
What are the steps ?
Design representations of data, architecture, and interfaces form the foundation for component-
level design. The processing narrative for each component is translated into a procedural design
model using a set of structured programming constructs. Graphical, tabular, or text-based
notation is used to represent the design.
What is the work product ?
The procedural design for each component, represented in graphical, tabular, or text-based
notation, is the primary work product produced during component-level design.
How do I ensures that I‘ve done it right ?
A design walkthrough of inspection is conducted. The design is examined to determine whether
data structures, interfaces, processing sequences, and logical conditions are correct and will
produce the appropriate data or control transformation allocated to the component during earlier
design steps.
23
The following are the elements for good interface design:-
1) Goal and the intension of task must be identified.
CODING
LOGIN WINDOW
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
24
Container c;
JPanel p1;
Statement stmt;
Connection conn;
ResultSet rst;
LoginWin()
{
l1=new JLabel("Enter User Name"); l2=new JLabel("Enter Password");
t1=new JTextField(); t2=new
JPasswordField();
b1=new JButton("Ok"); b2=new JButton("Cancel");
b1.addActionListener(this); b2.addActionListener(this);
c=getContentPane(); p1=new JPanel();
p1.setLayout(null); c.add(p1);
p1.add(l1);l1.setBounds(100,150,110,25);
p1.add(l2);l2.setBounds(100,190,110,25);
p1.add(t1);t1.setBounds(250,150,150,25);
p1.add(t2);t2.setBounds(250,190,150,25);
p1.add(b1);b1.setBounds(100,230,80,25);
p1.add(b2);b2.setBounds(250,230,80,25);
setVisible(true);
setSize(600,500);
setTitle("LOGIN WINDOW");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
25
String name="",pass="",desig="";
name=t1.getText();
pass=t2.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select desig from userid where username='"+name+"'"+"
and "+"password='"+pass+"'");
System.out.println(desig);
if(rst.next())
{
desig=rst.getString(1);
check=true;
}
else
JOptionPane.showMessageDialog(null,"Invalid username or password");
if(desig.compareTo("Administrator")==0)
new MainWin();
else if(desig.compareTo("Manager")==0)
new ManagerWin();
else if(desig.compareTo("Clerk")==0)
new ClerkWin();
else if(desig.compareTo("Receptionist")==0)
new ReceptionWin();
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
26
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
search();
if(check==true)
{
check=false;
dispose();
}
}
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");
}
}
public static void main(String args[])
{
new LoginWin();
}
}
MAIN WINDOW
import java.util.*;
import java.awt.*;
import java.awt.event.*;
27
import javax.swing.*;
class MainWin extends JFrame implements ActionListener,Runnable
{
JMenuBar mb;
JMenu umnu,cmnu,emnu,smnu,gmnu,pmnu,paymnu,bmnu,rmnu,hmnu;
JMenuItem uent,cent,eent,sent,pent,payent,bent,
usear,csear,esear,ssear,gsear,psear,paysear,bsear,
urem,crem,erem,srem,grem,prem,payrem,brem,
uup,cup,eup,sup,gup,pup,payup,bup,
re,rc,rg,rpay,rp,rb,rs,ru,
hsw,htop;
JToolBar tool;
JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16;
JPanel status;
JLabel l1,l2,l3;
Icon i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16;
JInternalFrame jif=new JInternalFrame();
static JDesktopPane jdsp=new JDesktopPane();
MainWin()
{
mb=new JMenuBar(); tool=new JToolBar();
status=new JPanel();
l1=new JLabel("Main Window");l2=new JLabel();l3=new JLabel();
i1=new ImageIcon("b1.jpg"); i2=new ImageIcon("b2.jpg");
i3=new ImageIcon("b3.jpg"); i4=new ImageIcon("b4.jpg");
i5=new ImageIcon("b5.jpg"); i6=new ImageIcon("b6.jpg");
i7=new ImageIcon("b7.jpg"); i8=new ImageIcon("b8.jpg");
28
i9=new ImageIcon("b9.jpg"); i10=new ImageIcon("b10.jpg");
i11=new ImageIcon("b11.jpg"); i12=new ImageIcon("b12.jpg");
i13=new ImageIcon("b13.jpg"); i14=new ImageIcon("b14.jpg");
i15=new ImageIcon("b15.jpg"); i16=new ImageIcon("b16.jpg");
b1=new JButton(i1); b2=new JButton(i2);
b3=new JButton(i3); b4=new JButton(i4);
b5=new JButton(i5); b6=new JButton(i6);
b7=new JButton(i7); b8=new JButton(i8);
b9=new JButton(i9); b10=new JButton(i10);
b11=new JButton(i11); b12=new JButton(i12);
b13=new JButton(i13); b14=new JButton(i14);
b15=new JButton(i15); b16=new JButton(i16);
b1.setToolTipText("Enquiry Entry Form");
b2.setToolTipText("Customer Entry Form");
b3.setToolTipText("Payment Entry Form");
b4.setToolTipText("Guaranter Entry Form");
b5.setToolTipText("Product Entry Form");
b6.setToolTipText("Bank Entry Form");
b7.setToolTipText("Staff Entry Form");
b8.setToolTipText("User Entry Form");
b9.setToolTipText("Enquiry Search Form");
b10.setToolTipText("Customer Search Form");
b11.setToolTipText("Payment Search Form");
b12.setToolTipText("Guaranter Search Form");
b13.setToolTipText("Product Search Form");
b14.setToolTipText("Bank Search Form");
b15.setToolTipText("Staff Search Form");
b16.setToolTipText("User Search Form");
b1.addActionListener(this); b2.addActionListener(this);
29
b3.addActionListener(this); b4.addActionListener(this);
b5.addActionListener(this); b6.addActionListener(this);
b7.addActionListener(this); b8.addActionListener(this);
b9.addActionListener(this); b10.addActionListener(this);
b11.addActionListener(this); b12.addActionListener(this);
b13.addActionListener(this); b14.addActionListener(this);
b15.addActionListener(this); b16.addActionListener(this);
emnu=new JMenu("ENQUIRY"); cmnu=new JMenu("CUSTOMER");
gmnu=new JMenu("GUARANTER"); paymnu=new JMenu("PAYMENT");
pmnu=new JMenu("PRODUCT"); bmnu=new JMenu("BANK");
smnu=new JMenu("STAFF"); umnu=new JMenu("USER");
rmnu=new JMenu("REPORT"); hmnu=new JMenu("HELP");
umnu.setMnemonic('U'); cmnu.setMnemonic('C');
emnu.setMnemonic('E'); smnu.setMnemonic('S');
gmnu.setMnemonic('G'); pmnu.setMnemonic('R');
paymnu.setMnemonic('P'); bmnu.setMnemonic('B');
rmnu.setMnemonic('O'); hmnu.setMnemonic('H');
uent=new JMenuItem("Entry",'e'); cent=new JMenuItem("Entry",'e');
eent=new JMenuItem("Entry",'e'); sent=new JMenuItem("Entry",'e');
pent=new JMenuItem("Entry",'e'); payent=new JMenuItem("Entry",'e');
bent=new JMenuItem("Entry",'e'); usear=new JMenuItem("Search",'s');
csear=new JMenuItem("Search",'s'); esear=new JMenuItem("Search",'s');
ssear=new JMenuItem("Search",'s'); gsear=new JMenuItem("Search" ,'s');
psear=new JMenuItem("Search",'s'); paysear=new JMenuItem("Search",'s');
bsear=new JMenuItem("Search",'s'); urem=new JMenuItem("Remove",'r');
crem=new JMenuItem("Remove",'r'); erem=new JMenuItem("Remove",'r');
srem=new JMenuItem("Remove",'r'); grem=new JMenuItem("Remove",'r');
prem=new JMenuItem("Remove",'r'); payrem=new JMenuItem("Remove",'r')
brem=new JMenuItem("Remove",'r'); uup=new JMenuItem("Update",'u');
30
cup=new JMenuItem("Update",'u'); eup=new JMenuItem("Update",'u');
sup=new JMenuItem("Update",'u'); gup=new JMenuItem("Update",'u');
pup=new JMenuItem("Update",'u'); payup=new JMenuItem("Update",'u');
bup=new JMenuItem("Update",'u'); re=new JMenuItem("Enquiry",'e');
rc=new JMenuItem("Customer",'c'); rg=new JMenuItem("Guaranter",'g');
rpay=new JMenuItem("Payment",'p'); rp=new JMenuItem("Product",'r');
rb=new JMenuItem("Bank",'b'); rs=new JMenuItem("Staff",'s');
ru=new JMenuItem("User",'u'); htop=new JMenuItem("About Topic",'t');
hsw=new JMenuItem("About S/W",'w');
cent.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,InputEvent.CTRL_MA
SK));
sear.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MAS
K));
cup.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U,InputEvent.CTRL_MA
SK));
eent.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MA
SK));
esear.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,InputEvent.CTRL_M
ASK));
eup.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,InputEvent.CTRL_MAS
K));
payent.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,InputEvent.CTRL_M
ASK));
payup.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,InputEvent.CTRL_M
ASK));
paysear.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_
MASK));
gsear.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H,InputEvent.CTRL_M
ASK));
31
Container c=getContentPane();
umnu.add(uent);umnu.add(usear);umnu.add(urem); umnu.add(uup);
cmnu.add(cent);cmnu.add(csear);cmnu.add(crem); cmnu.add(cup);
emnu.add(eent); emnu.add(esear); emnu.add(erem); emnu.add(eup);
smnu.add(sent);smnu.add(ssear);smnu.add(srem); smnu.add(sup);
gmnu.add(gsear);gmnu.add(grem); gmnu.add(gup);
pmnu.add(pent);pmnu.add(psear);pmnu.add(prem); pmnu.add(pup);
paymnu.add(payent);paymnu.add(paysear);paymnu.add(payrem);
paymnu.add(payup);
bmnu.add(bent);bmnu.add(bsear);bmnu.add(brem);bmnu.add(bup);
rmnu.add(re);rmnu.add(rc);rmnu.add(rpay); rmnu.add(rg);rmnu.add(rp);
rmnu.add(rb);rmnu.add(rs); rmnu.add(ru); hmnu.add(htop); hmnu.add(hsw);
uent.addActionListener(this);usear.addActionListener(this);
urem.addActionListener(this);uup.addActionListener(this);
cent.addActionListener(this);csear.addActionListener(this);
crem.addActionListener(this);cup.addActionListener(this);
eent.addActionListener(this);esear.addActionListener(this);
erem.addActionListener(this);eup.addActionListener(this);
sent.addActionListener(this);ssear.addActionListener(this);
srem.addActionListener(this);sup.addActionListener(this);
gsear.addActionListener(this); grem.addActionListener(this);
gup.addActionListener(this);
pent.addActionListener(this);psear.addActionListener(this);
prem.addActionListener(this);pup.addActionListener(this);
payent.addActionListener(this);paysear.addActionListener(this);
payrem.addActionListener(this);payup.addActionListener(this);
bent.addActionListener(this);bsear.addActionListener(this);
brem.addActionListener(this);bup.addActionListener(this);
re.addActionListener(this);rc.addActionListener(this);
32
rpay.addActionListener(this);rp.addActionListener(this);
rg.addActionListener(this);rb.addActionListener(this);
rs.addActionListener(this);ru.addActionListener(this);
htop.addActionListener(this);hsw.addActionListener(this);
mb.add(emnu);mb.add(cmnu);mb.add(paymnu);mb.add(gmnu);
mb.add(pmnu);mb.add(bmnu);mb.add(smnu);mb.add(umnu);
mb.add(rmnu);mb.add(hmnu);
setJMenuBar(mb);
tool.add(b1);tool.add(b2);tool.add(b3);tool.add(b4);
tool.add(b5); tool.add(b6); tool.add(b7);tool.add(b8);
tool.addSeparator();
tool.add(b9);tool.add(b10);tool.add(b11);tool.add(b12);
tool.add(b13); tool.add(b14); tool.add(b15);tool.add(b16);
tool.setBackground(Color.cyan);
status.setLayout(new GridLayout(1,3));
status.add(l1); status.add(l2); status.add(l3);
Thread th=new Thread(this,"MainWin");
th.start();
GridBagLayout gbag=new GridBagLayout();
GridBagConstraints gbc=new GridBagConstraints();
c.setLayout(gbag);
gbc.weightx=1.0;
gbc.ipadx=730;gbc.ipady=5;
gbc.anchor=GridBagConstraints.CENTER;
gbc.gridwidth=GridBagConstraints.REMAINDER;
gbag.setConstraints(tool,gbc);
tool.setFloatable(false);
gbc.weighty=1.0;
gbc.ipadx=1010;gbc.ipady=610;
33
gbc.gridwidth=GridBagConstraints.REMAINDER;
gbag.setConstraints(jdsp,gbc);
gbc.weighty=1.0;
gbc.ipadx=1000;gbc.ipady=25;
gbc.gridwidth=GridBagConstraints.REMAINDER;
gbag.setConstraints(status,gbc);
Color clr=new Color(46242210);
jdsp.setBackground(clr);
status.setBackground(Color.lightGray);
tool.setBackground(Color.cyan);
c.add(tool);
c.add(jdsp);
c.add(status);
setVisible(true);
setSize(1020,740);
setTitle("MAIN WINDOW");
CustomerEntry.mw=null;
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public void run()
{
while(true){
Date date;
date=new Date();
String ss=date.toString();
String =ss.substring(0,20);
l3.setText();
try{
34
Thread.sleep(1000);}catch(Exception e){}
}
}
void set()
{
try{
jif.setVisible(true); jif.setResizable(true);
jif.setMaximizable(true);jif.setIconifiable(true);jdsp.add(jif);
jif.toFront();
}catch(Exception e){System.out.println(e);}
}
35
set();
}
}
else if(ae.getSource()==urem)
{
if(urre==null)
{
jif=(urre=new UserRemove());
jif.setTitle("USER REMOVE FORM");
set();
}
}
else if(ae.getSource()==uup)
{
if(urup==null)
{
jif=(urup=new UserUpdate());
jif.setTitle("USER UPDATE FORM");
set();
}
}
else if(ae.getSource()==cent)
{
if(cuset==null)
{
jif=(cuset=new CustomerEntry());
jif.setTitle("CUSTOMER ENTRY FORM");
set();
}
36
}
else if(ae.getSource()==csear)
{
if(cussh==null)
{
jif=(cussh=new CustomerSearch());
jif.setTitle("CUSTOMER SEARCH FORM");
set();
}
}
else if(ae.getSource()==crem)
{
if(cusre==null)
{
jif=(cusre=new CustomerRemove());
jif.setTitle("CUSTOMER REMOVE FORM");
set();
}
}
else if(ae.getSource()==cup)
{
if(cusup==null)
{
jif=(cusup=new CustomerUpdate());
jif.setTitle("CUSTOMER UPDATE FORM");
set();
}
}
else if(ae.getSource()==eent)
37
{
if(enqet==null)
{
jif=(enqet=new EnquiryEntry());
jif.setTitle("ENQUIRY ENTRY FORM");
set();
}
}
else if(ae.getSource()==esear)
{
if(enqsh==null)
{
jif=(enqsh=new EnquirySearch());
jif.setTitle("ENQUIRY SEARCH FORM");
set();
}
}
else if(ae.getSource()==erem)
{
if(enqre==null)
{
jif=(enqre=new EnquiryRemove());
jif.setTitle("ENQUIRY REMOVE FORM");
set();
}
}
else if(ae.getSource()==eup)
{
if(enqup==null)
38
{
jif=(enqup=new EnquiryUpdate());
jif.setTitle("ENQUIRY UPDATE FORM");
set();
}
}
else if(ae.getSource()==sent)
{
if(stfet==null)
{
jif=(stfet=new StaffEntry());
jif.setTitle("STAFF ENTRY FORM");
set();
}
}
else if(ae.getSource()==ssear)
{
if(stfsh==null)
{
jif=(stfsh=new StaffSearch());
jif.setTitle("STAFF SEARCH FORM");
set();
}
}
else if(ae.getSource()==srem)
{
if(stfre==null)
{
jif=(stfre=new StaffRemove());
39
jif.setTitle("STAFF REMOVE FORM");
set();
}
}
else if(ae.getSource()==sup)
{
if(stfup==null)
{
jif=(stfup=new StaffUpdate());
jif.setTitle("STAFF UPDATE FORM");
set();
}
}
else if(ae.getSource()==pent)
{
if(pret==null)
{
jif=(pret=new ProductEntry());
jif.setTitle("PRODUCT ENTRY FORM");
set();
}
}
else if(ae.getSource()==psear)
{
if(prsh==null)
{
jif=(prsh=new ProductSearch());
jif.setTitle("PRODUCT SEARCH FORM");
set();
40
}
}
else if(ae.getSource()==prem)
{
if(prre==null)
{
jif=(prre=new ProductRemove());
jif.setTitle("PRODUCT REMOVE FORM");
set();
}
}
else if(ae.getSource()==pup)
{
if(prup==null)
{
jif=(prup=new ProductUpdate());
jif.setTitle("PRODUCT UPDATE FORM");
set();
}
}
else if(ae.getSource()==gsear)
{
if(grsh==null)
{
jif=(grsh=new GuaranterSearch());
jif.setTitle("GUARANTER SEARCH FORM");
set();
}
}
41
else if(ae.getSource()==grem)
{
if(grre==null)
{
jif=(grre=new GuaranterRemove());
jif.setTitle("GUARANTER REMOVE FORM");
set();
}
}
else if(ae.getSource()==gup)
{
if(grup==null)
{
jif=(grup=new GuaranterUpdate());
jif.setTitle("GUARANTER UPDATE FORM");
set();
}
}
else if(ae.getSource()==payent)
{
if(pyet==null)
{
jif=(pyet=new PaymentEntry());
jif.setTitle("PAYMENT ENTRY FORM");
set();
}
}
else if(ae.getSource()==paysear)
{
42
if(pysh==null)
{
jif=(pysh=new PaymentSearch());
jif.setTitle("PAYMENT SEARCH FORM");
set();
}
}
else if(ae.getSource()==payrem)
{
if(pyre==null)
{
jif=(pyre=new PaymentRemove());
jif.setTitle("PAYMENT REMOVE FORM");
set();
}
}
else if(ae.getSource()==payup)
{
if(pyup==null)
{
jif=(pyup=new PaymentUpdate());
jif.setTitle("PAYMENT UPDATE FORM");
set();
}
}
else if(ae.getSource()==bent)
{
if(bket==null)
{
43
jif=(bket=new BankEntry());
jif.setTitle("BANK ENTRY FORM");
set();
}
}
else if(ae.getSource()==bsear)
{
if(bksh==null)
{
jif=(bksh=new BankSearch());
jif.setTitle("BANK SEARCH FORM");
set();
}
}
else if(ae.getSource()==brem)
{
if(bkre==null)
{
jif=(bkre=new BankRemove());
jif.setTitle("BANK REMOVE FORM");
set();
}
}
else if(ae.getSource()==bup)
{
if(bkup==null)
{
jif=(bkup=new BankUpdate());
jif.setTitle("BANK UPDATE FORM");
44
set();
}
}
else if(ae.getSource()==hsw)
{
String str="This Software is Developed By \r Mr. Arvind Ojha Under The
Guidence Of Mr. Amir Junad";
JOptionPane.showInternalMessageDialog(jdsp,str,"About
Software",JOptionPane.CLOSED_OPTION);
}
else if(ae.getSource()==re)
{
if(enqrpt==null)
{
jif=(enqrpt=new EnquiryReport());
jif.setTitle("ENQUIRY REPORT FORM");
set();
}
}
else if(ae.getSource()==rc)
{
if(cusrpt==null)
{
jif=(cusrpt=new CustomerReport());
jif.setTitle("CUSTOMER REPORT FORM");
set();
}
}
else if(ae.getSource()==rpay)
45
{
if(pyrpt==null)
{
jif=(pyrpt=new PaymentReport());
jif.setTitle("PAYMENT REPORT FORM");
set();
}
}
else if(ae.getSource()==rg)
{
if(grrpt==null)
{
jif=(grrpt=new GuaranterReport());
jif.setTitle("GUARANTER REPORT FORM");
set();
}
}
else if(ae.getSource()==rp)
{
if(prrpt==null)
{
jif=(prrpt=new ProductReport());
jif.setTitle("PRODUCT REPORT FORM");
set();
}
}
else if(ae.getSource()==rb)
{
if(bkrpt==null)
46
{
jif=(bkrpt=new BankReport());
jif.setTitle("BANK REPORT FORM");
set();
}
}
else if(ae.getSource()==rs)
{
if(stfrpt==null)
{
jif=(stfrpt=new StaffReport());
jif.setTitle("STAFF REPORT FORM");
set();
}
}
else if(ae.getSource()==ru)
{
if(urrpt==null)
{
jif=(urrpt=new UserReport());
jif.setTitle("USER REPORT FORM");
set();
}
}
else if(ae.getSource()==b1)
{
if(enqet==null)
{
jif=(enqet=new EnquiryEntry());
47
jif.setTitle("ENQUIRY ENTRY FORM");
set();
}
}
else if(ae.getSource()==b2)
{
if(cuset==null)
{
jif=(cuset=new CustomerEntry());
jif.setTitle("CUSTOMER ENTRY FORM");
set();
}
}
else if(ae.getSource()==b3)
{
if(pyet==null)
{
jif=(pyet=new PaymentEntry());
jif.setTitle("PAYMENT ENTRY FORM");
set();
}
}
else if(ae.getSource()==b5)
{
if(pret==null)
{
jif=(pret=new ProductEntry());
jif.setTitle("PRODUCT ENTRY FORM");
set();
48
}
}
else if(ae.getSource()==b6)
{
if(bket==null)
{
jif=(bket=new BankEntry());
jif.setTitle("BANK ENTRY FORM");
set();
}
}
else if(ae.getSource()==b7)
{
if(stfet==null)
{
jif=(stfet=new StaffEntry());
jif.setTitle("STAFF ENTRY FORM");
set();
}
}
else if(ae.getSource()==b8)
{
if(uret==null)
{
jif= (uret=new UserEntry());
jif.setTitle("USER ENTRY FORM");
set();
}
}
49
else if(ae.getSource()==b9)
{
if(enqsh==null)
{
jif=(enqsh=new EnquirySearch());
jif.setTitle("ENQUIRY SEARCH FORM");
set();
}
}
else if(ae.getSource()==b10)
{
jif=new CustomerSearch();
jif.setTitle("CUSTOMER SEARCH FORM");
set();
}
else if(ae.getSource()==b11)
{
if(pysh==null)
{
jif=(pysh=new PaymentSearch());
jif.setTitle("PAYMENT SEARCH FORM");
set();
}
}
else if(ae.getSource()==b12)
{
if(grsh==null)
{
jif=(grsh=new GuaranterSearch());
50
jif.setTitle("GUARANTER SEARCH FORM");
set();
}
}
else if(ae.getSource()==b13)
{
if(prsh==null)
{
jif=(prsh=new ProductSearch());
jif.setTitle("PRODUCT SEARCH FORM");
set();
}
}
else if(ae.getSource()==b14)
{
if(bksh==null)
{
jif=(bksh=new BankSearch());
jif.setTitle("BANK SEARCH FORM");
set();
}
}
else if(ae.getSource()==b15)
{
if(stfsh==null)
{
jif=(stfsh=new StaffSearch());
jif.setTitle("STAFF SEARCH FORM");
set();
51
}
}
else if(ae.getSource()==b16)
{
if(ursh==null)
{
jif=(ursh=new UserSearch());
jif.setTitle("USER SEARCH FORM");
set();
}
}
}
52
JButton b1,b2,b3;
JPanel p1,p2;
Statement stmt;
Connection conn;
int rs,eq_no;
ResultSet rst;
EnquiryEntry()
{
l1=new JLabel("NAME"); l2=new JLabel("ADDRESS");
l3=new JLabel("PHONE NO"); l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO"); l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX"); l8=new JLabel("PROFESSION");
l9=new JLabel("PURPOSE"); l10=new JLabel("DD");
l11=new JLabel("MM"); l12=new JLabel("YYYY");
l13=new JLabel("ENQUIRY NO"); l14=new JLabel("REMARKS");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); t8.setEnabled(false);
c1=new JComboBox(); c2=new JComboBox();
c3=new JComboBox(); c4=new JComboBox();
b1=new JButton("OK"); b2=new JButton("Cancel");
b3=new JButton("Close"); b1.addActionListener(this);
b2.addActionListener(this); b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
53
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
c.add(p1);c.add(p2);
p1.add(l13);l13.setBounds(50,30,80,25);
p1.add(l1);l1.setBounds(50,100,80,25);
p1.add(l2);l2.setBounds(50,140,80,25);
p1.add(l3);l3.setBounds(50,180,80,25);
p1.add(l6);l6.setBounds(50,240,100,25);
p1.add(l8);l8.setBounds(50,280,80,25);
p1.add(l9);l9.setBounds(50,320,80,25);
p1.add(l10);l10.setBounds(150,220,40,25);
p1.add(l11);l11.setBounds(190,220,40,25);
p1.add(l12);l12.setBounds(230,220,80,25);
p1.add(c1);c1.setBounds(150,240,50,25);
p1.add(c2);c2.setBounds(200,240,60,25);
p1.add(c3);c3.setBounds(260,240,70,25);
p2.add(l4);l4.setBounds(50,140,80,25);
p2.add(l5);l5.setBounds(50,180,80,25);
p2.add(l7);l7.setBounds(50,240,80,25);
p2.add(l14);l14.setBounds(50,320,80,25);
p2.add(c4);c4.setBounds(150,240,80,25);
p1.add(t8);t8.setBounds(150,30,150,25);
p1.add(t1);t1.setBounds(150,100,150,25);
p1.add(t2);t2.setBounds(150,140,150,25);
p1.add(t3);t3.setBounds(150,180,150,25);
p1.add(t6);t6.setBounds(150,280,150,25);
p1.add(t7);t7.setBounds(150,320,150,25);
p1.add(b1);b1.setBounds(50,380,80,25);
p1.add(b2);b2.setBounds(200,380,80,25);
54
p2.add(b3);b3.setBounds(50,380,80,25);
p2.add(t4);t4.setBounds(150,140,150,25);
p2.add(t5);t5.setBounds(150,180,150,25);
p2.add(t9);t9.setBounds(150,320,150,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select");
55
c4.addItem("Male");
c4.addItem("Female");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select *from enquiry_no");
while(rst.next())
{
eq_no=rst.getInt(1);
}
String s1="EQNO ";
s1+=String.valueOf(eq_no);
t8.setText(s1);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
setSize(700,500); setVisible(true);
setTitle("ENQUIRY ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===========DATABASE CONNECTIVITY==============
void create()
{
String phone,mobile,name,address,dob,pro,pur,email,sex,doeq="",remarks,s1;
phone=t3.getText(); mobile=t5.getText();
remarks=t9.getText(); name=t1.getText();
56
address=t2.getText(); pro=t6.getText();
pur=t7.getText(); email=t4.getText();
sex=(String)c4.getSelectedItem();
dob=(String)c1.getSelectedItem();
dob+="-";
dob+=(String)c2.getSelectedItem();
dob+="-";
dob+=(String)c3.getSelectedItem();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(sysdate,'dd-mon-yy')from dual");
if(rst.next())
{
doeq=rst.getString(1);
}
rst=stmt.executeQuery("select *from enquiry_no");
while(rst.next())
{
eq_no=rst.getInt(1);
eq_no+=1;
}
s1="EQNO ";
s1+=String.valueOf(eq_no);
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
57
rs=stmt.executeUpdate("insert into enquiry
values('"+s1+"','"+name+"','"+address+"','"+phone+"','"+mobile+"','"+doeq+"','"+r
emarks+"','"+pur+"','"+email+"','"+sex+"','"+dob+"','"+pro+"')");
JOptionPane.showMessageDialog(this,"One record is saved");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t9.setText("");c1.setSelectedIndex(0); c2.setSelectedIndex(0);
c3.setSelectedIndex(0); c4.setSelectedIndex(0);
t8.setText(s1);
rs=stmt.executeUpdate(" update enquiry_no set eq_no=eq_no+1");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===========================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
create();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t9.setText("");c1.setSelectedIndex(0); c2.setSelectedIndex(0);
58
c3.setSelectedIndex(0); c4.setSelectedIndex(0);
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.enqet=null;ManagerWin.enqet=null;
ClerkWin.enqet=null;ReceptionWin.enqet=null;
}
}
public static void main(String s[])
{
new EnquiryEntry();
}
}
2. nquiry Search
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class EnquirySearch extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
59
EnquirySearch()
{
l1=new JLabel("NAME"); l2=new JLabel("ADDRESS");
l3=new JLabel("PHONE NO"); l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO"); l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX"); l8=new JLabel("PROFESSION");
l9=new JLabel("PURPOSE"); l10=new JLabel("DD");
l11=new JLabel("MM"); l12=new JLabel("YYYY");
l13=new JLabel("ENQUIRY NO"); l14=new JLabel("DATE OF ENQUIRY");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); c1=new JComboBox();
c2=new JComboBox(); c3=new JComboBox();
c4=new JComboBox(); b1=new JButton("Search");
b2=new JButton("Cancel"); b3=new JButton("Close");
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
c.add(p1);c.add(p2); c.add(p1);c.add(p2);
p1.add(l13);l13.setBounds(50,30,80,25);
p1.add(l1);l1.setBounds(50,100,80,25);
p1.add(l2);l2.setBounds(50,140,80,25);
60
p1.add(l3);l3.setBounds(50,180,80,25);
p1.add(l6);l6.setBounds(50,240,100,25);
p1.add(l8);l8.setBounds(50,280,80,25);
p1.add(l9);l9.setBounds(50,320,80,25);
p1.add(l10);l10.setBounds(160,220,40,25);
p1.add(l11);l11.setBounds(200,220,40,25);
p1.add(l12);l12.setBounds(260,220,80,25);
p1.add(l14);l14.setBounds(50,360,110,25);
p1.add(c1);c1.setBounds(150,240,50,25);
p1.add(c2);c2.setBounds(200,240,60,25);
p1.add(c3);c3.setBounds(260,240,70,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
61
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select");
c4.addItem("Male");c4.addItem("Female");
p2.add(l4);l4.setBounds(50,140,80,25);
p2.add(l5);l5.setBounds(50,180,80,25);
p2.add(l7);l7.setBounds(50,240,80,25);
p2.add(c4);c4.setBounds(150,240,80,25);
p1.add(t8);t8.setBounds(150,30,150,25);
p1.add(t1);t1.setBounds(150,100,150,25);
p1.add(t2);t2.setBounds(150,140,150,25);
p1.add(t3);t3.setBounds(150,180,150,25);
p1.add(t6);t6.setBounds(150,280,150,25);
p1.add(t7);t7.setBounds(150,320,150,25);
p1.add(t9);t9.setBounds(150,360,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,420,80,25);
p2.add(b3);b3.setBounds(150,420,80,25);
p2.add(t4);t4.setBounds(150,140,150,25);
p2.add(t5);t5.setBounds(150,180,150,25);
setSize(700,500);
setVisible(true);
setTitle("SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
62
//=============DATABASE CONNECTIVITY=================
void search()
{
String
name,add,pro,sex,dob,email,eq_dt="",pur,rem,eq_no="EQNO",phone,mobile;
eq_no+=t8.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(date_of_enquiry,'dd-mon-yy') from
enquiry where e_no='"+eq_no+"'");
if(rst.next())
{
eq_dt=rst.getString(1);
}
rst=stmt.executeQuery("select e_no from enquiry where e_no='"+eq_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select * from enquiry where e_no='"+eq_no+"'");
while(rst.next())
{
eq_no=rst.getString(1); name=rst.getString(2);
add=rst.getString(3); phone=rst.getString(4);
mobile=rst.getString(5); rem=rst.getString(7);
pur=rst.getString(8); email=rst.getString(9);
sex=rst.getString(10); dob=rst.getString(11);
pro=rst.getString(12);
t1.setText(name); t2.setText(add);
63
t3.setText(phone); t5.setText(mobile);
t9.setText(eq_dt); t6.setText(pro);
t7.setText(pur); t4.setText(email);
String s1=dob.substring(8,10);
c1.setSelectedItem(s1); s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
64
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===========================================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");c1.setSelectedIndex(0);
c2.setSelectedIndex(0);c3.setSelectedIndex(0);
65
c4.setSelectedIndex(0);
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.enqsh=null;ManagerWin.enqsh=null;
ClerkWin.enqsh=null;ReceptionWin.enqsh=null;
}
}
public static void main(String s[])
{
new EnquirySearch();
}
}
3. Enquiry Remove
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class EnquiryRemove extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3,b4;
JPanel p1,p2;
Connection conn;
Statement stmt;
ResultSet rst;
66
EnquiryRemove()
{
l1=new JLabel("NAME"); l2=new JLabel("ADDRESS");
l3=new JLabel("PHONE NO"); l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO"); l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX"); l8=new JLabel("PROFESSION");
l9=new JLabel("PURPOSE"); l10=new JLabel("DD");
l11=new JLabel("MM"); l12=new JLabel("YYYY");
l13=new JLabel("ENQUIRY NO"); l14=new JLabel("DATE OF ENQUIRY");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); c1=new JComboBox();
c2=new JComboBox(); c3=new JComboBox();
c4=new JComboBox(); b1=new JButton("Search");
b2=new JButton("Cancel"); b3=new JButton("Close");
b4=new JButton("Remove"); b1.addActionListener(this);
b2.addActionListener(this); b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
c.add(p1);c.add(p2);
p1.add(l13);l13.setBounds(50,30,80,25);
p1.add(l1);l1.setBounds(50,100,80,25);
p1.add(l2);l2.setBounds(50,140,80,25);
p1.add(l3);l3.setBounds(50,180,80,25);
67
p1.add(l6);l6.setBounds(50,240,100,25);
p1.add(l8);l8.setBounds(50,280,80,25);
p1.add(l9);l9.setBounds(50,320,80,25);
p1.add(l10);l10.setBounds(160,220,40,25);
p1.add(l11);l11.setBounds(210,220,40,25);
p1.add(l12);l12.setBounds(270,220,80,25);
p1.add(l14);l14.setBounds(50,360,110,25);
p1.add(c1);c1.setBounds(150,240,50,25);
p1.add(c2);c2.setBounds(200,240,60,25);
p1.add(c3);c3.setBounds(260,240,70,25);
p2.add(c4);c4.setBounds(150,240,80,25);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
68
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select");
c4.addItem("Male");
c4.addItem("Female");
p2.add(l4);l4.setBounds(50,140,80,25);
p2.add(l5);l5.setBounds(50,180,80,25);
p2.add(l7);l7.setBounds(50,240,80,25);
p1.add(t8);t8.setBounds(150,30,150,25);
p1.add(t1);t1.setBounds(150,100,150,25);
p1.add(t2);t2.setBounds(150,140,150,25);
p1.add(t3);t3.setBounds(150,180,150,25);
p1.add(t6);t6.setBounds(150,280,150,25);
p1.add(t7);t7.setBounds(150,320,150,25);
p1.add(t9);t9.setBounds(150,360,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,420,80,25);
p2.add(b3);b3.setBounds(150,420,80,25);
p1.add(b4);b4.setBounds(150,420,80,25);
p2.add(t4);t4.setBounds(150,140,150,25);
p2.add(t5);t5.setBounds(150,180,150,25);
69
setSize(700,500);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
String name,add,pro,sex,dob,email,eq_dt="",pur,rem,eq_no="EQNO ",phone,mobile;
eq_no+=t8.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(date_of_enquiry,'dd-mon-yy') from
enquiry where e_no='"+eq_no+"'");
if(rst.next())
{
eq_dt=rst.getString(1);
}
rst=stmt.executeQuery("select e_no from enquiry where e_no='"+eq_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select * from enquiry where e_no='"+eq_no+"'");
while(rst.next())
{
eq_no=rst.getString(1); name=rst.getString(2);
add=rst.getString(3); phone=rst.getString(4);
mobile=rst.getString(5); rem=rst.getString(7);
pur=rst.getString(8); email=rst.getString(9);
sex=rst.getString(10); dob=rst.getString(11);
70
pro=rst.getString(12); t1.setText(name);
t2.setText(add); t3.setText(phone);
t5.setText(mobile); t9.setText(eq_dt);
t6.setText(pro); t7.setText(pur);
t4.setText(email); String s1=dob.substring(8,10);
c1.setSelectedItem(s1); s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
71
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4); c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void remove()
{
String eq_no="EQNO ";
eq_no+=t8.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
72
stmt.executeUpdate("delete from enquiry where e_no='"+eq_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");
c1.setSelectedIndex(0); c2.setSelectedIndex(0);
c3.setSelectedIndex(0); c4.setSelectedIndex(0);
t8.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"You can not delete this record!");
}
}
//==================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");
c1.setSelectedIndex(0); c2.setSelectedIndex(0);
c3.setSelectedIndex(0); c4.setSelectedIndex(0);
73
t8.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.enqre=null;ManagerWin.enqre=null;
ClerkWin.enqre=null;ReceptionWin.enqre=null;
}
else if(ae.getSource()==b4)
remove();
}
public static void main(String s[])
{
new EnquiryRemove();
}
}
4. ENQUIRY UPDATE:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class EnquiryUpdate extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3,b4 ;
JPanel p1,p2;
Statement stmt;
74
Connection conn;
ResultSet rst;
EnquiryUpdate()
{
l13=new JLabel("ENQUIRY NO"); l1=new JLabel("NAME");
l2=new JLabel("ADDRESS"); l3=new JLabel("PHONE NO");
l4=new JLabel("EMAIL"); l5=new JLabel("MOBILE NO");
l6=new JLabel("DATE OF BIRTH"); l7=new JLabel("SEX");
l8=new JLabel("PROFESSION"); l9=new JLabel("PURPOSE");
l10=new JLabel("DD"); l11=new JLabel("MM");
l12=new JLabel("YYYY"); l14=new JLabel("DATE OF ENQUITY");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); c1=new JComboBox();
c2=new JComboBox(); c3=new JComboBox();
c4=new JComboBox(); b1=new JButton("Search");
b2=new JButton("Cancel"); b3=new JButton("Close");
b4=new JButton("Update"); b1.addActionListener(this);
b2.addActionListener(this); b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
c.add(p1);c.add(p2); c.add(p1);c.add(p2);
75
p1.add(l13);l13.setBounds(50,10,80,25); p1.add(l1);l1.setBounds(50,40,80,25);
p1.add(l2);l2.setBounds(50,80,80,25); p1.add(l3);l3.setBounds(50,120,80,25);
p1.add(l6);l6.setBounds(50,180,100,25); p1.add(l8);l8.setBounds(50,220,80,25);
p1.add(l9);l9.setBounds(50,260,80,25); p1.add(l10);l10.setBounds(160,160,40,25);
p1.add(l11);l11.setBounds(210,160,40,25);p1.add(l12);l12.setBounds(270,160,80,25);
p1.add(c1);c1.setBounds(150,180,50,25); p1.add(c2);c2.setBounds(200,180,60,25);
p1.add(c3);c3.setBounds(260,180,70,25); c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select"); c4.addItem("Male"); c4.addItem("Female");
p2.add(l4);l4.setBounds(50,80,80,25); p2.add(l5);l5.setBounds(50,120,80,25);
76
p2.add(l7);l7.setBounds(50,180,80,25); p2.add(l14);l14.setBounds(50,220,110,25);
p2.add(c4);c4.setBounds(90,180,80,25); p1.add(t8);t8.setBounds(150,10,150,25);
p1.add(t1);t1.setBounds(150,40,150,25); p1.add(t2);t2.setBounds(150,80,150,25);
p1.add(t3);t3.setBounds(150,120,150,25);p1.add(t6);t6.setBounds(150,220,150,25);
p1.add(t7);t7.setBounds(150,260,150,25); p2.add(b1);b1.setBounds(50,10,80,25);
p1.add(b2);b2.setBounds(200,340,80,25); p1.add(b4);b4.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(50,340,80,25); p2.add(t4);t4.setBounds(150,80,150,25);
p2.add(t5);t5.setBounds(150,120,150,25);p2.add(t9);t9.setBounds(150,220,150,25);
setSize(750,500); setVisible(true);
setTitle("UPDATE ENQUIRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
String name,add,pro,sex,dob,email,eq_dt="",pur,rem,eq_no="EQNO ",phone,mobile;
eq_no+=t8.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(date_of_enquiry,'dd-mon-yy') from
enquiry where e_no='"+eq_no+"'");
if(rst.next())
{
eq_dt=rst.getString(1);
}
rst=stmt.executeQuery("select e_no from enquiry where e_no='"+eq_no+"'");
77
if(rst.next())
{
rst=stmt.executeQuery("select * from enquiry where e_no='"+eq_no+"'");
while(rst.next())
{
eq_no=rst.getString(1); name=rst.getString(2);
add=rst.getString(3); phone=rst.getString(4);
mobile=rst.getString(5); rem=rst.getString(7);
pur=rst.getString(8); email=rst.getString(9);
sex=rst.getString(10); dob=rst.getString(11);
pro=rst.getString(12); t1.setText(name);
t2.setText(add); t3.setText(phone);
t5.setText(mobile); t9.setText(eq_dt);
t6.setText(pro); t7.setText(pur);
t4.setText(email); String s1=dob.substring(8,10);
c1.setSelectedItem(s1); s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
78
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4); c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void update()
{
79
String phone,mobile,eq_no="EQNO ",name,add,dob,pro,pur,email,sex,doeq="",remarks;
eq_no+=t8.getText(); phone=t3.getText();
mobile=t5.getText(); name=t1.getText();
add=t2.getText(); pro=t6.getText();
pur=t7.getText(); email=t4.getText();
sex=(String)c4.getSelectedItem();
dob=(String)c1.getSelectedItem(); dob+="-";
dob+=(String)c2.getSelectedItem(); dob+="-";
dob+=(String)c3.getSelectedItem();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is Update","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update enquiry set
name='"+name+"',"+"address='"+add+"',"+"phone_no='"+phone+"',"+"mobile_no=
'"+mobile+"',"+"purpose='"+pur+"',"+"email='"+email+"',"+"sex='"+sex+"',"+"do
b='"+dob+"',"+"profession='"+pro+"'"+"where e_no='"+eq_no+"'");
JOptionPane.showMessageDialog(this,"One Record Updated");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");c1.setSelectedIndex(0);
c2.setSelectedIndex(0);c3.setSelectedIndex(0);
c4.setSelectedIndex(0);t8.requestFocus();
}
80
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in updating record"+e);
}
}
//=================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");c1.setSelectedIndex(0);
c2.setSelectedIndex(0);c3.setSelectedIndex(0);
c4.setSelectedIndex(0);t8.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.enqup=null;ManagerWin.enqup=null;
ClerkWin.enqup=null;ReceptionWin.enqup=null;
}
else if(ae.getSource()==b4)
update();
}
81
public static void main(String s[])
{
new EnquiryUpdate();
}
}
CUSTOMER :-
1. Customer Entry
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class CustomerEntry extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15 ;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10 ;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3,b4;
JPanel p1,p2;
Statement stmt;
Connection conn;
int rs,cus_no;
ResultSet rst;
JInternalFrame jif=new JInternalFrame();
static MainWin mw;
static ManagerWin manw;
static ClerkWin clw;
static ReceptionWin recpw;
static GuaranterEntry gret;
CustomerEntry()
82
{
l1=new JLabel("CUSTOMER NO"); l2=new JLabel(" NAME");
l3=new JLabel("ADDRESS"); l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO"); l6=new JLabel("PRODUCT NO");
l7=new JLabel("BANK NO"); l8=new JLabel("LOAN AMOUNT");
l9=new JLabel("NO OF YEAR"); l10=new JLabel("NO. OF INSTALMENT");
l11=new JLabel("DD"); l12=new JLabel("MM");
l13=new JLabel("YYYY"); l14=new JLabel("DATE OF BIRTH");
l15=new JLabel("SEX");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); t10=new JTextField();
c1=new JComboBox(); c2=new JComboBox();
c3=new JComboBox(); c4=new JComboBox();
b1=new JButton("OK"); b2=new JButton("Cancel");
b3=new JButton("Close"); b4=new JButton("Guaranter Entry");
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this); b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel(); p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1); l1.setBounds(50,40,100,25); p1.add(l2); l2.setBounds(50,80,80,25);
p1.add(l3); l3.setBounds(50,120,90,25); p1.add(l4); l4.setBounds(50,160,100,25);
83
p1.add(l5); l5.setBounds(50,200,120,25); p1.add(l6); l6.setBounds(50,240,90,25);
p1.add(l7);l7.setBounds(50,280,80,25); p1.add(t1);t1.setBounds(150,40,150,25);
t1.setEnabled(false);
p1.add(t2);t2.setBounds(150,80,150,25); p1.add(t3);t3.setBounds(150,120,150,25);
p1.add(t4);t4.setBounds(150,160,150,25); p1.add(t5);t5.setBounds(150,200,150,25);
p1.add(t6);t6.setBounds(150,240,150,25); p1.add(t7);t7.setBounds(150,280,150,25);
p2.add(l8);l8.setBounds(50,80,100,25); p2.add(l9);l9.setBounds(50,120,120,25);
p2.add(l10);l10.setBounds(50,160,120,25);p2.add(l11);l11.setBounds(180,220,30,25);
p2.add(l12);l12.setBounds(230,220,30,25);p2.add(l13);l13.setBounds(270,220,70,25);
p2.add(l14);l14.setBounds(50,240,90,25); p2.add(l15);l15.setBounds(50,280,80,25);
p2.add(c1);c1.setBounds(170,240,50,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT"); c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
84
String s=String.valueOf(i);
c3.addItem(s);
}
p2.add(c2);c2.setBounds(220,240,60,25); p2.add(c3);c3.setBounds(280,240,70,25);
p2.add(c4);c4.setBounds(170,280,80,25); c4.addItem("Select");
c4.addItem("Male");c4.addItem("Female");
p1.add(b1);b1.setBounds(150,380,80,25); p2.add(b2);b2.setBounds(50,380,80,25);
p2.add(b3);b3.setBounds(170,380,80,25); p2.add(b4);b4.setBounds(150,40,150,25);
p2.add(t8);t8.setBounds(170,80,150,25); p2.add(t9);t9.setBounds(170,120,150,25);
p2.add(t10);t10.setBounds(170,160,150,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select *from customer_no");
while(rst.next())
{
cus_no=rst.getInt(1);
}
String s1="CNO ";
s1+=String.valueOf(cus_no);
t1.setText(s1);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error"+e);
}
setSize(710,550);
setVisible(true);
85
setTitle("CUSTOMER ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
void Create()
{
Int year,inst_amt,payment_amt,no_of_instalment,loan_amt,due_amt,
due_inst_no,rate=0,inst_no=0;
year=Integer.parseInt(t9.getText());
loan_amt=Integer.parseInt(t8.getText());
String sys_dt="",phone_no, mobile_no,bank_no="BNO ",p_no="PNO ";
String name,address,dob,sex;
name=t2.getText(); address=t3.getText();
phone_no=t4.getText(); mobile_no=t5.getText();
bank_no+=t7.getText(); p_no+=t6.getText();
sex=(String)c4.getSelectedItem(); dob=(String)c1.getSelectedItem(); dob+="-";
dob+=(String)c2.getSelectedItem();dob+="-";
dob+=(String)c3.getSelectedItem();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
no_of_instalment=year*12;
rst=stmt.executeQuery("select rate_of_interest from product where
p_no='"+p_no+"'");
if(rst.next())
{
86
rate=rst.getInt(1);
}
payment_amt=loan_amt+(loan_amt*rate*year)/100;
inst_amt=payment_amt/no_of_instalment;
rst=stmt.executeQuery("select to_char(sysdate,'dd-mon-yy')from dual");
if(rst.next())
{
sys_dt=rst.getString(1);
}
rst=stmt.executeQuery("select *from customer_no");
while(rst.next())
{
cus_no=rst.getInt(1);
cus_no+=1;
}
String s1="CNO ";
s1+=String.valueOf(cus_no);
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
rs=stmt.executeUpdate("insert into customer values
('"+s1+"','"+name+"','"+address+"','"+phone_no+"','"+mobile_no+"',
"+loan_amt+","+payment_amt+","+no_of_instalment+",'"+sys_dt+"','"+p_no+"','"+
bank_no+"','"+""+"','"+sex+"','"+dob+"',"+payment_amt+","+no_of_instalment+",
"+year+","+inst_amt+","+inst_no+")");
JOptionPane.showMessageDialog(this,"One Record Saved");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
87
t8.setText("");t9.setText("");t10.setText("");
c1.setSelectedIndex(0); c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t1.setText(s1);
rs=stmt.executeUpdate(" update customer_no set cus_no=cus_no+1");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void set()
{
jif.setTitle("GUARANTER ENTRY FORM");
jif.setVisible(true);jif.setResizable(true);
jif.setMaximizable(true);jif.setIconifiable(true);jif.toFront();
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
Create();
else if(ae.getSource()==b2)
{
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
c1.setSelectedIndex(0); c2.setSelectedIndex(0);
88
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.cuset=null;ManagerWin.cuset=null;
ClerkWin.cuset=null;ReceptionWin.cuset=null;
}
else if(ae.getSource()==b4)
{
if(mw==null&&gret==null)
{
jif=(gret=new GuaranterEntry());
set();MainWin.jdsp.add(jif);
}
if(manw==null&&gret==null);
{
jif=(gret=new GuaranterEntry());
set();ManagerWin.jdsp.add(jif);
}
if(clw==null&&gret==null);
{
jif=(gret=new GuaranterEntry());
set();ClerkWin.jdsp.add(jif);
}
if(recpw==null&&gret==null);
{
jif=(gret=new GuaranterEntry());
set();ReceptionWin.jdsp.add(jif);
89
}
}
}
public static void main(String args[])
{
new CustomerEntry();
}
}
2. Customer Search
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
90
l7=new JLabel("BANK NO"); l8=new JLabel("LOAN AMOUNT");
l9=new JLabel("PAYMENT AMOUNT");
l10=new JLabel("NO. OF INSTALMENT");
l11=new JLabel("DD"); l12=new JLabel("MM");
l13=new JLabel("YYYY"); l14=new JLabel("DATE OF BIRTH");
l15new JLabel("STATUS"); l16=new JLabel("DATE OF LOAN");
l17=new JLabel("SEX"); l18=new JLabel("DUE AMOUNT");
l19=new JLabel("DUE INSTALMENT NO"); l20=new JLabel("FOR YEAR");
l21=new JLabel("INSTALMENT AMOUNT");
l22=new JLabel("INSTALMENT NO");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); t10=new JTextField();
t11=new JTextField(); t12=new JTextField();
t13=new JTextField(); t14=new JTextField();
t15=new JTextField(); t16=new JTextField();
t17=new JTextField();
c1=new JComboBox(); c2=new JComboBox();
c3=new JComboBox(); c4=new JComboBox();
b1=new JButton("Search"); b2=new JButton("Cancel");
b3=new JButton("Close"); b1.addActionListener(this);
b2.addActionListener(this); b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,3));
p1=new JPanel(); p2=new JPanel();
p3=new JPanel(); p1.setLayout(null);
p2.setLayout(null); p3.setLayout(null);
91
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
p3.setBackground(clr); c.add(p1); c.add(p2); c.add(p3);
p1.add(l1); l1.setBounds(5,40,100,25); p1.add(l2); l2.setBounds(5,80,80,25);
p1.add(l3); l3.setBounds(5,120,90,25); p1.add(l4); l4.setBounds(5,160,100,25);
p1.add(l5); l5.setBounds(5,200,120,25); p1.add(l6); l6.setBounds(5,240,90,25);
p1.add(l7);l7.setBounds(5,280,80,25); p1.add(l16);l16.setBounds(5,320,100,25);
p1.add(t1);t1.setBounds(100,40,120,25); p1.add(t2);t2.setBounds(100,80,120,25);
p1.add(t3);t3.setBounds(100,120,120,25); p1.add(t4);t4.setBounds(100,160,120,25);
p1.add(t5);t5.setBounds(100,200,120,25); p1.add(t6);t6.setBounds(100,240,120,25);
p1.add(t7);t7.setBounds(100,280,120,25); p1.add(t12);t12.setBounds(100,320,120,25);
p2.add(l8);l8.setBounds(2,80,100,25); p2.add(l9);l9.setBounds(2,120,120,25);
p2.add(l10);l10.setBounds(2,160,120,25); p2.add(l15);l15.setBounds(2,200,80,25);
p2.add(l14);l14.setBounds(2,260,90,25); p2.add(l11);l11.setBounds(100,240,30,25);
p2.add(l12);l12.setBounds(150,240,30,25); p2.add(l13);l13.setBounds(210,240,70,25);
p2.add(l17);l17.setBounds(2,320,80,25); p2.add(c1);c1.setBounds(90,260,50,25);
p2.add(c2);c2.setBounds(140,260,60,25); p2.add(c3);c3.setBounds(200,260,65,25);
p2.add(c4);c4.setBounds(90,320,70,25); p3.add(l18);l18.setBounds(5,40,110,25);
p3.add(l19);l19.setBounds(5,80,120,25); p3.add(l20);l20.setBounds(5,120,110,25);
p3.add(l21);l21.setBounds(5,160,130,25); p3.add(l22);l22.setBounds(5,200,110,25);
p3.add(t13);t13.setBounds(130,40,80,25); p3.add(t14);t14.setBounds(130,80,80,25);
p3.add(t15);t15.setBounds(130,120,80,25); p3.add(t16);t16.setBounds(130,160,80,25);
p3.add(t17);t17.setBounds(130,200,80,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
92
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select"); c4.addItem("Male");
c4.addItem("Female"); p2.add(b1);b1.setBounds(2,40,80,25);
p3.add(b2);b2.setBounds(5,380,80,25); p3.add(b3);b3.setBounds(100,380,80,25);
p2.add(t8);t8.setBounds(120,80,120,25); p2.add(t9);t9.setBounds(120,120,120,25);
p2.add(t10);t10.setBounds(120,160,120,25);p2.add(t11);t11.setBounds(120,200,120,25);
setSize(800,550); setVisible(true);
setTitle("CUSTOMER SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
93
{
int loan_amt,pay_amt,no_inst,dueamt,dueinst_no,year,instamt,instno;
String name,add,sex,dob,dol="",st,cus_no="CNO ",p_no,b_no, phone,mobile;
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(date_of_loan,'dd-mon-yy')from customer
where c_no='"+cus_no+"'");
if(rst.next())
{
dol=rst.getString(1);
}
rst=stmt.executeQuery("select c_no from customer where c_no='"+cus_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select * from customer where c_no='"+cus_no+"'");
while(rst.next())
{
name=rst.getString(2); add=rst.getString(3);
phone=rst.getString(4); mobile=rst.getString(5);
loan_amt=rst.getInt(6); pay_amt=rst.getInt(7);
no_inst=rst.getInt(8); p_no=rst.getString(10);
b_no=rst.getString(11); st=rst.getString(12);
sex=rst.getString(13); dob=rst.getString(14);
dueamt=rst.getInt(15); dueinst_no=rst.getInt(16);
year=rst.getInt(17); instamt=rst.getInt(18);
instno=rst.getInt(19);
94
t2.setText(name); t3.setText(add);
t4.setText(phone); t5.setText(mobile);
t6.setText(p_no); t7.setText(b_no);
t12.setText(dol); String s1=String.valueOf(loan_amt);
t8.setText(s1); s1=String.valueOf(pay_amt);
t9.setText(s1); s1=String.valueOf(no_inst);
t10.setText(s1); t11.setText(st);
String s2=String.valueOf(dueamt); t13.setText(s2);
s2=String.valueOf(dueinst_no); t14.setText(s2);
s2=String.valueOf(year); t15.setText(s2);
s2=String.valueOf(instamt); t16.setText(s2);
s2=String.valueOf(instno); t17.setText(s2);
s1=dob.substring(8,10); c1.setSelectedItem(s1);
s1=dob.substring(5,7); int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
95
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//==================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
96
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
t11.setText("");t12.setText("");t13.setText("");
t14.setText("");t15.setText("");t16.setText("");
t17.setText("");
c1.setSelectedIndex(0);c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.cussh=null;ManagerWin.cussh=null;
ClerkWin.cussh=null;ReceptionWin.cussh=null;
}
}
public static void main(String args[])
{
new CustomerSearch();
}
}
3. Customer Remove:-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
97
import java.sql.*;
class CustomerRemove extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,l21,l22;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3,b4;
JPanel p1,p2,p3;
Statement stmt;
Connection conn;
ResultSet rst;
CustomerRemove()
{
l1=new JLabel("CUSTOMER NO"); l2=new JLabel(" NAME");
l3=new JLabel("ADDRESS"); l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO"); l6=new JLabel("PRODUCT NO");
l7=new JLabel("BANK NO"); l8=new JLabel("LOAN AMOUNT");
l9=new JLabel("PAYMENT AMOUNT");
l10=new JLabel("NO. OF INSTALMENT"); l11=new JLabel("DD");
l12=new JLabel("MM"); l13=new JLabel("YYYY");
l14=new JLabel("DATE OF BIRTH"); l15=new JLabel("STATUS");
l16=new JLabel("DATE OF LOAN"); l17=new JLabel("SEX");
l18=new JLabel("DUE AMOUNT"); l19=new JLabel("DUE INSTALMENT NO");
l20=new JLabel("FOR YEAR"); l21=new JLabel("INSTALMENT AMOUNT");
l22=new JLabel("INSTALMENT NO");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
98
t9=new JTextField(); t10=new JTextField();
t11=new JTextField(); t12=new JTextField();
t13=new JTextField(); t14=new JTextField();
t15=new JTextField(); t16=new JTextField();
t17=new JTextField();
c1=new JComboBox(); c2=new JComboBox();
c3=new JComboBox(); c4=new JComboBox();
b1=new JButton("Search"); b2=new JButton("Cancel");
b3=new JButton("Close"); b4=new JButton("Remove");
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this); b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,3));
p1=new JPanel(); p2=new JPanel();
p3=new JPanel(); p1.setLayout(null);
p2.setLayout(null); p3.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
p3.setBackground(clr);
c.add(p1); c.add(p2); c.add(p3);
p1.add(l1); l1.setBounds(5,40,100,25);
p1.add(l2); l2.setBounds(5,80,80,25);
p1.add(l3); l3.setBounds(5,120,90,25);
p1.add(l4); l4.setBounds(5,160,100,25);
p1.add(l5); l5.setBounds(5,200,120,25);
p1.add(l6); l6.setBounds(5,240,90,25);
p1.add(l7);l7.setBounds(5,280,80,25);
p1.add(l16);l16.setBounds(5,320,100,25);
p1.add(t1);t1.setBounds(100,40,120,25);
99
p1.add(t2);t2.setBounds(100,80,120,25);
p1.add(t3);t3.setBounds(100,120,120,25);
p1.add(t4);t4.setBounds(100,160,120,25);
p1.add(t5);t5.setBounds(100,200,120,25);
p1.add(t6);t6.setBounds(100,240,120,25);
p1.add(t7);t7.setBounds(100,280,120,25);
p1.add(t12);t12.setBounds(100,320,120,25);
p2.add(l8);l8.setBounds(2,80,100,25);
p2.add(l9);l9.setBounds(2,120,120,25);
p2.add(l10);l10.setBounds(2,160,120,25);
p2.add(l15);l15.setBounds(2,200,80,25);
p2.add(l14);l14.setBounds(2,260,90,25);
p2.add(l11);l11.setBounds(100,240,30,25);
p2.add(l12);l12.setBounds(150,240,30,25);
p2.add(l13);l13.setBounds(210,240,70,25);
p2.add(l17);l17.setBounds(2,320,80,25);
p2.add(c1);c1.setBounds(90,260,50,25);
p2.add(c2);c2.setBounds(140,260,60,25);
p2.add(c3);c3.setBounds(200,260,65,25);
p2.add(c4);c4.setBounds(90,320,70,25);
p3.add(l18);l18.setBounds(5,40,110,25);
p3.add(l19);l19.setBounds(5,80,120,25);
p3.add(l20);l20.setBounds(5,120,110,25);
p3.add(l21);l21.setBounds(5,160,130,25);
p3.add(l22);l22.setBounds(5,200,110,25);
p3.add(t13);t13.setBounds(130,40,80,25);
p3.add(t14);t14.setBounds(130,80,80,25);
p3.add(t15);t15.setBounds(130,120,80,25);
p3.add(t16);t16.setBounds(130,160,80,25);
100
p3.add(t17);t17.setBounds(130,200,80,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select"); c4.addItem("Male");
c4.addItem("Female");
p2.add(b1);b1.setBounds(2,40,80,25);
101
p3.add(b2);b2.setBounds(5,380,80,25);
p3.add(b3);b3.setBounds(100,380,80,25);
p1.add(b4);b4.setBounds(150,380,80,25);
p2.add(t8);t8.setBounds(120,80,120,25);
p2.add(t9);t9.setBounds(120,120,120,25);
p2.add(t10);t10.setBounds(120,160,120,25);
p2.add(t11);t11.setBounds(120,200,120,25);
setSize(800,550); setVisible(true);
setTitle("CUSTOMER REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
int loan_amt,pay_amt,no_inst,dueamt,dueinst_no,year,instamt,instno;
String name,add,sex,dob,dol="",st,cus_no="CNO ",p_no,b_no, phone,mobile;
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(date_of_loan,'dd-mon-yy')from customer
where c_no='"+cus_no+"'");
if(rst.next())
{
dol=rst.getString(1);
}
rst=stmt.executeQuery("select c_no from customer where c_no='"+cus_no+"'");
102
if(rst.next())
{
rst=stmt.executeQuery("select * from customer where c_no='"+cus_no+"'");
while(rst.next())
{
name=rst.getString(2); add=rst.getString(3);
phone=rst.getString(4); mobile=rst.getString(5);
loan_amt=rst.getInt(6); pay_amt=rst.getInt(7);
no_inst=rst.getInt(8); p_no=rst.getString(10);
b_no=rst.getString(11); st=rst.getString(12);
sex=rst.getString(13); dob=rst.getString(14);
dueamt=rst.getInt(15); dueinst_no=rst.getInt(16);
year=rst.getInt(17); instamt=rst.getInt(18);
instno=rst.getInt(19);
t2.setText(name); t3.setText(add);
t4.setText(phone); t5.setText(mobile);
t6.setText(p_no); t7.setText(b_no);
t12.setText(dol); String s1=String.valueOf(loan_amt);
t8.setText(s1); s1=String.valueOf(pay_amt);
t9.setText(s1); s1=String.valueOf(no_inst);
t10.setText(s1); t11.setText(st);
String s2=String.valueOf(dueamt); t13.setText(s2);
s2=String.valueOf(dueinst_no); t14.setText(s2);
s2=String.valueOf(year); t15.setText(s2);
s2=String.valueOf(instamt); t16.setText(s2);
s2=String.valueOf(instno); t17.setText(s2);
s1=dob.substring(8,10); c1.setSelectedItem(s1);
s1=dob.substring(5,7); int n=Integer.parseInt(s1);
switch(n)
103
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4); c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
104
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void remove()
{
String cus_no="CNO ";
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from customer where c_no='"+cus_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
t11.setText("");t12.setText("");t13.setText("");
t14.setText("");t15.setText("");
t16.setText("");t17.setText("");
105
c1.setSelectedIndex(0);c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t1.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"You can not delete this record!");
}
}
//==================================
106
{
dispose();
MainWin.cusre=null;ManagerWin.cusre=null;
ClerkWin.cusre=null;ReceptionWin.cusre=null;
}
else if(ae.getSource()==b4)
remove();
}
public static void main(String args[])
{
new CustomerRemove();
}
}
4. Customer Update :-
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class CustomerUpdate extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l18,l19,l20,l21,l22;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3,b4;
JPanel p1,p2,p3;
Statement stmt;
Connection conn;
ResultSet rst;
CustomerUpdate()
107
{
l1=new JLabel("CUSTOMER NO"); l2=new JLabel(" NAME");
l3=new JLabel("ADDRESS"); l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO"); l6=new JLabel("PRODUCT NO");
l7=new JLabel("BANK NO"); l8=new JLabel("LOAN AMOUNT");
l9=new JLabel("PAYMENT AMOUNT");
10=new JLabel("NO. OF INSTALMENT"); l11=new JLabel("DD");
l12=new JLabel("MM"); l13=new JLabel("YYYY");
l14=new JLabel("DATE OF BIRTH"); l15=new JLabel("STATUS");
l16=new JLabel("DATE OF LOAN"); l17=new JLabel("SEX");
l18=new JLabel("DUE AMOUNT"); l19=new JLabel("DUE INSTALMENT NO");
l20=new JLabel("FOR YEAR"); l21=new JLabel("INSTALMENT AMOUNT");
l22=new JLabel("INSTALMENT NO");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
t7=new JTextField(); t8=new JTextField();
t9=new JTextField(); t10=new JTextField();
t11=new JTextField(); t12=new JTextField();
t13=new JTextField(); t14=new JTextField();
t15=new JTextField(); t16=new JTextField();
t17=new JTextField();
c1=new JComboBox(); c2=new JComboBox();
c3=new JComboBox(); c4=new JComboBox();
b1=new JButton("Search"); b2=new JButton("Cancel");
b3=new JButton("Close"); b4=new JButton("Update");
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this); b4.addActionListener(this);
Container c=getContentPane();
108
c.setLayout(new GridLayout(1,3));
p1=new JPanel(); p2=new JPanel();
p3=new JPanel(); p1.setLayout(null);
p2.setLayout(null); p3.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
p3.setBackground(clr); c.add(p1); c.add(p2); c.add(p3);
p1.add(l1); l1.setBounds(5,40,100,25);
p1.add(l2); l2.setBounds(5,80,80,25);
p1.add(l3); l3.setBounds(5,120,90,25);
p1.add(l4); l4.setBounds(5,160,100,25);
p1.add(l5); l5.setBounds(5,200,120,25);
p1.add(l6); l6.setBounds(5,240,90,25);
p1.add(l7);l7.setBounds(5,280,80,25);
p1.add(l16);l16.setBounds(5,320,100,25);
p1.add(t1);t1.setBounds(100,40,120,25);
p1.add(t2);t2.setBounds(100,80,120,25);
p1.add(t3);t3.setBounds(100,120,120,25);
p1.add(t4);t4.setBounds(100,160,120,25);
p1.add(t5);t5.setBounds(100,200,120,25);
p1.add(t6);t6.setBounds(100,240,120,25);
p1.add(t7);t7.setBounds(100,280,120,25);
p1.add(t12);t12.setBounds(100,320,120,25);
p2.add(l8);l8.setBounds(2,80,100,25);
p2.add(l9);l9.setBounds(2,120,120,25);
p2.add(l10);l10.setBounds(2,160,120,25);
p2.add(l15);l15.setBounds(2,200,80,25);
p2.add(l14);l14.setBounds(2,260,90,25);
p2.add(l11);l11.setBounds(100,240,30,25);
109
p2.add(l12);l12.setBounds(150,240,30,25);
p2.add(l13);l13.setBounds(210,240,70,25);
p2.add(l17);l17.setBounds(2,320,80,25);
p2.add(c1);c1.setBounds(90,260,50,25);
p2.add(c2);c2.setBounds(140,260,60,25);
p2.add(c3);c3.setBounds(200,260,65,25);
p2.add(c4);c4.setBounds(90,320,70,25);
p3.add(l18);l18.setBounds(5,40,110,25);
p3.add(l19);l19.setBounds(5,80,120,25);
p3.add(l20);l20.setBounds(5,120,110,25);
p3.add(l21);l21.setBounds(5,160,130,25);
p3.add(l22);l22.setBounds(5,200,110,25);
p3.add(t13);t13.setBounds(130,40,80,25);
p3.add(t14);t14.setBounds(130,80,80,25);
p3.add(t15);t15.setBounds(130,120,80,25);
p3.add(t16);t16.setBounds(130,160,80,25);
p3.add(t17);t17.setBounds(130,200,80,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
110
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
c4.addItem("Select"); c4.addItem("Male"); c4.addItem("Female");
p2.add(b1);b1.setBounds(2,40,80,25);
p3.add(b2);b2.setBounds(5,380,80,25);
p3.add(b3);b3.setBounds(100,380,80,25);
p1.add(b4);b4.setBounds(150,380,80,25);
p2.add(t8);t8.setBounds(120,80,120,25);
p2.add(t9);t9.setBounds(120,120,120,25);
p2.add(t10);t10.setBounds(120,160,120,25);
p2.add(t11);t11.setBounds(120,200,120,25);
setSize(800,550); setVisible(true);
setTitle("CUSTOMER UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
int loan_amt,pay_amt,no_inst,dueamt,dueinst_no,year,instamt,instno;
111
String name,add,sex,dob,dol="",st,cus_no="CNO ",p_no,b_no, phone,mobile;
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(date_of_loan,'dd-mon-yy')from customer
where c_no='"+cus_no+"'");
if(rst.next())
{
dol=rst.getString(1);
}
rst=stmt.executeQuery("select c_no from customer where c_no='"+cus_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select * from customer where c_no='"+cus_no+"'");
while(rst.next())
{
name=rst.getString(2); add=rst.getString(3);
phone=rst.getString(4); mobile=rst.getString(5);
loan_amt=rst.getInt(6); pay_amt=rst.getInt(7);
no_inst=rst.getInt(8); p_no=rst.getString(10);
b_no=rst.getString(11); st=rst.getString(12);
sex=rst.getString(13); dob=rst.getString(14);
dueamt=rst.getInt(15); dueinst_no=rst.getInt(16);
year=rst.getInt(17); instamt=rst.getInt(18);
instno=rst.getInt(19);
t2.setText(name); t3.setText(add);
t4.setText(phone); t5.setText(mobile);
112
t6.setText(p_no); t7.setText(b_no);
t12.setText(dol); String s1=String.valueOf(loan_amt);
t8.setText(s1); s1=String.valueOf(pay_amt);
t9.setText(s1); s1=String.valueOf(no_inst);
t10.setText(s1); t11.setText(st);
String s2=String.valueOf(dueamt); t13.setText(s2);
s2=String.valueOf(dueinst_no); t14.setText(s2);
s2=String.valueOf(year); t15.setText(s2);
s2=String.valueOf(instamt); t16.setText(s2);
s2=String.valueOf(instno); t17.setText(s2);
s1=dob.substring(8,10); c1.setSelectedItem(s1);
s1=dob.substring(5,7); int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
113
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void update()
{
int loan_amt,pay_amt,no_inst,dueamt,dueinst_no,year,instamt,instno;
String name,add,sex,dob,dol="",status="",cus_no="CNO ",
p_no,b_no, phone,mobile;
114
cus_no+=t1.getText();
phone=t4.getText(); mobile=t5.getText();
b_no=t7.getText(); p_no=t6.getText();
pay_amt=Integer.parseInt(t9.getText());
no_inst=Integer.parseInt(t10.getText());
loan_amt=Integer.parseInt(t8.getText());
name=t2.getText(); add=t3.getText();
sex=(String)c4.getSelectedItem();
dob=(String)c1.getSelectedItem();
dob+="-";
dob+=(String)c2.getSelectedItem();
dob+="-";
dob+=(String)c3.getSelectedItem();
dol=t12.getText(); dueamt=Integer.parseInt(t13.getText());
dueinst_no =Integer.parseInt(t14.getText());
year=Integer.parseInt(t15.getText());
instamt=Integer.parseInt(t16.getText());
instno=Integer.parseInt(t17.getText());
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is Updated","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update customer set
name='"+name+"',"+"address='"+add+"',"+"phone_no='"+phone+"',"+"mobile_no='"
+mobile+"',"+"payment_amt="+pay_amt+",no_of_instalment="+no_inst+",date_of_loan
115
='"+dol+"',p_no='"+p_no+"',bank_no='"+b_no+"',status='"+status+"',sex='"+sex+"',do
b='"+dob+"',due_amt="+dueamt+",due_inst_no="+dueinst_no+",no_of_year="+year+",
inst_amt="+instamt+",inst_no="+instno+"where c_no='"+cus_no+"'");
JOptionPane.showMessageDialog(this,"One Record Updated");
t1.setText(""); t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
t11.setText("");t12.setText("");t13.setText("");
t14.setText("");t15.setText("");t16.setText("");
t17.setText(""); c1.setSelectedIndex(0);c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t1.requestFocus();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//==================================================================
public void actionPerformed(ActionEvent ae)
{
try{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
116
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
t11.setText("");t12.setText("");t13.setText("");
t14.setText("");t15.setText("");t16.setText("");
t17.setText(""); c1.setSelectedIndex(0);c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t1.requestFocus();
}
else if(ae.getSource()==b4)
update();
else if(ae.getSource()==b3)
{
dispose();
MainWin.cusup=null;ManagerWin.cusup=null;
ClerkWin.cusup=null;ReceptionWin.cusup=null;
}
}
catch(Exception e){
System.out.println(e);}
}
public static void main(String args[])
{
new CustomerUpdate();
}
}
PAYMENT:-
1. Payment Entry
import java.awt.*;
import java.awt.event.*;
117
import javax.swing.*;
import java.sql.*;
class PaymentEntry extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3;
JTextField t1,t2,t3;
JButton b1,b2,b3;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
PaymentEntry()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
t1=new JTextField(); t2=new JTextField();
b1=new JButton("OK"); b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
118
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(b1);b1.setBounds(150,340,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
setSize(650,500); setVisible(true);
setTitle("PAYMENT ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
void create()
{
int pay_amt,due_amt,inst_no=0,paym_amt=0,dueinst=0,due_inst_no,instamt=0;
String inst_dt="",cus_no="CNO ";
cus_no+=t1.getText();
pay_amt=Integer.parseInt(t2.getText());
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(sysdate,'dd-mon-yy')from dual");
if(rst.next())
{
inst_dt=rst.getString(1);
}
rst=stmt.executeQuery("select due_amt,due_inst_no,inst_amt,inst_no from
119
customer where c_no='"+cus_no+"'");
while(rst.next())
{
paym_amt=rst.getInt(1); dueinst=rst.getInt(2);
instamt=rst.getInt(3); inst_no=rst.getInt(4);
}
due_amt=paym_amt-pay_amt;
due_inst_no=dueinst-1;
inst_no+=1;
if(paym_amt==0||pay_amt!=instamt)
JOptionPane.showMessageDialog(this,"Instalment Completed / Invalid
Instalment Amount");
else
{
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("insert into payment values('"+cus_no+"',"+pay_amt+",
'"+inst_dt+"',"+due_amt+","+inst_no+","+due_inst_no+")");
JOptionPane.showMessageDialog(this,"One record Saved");
t1.setText(""); t2.setText("");
t1.requestFocus();
stmt.executeUpdate("update customer set due_amt="+due_amt+",
"+"due_inst_no="+due_inst_no+","+"inst_no="+inst_no+"where
c_no='"+cus_no+"'");
}
}
}
120
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===================================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
create();
else if(ae.getSource()==b2)
{
t1.setText(""); t2.setText("");
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.pyet=null;ManagerWin.pyet=null;
ClerkWin.pyet=null;ReceptionWin.pyet=null;
}
}
public static void main(String s[])
{
new PaymentEntry();
}
}
2. Payment Search
import java.awt.*;
import java.awt.event.*;
121
import javax.swing.*;
import java.sql.*;
class PaymentSearch extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6;
JTextField t1,t2,t3,t4,t5,t6;
JButton b1,b2,b3;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
PaymentSearch()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
l3=new JLabel("INSTALMET DATE");
l4=new JLabel("DUES AMOUNT ");
l5=new JLabel("INSTALMENT NO");
l6=new JLabel("DUES INSTALMENT NO");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
b1=new JButton("Search"); b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
122
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr); p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,140,100,25);
p1.add(l4);l4.setBounds(50,180,100,25);
p1.add(l5);l5.setBounds(50,220,130,25);
p1.add(l6);l6.setBounds(50,260,130,25);
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(t3);t3.setBounds(180,140,150,25);
p1.add(t4);t4.setBounds(180,180,150,25);
p1.add(t5);t5.setBounds(180,220,150,25);
p1.add(t6);t6.setBounds(180,260,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
setSize(700,500);
setVisible(true);
setTitle("PAYMENT SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
123
{
int inst_amt,due_amt,inst_no,due_inst_no;
String inst_dt="",c_num="CNO ";
c_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(inst_date,'dd-mon-yy') from payment
where c_no='"+c_num+"'");
if(rst.next())
{
inst_dt=rst.getString(1);
}
rst=stmt.executeQuery("select c_no from payment where c_no='"+c_num+"'");
if(rst.next())
{
rst=stmt.executeQuery("select inst_amt,inst_date,due_amt,inst_no,due_inst_no from
payment where c_no='"+c_num+"'");
while(rst.next())
{
inst_amt=rst.getInt(1); due_amt=rst.getInt(3);
inst_no=rst.getInt(4); due_inst_no=rst.getInt(5);
String s1=String.valueOf(inst_amt); t2.setText(s1);
t3.setText(inst_dt); s1=String.valueOf(due_amt);
t4.setText(s1); s1=String.valueOf(inst_no);
t5.setText(s1); s1=String.valueOf(due_inst_no);
t6.setText(s1);
}
124
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
//=============================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.pysh=null;ManagerWin.pysh=null;
ClerkWin.pysh=null;ReceptionWin.pysh=null;
}
}
public static void main(String s[])
{
new PaymentSearch();
125
}
}
3.Payment Remove
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class PaymentRemove extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6;
JTextField t1,t2,t3,t4,t5,t6;
JButton b1,b2,b3,b4;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
PaymentRemove()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
l3=new JLabel("INSTALMET DATE");
l4=new JLabel("NO OF INSTALMENT PAID");
l5=new JLabel("DUES AMOUNT");
l6=new JLabel("DUES INSTALMENT");
t1=new JTextField(); t2=new JTextField();
t3=new JTextField(); t4=new JTextField();
t5=new JTextField(); t6=new JTextField();
b1=new JButton("Search"); b2=new JButton("Cancel");
b3=new JButton("Close"); b4=new JButton("Remove");
126
b1.addActionListener(this); b2.addActionListener(this);
b3.addActionListener(this); b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,150,100,25);
p1.add(l4);l4.setBounds(50,190,150,25);
p1.add(l5);l5.setBounds(50,230,130,25);
p1.add(l6);l6.setBounds(50,270,110,25);
p1.add(t1);t1.setBounds(200,30,150,25);
p1.add(t2);t2.setBounds(200,100,150,25);
p1.add(t3);t3.setBounds(200,150,150,25);
p1.add(t4);t4.setBounds(200,190,150,25);
p1.add(t5);t5.setBounds(200,230,150,25);
p1.add(t6);t6.setBounds(200,270,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
127
p1.add(b4);b4.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PAYMENT REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
int inst_amt,due_amt,inst_no,due_inst_no;
String inst_dt="",c_num="CNO ";
c_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(inst_date,'dd-mon-yy') from payment
where c_no='"+c_num+"'");
if(rst.next())
{
inst_dt=rst.getString(1);
}
128
{
rst=stmt.executeQuery("select inst_amt,inst_date,due_amt,inst_no,due_inst_no
from payment where c_no='"+c_num+"'");
while(rst.next())
{
inst_amt=rst.getInt(1);
//inst_dt=rst.getString(2);
due_amt=rst.getInt(3);
inst_no=rst.getInt(4);
due_inst_no=rst.getInt(5);
String s1=String.valueOf(inst_amt);
t2.setText(s1);
t3.setText(inst_dt);
s1=String.valueOf(due_amt);
t4.setText(s1);
s1=String.valueOf(inst_no);
t5.setText(s1);
s1=String.valueOf(due_inst_no);
t6.setText(s1);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
129
}
void remove()
{
String cus_no="CNO ";
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from payment where c_no='"+cus_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t1.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"You can not delete this record!"+e);
}
}
130
//=============================================
131
3. Payment Update
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
PaymentUpdate()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
l3=new JLabel("INSTALMET DATE");
l4=new JLabel("NO OF INSTALMENT PAID");
l5=new JLabel("DUES AMOUNT");
l6=new JLabel("DUES INSTALMENT");
t1=new JTextField();
t2=new JTextField();
132
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Update");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,150,100,25);
133
p1.add(l4);l4.setBounds(50,190,150,25);
p1.add(l5);l5.setBounds(50,230,130,25);
p1.add(l6);l6.setBounds(50,270,110,25);
p1.add(t1);t1.setBounds(200,30,150,25);
p1.add(t2);t2.setBounds(200,100,150,25);
p1.add(t3);t3.setBounds(200,150,150,25);
p1.add(t4);t4.setBounds(200,190,150,25);
p1.add(t5);t5.setBounds(200,230,150,25);
p1.add(t6);t6.setBounds(200,270,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
p1.add(b4);b4.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PAYMENT UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
int inst_amt,due_amt,inst_no,due_inst_no;
134
String inst_dt="",c_num="CNO ";
c_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(inst_date,'dd-mon-yy') from payment
where c_no='"+c_num+"'");
if(rst.next())
{
inst_dt=rst.getString(1);
}
rst=stmt.executeQuery("select inst_amt,inst_date,due_amt,inst_no,due_inst_no
from payment where c_no='"+c_num+"'");
while(rst.next())
{
inst_amt=rst.getInt(1);
due_amt=rst.getInt(3);
inst_no=rst.getInt(4);
due_inst_no=rst.getInt(5);
String s1=String.valueOf(inst_amt);
135
t2.setText(s1);
t3.setText(inst_dt);
s1=String.valueOf(due_amt);
t5.setText(s1);
s1=String.valueOf(inst_no);
t4.setText(s1);
s1=String.valueOf(due_inst_no);
t6.setText(s1);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
void update()
{
int pay_amt,due_amt,inst_no=0,paym_amt=0,no_of_instalment=0,due_inst_no;
String inst_dt="",cus_no="CNO ";
cus_no+=t1.getText();
pay_amt=Integer.parseInt(t2.getText());
inst_no=Integer.parseInt(t4.getText());
due_amt=Integer.parseInt(t5.getText());
136
due_inst_no=Integer.parseInt(t6.getText());
inst_dt=t3.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select c_no from payment where c_no='"+cus_no+"'");
if(rst.next())
{
int result=JOptionPane.showConfirmDialog(this,"? record is Updated","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update payment set
inst_amt="+pay_amt+","+"inst_date='"+inst_dt+"',"+"due_amt="+due_amt+","+"ins
t_no="+inst_no+","+"due_inst_no="+due_inst_no+"where c_no='"+cus_no+"'"+" and
"+"inst_date='"+inst_dt+"'");
//stmt.executeUpdate("update customer set
due_amt="+due_amt+"due_inst_no="+due_inst_no+"inst_no="+inst_no+"where
c_no='"+cus_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText(""); t1.requestFocus();
}
}
else
JOptionPane.showMessageDialog(this,"Invalid customer No.");
137
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in update record"+e);
}
}
//=============================================
138
else if(ae.getSource()==b4)
update();
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
GuaranterEntry()
139
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("GUARANTER NAME");
l3=new JLabel("ADDRESS");
l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO");
l6=new JLabel("PROFESSION");
l7=new JLabel("SEX");
c1=new JComboBox();
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("OK");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
140
p1.setLayout(null);p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,120,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,80,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,80,25);
p2.add(l7);l7.setBounds(50,100,80,25);
p1.add(t1);t1.setBounds(170,30,150,25);
p1.add(t2);t2.setBounds(170,100,150,25);
p1.add(t3);t3.setBounds(170,140,150,25);
p1.add(t4);t4.setBounds(170,180,150,25);
p1.add(t5);t5.setBounds(170,220,150,25);
p1.add(t6);t6.setBounds(170,260,150,25);
p1.add(b1);b1.setBounds(170,340,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(150,340,80,25);
p2.add(c1);c1.setBounds(150,100,80,25);
c1.addItem("Select");
c1.addItem("Male");c1.addItem("Female");
141
setSize(650,500);
setVisible(true);
setTitle("GUARANTER ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
void create()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
142
rs=stmt.executeUpdate("insert into guaranter
values('"+c_no+"','"+name+"','"+add+"','"+ph+"','"+mob+"','"+pro+"','"+sex+"')");
JOptionPane.showMessageDialog(this,"One record is saved");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");c1.setSelectedIndex(0);
t1.requestFocus();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===========FORM DESIGNING=========================
143
else if(ae.getSource()==b3)
{
dispose();
CustomerEntry.gret=null;
MainWin.gret=null;ManagerWin.gret=null;
ClerkWin.gret=null;ReceptionWin.gret=null;
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class GuaranterSearch extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7;
JTextField t1,t2,t3,t4,t5,t6;
JButton b1,b2,b3;
JComboBox c1;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
144
GuaranterSearch()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("NAME");
l3=new JLabel("ADDRESS");
l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO");
l6=new JLabel("PROFESSION");
l7=new JLabel("SEX");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
c1=new JComboBox();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
145
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,80,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,80,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,80,25);
p2.add(l7);l7.setBounds(50,100,80,25);
p1.add(t1);t1.setBounds(150,30,150,25);
p1.add(t2);t2.setBounds(150,100,150,25);
p1.add(t3);t3.setBounds(150,140,150,25);
p1.add(t4);t4.setBounds(150,180,150,25);
p1.add(t5);t5.setBounds(150,220,150,25);
p1.add(t6);t6.setBounds(150,260,150,25);
p2.add(c1);c1.setBounds(150,100,80,25);
c1.addItem("Select");
c1.addItem("Male");c1.addItem("Female");
146
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(150,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("GUARANTER SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select c_no from guaranter where c_no='"+cus_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select
name,address,phone_no,mobile_no,profession,sex from guaranter where
c_no='"+cus_no+"'");
while(rst.next())
147
{
name=rst.getString(1);
add=rst.getString(2);
phone=rst.getString(3);
mobile=rst.getString(4);
pro=rst.getString(5);
sex=rst.getString(6);
t2.setText(name);
t3.setText(add);
t4.setText(phone);
t5.setText(mobile);
t6.setText(pro);
c1.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//==================================
148
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");c1.setSelectedIndex(0);
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.grsh=null;ManagerWin.grsh=null;
ClerkWin.grsh=null;ReceptionWin.grsh=null;
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
149
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JTextField t1,t2,t3,t4,t5,t6,t8;
JButton b1,b2,b3,b4;
JComboBox c1;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
GuaranterRemove()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("NAME");
l3=new JLabel("ADDRESS");
l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO");
l6=new JLabel("PROFESSION");
l7=new JLabel("SEX");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
c1=new JComboBox();
150
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Remove");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,80,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,80,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,80,25);
p2.add(l7);l7.setBounds(50,100,80,25);
p1.add(t1);t1.setBounds(150,30,150,25);
151
p1.add(t2);t2.setBounds(150,100,150,25);
p1.add(t3);t3.setBounds(150,140,150,25);
p1.add(t4);t4.setBounds(150,180,150,25);
p1.add(t5);t5.setBounds(150,220,150,25);
p1.add(t6);t6.setBounds(150,260,150,25);
p2.add(c1);c1.setBounds(150,100,80,25);
c1.addItem("Select");
c1.addItem("Male");c1.addItem("Female");
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(150,340,80,25);
p1.add(b4);b4.setBounds(150,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("GUARANTER REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
152
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select c_no from guaranter where c_no='"+cus_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select
name,address,phone_no,mobile_no,profession,sex from guaranter where
c_no='"+cus_no+"'");
while(rst.next())
{
name=rst.getString(1);
add=rst.getString(2);
phone=rst.getString(3);
mobile=rst.getString(4);
pro=rst.getString(5);
sex=rst.getString(6);
t2.setText(name);
t3.setText(add);
t4.setText(phone);
t5.setText(mobile);
t6.setText(pro);
c1.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
153
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void remove()
{
String cus_no="CNO ";
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from guaranter where c_no='"+cus_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");c1.setSelectedIndex(0);
t1.requestFocus();
154
}
}
//=======================================================
155
}
}
4. Guaranter Update
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
GuaranterUpdate()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("NAME");
l3=new JLabel("ADDRESS");
l4=new JLabel("PHONE NO");
l5=new JLabel("MOBILE NO");
l6=new JLabel("PROFESSION");
l7=new JLabel("SEX");
156
c1=new JComboBox();
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Update");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null);p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
157
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,80,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,80,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,80,25);
p2.add(l7);l7.setBounds(50,100,80,25);
p1.add(t1);t1.setBounds(150,30,150,25);
p1.add(t2);t2.setBounds(150,100,150,25);
p1.add(t3);t3.setBounds(150,140,150,25);
p1.add(t4);t4.setBounds(150,180,150,25);
p1.add(t5);t5.setBounds(150,220,150,25);
p1.add(t6);t6.setBounds(150,260,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(150,340,80,25);
p1.add(b4);b4.setBounds(150,340,80,25);
p2.add(c1);c1.setBounds(150,100,80,25);
c1.addItem("Select");
c1.addItem("Male");c1.addItem("Female");
setSize(650,500);
setVisible(true);
setTitle("GUARANTER UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
158
}
//=============DATABASE CONNECTIVITY=================
void search()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select c_no from guaranter where c_no='"+cus_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select
name,address,phone_no,mobile_no,profession,sex from guaranter where
c_no='"+cus_no+"'");
while(rst.next())
{
name=rst.getString(1);
add=rst.getString(2);
phone=rst.getString(3);
mobile=rst.getString(4);
pro=rst.getString(5);
sex=rst.getString(6);
t2.setText(name);
t3.setText(add);
159
t4.setText(phone);
t5.setText(mobile);
t6.setText(pro);
c1.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void update()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
160
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is Update","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update guaranter set
c_no='"+cus_no+"',"+"name='"+name+"',"+"address='"+add+"',"+"phone_no='"+p
h+"',"+"mobile_no='"+mob+"',"+"profession='"+pro+"',"+"sex='"+sex+"'"+"where
c_no='"+cus_no+"'");
JOptionPane.showMessageDialog(this,"One record is updated");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");c1.setSelectedIndex(0);
t1.requestFocus();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in updating record"+e);
}
}
//==================================
161
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");c1.setSelectedIndex(0);
t1.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.grup=null;ManagerWin.grup=null;
ClerkWin.grup=null;ReceptionWin.grup=null;
}
else if(ae.getSource()==b4)
update();
}
162
class PaymentEntry extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3;
JTextField t1,t2,t3;
JButton b1,b2,b3;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
PaymentEntry()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
t1=new JTextField();
t2=new JTextField();
b1=new JButton("OK");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
163
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(b1);b1.setBounds(150,340,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PAYMENT ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
164
}
void create()
{
int pay_amt,due_amt,inst_no=0,paym_amt=0,dueinst=0,due_inst_no,instamt=0;
String inst_dt="",cus_no="CNO ";
cus_no+=t1.getText();
pay_amt=Integer.parseInt(t2.getText());
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(sysdate,'dd-mon-yy')from dual");
if(rst.next())
{
inst_dt=rst.getString(1);
}
rst=stmt.executeQuery("select due_amt,due_inst_no,inst_amt,inst_no from
customer where c_no='"+cus_no+"'");
while(rst.next())
{
165
paym_amt=rst.getInt(1);
dueinst=rst.getInt(2);
instamt=rst.getInt(3);
inst_no=rst.getInt(4);
}
due_amt=paym_amt-pay_amt;
due_inst_no=dueinst-1;
inst_no+=1;
if(paym_amt==0||pay_amt!=instamt)
JOptionPane.showMessageDialog(this,"Instalment Completed / Invalid
Instalment Amount");
else
{
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("insert into payment
values('"+cus_no+"',"+pay_amt+",'"+inst_dt+"',"+due_amt+","+inst_no+","+due_ins
t_no+")");
JOptionPane.showMessageDialog(this,"One record Saved");
t1.setText("");
t2.setText("");
t1.requestFocus();
stmt.executeUpdate("update customer set
due_amt="+due_amt+","+"due_inst_no="+due_inst_no+","+"inst_no="+inst_no+"w
here c_no='"+cus_no+"'");
}
}
166
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===================================================
167
public static void main(String s[])
{
new PaymentEntry();
}
}
2. Payment Search
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
PaymentSearch()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
l3=new JLabel("INSTALMET DATE");
l4=new JLabel("DUES AMOUNT ");
l5=new JLabel("INSTALMENT NO");
168
l6=new JLabel("DUES INSTALMENT NO");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
169
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,140,100,25);
p1.add(l4);l4.setBounds(50,180,100,25);
p1.add(l5);l5.setBounds(50,220,130,25);
p1.add(l6);l6.setBounds(50,260,130,25);
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(t3);t3.setBounds(180,140,150,25);
p1.add(t4);t4.setBounds(180,180,150,25);
p1.add(t5);t5.setBounds(180,220,150,25);
p1.add(t6);t6.setBounds(180,260,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
setSize(700,500);
setVisible(true);
setTitle("PAYMENT SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
170
int inst_amt,due_amt,inst_no,due_inst_no;
String inst_dt="",c_num="CNO ";
c_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(inst_date,'dd-mon-yy') from payment where
c_no='"+c_num+"'");
if(rst.next())
{
inst_dt=rst.getString(1);
}
rst=stmt.executeQuery("select inst_amt,inst_date,due_amt,inst_no,due_inst_no
from payment where c_no='"+c_num+"'");
while(rst.next())
{
inst_amt=rst.getInt(1);
//inst_dt=rst.getString(2);
due_amt=rst.getInt(3);
inst_no=rst.getInt(4);
due_inst_no=rst.getInt(5);
171
String s1=String.valueOf(inst_amt);
t2.setText(s1);
t3.setText(inst_dt);
s1=String.valueOf(due_amt);
t4.setText(s1);
s1=String.valueOf(inst_no);
t5.setText(s1);
s1=String.valueOf(due_inst_no);
t6.setText(s1);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
//=============================================
172
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.pysh=null;ManagerWin.pysh=null;
ClerkWin.pysh=null;ReceptionWin.pysh=null;
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
173
Connection conn;
ResultSet rst;
PaymentRemove()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
l3=new JLabel("INSTALMET DATE");
l4=new JLabel("NO OF INSTALMENT PAID");
l5=new JLabel("DUES AMOUNT");
l6=new JLabel("DUES INSTALMENT");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Remove");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
174
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,150,100,25);
p1.add(l4);l4.setBounds(50,190,150,25);
p1.add(l5);l5.setBounds(50,230,130,25);
p1.add(l6);l6.setBounds(50,270,110,25);
p1.add(t1);t1.setBounds(200,30,150,25);
p1.add(t2);t2.setBounds(200,100,150,25);
p1.add(t3);t3.setBounds(200,150,150,25);
p1.add(t4);t4.setBounds(200,190,150,25);
p1.add(t5);t5.setBounds(200,230,150,25);
p1.add(t6);t6.setBounds(200,270,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
p1.add(b4);b4.setBounds(170,340,80,25);
175
setSize(650,500);
setVisible(true);
setTitle("PAYMENT REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
int inst_amt,due_amt,inst_no,due_inst_no;
String inst_dt="",c_num="CNO ";
c_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(inst_date,'dd-mon-yy') from payment
where c_no='"+c_num+"'");
if(rst.next())
{
inst_dt=rst.getString(1);
}
176
rst=stmt.executeQuery("select inst_amt,inst_date,due_amt,inst_no,due_inst_no
from payment where c_no='"+c_num+"'");
while(rst.next())
{
inst_amt=rst.getInt(1);
//inst_dt=rst.getString(2);
due_amt=rst.getInt(3);
inst_no=rst.getInt(4);
due_inst_no=rst.getInt(5);
String s1=String.valueOf(inst_amt);
t2.setText(s1);
t3.setText(inst_dt);
s1=String.valueOf(due_amt);
t4.setText(s1);
s1=String.valueOf(inst_no);
t5.setText(s1);
s1=String.valueOf(due_inst_no);
t6.setText(s1);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
177
void remove()
{
String cus_no="CNO ";
cus_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from payment where c_no='"+cus_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t1.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"You can not delete this record!"+e);
}
}
//=============================================
178
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t1.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.pyre=null;ManagerWin.pyre=null;
ClerkWin.pyre=null;ReceptionWin.pyre=null;
}
else if(ae.getSource()==b4)
remove();
}
179
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
PaymentUpdate()
{
l1=new JLabel("CUSTOMER NO.");
l2=new JLabel("INSTALMENT AMOUNT");
l3=new JLabel("INSTALMET DATE");
l4=new JLabel("NO OF INSTALMENT PAID");
l5=new JLabel("DUES AMOUNT");
l6=new JLabel("DUES INSTALMENT");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
180
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Update");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,150,100,25);
p1.add(l4);l4.setBounds(50,190,150,25);
181
p1.add(l5);l5.setBounds(50,230,130,25);
p1.add(l6);l6.setBounds(50,270,110,25);
p1.add(t1);t1.setBounds(200,30,150,25);
p1.add(t2);t2.setBounds(200,100,150,25);
p1.add(t3);t3.setBounds(200,150,150,25);
p1.add(t4);t4.setBounds(200,190,150,25);
p1.add(t5);t5.setBounds(200,230,150,25);
p1.add(t6);t6.setBounds(200,270,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
p1.add(b4);b4.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PAYMENT UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
int inst_amt,due_amt,inst_no,due_inst_no;
String inst_dt="",c_num="CNO ";
182
c_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(inst_date,'dd-mon-yy') from payment
where c_no='"+c_num+"'");
if(rst.next())
{
inst_dt=rst.getString(1);
}
rst=stmt.executeQuery("select inst_amt,inst_date,due_amt,inst_no,due_inst_no
from payment where c_no='"+c_num+"'");
while(rst.next())
{
inst_amt=rst.getInt(1);
due_amt=rst.getInt(3);
inst_no=rst.getInt(4);
due_inst_no=rst.getInt(5);
String s1=String.valueOf(inst_amt);
t2.setText(s1);
183
t3.setText(inst_dt);
s1=String.valueOf(due_amt);
t5.setText(s1);
s1=String.valueOf(inst_no);
t4.setText(s1);
s1=String.valueOf(due_inst_no);
t6.setText(s1);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
void update()
{
int pay_amt,due_amt,inst_no=0,paym_amt=0,no_of_instalment=0,due_inst_no;
String inst_dt="",cus_no="CNO ";
cus_no+=t1.getText();
pay_amt=Integer.parseInt(t2.getText());
inst_no=Integer.parseInt(t4.getText());
due_amt=Integer.parseInt(t5.getText());
due_inst_no=Integer.parseInt(t6.getText());
184
inst_dt=t3.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select c_no from payment where c_no='"+cus_no+"'");
if(rst.next())
{
int result=JOptionPane.showConfirmDialog(this,"? record is Updated","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update payment set
inst_amt="+pay_amt+","+"inst_date='"+inst_dt+"',"+"due_amt="+due_amt+","+"in
st_no="+inst_no+","+"due_inst_no="+due_inst_no+"where c_no='"+cus_no+"'"+"
and "+"inst_date='"+inst_dt+"'");
//stmt.executeUpdate("update customer set
due_amt="+due_amt+"due_inst_no="+due_inst_no+"inst_no="+inst_no+"where
c_no='"+cus_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText(""); t1.requestFocus();
}
}
else
JOptionPane.showMessageDialog(this,"Invalid customer No.");
185
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in update record"+e);
}
}
//=============================================
186
update();
}
ProductEntry()
{
l1=new JLabel("PRODUCT NO");
187
l2=new JLabel("PRODUCT NAME");
l3=new JLabel("SHOP NAME");
l4=new JLabel("SHOP ADDRESS");
l5=new JLabel("PRICE");
l6=new JLabel("RATE OF INTEREST");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("OK");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
188
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,120,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,100,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,120,25);
p1.add(t1);t1.setBounds(170,30,150,25);
p1.add(t2);t2.setBounds(170,100,150,25);
p1.add(t3);t3.setBounds(170,140,150,25);
p1.add(t4);t4.setBounds(170,180,150,25);
p1.add(t5);t5.setBounds(170,220,150,25);
p1.add(t6);t6.setBounds(170,260,150,25);
p1.add(b1);b1.setBounds(170,340,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PRODUCT ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
189
void create()
{
int price,rate_of_interest;
String name,shop_name,shop_address,p_no;
price=Integer.parseInt(t5.getText());
rate_of_interest=Integer.parseInt(t6.getText());
p_no="PNO ";
p_no+=t1.getText();
name=t2.getText();
shop_name=t3.getText();
shop_address=t4.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("insert into product
values('"+p_no+"','"+name+"','"+shop_name+"','"+shop_address+"',"+price+","+r
ate_of_interest+")");
190
JOptionPane.showMessageDialog(this,"One record is saved");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===================================================
{
if(ae.getSource()==b1)
create();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.pret=null;ManagerWin.pret=null;
ClerkWin.pret=null;ReceptionWin.pret=null;
}
191
}
ProductSearch()
{
l1=new JLabel("PRODUCT NO");
l2=new JLabel("PRODUCT NAME");
l3=new JLabel("SHOP NAME");
192
l4=new JLabel("SHOP ADDRESS");
l5=new JLabel("PRICE");
l6=new JLabel("RATE OF INTEREST");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
193
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,120,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,100,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,120,25);
p1.add(t1);t1.setBounds(170,30,150,25);
p1.add(t2);t2.setBounds(170,100,150,25);
p1.add(t3);t3.setBounds(170,140,150,25);
p1.add(t4);t4.setBounds(170,180,150,25);
p1.add(t5);t5.setBounds(170,220,150,25);
p1.add(t6);t6.setBounds(170,260,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PRODUCT SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
194
int price,interest;
String name="",s_name="",s_add="",p_num="PNO ";
p_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select
name,shop_name,shop_address,price,rate_of_interest from product where
p_no='"+p_num+"'");
if(rst.next())
{
name=rst.getString(1);
s_name=rst.getString(2);
s_add=rst.getString(3);
price=rst.getInt(4);
interest=rst.getInt(5);
t2.setText(name);
t3.setText(s_name);
t4.setText(s_add);
String s1=String.valueOf(price);
t5.setText(s1);
s1=String.valueOf(interest);
t6.setText(s1);
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
195
{
JOptionPane.showMessageDialog(this,e);
}
}
//=============================================
196
}
3. Product Remove
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
ProductRemove()
{
l1=new JLabel("PRODUCT NO");
l2=new JLabel("PRODUCT NAME");
l3=new JLabel("SHOP NAME");
l4=new JLabel("SHOP ADDRESS");
l5=new JLabel("PRICE");
l6=new JLabel("RATE OF INTEREST");
t1=new JTextField();
197
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Remove");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,120,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,100,25);
198
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,120,25);
p1.add(t1);t1.setBounds(170,30,150,25);
p1.add(t2);t2.setBounds(170,100,150,25);
p1.add(t3);t3.setBounds(170,140,150,25);
p1.add(t4);t4.setBounds(170,180,150,25);
p1.add(t5);t5.setBounds(170,220,150,25);
p1.add(t6);t6.setBounds(170,260,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
p1.add(b4);b4.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PRODUCT REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
int price,interest;
String name="",s_name="",s_add="",p_num="PNO ";
p_num+=t1.getText();
try{
199
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select
name,shop_name,shop_address,price,rate_of_interest from product where
p_no='"+p_num+"'");
if(rst.next())
{
name=rst.getString(1);
s_name=rst.getString(2);
s_add=rst.getString(3);
price=rst.getInt(4);
interest=rst.getInt(5);
t2.setText(name);
t3.setText(s_name);
t4.setText(s_add);
String s1=String.valueOf(price);
t5.setText(s1);
s1=String.valueOf(interest);
t6.setText(s1);
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
200
void remove()
{
String p_no="PNO ";
p_no+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from product where p_no='"+p_no+"'");
t1.setText("");
t2.setText("");t3.setText("");
t4.setText("");
t5.setText("");t6.setText("");t1.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"You can not delete this record!");
}
}
//=============================================
201
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t1.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.prre=null;ManagerWin.prre=null;
ClerkWin.prre=null;ReceptionWin.prre=null;
}
else if(ae.getSource()==b4)
remove();
}
202
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
ProductUpdate()
{
l1=new JLabel("PRODUCT NO");
l2=new JLabel("PRODUCT NAME");
l3=new JLabel("SHOP NAME");
l4=new JLabel("SHOP ADDRESS");
l5=new JLabel("PRICE");
l6=new JLabel("RATE OF INTEREST");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
203
t5=new JTextField();
t6=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Update");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,120,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(l4);l4.setBounds(50,180,100,25);
p1.add(l5);l5.setBounds(50,220,100,25);
p1.add(l6);l6.setBounds(50,260,120,25);
204
p1.add(t1);t1.setBounds(170,30,150,25);
p1.add(t2);t2.setBounds(170,100,150,25);
p1.add(t3);t3.setBounds(170,140,150,25);
p1.add(t4);t4.setBounds(170,180,150,25);
p1.add(t5);t5.setBounds(170,220,150,25);
p1.add(t6);t6.setBounds(170,260,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,340,80,25);
p2.add(b3);b3.setBounds(170,340,80,25);
p1.add(b4);b4.setBounds(170,340,80,25);
setSize(650,500);
setVisible(true);
setTitle("PRODUCT UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
int price,interest;
String name="",s_name="",s_add="",p_num="PNO ";
p_num+=t1.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
205
stmt=conn.createStatement();
rst=stmt.executeQuery("select
name,shop_name,shop_address,price,rate_of_interest from product where
p_no='"+p_num+"'");
if(rst.next())
{
name=rst.getString(1);
s_name=rst.getString(2);
s_add=rst.getString(3);
price=rst.getInt(4);
interest=rst.getInt(5);
t2.setText(name);
t3.setText(s_name);
t4.setText(s_add);
String s1=String.valueOf(price);
t5.setText(s1);
s1=String.valueOf(interest);
t6.setText(s1);
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
void update()
{
206
int price,interest;
String name,s_name,s_add, pr_no="PNO ";
price=Integer.parseInt(t5.getText());
interest=Integer.parseInt(t6.getText());
pr_no+=t1.getText();
name=t2.getText();
s_name=t3.getText();
s_add=t4.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select p_no from product where p_no='"+pr_no+"'");
if(rst.next())
{
int result=JOptionPane.showConfirmDialog(this,"? record is Update","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update product set
name='"+name+"',"+"shop_name='"+s_name+"',"+"shop_address='"+s_add+"',"+
"price="+price+","+"rate_of_interest="+interest+"where p_no='"+pr_no+"'");
JOptionPane.showMessageDialog(this,"One record is saved");
207
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t1.requestFocus();
}
}
else
JOptionPane.showMessageDialog(this,"Invalid product No.");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in updating record"+e);
}
}
//=============================================
208
{
dispose();
MainWin.prup=null;ManagerWin.prup=null;
ClerkWin.prup=null;ReceptionWin.prup=null;
}
else if(ae.getSource()==b4)
update();
}
209
ResultSet rst;
int rs;
BankEntry()
{
l1=new JLabel("BANK NO.");
l2=new JLabel("BANK NAME");
l3=new JLabel("BRANCH");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
b1=new JButton("OK");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
210
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(t3);t3.setBounds(180,140,150,25);
p1.add(b1);b1.setBounds(150,240,90,25);
p2.add(b2);b2.setBounds(50,240,90,25);
p2.add(b3);b3.setBounds(170,240,90,25);
setSize(650,500);
setVisible(true);
setTitle("BANK ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
void Create()
{
211
String name,branch,b_no;
b_no="BNO ";
b_no+=t1.getText();
name=t2.getText();
branch=t3.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
rs=stmt.executeUpdate("insert into bank
values('"+b_no+"','"+name+"','"+branch+"')");
JOptionPane.showMessageDialog(this,"One record is saved");
t1.setText("");
t2.setText("");t3.setText("");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//====================================
212
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
Create();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.bket=null;ManagerWin.bket=null;
ClerkWin.bket=null;ReceptionWin.bket=null;
}
}
213
JLabel l1,l2,l3;
JTextField t1,t2,t3;
JButton b1,b2,b3;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
BankSearch()
{
l1=new JLabel("BANK NO.");
l2=new JLabel("BANK NAME");
l3=new JLabel("BRANCH");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
214
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(t3);t3.setBounds(180,140,150,25);
p2.add(b1);b1.setBounds(50,30,90,25);
p2.add(b2);b2.setBounds(50,240,90,25);
p2.add(b3);b3.setBounds(170,240,90,25);
setSize(650,500);
setVisible(true);
setTitle("BANK SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
215
//=============DATABASE CONNECTIVITY=================
void search()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select bank_no from bank where
bank_no='"+b_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select * from bank where bank_no='"+b_no+"'");
while(rst.next())
{
name=rst.getString(2);
br=rst.getString(3);
}
t2.setText(name);
t3.setText(br);
}
else
JOptionPane.showMessageDialog(this,"Invalid Bank Number");
} catch(Exception e)
216
{
JOptionPane.showMessageDialog(this,"Error in searching record"+e);
}
}
//================================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.bksh=null;ManagerWin.bksh=null;
ClerkWin.bksh=null;ReceptionWin.bksh=null;
}
}
217
3. Bank Remove
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
BankRemove()
{
l1=new JLabel("BANK NO.");
l2=new JLabel("BANK NAME");
l3=new JLabel("BRANCH");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
218
b3=new JButton("Close");
b4=new JButton("Remove");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,140,80,25);
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(t3);t3.setBounds(180,140,150,25);
p2.add(b1);b1.setBounds(50,30,90,25);
p2.add(b2);b2.setBounds(50,240,90,25);
219
p2.add(b3);b3.setBounds(170,240,90,25);
p1.add(b4);b4.setBounds(170,240,80,25);
setSize(650,500);
setVisible(true);
setTitle("BANK REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select bank_no from bank where
bank_no='"+b_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select * from bank where bank_no='"+b_no+"'");
while(rst.next())
{
220
name=rst.getString(2);
br=rst.getString(3);
}
t2.setText(name);
t3.setText(br);
}
else
JOptionPane.showMessageDialog(this,"Invalid Bank Number");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in searching record"+e);
}
}
void remove()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from bank where bank_no='"+b_no+"'");
221
t1.setText("");
t2.setText("");t3.setText("");
t1.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"You can not delete this record!"+e);
}
}
//==========================================================
222
else if(ae.getSource()==b4)
remove();
}
public static void main(String s[])
{
new BankRemove();
}
}
4.Bank Update
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
BankUpdate()
{
l1=new JLabel("BANK NO.");
l2=new JLabel("BANK NAME");
l3=new JLabel("BRANCH");
223
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Update");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();p2=new JPanel();
p1.setLayout(null); p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
p1.add(l1);l1.setBounds(50,30,100,25);
p1.add(l2);l2.setBounds(50,100,130,25);
p1.add(l3);l3.setBounds(50,140,80,25);
224
p1.add(t1);t1.setBounds(180,30,150,25);
p1.add(t2);t2.setBounds(180,100,150,25);
p1.add(t3);t3.setBounds(180,140,150,25);
p2.add(b1);b1.setBounds(50,30,90,25);
p2.add(b2);b2.setBounds(50,240,90,25);
p2.add(b3);b3.setBounds(170,240,90,25);
p1.add(b4);b4.setBounds(170,240,80,25);
setSize(650,500);
setVisible(true);
setTitle("BANK UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
void search()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
225
stmt=conn.createStatement();
rst=stmt.executeQuery("select bank_no from bank where
bank_no='"+b_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select name,branch from bank where
bank_no='"+b_no+"'");
while(rst.next())
{
name=rst.getString(1);
br=rst.getString(2);
}
t2.setText(name);
t3.setText(br);
}
else
JOptionPane.showMessageDialog(this,"Invalid bank number");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in searching"+e);
}
}
void update()
{
226
b_no+=t1.getText();
name=t2.getText();
branch=t3.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is Update","Update
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update bank set
bank_no='"+b_no+"',"+"name="+"'"+name+"',"+"branch="+"'"+branch+"'"+"w
here bank_no='"+b_no+"'");
JOptionPane.showMessageDialog(this,"One Record Updated");
t1.setText("");
t2.setText("");t3.setText("");
t1.requestFocus();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in updating"+e);
}
}
//===========================================================
public void actionPerformed(ActionEvent ae)
{
227
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");
t1.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.bkup=null;ManagerWin.bkup=null;
ClerkWin.bkup=null;ReceptionWin.bkup=null;
}
else if(ae.getSource()==b4)
update();
}
STAFF :-
1. Staff Entry
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
228
import java.sql.*;
StaffEntry()
{
l15=new JLabel("STAFF NO.");
l1=new JLabel("Name");
l2=new JLabel(" ADDRESS");
l3=new JLabel("PHONE NO");
l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO");
l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX");
l8=new JLabel("DESIGNATION");
l9=new JLabel("HIRE DATE");
l10=new JLabel("DD");
l11=new JLabel("MM");
229
l12=new JLabel("YYYY");
l13=new JLabel("SALARY");
l14=new JLabel("COMMISSION");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
t10=new JTextField();
c1=new JComboBox();
c2=new JComboBox();
c3=new JComboBox();
c4=new JComboBox();
b1=new JButton("OK");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
230
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l15);l15.setBounds(50,30,80,25);
p1.add(l1); l1.setBounds(50,100,80,25);
p1.add(l2); l2.setBounds(50,140,80,25);
p1.add(l3); l3.setBounds(50,180,80,25);
p1.add(l6); l6.setBounds(50,240,100,25);
p1.add(l8); l8.setBounds(50,280,80,25);
p1.add(l9); l9.setBounds(50,320,80,25);
p1.add(l10); l10.setBounds(160,220,40,25);
p1.add(l11); l11.setBounds(210,220,40,25);
p1.add(l12); l12.setBounds(270,220,80,25);
p1.add(l13); l13.setBounds(50,360,80,25);
p1.add(c1); c1.setBounds(150,240,50,25);
p1.add(c2); c2.setBounds(200,240,60,25);
p1.add(c3); c3.setBounds(260,240,70,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
231
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
p2.add(l4); l4.setBounds(50,140,80,25);
p2.add(l5); l5.setBounds(50,180,80,25);
p2.add(l7); l7.setBounds(50,240,80,25);
p2.add(l14); l14.setBounds(50,360,80,25);
p2.add(c4); c4.setBounds(90,240,80,25);
c4.addItem("Select");
232
c4.addItem("Male");c4.addItem("Female");
p1.add(t1); t1.setBounds(150,100,150,25);
p1.add(t2); t2.setBounds(150,140,150,25);
p1.add(t3); t3.setBounds(150,180,150,25);
p1.add(t6); t6.setBounds(150,280,150,25);
p1.add(t7); t7.setBounds(150,320,150,25);
p1.add(t8); t8.setBounds(150,360,150,25);
p1.add(t10); t10.setBounds(150,30,150,25);
t10.setEnabled(false);
p1.add(b1); b1.setBounds(150,440,80,25);
p2.add(b2); b2.setBounds(50,440,80,25);
p2.add(b3); b3.setBounds(150,440,80,25);
p2.add(t4); t4.setBounds(150,140,150,25);
p2.add(t5); t5.setBounds(150,180,150,25);
p2.add(t9); t9.setBounds(150,360,150,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select *from staff_no");
while(rst.next())
{
stf_no=rst.getInt(1);
}
233
String s1="EMPNO ";
s1+=String.valueOf(stf_no);
t10.setText(s1);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
setSize(700,500);
setVisible(true);
setTitle("STAFF ENTRY FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//============DATABASE CONNECTIVIRY============
void create()
{
int emp_no,salary,comm;
String phone,mobile,name,desig,h_dt="",add,dob,sex,email;
name=t1.getText();
add=t2.getText();
desig=t6.getText();
email=t4.getText();
sex=(String)c4.getSelectedItem();
phone=t3.getText();
234
salary=Integer.parseInt(t8.getText());
mobile=t5.getText();
comm=Integer.parseInt(t9.getText());
dob=(String)c1.getSelectedItem();
dob+="-";
dob+=(String)c2.getSelectedItem();
dob+="-";
dob+=(String)c3.getSelectedItem();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(sysdate,'dd-mon-yy')from dual");
if(rst.next())
{
h_dt=rst.getString(1);
235
s1+=String.valueOf(stf_no);
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
rs=stmt.executeUpdate("insert into staff
values('"+s1+"','"+name+"','"+desig+"',"+salary+","+comm+",'"+h_dt+"','"+add+"
','"+phone+"','"+mobile+"','"+dob+"','"+sex+"','"+email+"')");
JOptionPane.showMessageDialog(this,"One record is saved");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");c1.setSelectedIndex(0);
c2.setSelectedIndex(0); c3.setSelectedIndex(0);
c4.setSelectedIndex(0);
t10.setText(s1);
rs=stmt.executeUpdate(" update staff_no set stf_no=stf_no+1");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//==========================================
236
if(ae.getSource()==b1)
create();
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");c1.setSelectedIndex(0);
c2.setSelectedIndex(0); c3.setSelectedIndex(0);
c4.setSelectedIndex(0);
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.stfet=null;ManagerWin.stfet=null;
ClerkWin.stfet=null;ReceptionWin.stfet=null;
}
237
import java.sql.*;
StaffSearch()
{
l15=new JLabel("STAFF NO.");
l1=new JLabel("Name");
l2=new JLabel(" ADDRESS");
l3=new JLabel("PHONE NO");
l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO");
l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX");
l8=new JLabel("DESIGNATION");
l9=new JLabel("HIRE DATE");
l10=new JLabel("DD");
l11=new JLabel("MM");
l12=new JLabel("YYYY");
l13=new JLabel("SALARY");
238
l14=new JLabel("COMMISSION");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
t10=new JTextField();
c1=new JComboBox();
c2=new JComboBox();
c3=new JComboBox();
c4=new JComboBox();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();
p2=new JPanel();
239
p1.setLayout(null);
p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l15);l15.setBounds(50,30,80,25);
p1.add(l1); l1.setBounds(50,100,80,25);
p1.add(l2); l2.setBounds(50,140,80,25);
p1.add(l3); l3.setBounds(50,180,80,25);
p1.add(l6); l6.setBounds(50,240,100,25);
p1.add(l8); l8.setBounds(50,280,80,25);
p1.add(l9); l9.setBounds(50,320,80,25);
p1.add(l10); l10.setBounds(160,220,40,25);
p1.add(l11); l11.setBounds(210,220,40,25);
p1.add(l12); l12.setBounds(270,220,80,25);
p1.add(l13); l13.setBounds(50,360,80,25);
p1.add(c1); c1.setBounds(150,240,50,25);
p1.add(c2); c2.setBounds(200,240,60,25);
p1.add(c3); c3.setBounds(260,240,70,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
240
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
p2.add(l4); l4.setBounds(50,140,80,25);
p2.add(l5); l5.setBounds(50,180,80,25);
p2.add(l7); l7.setBounds(50,240,80,25);
p2.add(l14); l14.setBounds(50,360,80,25);
241
p2.add(c4); c4.setBounds(150,240,80,25);
c4.addItem("Select");
c4.addItem("Male");c4.addItem("Female");
p1.add(t1); t1.setBounds(150,100,150,25);
p1.add(t2); t2.setBounds(150,140,150,25);
p1.add(t3); t3.setBounds(150,180,150,25);
p1.add(t6); t6.setBounds(150,280,150,25);
p1.add(t7); t7.setBounds(150,320,150,25);
p1.add(t8); t8.setBounds(150,360,150,25);
p1.add(t10); t10.setBounds(150,30,150,25);
p2.add(b1); b1.setBounds(50,30,80,25);
p2.add(b2); b2.setBounds(50,440,80,25);
p2.add(b3); b3.setBounds(150,440,80,25);
p2.add(t4); t4.setBounds(150,140,150,25);
p2.add(t5); t5.setBounds(150,180,150,25);
p2.add(t9); t9.setBounds(150,360,150,25);
setSize(700,500);
setVisible(true);
setTitle("STAFF SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
242
{
int sal,comm;
String e_no="EMPNO ",phone,mobile,name,add,desig,sex,dob,email,h_dt="";
e_no+=t10.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(hiredate,'dd-mon-yy') from staff where
emp_no='"+e_no+"'");
if(rst.next())
{
h_dt=rst.getString(1);
}
rst=stmt.executeQuery("select emp_no from staff where emp_no='"+e_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select
emp_name,designation,salary,comm,hiredate,address,phone_no,mobile_no,dob,sex,em
ail from staff where emp_no='"+e_no+"'");
while(rst.next())
{
name=rst.getString(1);
desig=rst.getString(2);
sal=rst.getInt(3);
comm=rst.getInt(4);
//h_dt=rst.getString(5);
add=rst.getString(6);
243
phone=rst.getString(7);
mobile=rst.getString(8);
dob=rst.getString(9);
sex=rst.getString(10);
email=rst.getString(11);
t1.setText(name);
t2.setText(add);
String s1;
t3.setText(phone);
t5.setText(mobile);
s1=String.valueOf(sal);
t8.setText(s1);
s1=String.valueOf(comm);
t9.setText(s1);
t6.setText(desig);
t7.setText(h_dt);
t4.setText(email);
s1=dob.substring(8,10);
c1.setSelectedItem(s1);
s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
244
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
245
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//==================================
246
ClerkWin.stfsh=null;ReceptionWin.stfsh=null;
}
}
public static void main(String args[])
{
new StaffSearch();
}
}
3. Staff Search
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
StaffSearch()
{
l15=new JLabel("STAFF NO.");
l1=new JLabel("Name");
247
l2=new JLabel(" ADDRESS");
l3=new JLabel("PHONE NO");
l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO");
l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX");
l8=new JLabel("DESIGNATION");
l9=new JLabel("HIRE DATE");
l10=new JLabel("DD");
l11=new JLabel("MM");
l12=new JLabel("YYYY");
l13=new JLabel("SALARY");
l14=new JLabel("COMMISSION");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
t10=new JTextField();
c1=new JComboBox();
c2=new JComboBox();
c3=new JComboBox();
c4=new JComboBox();
248
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l15);l15.setBounds(50,30,80,25);
p1.add(l1); l1.setBounds(50,100,80,25);
p1.add(l2); l2.setBounds(50,140,80,25);
p1.add(l3); l3.setBounds(50,180,80,25);
p1.add(l6); l6.setBounds(50,240,100,25);
p1.add(l8); l8.setBounds(50,280,80,25);
p1.add(l9); l9.setBounds(50,320,80,25);
p1.add(l10); l10.setBounds(160,220,40,25);
p1.add(l11); l11.setBounds(210,220,40,25);
249
p1.add(l12); l12.setBounds(270,220,80,25);
p1.add(l13); l13.setBounds(50,360,80,25);
p1.add(c1); c1.setBounds(150,240,50,25);
p1.add(c2); c2.setBounds(200,240,60,25);
p1.add(c3); c3.setBounds(260,240,70,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
250
{
String s=String.valueOf(i);
c3.addItem(s);
}
p2.add(l4); l4.setBounds(50,140,80,25);
p2.add(l5); l5.setBounds(50,180,80,25);
p2.add(l7); l7.setBounds(50,240,80,25);
p2.add(l14); l14.setBounds(50,360,80,25);
p2.add(c4); c4.setBounds(150,240,80,25);
c4.addItem("Select");
c4.addItem("Male");c4.addItem("Female");
p1.add(t1); t1.setBounds(150,100,150,25);
p1.add(t2); t2.setBounds(150,140,150,25);
p1.add(t3); t3.setBounds(150,180,150,25);
p1.add(t6); t6.setBounds(150,280,150,25);
p1.add(t7); t7.setBounds(150,320,150,25);
p1.add(t8); t8.setBounds(150,360,150,25);
p1.add(t10); t10.setBounds(150,30,150,25);
p2.add(b1); b1.setBounds(50,30,80,25);
p2.add(b2); b2.setBounds(50,440,80,25);
p2.add(b3); b3.setBounds(150,440,80,25);
p2.add(t4); t4.setBounds(150,140,150,25);
251
p2.add(t5); t5.setBounds(150,180,150,25);
p2.add(t9); t9.setBounds(150,360,150,25);
setSize(700,500);
setVisible(true);
setTitle("STAFF SEARCH FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
int sal,comm;
String e_no="EMPNO ",phone,mobile,name,add,desig,sex,dob,email,h_dt="";
e_no+=t10.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(hiredate,'dd-mon-yy') from staff where
emp_no='"+e_no+"'");
if(rst.next())
{
h_dt=rst.getString(1);
}
rst=stmt.executeQuery("select emp_no from staff where emp_no='"+e_no+"'");
if(rst.next())
252
{
rst=stmt.executeQuery("select
emp_name,designation,salary,comm,hiredate,address,phone_no,mobile_no,dob,sex,em
ail from staff where emp_no='"+e_no+"'");
while(rst.next())
{
name=rst.getString(1);
desig=rst.getString(2);
sal=rst.getInt(3);
comm=rst.getInt(4);
//h_dt=rst.getString(5);
add=rst.getString(6);
phone=rst.getString(7);
mobile=rst.getString(8);
dob=rst.getString(9);
sex=rst.getString(10);
email=rst.getString(11);
t1.setText(name);
t2.setText(add);
String s1;
t3.setText(phone);
t5.setText(mobile);
s1=String.valueOf(sal);
t8.setText(s1);
s1=String.valueOf(comm);
t9.setText(s1);
t6.setText(desig);
t7.setText(h_dt);
253
t4.setText(email);
s1=dob.substring(8,10);
c1.setSelectedItem(s1);
s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
254
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//==================================
255
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
c1.setSelectedIndex(0); c2.setSelectedIndex(0);
c3.setSelectedIndex(0); c4.setSelectedIndex(0);
t10.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.stfsh=null;ManagerWin.stfsh=null;
ClerkWin.stfsh=null;ReceptionWin.stfsh=null;
}
}
256
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
JComboBox c1,c2,c3,c4;
JButton b1,b2,b3,b4;
JPanel p1,p2;
Statement stmt;
Connection conn;
ResultSet rst;
StaffRemove()
{
l15=new JLabel("STAFF NO.");
l1=new JLabel("Name");
l2=new JLabel(" ADDRESS");
l3=new JLabel("PHONE NO");
l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO");
l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX");
l8=new JLabel("DESIGNATION");
l9=new JLabel("HIRE DATE");
l10=new JLabel("DD");
l11=new JLabel("MM");
l12=new JLabel("YYYY");
l13=new JLabel("SALARY");
l14=new JLabel("COMMISSION");
t1=new JTextField();
257
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
t10=new JTextField();
c1=new JComboBox();
c2=new JComboBox();
c3=new JComboBox();
c4=new JComboBox();
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Remove");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();
p2=new JPanel();
258
p1.setLayout(null);
p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l15);l15.setBounds(50,30,80,25);
p1.add(l1); l1.setBounds(50,100,80,25);
p1.add(l2); l2.setBounds(50,140,80,25);
p1.add(l3); l3.setBounds(50,180,80,25);
p1.add(l6); l6.setBounds(50,240,100,25);
p1.add(l8); l8.setBounds(50,280,80,25);
p1.add(l9); l9.setBounds(50,320,80,25);
p1.add(l10); l10.setBounds(160,220,40,25);
p1.add(l11); l11.setBounds(210,220,40,25);
p1.add(l12); l12.setBounds(270,220,80,25);
p1.add(l13); l13.setBounds(50,360,80,25);
p1.add(c1); c1.setBounds(150,240,50,25);
p1.add(c2); c2.setBounds(200,240,60,25);
p1.add(c3); c3.setBounds(260,240,70,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
259
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
{
String s=String.valueOf(i);
c3.addItem(s);
}
p2.add(l4); l4.setBounds(50,140,80,25);
p2.add(l5); l5.setBounds(50,180,80,25);
p2.add(l7); l7.setBounds(50,240,80,25);
p2.add(l14); l14.setBounds(50,360,80,25);
p2.add(c4); c4.setBounds(150,240,80,25);
c4.addItem("Select");
c4.addItem("Male");c4.addItem("Female");
260
p1.add(t1); t1.setBounds(150,100,150,25);
p1.add(t2); t2.setBounds(150,140,150,25);
p1.add(t3); t3.setBounds(150,180,150,25);
p1.add(t6); t6.setBounds(150,280,150,25);
p1.add(t7); t7.setBounds(150,320,150,25);
p1.add(t8); t8.setBounds(150,360,150,25);
p1.add(t10); t10.setBounds(150,30,150,25);
p2.add(b1); b1.setBounds(50,30,80,25);
p2.add(b2); b2.setBounds(50,440,80,25);
p2.add(b3); b3.setBounds(150,440,80,25);
p1.add(b4); b4.setBounds(50,440,80,25);
p2.add(t4); t4.setBounds(150,140,150,25);
p2.add(t5); t5.setBounds(150,180,150,25);
p2.add(t9); t9.setBounds(150,360,150,25);
setSize(700,500);
setVisible(true);
setTitle("STAFF REMOVE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
int sal,comm;
String e_no="EMPNO ",phone,mobile,name,add,desig,sex,dob,email,h_dt="";
261
e_no+=t10.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(hiredate,'dd-mon-yy') from staff where
emp_no='"+e_no+"'");
if(rst.next())
{
h_dt=rst.getString(1);
}
rst=stmt.executeQuery("select emp_no from staff where emp_no='"+e_no+"'");
if(rst.next())
{
rst=stmt.executeQuery("select
emp_name,designation,salary,comm,hiredate,address,phone_no,mobile_no,dob,sex,email
from staff where emp_no='"+e_no+"'");
while(rst.next())
{
name=rst.getString(1);
desig=rst.getString(2);
sal=rst.getInt(3);
comm=rst.getInt(4);
//h_dt=rst.getString(5);
add=rst.getString(6);
phone=rst.getString(7);
mobile=rst.getString(8);
dob=rst.getString(9);
262
sex=rst.getString(10);
email=rst.getString(11);
t1.setText(name);
t2.setText(add);
String s1;
t3.setText(phone);
t5.setText(mobile);
s1=String.valueOf(sal);
t8.setText(s1);
s1=String.valueOf(comm);
t9.setText(s1);
t6.setText(desig);
t7.setText(h_dt);
t4.setText(email);
s1=dob.substring(8,10);
c1.setSelectedItem(s1);
s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
263
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
264
}
}
void remove()
{
String stf_no="EMPNO ";
stf_no+=t10.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from staff where emp_no='"+stf_no+"'");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
c1.setSelectedIndex(0); c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t10.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
265
JOptionPane.showMessageDialog(null,"You can not delete this record!"+e);
}
}
//==================================
266
}
5. Staff Update
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
StaffUpdate()
{
l15=new JLabel("STAFF NO.");
l1=new JLabel("Name");
267
l2=new JLabel(" ADDRESS");
l3=new JLabel("PHONE NO");
l4=new JLabel("EMAIL");
l5=new JLabel("MOBILE NO");
l6=new JLabel("DATE OF BIRTH");
l7=new JLabel("SEX");
l8=new JLabel("DESIGNATION");
l9=new JLabel("HIRE DATE");
l10=new JLabel("DD");
l11=new JLabel("MM");
l12=new JLabel("YYYY");
l13=new JLabel("SALARY");
l14=new JLabel("COMMISSION");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
t5=new JTextField();
t6=new JTextField();
t7=new JTextField();
t8=new JTextField();
t9=new JTextField();
t10=new JTextField();
c1=new JComboBox();
c2=new JComboBox();
c3=new JComboBox();
c4=new JComboBox();
268
b1=new JButton("Search");
b2=new JButton("Cancel");
b3=new JButton("Close");
b4=new JButton("Update");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1); c.add(p2);
p1.add(l15);l15.setBounds(50,30,80,25);
p1.add(l1); l1.setBounds(50,100,80,25);
p1.add(l2); l2.setBounds(50,140,80,25);
p1.add(l3); l3.setBounds(50,180,80,25);
p1.add(l6); l6.setBounds(50,240,100,25);
p1.add(l8); l8.setBounds(50,280,80,25);
p1.add(l9); l9.setBounds(50,320,80,25);
269
p1.add(l10); l10.setBounds(160,220,40,25);
p1.add(l11); l11.setBounds(210,220,40,25);
p1.add(l12); l12.setBounds(270,220,80,25);
p1.add(l13); l13.setBounds(50,360,80,25);
p1.add(c1); c1.setBounds(150,240,50,25);
p1.add(c2); c2.setBounds(200,240,60,25);
p1.add(c3); c3.setBounds(260,240,70,25);
c1.addItem("00");
for(int i=1;i<=9;i++)
{
String s=String.valueOf("0"+i);
c1.addItem(s);
}
for(int i=10;i<=31;i++)
{
String s=String.valueOf(i);
c1.addItem(s);
}
c2.addItem("00");
c2.addItem("JAN");c2.addItem("FEB");
c2.addItem("MAR");c2.addItem("APR");
c2.addItem("MAY");c2.addItem("JUN");
c2.addItem("JULY");c2.addItem("AUG");
c2.addItem("SEP");c2.addItem("OCT");
c2.addItem("NOV");c2.addItem("DEC");
c3.addItem("0000");
for(int i=1950;i<=2100;i++)
270
{
String s=String.valueOf(i);
c3.addItem(s);
}
p2.add(l4); l4.setBounds(50,140,80,25);
p2.add(l5); l5.setBounds(50,180,80,25);
p2.add(l7); l7.setBounds(50,240,80,25);
p2.add(l14); l14.setBounds(50,360,80,25);
p2.add(c4); c4.setBounds(90,240,80,25);
c4.addItem("Select");
c4.addItem("Male");c4.addItem("Female");
p1.add(t1); t1.setBounds(150,100,150,25);
p1.add(t2); t2.setBounds(150,140,150,25);
p1.add(t3); t3.setBounds(150,180,150,25);
p1.add(t6); t6.setBounds(150,280,150,25);
p1.add(t7); t7.setBounds(150,320,150,25);
p1.add(t8); t8.setBounds(150,360,150,25);
p1.add(t10); t10.setBounds(150,30,150,25);
p2.add(b1); b1.setBounds(50,30,80,25);
p2.add(b2); b2.setBounds(50,440,80,25);
p2.add(b3); b3.setBounds(150,440,80,25);
p1.add(b4); b4.setBounds(50,440,80,25);
p2.add(t4); t4.setBounds(150,140,150,25);
p2.add(t5); t5.setBounds(150,180,150,25);
271
p2.add(t9); t9.setBounds(150,360,150,25);
setSize(700,500);
setVisible(true);
setTitle("STAFF UPDATE FORM");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//=============DATABASE CONNECTIVITY=================
void search()
{
int sal,comm;
String e_no="EMPNO ",phone,mobile,name,add,desig,sex,dob,email,h_dt="";
e_no+=t10.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select to_char(hiredate,'dd-mon-yy') from staff where
emp_no='"+e_no+"'");
if(rst.next())
{
h_dt=rst.getString(1);
}
rst=stmt.executeQuery("select emp_no from staff where
emp_no='"+e_no+"'");
if(rst.next())
{
272
rst=stmt.executeQuery("select
emp_name,designation,salary,comm,hiredate,address,phone_no,mobile_no,dob,sex,e
mail from staff where emp_no='"+e_no+"'");
while(rst.next())
{
name=rst.getString(1);
desig=rst.getString(2);
sal=rst.getInt(3);
comm=rst.getInt(4);
//h_dt=rst.getString(5);
add=rst.getString(6);
phone=rst.getString(7);
mobile=rst.getString(8);
dob=rst.getString(9);
sex=rst.getString(10);
email=rst.getString(11);
t1.setText(name);
t2.setText(add);
String s1;
t3.setText(phone);
t5.setText(mobile);
s1=String.valueOf(sal);
t8.setText(s1);
s1=String.valueOf(comm);
t9.setText(s1);
t6.setText(desig);
t7.setText(h_dt);
t4.setText(email);
273
s1=dob.substring(8,10);
c1.setSelectedItem(s1);
s1=dob.substring(5,7);
int n=Integer.parseInt(s1);
switch(n)
{
case 1: c2.setSelectedIndex(1);
break;
case 2: c2.setSelectedIndex(2);
break;
case 3: c2.setSelectedIndex(3);
break;
case 4: c2.setSelectedIndex(4);
break;
case 5: c2.setSelectedIndex(5);
break;
case 6: c2.setSelectedIndex(6);
break;
case 7: c2.setSelectedIndex(7);
break;
case 8: c2.setSelectedIndex(8);
break;
case 9: c2.setSelectedIndex(9);
break;
case 10: c2.setSelectedIndex(10);
break;
case 11: c2.setSelectedIndex(11);
break;
274
case 12: c2.setSelectedIndex(12);
break;
default: c2.setSelectedIndex(0);
}
s1=dob.substring(0,4);
c3.setSelectedItem(s1);
c4.setSelectedItem(sex);
}
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
void update()
{
int sal,comm;
String name,desig,add,dob,sex,email, stf_no="EMPNO ",phone,mobile;
stf_no+=t10.getText();
name=t1.getText();
add=t2.getText();
desig=t6.getText();
email=t4.getText();
sex=(String)c4.getSelectedItem();
275
phone=t3.getText();
sal=Integer.parseInt(t8.getText());
mobile=t5.getText();
comm=Integer.parseInt(t9.getText());
dob=(String)c1.getSelectedItem();
dob+="-";
dob+=(String)c2.getSelectedItem();
dob+="-";
dob+=(String)c3.getSelectedItem();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select emp_no from staff where
emp_no='"+stf_no+"'");
if(rst.next())
{
int result=JOptionPane.showConfirmDialog(this,"? record is
update","Update Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("update staff set
emp_name='"+name+"',"+"designation='"+desig+"',"+"salary="+sal+","+"comm
="+comm+","+"address='"+add+"',"+"phone_no='"+phone+"',"+"mobile_no='"+
276
mobile+"',"+"dob='"+dob+"',"+"sex='"+sex+"',"+"email='"+email+"'"+"where
emp_no='"+stf_no+"'");
JOptionPane.showMessageDialog(this,"One record is Updated");
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
c1.setSelectedIndex(0);c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t10.requestFocus();
}
}
else
JOptionPane.showMessageDialog(this,"Invalid staff No.");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in updating record"+e);
}
}
//==================================
277
else if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");t7.setText("");
t8.setText("");t9.setText("");t10.setText("");
c1.setSelectedIndex(0);c2.setSelectedIndex(0);
c3.setSelectedIndex(0);c4.setSelectedIndex(0);
t10.requestFocus();
}
else if(ae.getSource()==b3)
{
dispose();
MainWin.stfup=null;ManagerWin.stfup=null;
ClerkWin.stfup=null;ReceptionWin.stfup=null;
}
else if(ae.getSource()==b4)
update();
}
USER :-
1. User Entry
import java.awt.*;
278
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
JLabel l1,l2,l3,l4;
JTextField t1,t3;
JComboBox c1;
JPasswordField t2;
JButton b1,b2,b3,b4;
JPanel p1,p2;
Connection conn;
Statement stmt;
ResultSet rst;
int rs;
UserEntry()
{
l1=new JLabel("USER NAME");
l2=new JLabel("PASSWORD");
l3=new JLabel("USER ID");
l4=new JLabel("DESIGNATION");
t1=new JTextField();
t3=new JTextField();
279
t2=new JPasswordField();
b1=new JButton("Create");
b2=new JButton("Clear");
b3=new JButton("Cancel");
b4=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
c1=new JComboBox();
c1.addItem("Select");
c1.addItem("Administrator");
c1.addItem("Manager");
c1.addItem("Clerk");
c1.addItem("Receptionist");
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
Color clr=new Color(44202100);
p1.setBackground(clr);
280
p2.setBackground(clr);
c.add(p1); c.add(p2);
setSize(620,300);
setTitle("USER ENTRY FORM");
setVisible(true);
p1.add(l1);l1.setBounds(50,70,80,25);
p1.add(l2);l2.setBounds(50,110,80,25);
p1.add(l3);l3.setBounds(50,30,80,25);
p1.add(l4);l4.setBounds(50,150,80,25);
p1.add(t1);t1.setBounds(150,70,150,25);
p1.add(t2);t2.setBounds(150,110,150,25);
p1.add(t3);t3.setBounds(150,30,150,25);
t3.setEnabled(false);
p1.add(c1);c1.setBounds(150,150,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,70,80,25);
p2.add(b3);b3.setBounds(50,110,80,25);
p2.add(b4);b4.setBounds(50,180,80,25);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
try{
int u_id=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
281
stmt=conn.createStatement();
rst=stmt.executeQuery("select *from user_no");
if(rst.next())
{
u_id=rst.getInt(1);
}
String s1=String.valueOf(u_id);
String user_id="UID ";
user_id+=s1;
t3.setText(user_id);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error"+e);
}
}
//==============CODE FOR DATABASE CONNECTIVITY==============
void Create()
{
String username;
username=t1.getText();
String password=t2.getText();
String desig=(String)c1.getSelectedItem();
int u_id=0;
try{
282
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select *from user_no");
if(rst.next())
{
u_id=rst.getInt(1);
u_id+=1;
}
String user_id="UID ";
String s1=String.valueOf(u_id);
user_id+=s1;
int result=JOptionPane.showConfirmDialog(this,"? record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
rs=stmt.executeUpdate("insert into userid
values('"+user_id+"','"+username+"','"+password+"','"+desig+"')");
JOptionPane.showMessageDialog(this,"One Record Saved");
stmt.executeUpdate("update user_no set u_id=u_id+1");
t1.setText("");
t2.setText("");
c1.setSelectedIndex(0);
t1.requestFocus();
t3.setText(user_id);
}
}
283
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in inserting record"+e);
}
}
//===========FORM DESIGNING=========================
public void actionPerformed(ActionEvent ae)
{
if (ae.getSource()==b1)
Create();
else if(ae.getSource()==b3)
{
t1.setText("");
t2.setText("");
c1.setSelectedIndex(0);
t1.requestFocus();
}
else if(ae.getSource()==b4)
{
dispose();
MainWin.uret=null;ManagerWin.uret=null;
ClerkWin.uret=null;ReceptionWin.uret=null;
}
}
284
new UserEntry();
}
}
2. User Search
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
UserSearch()
{
l1=new JLabel("USER NAME");
l2=new JLabel("PASSWORD");
l3=new JLabel("USER ID");
l4=new JLabel("DESINGNATION");
t1=new JTextField();
t2=new JTextField();
285
t3=new JTextField();
t4=new JTextField();
b1=new JButton("Search");
b2=new JButton("Clear");
b3=new JButton("Cancel");
b4=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
setSize(620,300);
setTitle("USER SEARCH FORM");
setVisible(true);
286
p1.add(l1);l1.setBounds(50,70,80,25);
p1.add(l2);l2.setBounds(50,110,80,25);
p1.add(l3);l3.setBounds(50,30,80,25);
p1.add(l4);l4.setBounds(50,150,100,25);
p1.add(t1);t1.setBounds(150,70,150,25);
p1.add(t2);t2.setBounds(150,110,150,25);
p1.add(t3);t3.setBounds(150,30,150,25);
p1.add(t4);t4.setBounds(150,150,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,70,80,25);
p2.add(b3);b3.setBounds(50,110,80,25);
p2.add(b4);b4.setBounds(50,180,80,25);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
void search()
{
String name="",pass="",u_id="UID ",desig;
u_id+=t3.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
287
rst=stmt.executeQuery("select * from userid where user_id='"+u_id+"'");
if(rst.next())
{
name=rst.getString(2);
pass=rst.getString(3);
desig=rst.getString(4);
t1.setText(name);
t2.setText(pass);
t4.setText(desig);
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
//=============================================
288
}
else if(ae.getSource()==b4)
{
dispose();
MainWin.ursh=null;ManagerWin.ursh=null;
ClerkWin.ursh=null;ReceptionWin.ursh=null;
}
}
3. User Remove
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
289
ResultSet rst;
UserRemove()
{
l1=new JLabel("USER NAME");
l2=new JLabel("PASSWORD");
l3=new JLabel("USER ID");
l4=new JLabel("DESIGNATION");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
b1=new JButton("Search");
b2=new JButton("Remove");
b3=new JButton("Cancel");
b4=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Container c=getContentPane();
290
c.setLayout(new GridLayout(1,2));
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
setSize(600,300);
setTitle("Remove User ");
setVisible(true);
p1.add(l1);l1.setBounds(50,70,80,25);
p1.add(l2);l2.setBounds(50,110,80,25);
p1.add(l3);l3.setBounds(50,30,80,25);
p1.add(l4);l4.setBounds(50,150,100,25);
p1.add(t1);t1.setBounds(150,70,150,25);
p1.add(t2);t2.setBounds(150,110,150,25);
p1.add(t3);t3.setBounds(150,30,150,25);
p1.add(t4);t4.setBounds(150,150,150,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,70,80,25);
p2.add(b3);b3.setBounds(50,110,80,25);
p2.add(b4);b4.setBounds(50,180,80,25);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//===============DATABASE CONNECTIVITY============
291
void search()
{
String name="",pass="",u_id="UID ",desig;
u_id+=t3.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from userid where user_id='"+u_id+"'");
if(rst.next())
{
name=rst.getString(2);
pass=rst.getString(3);
desig=rst.getString(4);
t1.setText(name);
t2.setText(pass);
t4.setText(desig);
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
void remove()
{
292
String u_id="UID ";
u_id+=t3.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is delete","Delete
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
{
stmt.executeUpdate("delete from userid where user_id='"+u_id+"'");
t1.setText(""); t4.setText("");
t2.setText("");t3.setText("");t3.requestFocus();
JOptionPane.showMessageDialog(this,"One record deleted!");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"You can not delete this record!"+e);
}
}
//=============================================
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
search();
else if(ae.getSource()==b2)
remove();
293
else if(ae.getSource()==b3)
{
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t3.requestFocus();
}
else if(ae.getSource()==b4)
{
dispose();
MainWin.urre=null;ManagerWin.urre=null;
ClerkWin.urre=null;ReceptionWin.urre=null;
}
}
4. User Update
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
294
class UserUpdate extends JInternalFrame implements ActionListener
{
JLabel l1,l2,l3,l4;
JTextField t1,t2,t3,t4;
JButton b1,b2,b3,b4,b5;
JPanel p1,p2;
int rs;
Statement stmt;
Connection conn;
ResultSet rst;
UserUpdate()
{
l1=new JLabel("USER NAME");
l2=new JLabel("PASSWORD");
l3=new JLabel("USER ID");
l4=new JLabel("DESINGNATION");
t1=new JTextField();
t2=new JTextField();
t3=new JTextField();
t4=new JTextField();
b1=new JButton("Search");
b2=new JButton("Clear");
b3=new JButton("Cancel");
b4=new JButton("Close");
b5=new JButton("Update");
295
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
p1=new JPanel();
p2=new JPanel();
p1.setLayout(null);
p2.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(1,2));
Color clr=new Color(44202100);
p1.setBackground(clr);
p2.setBackground(clr);
c.add(p1);c.add(p2);
c.add(p1); c.add(p2);
setSize(620,300);
setTitle("UpdateUser");
setVisible(true);
p1.add(l1);l1.setBounds(50,70,80,25);
p1.add(l2);l2.setBounds(50,110,80,25);
p1.add(l3);l3.setBounds(50,30,80,25);
p1.add(l4);l4.setBounds(50,150,100,25);
p1.add(t1);t1.setBounds(150,70,150,25);
p1.add(t2);t2.setBounds(150,110,150,25);
296
p1.add(t3);t3.setBounds(150,30,150,25);
p1.add(t4);t4.setBounds(150,150,150,25);
p1.add(b5);b5.setBounds(150,180,80,25);
p2.add(b1);b1.setBounds(50,30,80,25);
p2.add(b2);b2.setBounds(50,70,80,25);
p2.add(b3);b3.setBounds(50,110,80,25);
p2.add(b4);b4.setBounds(50,180,80,25);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
//==============CODE FOR DATABASE CONNECTIVITY==============
void search()
{
String name="",pass="",u_id="UID ",desig;
u_id+=t3.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from userid where user_id='"+u_id+"'");
if(rst.next())
{
name=rst.getString(2);
pass=rst.getString(3);
297
desig=rst.getString(4);
t1.setText(name);
t2.setText(pass);
t4.setText(desig);
}
else
JOptionPane.showMessageDialog(this,"There is no such record");
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
void update()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"? record is Update","Update
Record",JOptionPane.OK_CANCEL_OPTION);
298
if(result==JOptionPane.OK_OPTION)
{
rs=stmt.executeUpdate("update userid set
user_id='"+u_id+"',"+"username="+"'"+name+"',"+"password='"+pass+"',"+"desig='
"+desig+"'"+"where user_id='"+u_id+"'" );
JOptionPane.showMessageDialog(this,"One record Updated");
t1.setText("");t4.setText("");
t2.setText("");t3.setText("");
t3.requestFocus();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Error in update record"+e);
}
}
//==================================================================
=========================
299
t3.requestFocus();
}
else if(ae.getSource()==b4)
{
dispose();
MainWin.urup=null;ManagerWin.urup=null;
ClerkWin.urup=null;ReceptionWin.urup=null;
}
else if(ae.getSource()==b5)
update();
}
REPORT :-
1. Enquiry Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
300
import javax.swing.border.*;
EnquiryReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(3,1));
301
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from enquiry");
while(rst.next())
{
row=rst.getRow();
}
data1=new String[row][6];
data2=new String[row][6];
rst=stmt.executeQuery("select * from enquiry");
while(rst.next())
{
data1[i][0]=rst.getString(1);
data1[i][1]=rst.getString(2);
data1[i][2]=rst.getString(3);
data1[i][3]=rst.getString(4);
data1[i][4]=rst.getString(5);
data1[i][5]=rst.getString(6);
data2[i][0]=rst.getString(7);
data2[i][1]=rst.getString(8);
data2[i][2]=rst.getString(9);
data2[i][3]=rst.getString(10);
302
data2[i][4]=rst.getString(11);
data2[i][5]=rst.getString(12);
i++;
}
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String head1[]={"E_NO","Name","Address","Phone_No","Mobile_No","Date"};
table1=new JTable(data1,head1);
String head2[]={"Remarks","Purpose","Email","Sex","Dob","Profession"};
table2=new JTable(data2,head2);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp1=new JScrollPane(table1,v,h);
JScrollPane jsp2=new JScrollPane(table2,v,h);
c.add(jsp1);c.add(jsp2);c.add(p1,"South");
setSize(1000,580);
setTitle("ENQUIRY REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException
{
String eno,name,add,ph,mob,date,rema,pur,email,sex,dob,pro;
int line=1;
303
pindex=1;
pg.translate((int)pf.getImageableX(),(int)pf.getImageableY());
int w=(int)pf.getImageableWidth();
int h=(int)pf.getImageableHeight();
pg.setClip(0,0,w,h);
pg.setColor(Color.white);
pg.fillRect(0,0,w,h);
pg.setColor(Color.black);
pg.setFont(new Font("Times",Font.BOLD,34));
try
{
rst=stmt.executeQuery("select * from enquiry");
pg.drawString("ENO\t\tNAME\t\tADDRESS\t\tPHONE\t\tMOBILE\t\tDATE\t\t
REMARKS\t\tPURPOSE\t\tEMAIL\t\tSEX\t\tDOB\t\tPROFESSION",line++,1);
while(rst.next())
{
eno=rst.getString(0);
name=rst.getString(1);
add=rst.getString(2);
ph=rst.getString(3);
mob=rst.getString(4);
date=rst.getString(5);
rema=rst.getString(6);
pur=rst.getString(7);
email=rst.getString(8);
sex=rst.getString(9);
dob=rst.getString(10);
pro=rst.getString(11);
304
pg.drawString(eno+"\t\t"+name+"\t\t"+add+"\t\t"+ph+"\t\t"+mob+"\t\t"+date+
"\t\t"+rema+"\t\t"+pur+"\t\t"+email+"\t\t"+sex+"\t\t"+dob+"\t\t"+pro,line++,1);
}
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
try{
PrinterJob prn=PrinterJob.getPrinterJob();
prn.setPrintable(this);
if(!prn.printDialog())
return;
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.enqrpt=null;ManagerWin.enqrpt=null;
305
ClerkWin.enqrpt=null;ReceptionWin.enqrpt=null;
}
}
public static void main(String s[])
{
new EnquiryReport();
}
}
2. Customer Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
306
String data1[][],data2[][];
CustomerReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(3,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from customer");
while(rst.next())
{
307
row=rst.getRow();
}
data1=new String[row][9];
data2=new String[row][9];
rst=stmt.executeQuery("select * from customer");
while(rst.next())
{
data1[i][0]=rst.getString(1);
data1[i][1]=rst.getString(2);
data1[i][2]=rst.getString(3);
data1[i][3]=rst.getString(4);
data1[i][4]=rst.getString(5);
data1[i][5]=rst.getString(6);
data1[i][6]=rst.getString(7);
data1[i][7]=rst.getString(8);
data1[i][8]=rst.getString(9);
data2[i][0]=rst.getString(10);
data2[i][1]=rst.getString(11);
// data2[i][1]=rst.getString(12);
data2[i][2]=rst.getString(13);
data2[i][3]=rst.getString(14);
data2[i][4]=rst.getString(15);
data2[i][5]=rst.getString(16);
data2[i][6]=rst.getString(17);
data2[i][7]=rst.getString(18);
data2[i][8]=rst.getString(19);
i++;
}
308
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String
head1[]={"C_NO","Name","Address","Phone_No","Mobile_No","Loan_Amt","Pay_
Amt","No_Of_Inst","Date"};
table1=new JTable(data1,head1);
String
head2[]={"P_no","Bank_no","Sex","Dob","Due","Due_inst","Year","Inst_Amt","Ins
t_NO"};
table2=new JTable(data2,head2);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp1=new JScrollPane(table1,v,h);
JScrollPane jsp2=new JScrollPane(table2,v,h);
c.add(jsp1);c.add(jsp2);c.add(p1,"South");
setSize(1000,580);
setTitle("CUSTOMER REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
309
String
cno,name,add,ph,mob,loan,pay_amt,no_of_inst,date,pno,bno,status,sex,dob,due_amt,du
e_inst,year,inst_amt,inst_no;
int line=1;
pindex=1;
pg.translate((int)pf.getImageableX(),(int)pf.getImageableY());
int w=(int)pf.getImageableWidth();
int h=(int)pf.getImageableHeight();
pg.setClip(0,0,w,h);
pg.setColor(Color.white);
pg.fillRect(0,0,w,h);
pg.setColor(Color.black);
pg.setFont(new Font("Times",Font.BOLD,34));
try
{
rst=stmt.executeQuery("select * from customer");
pg.drawString("CNO\t\tNAME\t\tADDRESS\t\tPHONE\t\tMOBILE\t\tLOAN_A
MT\t\tPAYMENT_AMT\t\tNO_OF_INSTALMENT\t\tDATE\t\tP_NO\t\tBANK_NO\t\t
STATUS\t\tSEX\t\tDOB\t\tDUE_AMT\t\tDUE_INST_NO\t\tYEAR\t\tINST_AMT\t\tIN
ST_NO",line++,1);
while(rst.next())
{
cno=rst.getString(0);
name=rst.getString(1);
add=rst.getString(2);
ph=rst.getString(3);
mob=rst.getString(4);
loan=rst.getString(5);
pay_amt=rst.getString(6);
310
no_of_inst=rst.getString(7);
date=rst.getString(8);
pno=rst.getString(9);
bno=rst.getString(10);
status=rst.getString(11);
sex=rst.getString(12);
dob=rst.getString(13);
due_amt=rst.getString(14);
due_inst=rst.getString(15);
year=rst.getString(16);
inst_amt=rst.getString(17);
inst_no=rst.getString(18);
pg.drawString(cno+"\t\t"+name+"\t\t"+add+"\t\t"+ph+"\t\t"+mob+"\t\t"+loan
+"\t\t"+pay_amt+"\t\t"+no_of_inst+"\t\t"+date+"\t\t"+pno+"\t\t"+bno+"\t\t"+status+"
\t\t"+sex+"\t\t"+dob+"\t\t"+due_amt+"\t\t"+due_inst+"\t\t"+year+"\t\t"+inst_amt+"\t\
t"+inst_no,line++,1);
}
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
311
try{
PrinterJob prn=PrinterJob.getPrinterJob();
prn.setPrintable(this);
if(!prn.printDialog())
return;
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.cusrpt=null;ManagerWin.cusrpt=null;
ClerkWin.cusrpt=null;ReceptionWin.cusrpt=null;
}
}
3. Payment Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
312
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
PaymentReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
313
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(2,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from payment");
while(rst.next())
{
row=rst.getRow();
}
data=new String[row][6];
rst=stmt.executeQuery("select * from payment");
while(rst.next())
{
data[i][0]=rst.getString(1);
data[i][1]=rst.getString(2);
data[i][2]=rst.getString(3);
data[i][3]=rst.getString(4);
data[i][4]=rst.getString(5);
data[i][5]=rst.getString(6);
314
i++;
}
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String
head[]={"C_NO","Inst_Amt","Date","Due_Amt","Inst_No","DueInst_NO"};
table=new JTable(data,head);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
c.add(jsp);c.add(p1,"South");
setSize(1000,580);
setTitle("PAYMENT REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
315
int w=(int)pf.getImageableWidth();
int h=(int)pf.getImageableHeight();
pg.setClip(0,0,w,h);
pg.setColor(Color.white);
pg.fillRect(0,0,w,h);
pg.setColor(Color.black);
pg.setFont(new Font("Times",Font.BOLD,34));
try
{
rst=stmt.executeQuery("select * from payment");
pg.drawString("CNO\t\tINST_AMT\t\tDATE\t\tDUE_AMT\t\tINST_NO",line+
+,1);
while(rst.next())
{
cno=rst.getString(0);
inst_amt=rst.getString(1);
date=rst.getString(2);
due=rst.getString(3);
inst_no=rst.getString(4);
pg.drawString(cno+"\t\t"+inst_amt+"\t\t"+date+"\t\t"+due+"\t\t"+inst_no,line+
+,1);
}
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
316
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
try{
PrinterJob prn=PrinterJob.getPrinterJob();
prn.setPrintable(this);
if(!prn.printDialog())
return;
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.pyrpt=null;ManagerWin.pyrpt=null;
ClerkWin.pyrpt=null;ReceptionWin.pyrpt=null;
}
}
public static void main(String s[])
{
new PaymentReport();
}
}
317
4. Guaranter Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
GuaranterReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
318
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(2,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from guaranter");
while(rst.next())
{
row=rst.getRow();
}
data=new String[row][7];
rst=stmt.executeQuery("select * from guaranter");
while(rst.next())
{
data[i][0]=rst.getString(1);
data[i][1]=rst.getString(2);
319
data[i][2]=rst.getString(3);
data[i][3]=rst.getString(4);
data[i][4]=rst.getString(5);
data[i][5]=rst.getString(6);
data[i][6]=rst.getString(7);
i++;
}
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String
head[]={"C_NO","Name","Address","Ph_no","Mob_no","Profession","Sex"};
table=new JTable(data,head);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
c.add(jsp);c.add(p1,"South");
setSize(1000,580);
setTitle("GUARANTER REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException
{
String cno,name,add,ph,mob,pro,sex;
320
int line=1;
pindex=1;
pg.translate((int)pf.getImageableX(),(int)pf.getImageableY());
int w=(int)pf.getImageableWidth();
int h=(int)pf.getImageableHeight();
pg.setClip(0,0,w,h);
pg.setColor(Color.white);
pg.fillRect(0,0,w,h);
pg.setColor(Color.black);
pg.setFont(new Font("Times",Font.BOLD,34));
try
{
rst=stmt.executeQuery("select * from guaranter");
pg.drawString("CNO\t\tNAME\t\tADDRESS\t\tPHONE\t\tMOBILE\t\tPROFESSI
ON\t\tSEX",line++,1);
while(rst.next())
{
cno=rst.getString(0);
name=rst.getString(1);
add=rst.getString(2);
ph=rst.getString(3);
mob=rst.getString(4);
pro=rst.getString(5);
sex=rst.getString(6);
pg.drawString(cno+"\t\t"+name+"\t\t"+add+"\t\t"+ph+"\t\t"+mob+"\t\t"+pro+"\
t\t"+sex,line++,1);
}
}catch(Exception e)
{
321
System.out.println(e);
}
System.gc();
return 0;
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
try{
PrinterJob prn=PrinterJob.getPrinterJob();
prn.setPrintable(this);
if(!prn.printDialog())
return;
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.grrpt=null;ManagerWin.grrpt=null;
ClerkWin.grrpt=null;ReceptionWin.grrpt=null;
}
}
public static void main(String s[])
{
322
new GuaranterReport();
}
}
5. Product Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
ProductReport()
{
323
b1=new JButton("Print");
b2=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(2,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from product");
while(rst.next())
{
row=rst.getRow();
}
data=new String[row][6];
rst=stmt.executeQuery("select * from product");
while(rst.next())
324
{
data[i][0]=rst.getString(1);
data[i][1]=rst.getString(2);
data[i][2]=rst.getString(3);
data[i][3]=rst.getString(4);
data[i][4]=rst.getString(5);
data[i][5]=rst.getString(6);
i++;
}
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
setSize(1000,580);
setTitle("PRODUCT REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
325
public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException
{
String pno,name,sh_name,add,price,interest;
int line=1;
pindex=1;
pg.translate((int)pf.getImageableX(),(int)pf.getImageableY());
int w=(int)pf.getImageableWidth();
int h=(int)pf.getImageableHeight();
pg.setClip(0,0,w,h);
pg.setColor(Color.white);
pg.fillRect(0,0,w,h);
pg.setColor(Color.black);
pg.setFont(new Font("Times",Font.BOLD,34));
try
{
rst=stmt.executeQuery("select * from product");
pg.drawString("PNO\t\tNAME\t\tSHOAP_NAME\t\tSHOAP_ADDRESS\t\tPRI
CE\t\tINTEREST",line++,1);
while(rst.next())
{
pno=rst.getString(0);
name=rst.getString(1);
sh_name=rst.getString(2);
add=rst.getString(3);
price=rst.getString(4);
interest=rst.getString(5);
pg.drawString(pno+"\t\t"+name+"\t\t"+sh_name+"\t\t"+add+"\t\t"+price+"\t\t
"+interest,line++,1);
}
326
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
327
}
6. Bank Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
328
String data[][];
int row;
BankReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(2,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from bank");
while(rst.next())
{
329
row=rst.getRow();
}
data=new String[row][3];
rst=stmt.executeQuery("select * from bank");
while(rst.next())
{
data[i][0]=rst.getString(1);
data[i][1]=rst.getString(2);
data[i][2]=rst.getString(3);
i++;
}
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String head[]={"Bank_No","Name","Branch"};
TableModel tmodel=new DefaultTableModel(data,head);;
table=new JTable(tmodel);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
c.add(jsp);c.add(p1,"South");
setSize(800,500);
setTitle("BANK REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
330
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
try{
PrinterJob prn=PrinterJob.getPrinterJob();
prn.setPrintable(this);
if(!prn.printDialog())
return;
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.bkrpt=null;ManagerWin.bkrpt=null;
ClerkWin.bkrpt=null;ReceptionWin.bkrpt=null;
}
}
public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException
{
String bno,name,branch;
int line=1;
pindex=1;
pg.translate((int)pf.getImageableX(),(int)pf.getImageableY());
331
int w=(int)pf.getImageableWidth();
int h=(int)pf.getImageableHeight();
pg.setClip(0,0,w,h);
pg.setColor(Color.white);
pg.fillRect(0,0,w,h);
pg.setColor(Color.black);
pg.setFont(new Font("Times",Font.BOLD,34));
try
{
rst=stmt.executeQuery("select * from bank");
pg.drawString("BANK_NO\t\tNAME\t\tBRANCH",line++,1);
while(rst.next())
{
bno=rst.getString(0);
name=rst.getString(1);
branch=rst.getString(2);
pg.drawString(bno+"\t\t"+name+"\t\t"+branch,line++,1);
}
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
public static void main(String s[])
{
new BankReport();
}
332
}
7. Staff Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
StaffReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
333
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
Container c=getContentPane();
c.setLayout(new GridLayout(3,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from staff");
while(rst.next())
{
row=rst.getRow();
}
data1=new String[row][6];
data2=new String[row][6];
rst=stmt.executeQuery("select * from staff");
while(rst.next())
{
334
data1[i][0]=rst.getString(1);
data1[i][1]=rst.getString(2);
data1[i][2]=rst.getString(3);
data1[i][3]=rst.getString(4);
data1[i][4]=rst.getString(5);
data1[i][5]=rst.getString(6);
data2[i][0]=rst.getString(7);
data2[i][1]=rst.getString(8);
data2[i][2]=rst.getString(9);
data2[i][3]=rst.getString(10);
data2[i][4]=rst.getString(11);
data2[i][5]=rst.getString(12);
i++;
}
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String
head1[]={"Emp_No","Name","Designation","Salary","Commision","HireDate"};
table1=new JTable(data1,head1);
String head2[]={"Address","Phone","Mobile","Dob","Sex","Email"};
table2=new JTable(data2,head2);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp1=new JScrollPane(table1,v,h);
335
JScrollPane jsp2=new JScrollPane(table2,v,h);
c.add(jsp1);c.add(jsp2);c.add(p1,"South");
setSize(1000,580);
setTitle("STAFF REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
336
empno=rst.getString(0);
name=rst.getString(1);
desig=rst.getString(2);
sal=rst.getString(3);
comm=rst.getString(4);
hiredate=rst.getString(5);
add=rst.getString(6);
ph=rst.getString(7);
mob=rst.getString(8);
dob=rst.getString(9);
sex=rst.getString(10);
email=rst.getString(11);
pg.drawString(empno+"\t\t"+name+"\t\t"+desig+"\t\t"+sal+"\t\t"+comm+"\t\t"
+hiredate+"\t\t"+add+"\t\t"+ph+"\t\t"+mob+"\t\t"+dob+"\t\t"+sex+"\t\t"+email,line+
+,1);
}
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
337
PrinterJob prn=PrinterJob.getPrinterJob();
prn.setPrintable(this);
if(!prn.printDialog())
return;
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.stfrpt=null;ManagerWin.stfrpt=null;
ClerkWin.stfrpt=null;ReceptionWin.stfrpt=null;
}
}
8. User Report
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
338
import javax.swing.table.*;
import java.util.*;
import java.io.*;
import javax.print.*;
import java.awt.print.*;
import javax.swing.border.*;
UserReport()
{
b1=new JButton("Print");
b2=new JButton("Close");
b1.addActionListener(this);
b2.addActionListener(this);
p1=new JPanel();
p1.setLayout(null);
339
Container c=getContentPane();
c.setLayout(new GridLayout(2,1));
p1.add(b1);b1.setBounds(50,50,80,25);
p1.add(b2);b2.setBounds(150,50,80,25);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
rst=stmt.executeQuery("select * from userid");
while(rst.next())
{
row=rst.getRow();
}
data=new String[row][19];
rst=stmt.executeQuery("select * from userid");
while(rst.next())
{
data[i][0]=rst.getString(1);
data[i][1]=rst.getString(2);
data[i][2]=rst.getString(3);
data[i][3]=rst.getString(4);
i++;
}
340
} catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
String head[]={"User_Id","Name","Password","Designation"};
table=new JTable(data,head);
JScrollPane jsp=new JScrollPane(table);
c.add(jsp); c.add(p1);
setSize(800,500);
setTitle("USER REPORT FORM");
setVisible(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
341
try
{
rst=stmt.executeQuery("select * from userid");
pg.drawString("UID\t\tNAME\t\tPASSWORD\t\tDESIGNATION",line++,1);
while(rst.next())
{
uid=rst.getString(0);
name=rst.getString(1);
pass=rst.getString(2);
desig=rst.getString(3);
pg.drawString(uid+"\t\t"+name+"\t\t"+pass+"\t\t"+desig,line++,1);
}
}catch(Exception e)
{
System.out.println(e);
}
System.gc();
return 0;
}
342
prn.print();
}catch(Exception e)
{
System.out.println(e);
}
}
else if(ae.getSource()==b2)
{
dispose();
MainWin.urrpt=null;ManagerWin.urrpt=null;
ClerkWin.urrpt=null;ReceptionWin.urrpt=null;
}
}
1.JAVA PROGRAM
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
343
class BankEntry extends JInternalFrame implements ActionListener
{
*// for instantiation of objects
Connection conn;
Statement stmt;
ResultSet rst;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:bns","baijnath","arvind");
stmt=conn.createStatement();
int result=JOptionPane.showConfirmDialog(this,"?record is saved","Save
Record",JOptionPane.OK_CANCEL_OPTION);
if(result==JOptionPane.OK_OPTION)
rs=stmt.executeUpdate("insert into bank values('"+b_no+"','"+name+"','"+branch+"')");
JOptionPane.showMessageDialog(this,"One record is saved");*//
String name,branch,b_no;
b_no="BNO ";
b_no+=t1.getText();
name=t2.getText();
branch=t3.getText();;
catch(Exception e)
{
System.out.println(e);
}
}
}
344
VALIDATION CHECK
TESTING
For the better implementation of the system, testing is very necessary. Testing can be done at
any stage according to the need. Some of the testing done in this project is:
1.Unit Testing :-
In unit testing is the analyst test the programs, making up a system. Unit testing gives
stress on the module independently of one another, to find errors. This helps the tester in
deducting errors in coding and logic that are contained within that module alone. The errors
resulting from the interaction between modules are initially avoided.
a) Empty row cannot be inserted. Row must have at least one value column set.
b) Multiple step-operations generated. Check each status value.
345
c) Too many values.
d) Select keyword not found.
Each and every form designed in this project personal loan processing system is a unit and
every form was tested independently. It was tested to find that there is any error in oracle or
Java coding. Founded errors are corrected successfully.
a) In Java, no values are inserted in the any row. Thus, blank form cannot be saved.
b) Invalid data type was tried to insert.
c) The error was found in oracle when primary key has no value.
d) In oracle, the data was inserted in improper way.
2. Integration Testing: -
Integration is corrected with how a system is tied together within. It is more than
sharing a physical part or location .it means that parts of the system work together within
the system even though each part performs a unique function. Successful integration will
perform a synergistic effect and greater total impact than if each component work
separately.
346
After connecting different forms through Main Window form , it was time for integration
testing. This was done to see that the linking of the forms is perfect and the linked forms work
smoothly.
The important and the essential part of the system development phase is system testing.
The number and the nature of errors in a newly designed system depend on some usual
factors like communication between the user and the designer; the programmer’s ability to
generate a code that reflects exactly the system specification and the time frame for the
design. System testing gathers all the system into one pool and tests the whole system to
determine whether it meets the user requirements.
As a system testing deals with overall running of the system. After proper linking and
testing of the forms independently as well as interactively. It too meets with some errors due to
some points left during unit and integration testing.
347
TESTING TECHNIQUES
Software testing is a critical element of software quality assurance and represents the ultimate
review of specification, design, and code generation. The increasing visibility of software as a
system element and the attendant costs associated with a software failure are motivating forces
for well planned, through testing.
Following are the two types of techniques, which have been used to test this project:
White box testing:- In this method test cases are derived from the internal design
specification or actual code. White box test cases selected from program code or
functions under test. The chief advantage of white box testing is that it tests the internal
details of the code and tries to check all paths that a program can execute to determine if
348
a problem occurs. This testing can check additional functions or code that has been
implemented, but not specified.
Black box testing: In this method test cases are derived from the functional specification
of the system. Black box test cases selection can be done without any reference to the
program design or program code. The chief advantage of black box testing is that it can
be done before the design or coding of a program. This test helps to get the design and
coding correct with respect to the specification. This test is good at testing for missing
functions or the program behavior that deviates from the specification. This test is best
for evaluating products that you intend to use in your systems. Black Box Test case for
this project is given in following tables.
ID Result
1. TC-001 Enter user name in the Display
text box specified. administrator’s
Main Window,
User Name must not be if the values are
more than 10 characters. found in
database.
Enter password in the Otherwise
text box specified. redirect to
Password must not be Login screen
greater than 10 with
characters. appropriate
message.
Click on ok button.
349
Product Entry Form
ID Result
1. TC-002 Enter product no in the New product
specified textboxes. number created.
Click on ok button.
ID Result
1. TC-003 Change Product Product
information in the information
specified textboxes. updated.
Click on ok button.
350
Product Search Form
ID Result
1. TC-004 Enter product no in the Product
specified box information
displayed
Click on the search
Button
ID Result
1. TC-005 Enter Product no to be Product
deleted in the specified information
box. deleted.
Click on the remove
button.
Click on ok button.
ID Result
1. TC-007 Enter enquiry number in Enquiry
the specified box. Information
Click on the search Displayed.
Button
ID Result
352
1. TC-008 Employee number will be Staff
generated autometicaly. information
successfully
Enter employee name . It entered.
must not be empty or
more than 20 characters.
Click on ok button.
Staff Update Form
Result
1. TC-009 Change the Staff Staff
Information in the field information
updated.
Click on Update Button.
353
Staff Search Form
ID Result
1. TC-010 Enter employee number Staff
in the specified box. Information
Displayed.
Click on the search
Button
ID Result
1. TC-011 Customer no will be Customer
auto generated. information
successfully
customer name, address, entered.
product no,bank no must
not be null.
Click on ok button.
Result
1. TC-013 Customer number must If customer no
be entered in the exists guaranter
specified text box. information
entered
Name must not be null, successfully.
not more than 20
characters.
Click on ok button.
ID Result
355
1. TC-014 Enter customer no in the Guaranter
specified box. Information
Displayed.
Click on the search
Button.
ID Result
1. TC-015 Enter Customer number Payment
in the specified box. information
successfully
Installment date will auto entered.
generated.
ID Result
1. TC-018 Enter Bank number in Bank
the specified box. information
Deleted.
Click on the remove
button.
TEST REPORT
358
S Message(Source Module) Cause Resolution
No.
Security is a major part, which I have taken care and considered very closely. I have used every
possible technique to stop any breach in the security of this project.
359
Use of Administrator Password: - The passwords provide security to the administrator to
prevent form unauthorized access of data by the operator or other end users.
User Related checks and validations: - For this software, the developer uses user related
checks and validations from the user.
User authorized keys: - Password checking for login of users.
Provision of efficient data backup system: - In this software an efficient system is used
for adequate backup facility.
Multiple database backups: - The efficient system is used for this software to give
multiple data backup.
DATA SECURITY
360
INPUT SCREENS
LOGIN WINDOW
MAIN WINDOW
361
362
OUTPUT SCREENS AND REPORT
REPORT GENERATION
Reports are the important part of the software. It displays the output of the program. In most of
the software development companies, the cost of development is calculated by the number of
reports that is generated by the software. The report helps both the bank and LOAN
PROCESSING SYSTEM FOR . The Loan processing systems for private loan provider help
the customer to provide loan to them in connection with the bank. Report displays list of details
of the customer so that the bank can know about a particular customer such as his/her
customer_no, their name, address, phone_no,
Loan amount and other activities. There is the report which displays the details of the bank.
In this way, reports are divided into eight parts. They are described as below:-
363
REPORT SCREENS
ENQUIRY REPORT
Every System that is developed has some limitation and this project is no exception. The
development of this software should be carried out keeping in mind the current need of this
organisation.
Looking at the bright prospects of the projects, it still has certain limitations, which can’t
be ruled out. The software restricts the activity of LOANS PROVIDED BY LOAN
PROCESSING SYSTEM FOR s. Its scope would be enhanced a lot.
Slight modification of program can affect this software. Authorized person of
management should make so many changes in the program.
Different kinds of test can be designed and incorporated into test program.
364
The major limitation of this project is that we can not access online .We can make it
online so that the customers can pay their instalment from any where and also make
enquiry.
Almost all modules are independent of each other so further modification in one, does not affect
other one. LOAN PROCESSING SYSTEM FOR , for the purpose of getting solved the work of
the LOANS provides this application. After development of this software, I can say that the
complete work of LOANS provided LOAN PROCESSING SYSTEM FOR , would be under
control and easier to handle. Keeping in mind the needs of the organization, which may crop up
in the near future, I have tried and introduced certain features, which may be required by the
organization, and so at that time implementation can be done without any problems. Right now
I shall be developing this software keeping in mind just of LOANS provided LOAN
PROCESSING SYSTEM FOR , but this job can be done countrywide. It will run successfully,
it can be distributed to other organizations too.
BIBLIOGRAPHY
This project is prepared with a few of the latest version of java and oracle books. Some of the
authors book which make me able to summarise the whole content of the project.
(a) B.P.das, an introduction to database system ,asian student edition Galolia publication.
(b) Ger S.pressman, software engineering concepts.
(c) J2ee:the complete reference, McGraw-hill
365
All this authors’ book helps me throughout the making of the project, without taking the support
of these books this project has not been possible.
366