Loan Processing System
Loan Processing System
Loan Processing System
SSS started operations in 2000, with the objective to focus on the training needs of software professional and provided world class software services & Solutions. Today, SSS is Indias foremost training organization in advanced software tools and products with over 1000 professionals working at over 100 training centers across the country. Using modern software tools and advanced facilities, SSS is dedicated to upgrading the skills of Indian Software Professionals to bring them at par with the worlds best by importing quality training in current & emerging technologies. 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 dont 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.
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.
PRELIMINARY INVESTIGATION
Since all the works are done manually, thats 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 cant 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 theyre 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.
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 users needs. The various types of feasibility are: Technical Feasibility: This evaluation determines Whether the technology needed for the proposed system is available. How this technology integrated within the organization.
Technical evaluation must also assess whether the existing system can be upgraded to use the new technology or the organization has expertise to use it. In this case a totally new setup needed which obviously suitable for proposed software. The proposed system has enough capability to be expanded in future. Proposed system will guarantee accuracy, reliability, and ease of access and data security. 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. Operational Feasibility: It is mainly related to human organizational and political aspects. Operational feasibility covers two aspects. The operational feasibility determines how acceptable the software is within the organization. The evaluation 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.
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. Social Feasibility: Social Feasibility is a determination of whether a proposed project will be acceptable to the people or not. This determination typically examines the probability of the project being accepted by the group directly affected by the proposed system change. Interfaces: The proposed system " LOAN PROCESSING SYSTEM FOR SSS 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 SSS" Behavioral Description: It describes about the various types of events used in developing " LOAN PROCESSING SYSTEM FOR SSS".
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 SSS 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
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 SSS 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 b) Device for measuring progress.
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 rescheduled. 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)
specification of validation criteria acts as implicit review of all other requirement. It is essential that time and attention be given this section. Finally, the specification includes a bibliography and appendix. The bibliography contains references to all.
USE CASE DIAGRAM 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. Manager
Ask for Customer Report.
Receive Information.
Clerk
Give information about various Lonas. Receive Payments.
Receive Information
Guaranteer
E R DIAGRAM
empno
cno
name
productno bankno
cno
staff
for mak es
customer
job name
product
take s
name
loan
instalmentamount
payment
11
To construct data flow diagram, we use: 1. Arrows 2. Circles 3. Open-ended boxes, and 4. Squares. An arrow identifies data flow-data in motion. It is a pipeline trough which information flows. Like the rectangle in flowcharts, circles stand for process that converts data/into information. An open-ended box represents a data/store-data at rest, or temporary repository of data. A square defines a source (originator) or destination of system data.
12
0 Level DFD enquiry about finance get enquiry detail Customer Loan Processing System ask for loan get loan get customer status report Management ask for customer status
1st Level DFD enquiry about loan/finance get loan/finance details 1 Front Office System Enquiry get enquiry report ask enquiry report ask for loan Product banks Customer 2 Loan Sanction System check loan sanction loan sanction details customer get loan Management 3 pay loan amount get receipt Loan Recovery System ask payment report payments get payment report
get
13
Bank
gets detail
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
Modules And Their Description
Software is divided into separately named and addressable components called modules that integrated to satisfy problem requirements. LOAN PROCESSING SYSTEM contain six module methods:1. 2 3 4 5 6 Enquiry _system( ) Guaranter _system( ) Bank_system( ) Payment _system( ) Product_system( ) Customer _system( )
Software is divided into separately named and addressable components called modules that integrated to satisfy problem requirements. LOAN PROCESSING SYSTEM FOR SSS has six module:1)
Enquiry _system:- This module contains the detail of those person who enquiry
about LOAN PROCESSING SYSTEM FOR SSS. They ask for the which kind of loan is provided by LOAN PROCESSING SYSTEM FOR SSS How much interest is taken by LOAN PROCESSING SYSTEM FOR SSS .process of taking loan.All the deatails are provided by the enquire system..
2)
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
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. 1.1 Primary Key The Primary Key is a kind of Candidate Key that is chosen by the database designer as the principal means of identifying entities within an entity set. The reminder is then called alternate keys. Primary Key used in this project are:Field E_no P_no Bank_no Emp_no User_id C_no Table name Enquiry Product Bank Staff Userid Customer
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
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 componentlevel 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 Ive 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.
expert user with adequate knowledge of the system. average user with reasonable knowledge. Novice user with little or no knowledge.
23
The following are the elements for good interface design:1) Goal and the intension of task must be identified. 2) Develop standards for good interface design and stick to it. 3) Use icons wherever possible to provide appropriate message. 4) Provide context sensitive help to guide the user. 5) Discuss with current user to improve the interface. 6) Think from user prorpective. 7) Justify the data items. 8) Grouping of data elements is important. 9) Provide key-board shortcut for frequently done tasks. 10) Provide on-line manual to help user in operating the software. 11) Develop navigational procedure prior to developing the user interface.
CODING
LOGIN WINDOW import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class LoginWin extends JDialog implements ActionListener { boolean check=false; JLabel l1,l2; JTextField t1; JPasswordField t2; JButton b1,b2;
24
Container c; JPanel p1; Statement stmt; Connection conn; ResultSet rst; LoginWin() { l1=new JLabel("Enter User Name"); t1=new JTextField(); JPasswordField(); b1=new JButton("Ok"); b1.addActionListener(this); c=getContentPane(); p1.setLayout(null); b2=new JButton("Cancel"); b2.addActionListener(this); p1=new JPanel(); c.add(p1); l2=new JLabel("Enter Password"); t2=new
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); } //==============CODE FOR DATABASE CONNECTIVITY============== void search() {
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(); } }
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(); 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
tool=new JToolBar();
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); b3=new JButton(i3); b5=new JButton(i5); b7=new JButton(i7); b9=new JButton(i9); b11=new JButton(i11); b13=new JButton(i13); b15=new JButton(i15); b2=new JButton(i2); b4=new JButton(i4); b6=new JButton(i6); b8=new JButton(i8); b10=new JButton(i10); b12=new JButton(i12); b14=new JButton(i14); 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
b4.addActionListener(this); b6.addActionListener(this); b8.addActionListener(this); b10.addActionListener(this); b12.addActionListener(this); b14.addActionListener(this); b16.addActionListener(this); cmnu=new JMenu("CUSTOMER"); paymnu=new JMenu("PAYMENT"); bmnu=new JMenu("BANK"); umnu=new JMenu("USER"); hmnu=new JMenu("HELP");
emnu=new JMenu("ENQUIRY"); gmnu=new JMenu("GUARANTER"); pmnu=new JMenu("PRODUCT"); smnu=new JMenu("STAFF"); rmnu=new JMenu("REPORT"); umnu.setMnemonic('U'); emnu.setMnemonic('E'); gmnu.setMnemonic('G'); paymnu.setMnemonic('P'); rmnu.setMnemonic('O');
cmnu.setMnemonic('C'); smnu.setMnemonic('S'); pmnu.setMnemonic('R'); bmnu.setMnemonic('B'); hmnu.setMnemonic('H'); cent=new JMenuItem("Entry",'e'); sent=new JMenuItem("Entry",'e'); payent=new JMenuItem("Entry",'e'); usear=new JMenuItem("Search",'s'); esear=new JMenuItem("Search",'s'); gsear=new JMenuItem("Search" ,'s'); paysear=new JMenuItem("Search",'s'); urem=new JMenuItem("Remove",'r'); erem=new JMenuItem("Remove",'r'); grem=new JMenuItem("Remove",'r');
uent=new JMenuItem("Entry",'e'); eent=new JMenuItem("Entry",'e'); pent=new JMenuItem("Entry",'e'); bent=new JMenuItem("Entry",'e'); csear=new JMenuItem("Search",'s'); ssear=new JMenuItem("Search",'s'); psear=new JMenuItem("Search",'s'); bsear=new JMenuItem("Search",'s'); crem=new JMenuItem("Remove",'r'); srem=new JMenuItem("Remove",'r');
cup=new JMenuItem("Update",'u'); sup=new JMenuItem("Update",'u'); pup=new JMenuItem("Update",'u'); bup=new JMenuItem("Update",'u'); rc=new JMenuItem("Customer",'c'); rpay=new JMenuItem("Payment",'p'); rb=new JMenuItem("Bank",'b'); ru=new JMenuItem("User",'u');
eup=new JMenuItem("Update",'u'); gup=new JMenuItem("Update",'u'); payup=new JMenuItem("Update",'u'); re=new JMenuItem("Enquiry",'e'); rg=new JMenuItem("Guaranter",'g'); rp=new JMenuItem("Product",'r'); rs=new JMenuItem("Staff",'s'); 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_MA SK)); 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_ MASK)); 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); 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
grem.addActionListener(this);
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 sss=ss.substring(0,20); l3.setText(sss); 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);} } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==uent) { if(uret==null) { jif= (uret=new UserEntry()); jif.setTitle("USER ENTRY FORM"); set(); } } else if(ae.getSource()==usear) { if(ursh==null) { jif=(ursh=new UserSearch()); jif.setTitle("USER SEARCH FORM");
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(); } } } public static void main(String s[]) { new MainWin(); } } ENQUIRY
1. Enquiry Entry
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class EnquiryEntry 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;
52
JButton b1,b2,b3; JPanel p1,p2; Statement stmt; Connection conn; int rs,eq_no; ResultSet rst; EnquiryEntry() { l1=new JLabel("NAME"); l3=new JLabel("PHONE NO"); l5=new JLabel("MOBILE NO"); l7=new JLabel("SEX"); l11=new JLabel("MM"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b1=new JButton("OK"); b3=new JButton("Close"); b2.addActionListener(this); Container c=getContentPane(); c.setLayout(new GridLayout(1,2)); p1=new JPanel();p2=new JPanel(); p1.setLayout(null);p2.setLayout(null);
53
l2=new JLabel("ADDRESS"); l4=new JLabel("EMAIL"); l6=new JLabel("DATE OF BIRTH"); l10=new JLabel("DD"); l12=new JLabel("YYYY"); l14=new JLabel("REMARKS"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField(); t8.setEnabled(false); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b1.addActionListener(this); b3.addActionListener(this);
l8=new JLabel("PROFESSION");
Color clr=new Color(44202100); p1.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.setBackground(clr);
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(); remarks=t9.getText(); mobile=t5.getText(); name=t1.getText();
56
address=t2.getText(); pur=t7.getText();
pro=t6.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 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);
into
enquiry
values('"+s1+"','"+name+"','"+address+"','"+phone+"','"+mobile+"','"+doeq+"','"+r
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"); l3=new JLabel("PHONE NO"); l5=new JLabel("MOBILE NO"); l7=new JLabel("SEX"); l11=new JLabel("MM"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b1.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); c.add(p1);c.add(p2); p2.setBackground(clr); c.add(p1);c.add(p2); l9=new JLabel("PURPOSE"); l2=new JLabel("ADDRESS"); l4=new JLabel("EMAIL"); l6=new JLabel("DATE OF BIRTH"); l10=new JLabel("DD"); l12=new JLabel("YYYY"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b1=new JButton("Search"); b3=new JButton("Close"); b2.addActionListener(this);
l8=new JLabel("PROFESSION");
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); add=rst.getString(3); mobile=rst.getString(5); pur=rst.getString(8); sex=rst.getString(10); pro=rst.getString(12); t1.setText(name); t2.setText(add);
63
String s1=dob.substring(8,10); 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"); l3=new JLabel("PHONE NO"); l5=new JLabel("MOBILE NO"); l7=new JLabel("SEX"); l11=new JLabel("MM"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b4=new JButton("Remove"); b2.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
l2=new JLabel("ADDRESS"); l4=new JLabel("EMAIL"); l6=new JLabel("DATE OF BIRTH"); l10=new JLabel("DD"); l12=new JLabel("YYYY"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField();
l8=new JLabel("PROFESSION");
l9=new JLabel("PURPOSE");
c1=new JComboBox(); c3=new JComboBox(); b1=new JButton("Search"); b3=new JButton("Close"); b1.addActionListener(this); b3.addActionListener(this);
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); add=rst.getString(3); mobile=rst.getString(5); pur=rst.getString(8); sex=rst.getString(10); name=rst.getString(2); phone=rst.getString(4); rem=rst.getString(7); email=rst.getString(9); dob=rst.getString(11);
70
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); 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
c3.setSelectedItem(s1);
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"); l2=new JLabel("ADDRESS"); l4=new JLabel("EMAIL"); l1=new JLabel("NAME"); l3=new JLabel("PHONE NO"); l5=new JLabel("MOBILE NO"); l7=new JLabel("SEX"); l9=new JLabel("PURPOSE");
l6=new JLabel("DATE OF BIRTH"); l8=new JLabel("PROFESSION"); l10=new JLabel("DD"); l12=new JLabel("YYYY"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b4=new JButton("Update"); b2.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); c.add(p1);c.add(p2);
l11=new JLabel("MM"); l14=new JLabel("DATE OF ENQUITY"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b1=new JButton("Search"); b3=new JButton("Close"); b1.addActionListener(this); b3.addActionListener(this);
p2.setBackground(clr); c.add(p1);c.add(p2);
75
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);
76
p2.add(l5);l5.setBounds(50,120,80,25);
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(t1);t1.setBounds(150,40,150,25); p1.add(t7);t7.setBounds(150,260,150,25); p2.add(b3);b3.setBounds(50,340,80,25); setSize(750,500); setVisible(true); p1.add(t8);t8.setBounds(150,10,150,25); p1.add(t2);t2.setBounds(150,80,150,25); p2.add(b1);b1.setBounds(50,10,80,25); p2.add(t4);t4.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(b2);b2.setBounds(200,340,80,25); p1.add(b4);b4.setBounds(50,340,80,25); p2.add(t5);t5.setBounds(150,120,150,25);p2.add(t9);t9.setBounds(150,220,150,25); 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); add=rst.getString(3); mobile=rst.getString(5); pur=rst.getString(8); sex=rst.getString(10); pro=rst.getString(12); t2.setText(add); t5.setText(mobile); t6.setText(pro); t4.setText(email); c1.setSelectedItem(s1); 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
name=rst.getString(2); phone=rst.getString(4); rem=rst.getString(7); email=rst.getString(9); dob=rst.getString(11); t1.setText(name); t3.setText(phone); t9.setText(eq_dt); t7.setText(pur); String s1=dob.substring(8,10); s1=dob.substring(5,7);
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); 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
c3.setSelectedItem(s1);
String phone,mobile,eq_no="EQNO ",name,add,dob,pro,pur,email,sex,doeq="",remarks; eq_no+=t8.getText(); mobile=t5.getText(); add=t2.getText(); pur=t7.getText(); phone=t3.getText(); name=t1.getText(); pro=t6.getText(); email=t4.getText(); dob+="-"; dob+="-";
sex=(String)c4.getSelectedItem(); dob=(String)c1.getSelectedItem(); dob+=(String)c2.getSelectedItem(); 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"); l3=new JLabel("ADDRESS"); l5=new JLabel("MOBILE NO"); l7=new JLabel("BANK NO"); l9=new JLabel("NO OF YEAR"); l11=new JLabel("DD"); l13=new JLabel("YYYY"); l15=new JLabel("SEX"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b1=new JButton("OK"); b3=new JButton("Close"); b1.addActionListener(this); b3.addActionListener(this); Container c=getContentPane(); c.setLayout(new GridLayout(1,2)); p1=new JPanel(); p1.setLayout(null); p2=new JPanel(); p2.setLayout(null); p2.setBackground(clr); p1.add(l2); l2.setBounds(50,80,80,25); p1.add(l4); l4.setBounds(50,160,100,25); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField(); t10=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b4=new JButton("Guaranter Entry"); b2.addActionListener(this); b4.addActionListener(this); l2=new JLabel(" NAME"); l6=new JLabel("PRODUCT NO"); l8=new JLabel("LOAN AMOUNT"); l10=new JLabel("NO. OF INSTALMENT"); l4=new JLabel("PHONE NO");
Color clr=new Color(44202100); p1.setBackground(clr); c.add(p1); c.add(p2); p1.add(l1); l1.setBounds(50,40,100,25); p1.add(l3); l3.setBounds(50,120,90,25);
83
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(c4);c4.setBounds(170,280,80,25); p1.add(b1);b1.setBounds(150,380,80,25); p2.add(t8);t8.setBounds(170,80,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); } //==============CODE FOR DATABASE CONNECTIVITY============== 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(); mobile_no=t5.getText(); p_no+=t6.getText(); dob=(String)c1.getSelectedItem(); dob+="-"; phone_no=t4.getText(); bank_no+=t7.getText();
dob+=(String)c2.getSelectedItem();dob+="-";
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
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class CustomerSearch 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; JPanel p1,p2,p3; Statement stmt; Connection conn; ResultSet rst; CustomerSearch() { l1=new JLabel("CUSTOMER NO"); l3=new JLabel("ADDRESS"); l5=new JLabel("MOBILE NO"); l2=new JLabel(" NAME"); l6=new JLabel("PRODUCT NO");
90
l9=new JLabel("PAYMENT AMOUNT"); l10=new JLabel("NO. OF INSTALMENT"); l11=new JLabel("DD"); l12=new JLabel("MM"); l14=new JLabel("DATE OF BIRTH"); l16=new JLabel("DATE OF LOAN"); l18=new JLabel("DUE AMOUNT"); l13=new JLabel("YYYY"); l15new JLabel("STATUS"); l17=new JLabel("SEX");
l19=new JLabel("DUE INSTALMENT NO"); l20=new JLabel("FOR YEAR"); l21=new JLabel("INSTALMENT AMOUNT"); l22=new JLabel("INSTALMENT NO"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); t11=new JTextField(); t13=new JTextField(); t15=new JTextField(); t17=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b3=new JButton("Close"); b2.addActionListener(this); Container c=getContentPane(); c.setLayout(new GridLayout(1,3)); p1=new JPanel(); p3=new JPanel(); p2.setLayout(null); p2=new JPanel(); p1.setLayout(null); p3.setLayout(null);
91
t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField(); t10=new JTextField(); t12=new JTextField(); t14=new JTextField(); t16=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b1.addActionListener(this); b3.addActionListener(this);
b1=new JButton("Search");
Color clr=new Color(44202100); p1.setBackground(clr); p3.setBackground(clr); p2.setBackground(clr); c.add(p1); c.add(p2); c.add(p3); p1.add(l2); l2.setBounds(5,80,80,25); p1.add(l4); l4.setBounds(5,160,100,25); p1.add(l6); l6.setBounds(5,240,90,25); p1.add(l16);l16.setBounds(5,320,100,25); p1.add(t2);t2.setBounds(100,80,120,25); p1.add(t4);t4.setBounds(100,160,120,25); p1.add(t6);t6.setBounds(100,240,120,25); p2.add(l9);l9.setBounds(2,120,120,25); p2.add(l15);l15.setBounds(2,200,80,25); p2.add(l11);l11.setBounds(100,240,30,25); p2.add(l13);l13.setBounds(210,240,70,25); p2.add(c1);c1.setBounds(90,260,50,25); p2.add(c3);c3.setBounds(200,260,65,25); p3.add(l18);l18.setBounds(5,40,110,25); p3.add(l20);l20.setBounds(5,120,110,25); p3.add(l22);l22.setBounds(5,200,110,25); p3.add(t14);t14.setBounds(130,80,80,25);
p1.add(l1); l1.setBounds(5,40,100,25); p1.add(l3); l3.setBounds(5,120,90,25); p1.add(l5); l5.setBounds(5,200,120,25); p1.add(l7);l7.setBounds(5,280,80,25); p1.add(t1);t1.setBounds(100,40,120,25); p1.add(t3);t3.setBounds(100,120,120,25); p1.add(t5);t5.setBounds(100,200,120,25); p2.add(l8);l8.setBounds(2,80,100,25); p2.add(l10);l10.setBounds(2,160,120,25); p2.add(l14);l14.setBounds(2,260,90,25); p2.add(l12);l12.setBounds(150,240,30,25); p2.add(l17);l17.setBounds(2,320,80,25); p2.add(c2);c2.setBounds(140,260,60,25); p2.add(c4);c4.setBounds(90,320,70,25); p3.add(l19);l19.setBounds(5,80,120,25); p3.add(l21);l21.setBounds(5,160,130,25); p3.add(t13);t13.setBounds(130,40,80,25);
p1.add(t7);t7.setBounds(100,280,120,25); p1.add(t12);t12.setBounds(100,320,120,25);
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("Female"); c4.addItem("Male"); p2.add(b1);b1.setBounds(2,40,80,25); p3.add(b3);b3.setBounds(100,380,80,25); p2.add(t9);t9.setBounds(120,120,120,25);
{ 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); phone=rst.getString(4); loan_amt=rst.getInt(6); no_inst=rst.getInt(8); b_no=rst.getString(11); sex=rst.getString(13); dueamt=rst.getInt(15); year=rst.getInt(17); instno=rst.getInt(19);
94
t3.setText(add); t5.setText(mobile); t7.setText(b_no); String s1=String.valueOf(loan_amt); s1=String.valueOf(pay_amt); s1=String.valueOf(no_inst); t11.setText(st); t13.setText(s2); t14.setText(s2); t15.setText(s2); t16.setText(s2); t17.setText(s2); c1.setSelectedItem(s1); int n=Integer.parseInt(s1);
String s2=String.valueOf(dueamt); s2=String.valueOf(dueinst_no); s2=String.valueOf(year); s2=String.valueOf(instamt); s2=String.valueOf(instno); s1=dob.substring(8,10); s1=dob.substring(5,7); 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.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"); l3=new JLabel("ADDRESS"); l5=new JLabel("MOBILE NO"); l7=new JLabel("BANK NO"); l2=new JLabel(" NAME"); l6=new JLabel("PRODUCT NO"); l8=new JLabel("LOAN AMOUNT"); l11=new JLabel("DD"); l4=new JLabel("PHONE NO");
l9=new JLabel("PAYMENT AMOUNT"); l10=new JLabel("NO. OF INSTALMENT"); l12=new JLabel("MM"); l14=new JLabel("DATE OF BIRTH"); l16=new JLabel("DATE OF LOAN"); l20=new JLabel("FOR YEAR"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); l13=new JLabel("YYYY"); l15=new JLabel("STATUS"); l17=new JLabel("SEX");
l18=new JLabel("DUE AMOUNT"); l19=new JLabel("DUE INSTALMENT NO"); l21=new JLabel("INSTALMENT AMOUNT"); l22=new JLabel("INSTALMENT NO"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField();
98
t9=new JTextField(); t11=new JTextField(); t13=new JTextField(); t15=new JTextField(); t17=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b3=new JButton("Close");
t10=new JTextField(); t12=new JTextField(); t14=new JTextField(); t16=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b4=new JButton("Remove"); b2.addActionListener(this); b4.addActionListener(this);
c.setLayout(new GridLayout(1,3)); p1=new JPanel(); p3=new JPanel(); p2.setLayout(null); p2=new JPanel(); p1.setLayout(null); p3.setLayout(null); p2.setBackground(clr);
Color clr=new Color(44202100); p1.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("Female"); p2.add(b1);b1.setBounds(2,40,80,25);
101
c4.addItem("Male");
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); phone=rst.getString(4); loan_amt=rst.getInt(6); no_inst=rst.getInt(8); b_no=rst.getString(11); sex=rst.getString(13); dueamt=rst.getInt(15); year=rst.getInt(17); instno=rst.getInt(19); t2.setText(name); t4.setText(phone); t6.setText(p_no); t12.setText(dol); t8.setText(s1); t9.setText(s1); t10.setText(s1); t3.setText(add); t5.setText(mobile); t7.setText(b_no); String s1=String.valueOf(loan_amt); s1=String.valueOf(pay_amt); s1=String.valueOf(no_inst); t11.setText(st); t13.setText(s2); t14.setText(s2); t15.setText(s2); t16.setText(s2); t17.setText(s2); c1.setSelectedItem(s1); int n=Integer.parseInt(s1); add=rst.getString(3); mobile=rst.getString(5); pay_amt=rst.getInt(7); p_no=rst.getString(10); st=rst.getString(12); dob=rst.getString(14); dueinst_no=rst.getInt(16); instamt=rst.getInt(18);
{ 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); c4.setSelectedItem(sex);
104
c3.setSelectedItem(s1);
} } 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!"); } } //================================== 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("");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()==b3)
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"); l3=new JLabel("ADDRESS"); l5=new JLabel("MOBILE NO"); l7=new JLabel("BANK NO"); l2=new JLabel(" NAME"); l6=new JLabel("PRODUCT NO"); l8=new JLabel("LOAN AMOUNT"); l11=new JLabel("DD"); l15=new JLabel("STATUS"); l17=new JLabel("SEX"); l4=new JLabel("PHONE NO");
l9=new JLabel("PAYMENT AMOUNT"); 10=new JLabel("NO. OF INSTALMENT"); l12=new JLabel("MM"); l14=new JLabel("DATE OF BIRTH"); l16=new JLabel("DATE OF LOAN"); l20=new JLabel("FOR YEAR"); t1=new JTextField(); t3=new JTextField(); t5=new JTextField(); t7=new JTextField(); t9=new JTextField(); t11=new JTextField(); t13=new JTextField(); t15=new JTextField(); t17=new JTextField(); c1=new JComboBox(); c3=new JComboBox(); b3=new JButton("Close"); b1.addActionListener(this); b3.addActionListener(this); Container c=getContentPane();
108
l13=new JLabel("YYYY");
l18=new JLabel("DUE AMOUNT"); l19=new JLabel("DUE INSTALMENT NO"); l21=new JLabel("INSTALMENT AMOUNT"); l22=new JLabel("INSTALMENT NO"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); t8=new JTextField(); t10=new JTextField(); t12=new JTextField(); t14=new JTextField(); t16=new JTextField(); c2=new JComboBox(); c4=new JComboBox(); b2=new JButton("Cancel"); b4=new JButton("Update"); b2.addActionListener(this); b4.addActionListener(this);
b1=new JButton("Search");
c.setLayout(new GridLayout(1,3)); p1=new JPanel(); p3=new JPanel(); p2.setLayout(null); p2=new JPanel(); p1.setLayout(null); p3.setLayout(null); p2.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); phone=rst.getString(4); loan_amt=rst.getInt(6); no_inst=rst.getInt(8); b_no=rst.getString(11); sex=rst.getString(13); dueamt=rst.getInt(15); year=rst.getInt(17); instno=rst.getInt(19); t2.setText(name); t4.setText(phone); t3.setText(add); t5.setText(mobile);
112
t7.setText(b_no); String s1=String.valueOf(loan_amt); s1=String.valueOf(pay_amt); s1=String.valueOf(no_inst); t11.setText(st); t13.setText(s2); t14.setText(s2); t15.setText(s2); t16.setText(s2); t17.setText(s2); c1.setSelectedItem(s1); int n=Integer.parseInt(s1);
String s2=String.valueOf(dueamt); s2=String.valueOf(dueinst_no); s2=String.valueOf(year); s2=String.valueOf(instamt); s2=String.valueOf(instno); s1=dob.substring(8,10); s1=dob.substring(5,7); 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
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 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(); b1=new JButton("OK"); b3=new JButton("Close"); b1.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); 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
p2.setBackground(clr);
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); } //==============CODE FOR DATABASE CONNECTIVITY==============
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); instamt=rst.getInt(3); } 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(""); 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
dueinst=rst.getInt(2); inst_no=rst.getInt(4);
t2.setText("");
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(""); } 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
t2.setText("");
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(); t3=new JTextField(); t5=new JTextField(); b3=new JButton("Close"); b1.addActionListener(this); b3.addActionListener(this); Container c=getContentPane();
122
b1=new JButton("Search");
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); 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
p2.setBackground(clr);
{ 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); inst_no=rst.getInt(4); t3.setText(inst_dt); t4.setText(s1); t5.setText(s1); t6.setText(s1); }
124
String s1=String.valueOf(inst_amt);
s1=String.valueOf(inst_no); s1=String.valueOf(due_inst_no);
} 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(); t3=new JTextField(); t5=new JTextField(); b3=new JButton("Close"); t2=new JTextField(); t4=new JTextField(); t6=new JTextField(); b2=new JButton("Cancel"); b4=new JButton("Remove");
126
b1=new JButton("Search");
b2.addActionListener(this); b4.addActionListener(this);
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); } rst=stmt.executeQuery("select c_no from payment where c_no='"+c_num+"'"); if(rst.next())
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
//=============================================
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(); }
3. Payment Update
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class PaymentUpdate 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; 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");
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
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 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);
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 ";
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 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."); customer set due_amt="+due_amt+"due_inst_no="+due_inst_no+"inst_no="+inst_no+"where
137
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.pyup=null;ManagerWin.pyup=null; ClerkWin.pyup=null;ReceptionWin.pyup=null; }
138
else if(ae.getSource()==b4) update(); } public static void main(String s[]) { new PaymentUpdate(); } } GUARANTER :1. Guaranter Entry
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class GuaranterEntry 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; Connection conn; Statement stmt; int rs;
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); } //==============CODE FOR DATABASE CONNECTIVITY============== void create() { String ph,mob,name,add,pro,sex,c_no="CNO "; c_no+=t1.getText(); ph=t4.getText(); mob=t5.getText(); name=t2.getText(); add=t3.getText(); pro=t6.getText(); sex=(String)c1.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 saved","Save Record",JOptionPane.OK_CANCEL_OPTION); if(result==JOptionPane.OK_OPTION) {
142
into
guaranter
values('"+c_no+"','"+name+"','"+add+"','"+ph+"','"+mob+"','"+pro+"','"+sex+"')");
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("");c1.setSelectedIndex(0); }
143
else if(ae.getSource()==b3) { dispose(); CustomerEntry.gret=null; MainWin.gret=null;ManagerWin.gret=null; ClerkWin.gret=null;ReceptionWin.gret=null; } } public static void main(String s[]) { new GuaranterEntry(); } }
2. Guaranter Search
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
setSize(650,500); setVisible(true); setTitle("GUARANTER SEARCH FORM"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } //=============DATABASE CONNECTIVITY================= void search() { String name,add,pro,sex,cus_no="CNO ",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 c_no from guaranter where c_no='"+cus_no+"'"); if(rst.next()) { rst=stmt.executeQuery("select name,address,phone_no,mobile_no,profession,sex c_no='"+cus_no+"'"); while(rst.next())
147
from
guaranter
where
{ 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); } }
//==================================
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; } } public static void main(String s[]) { new GuaranterSearch(); } }
3. Guaranter Remove
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class GuaranterRemove extends JInternalFrame implements ActionListener {
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() { String name,add,pro,sex,cus_no="CNO ",phone,mobile; cus_no+=t1.getText(); try{
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 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
from
guaranter
where
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(); JOptionPane.showMessageDialog(this,"One record deleted!"); } } catch(Exception e) { JOptionPane.showMessageDialog(null,"You can not delete this record!");
154
} } //=======================================================
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("");c1.setSelectedIndex(0); t1.requestFocus(); } else if(ae.getSource()==b3) { dispose(); MainWin.grre=null;ManagerWin.grre=null; ClerkWin.grre=null;ReceptionWin.grre=null; } else if(ae.getSource()==b4) remove(); } public static void main(String s[]) { new GuaranterRemove();
155
} }
4. Guaranter Update
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class GuaranterUpdate extends JInternalFrame implements ActionListener { JLabel l1,l2,l3,l4,l5,l6,l7; JTextField t1,t2,t3,t4,t5,t6; JButton b1,b2,b3,b4; JComboBox c1; JPanel p1,p2; Statement stmt; Connection conn; ResultSet rst;
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() { String name,add,pro,sex,cus_no="CNO ",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 c_no from guaranter where c_no='"+cus_no+"'"); if(rst.next()) { rst=stmt.executeQuery("select name,address,phone_no,mobile_no,profession,sex 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
from
guaranter
where
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() {
String name,add,pro,sex,cus_no="CNO ",ph,mob; cus_no+=t1.getText(); ph=t4.getText(); mob=t5.getText(); name=t2.getText(); add=t3.getText(); pro=t6.getText(); sex=(String)c1.getSelectedItem(); try{ 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); } } //==================================
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(); } public static void main(String s[]) { new GuaranterUpdate(); } } PAYMENT :1. Payment Entry import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*;
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");
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);
} //==============CODE FOR DATABASE CONNECTIVITY============== 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 t_no+")"); JOptionPane.showMessageDialog(this,"One record Saved"); t1.setText(""); t2.setText(""); t1.requestFocus(); stmt.executeUpdate("update here c_no='"+cus_no+"'"); } }
166
into
payment
values('"+cus_no+"',"+pay_amt+",'"+inst_dt+"',"+due_amt+","+inst_no+","+due_ins
customer
set
due_amt="+due_amt+","+"due_inst_no="+due_inst_no+","+"inst_no="+inst_no+"w
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; } }
167
import java.awt.*; import java.awt.event.*; 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");
168
t1=new JTextField(); t2=new JTextField(); t3=new JTextField(); t4=new JTextField(); t5=new JTextField(); t6=new JTextField();
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 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); //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); } } //=============================================
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(); } }
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;
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); } rst=stmt.executeQuery("select c_no from payment where c_no='"+c_num+"'"); if(rst.next()) {
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(); }
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class PaymentUpdate 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; 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");
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);
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 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);
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 ";
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 st_no="+inst_no+","+"due_inst_no="+due_inst_no+"where and "+"inst_date='"+inst_dt+"'"); //stmt.executeUpdate("update 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."); customer set due_amt="+due_amt+"due_inst_no="+due_inst_no+"inst_no="+inst_no+"where payment set inst_amt="+pay_amt+","+"inst_date='"+inst_dt+"',"+"due_amt="+due_amt+","+"in c_no='"+cus_no+"'"+"
185
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.pyup=null;ManagerWin.pyup=null; ClerkWin.pyup=null;ReceptionWin.pyup=null; } else if(ae.getSource()==b4)
186
update(); } public static void main(String s[]) { new PaymentUpdate(); } } PRODUCT :1. Product Entry
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class ProductEntry 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;
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); } //==============CODE FOR DATABASE CONNECTIVITY==============
189
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 ate_of_interest+")");
190
into
product
values('"+p_no+"','"+name+"','"+shop_name+"','"+shop_address+"',"+price+","+r
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(""); } else if(ae.getSource()==b3) { dispose(); MainWin.pret=null;ManagerWin.pret=null; ClerkWin.pret=null;ReceptionWin.pret=null; }
191
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class ProductSearch 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; ProductSearch() { l1=new JLabel("PRODUCT NO"); l2=new JLabel("PRODUCT NAME"); l3=new JLabel("SHOP NAME");
192
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 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
from
product
where
{ 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.prsh=null;ManagerWin.prsh=null; ClerkWin.prsh=null;ReceptionWin.prsh=null; } } public static void main(String s[]) { new ProductSearch(); }
196
}
3. Product Remove
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class ProductRemove 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; 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 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
from
product
where
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(); }
import java.awt.*;
202
import java.awt.event.*; import javax.swing.*; import java.sql.*; class ProductUpdate 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; 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");
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 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
from
product
where
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); } } //=============================================
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)
208
{ dispose(); MainWin.prup=null;ManagerWin.prup=null; ClerkWin.prup=null;ReceptionWin.prup=null; } else if(ae.getSource()==b4) update(); } public static void main(String s[]) { new ProductUpdate(); } } BANK :1. Bank Entry
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class BankEntry extends JInternalFrame implements ActionListener { JLabel l1,l2,l3; JTextField t1,t2,t3; JButton b1,b2,b3; JPanel p1,p2; Connection conn; Statement stmt;
209
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); } //==============CODE FOR DATABASE CONNECTIVITY============== 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 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); } } //==================================== into bank
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; } } public static void main(String s[]) { new BankEntry(); } }
2. Bank Search
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class BankSearch extends JInternalFrame implements ActionListener {
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();
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);
//=============DATABASE CONNECTIVITY================= void search() { String name="",br="",b_no="BNO "; b_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 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
//================================================ 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; } } public static void main(String s[]) { new BankSearch(); } }
217
3. Bank Remove
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class BankRemove extends JInternalFrame implements ActionListener { JLabel l1,l2,l3; JTextField t1,t2,t3; JButton b1,b2,b3,b4; JPanel p1,p2; Connection conn; Statement stmt; ResultSet rst; BankRemove() { l1=new JLabel("BANK NO."); l2=new JLabel("BANK NAME"); l3=new JLabel("BRANCH"); t1=new JTextField(); t2=new JTextField(); t3=new JTextField();
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() { String name="",br="",b_no="BNO "; b_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 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() { String b_no="BNO "; b_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 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); } } //========================================================== public void actionPerformed(ActionEvent ae) { 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.bkre=null;ManagerWin.bkre=null; ClerkWin.bkre=null;ReceptionWin.bkre=null; }
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.*; class BankUpdate extends JInternalFrame implements ActionListener { JLabel l1,l2,l3; JTextField t1,t2,t3; JButton b1,b2,b3,b4; JPanel p1,p2; Statement stmt; Connection conn; ResultSet rst; BankUpdate() { l1=new JLabel("BANK NO."); l2=new JLabel("BANK NAME"); l3=new JLabel("BRANCH");
223
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
setSize(650,500); setVisible(true); setTitle("BANK UPDATE FORM"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } //==============CODE FOR DATABASE CONNECTIVITY============== void search() { String name="",br="",b_no="BNO "; b_no+=t1.getText(); 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() {
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 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
bank
set
bank_no='"+b_no+"',"+"name="+"'"+name+"',"+"branch="+"'"+branch+"'"+"w
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(); } public static void main(String s[]) { new BankUpdate(); } } STAFF :1. Staff Entry
import java.sql.*; class StaffEntry 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; JPanel p1,p2; Statement stmt; Connection conn; int rs,stf_no; ResultSet rst;
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); } rst=stmt.executeQuery("select *from staff_no"); while(rst.next()) { stf_no=rst.getInt(1); stf_no+=1; } String s1="EMPNO ";
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 ','"+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); } } //========================================== public void actionPerformed(ActionEvent ae) {
236
into
staff
values('"+s1+"','"+name+"','"+desig+"',"+salary+","+comm+",'"+h_dt+"','"+add+"
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; } } public static void main(String args[]) { new StaffEntry(); } } 2. Staff Search import java.awt.*; import java.awt.event.*; import javax.swing.*;
237
import java.sql.*; class StaffSearch 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; JPanel p1,p2; Statement stmt; Connection conn; ResultSet rst; 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(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); }
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); }
{ 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
//==================================
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("");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;
246
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class StaffSearch 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; JPanel p1,p2; Statement stmt; Connection conn; ResultSet rst; 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
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); } }
//==================================
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; } } public static void main(String args[]) { new StaffSearch(); } }
4. Staff Remove
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class StaffRemove extends JInternalFrame implements ActionListener {
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);
} 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
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("");t10.setText(""); c1.setSelectedIndex(0); c2.setSelectedIndex(0); c3.setSelectedIndex(0);c4.setSelectedIndex(0); t10.requestFocus(); } else if(ae.getSource()==b3) { dispose(); MainWin.stfre=null;ManagerWin.stfre=null; ClerkWin.stfre=null;ReceptionWin.stfre=null; } else if(ae.getSource()==b4) remove();
266
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class StaffUpdate 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; ResultSet rst; 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, 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); 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='"+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='" emp_no from staff where
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); } } //==================================
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(); } public static void main(String args[]) { new StaffUpdate(); } } USER :1. User Entry
import java.awt.*;
278
import java.awt.event.*; import javax.swing.*; import java.sql.*; class UserEntry extends JInternalFrame implements ActionListener { 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 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); } } into userid
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; } } public static void main(String s[]) {
284
new UserEntry(); } }
2. User Search
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class UserSearch extends JInternalFrame implements ActionListener { JLabel l1,l2,l3,l4; JTextField t1,t2,t3,t4; JButton b1,b2,b3,b4; JPanel p1,p2; Statement stmt; Connection conn; ResultSet rst; 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); } } //============================================= public void actionPerformed(ActionEvent ae) { if(ae.getSource()==b1) search(); else if(ae.getSource()==b3) { t1.setText(""); t2.setText("");t3.setText(""); t3.requestFocus();
288
} else if(ae.getSource()==b4) { dispose(); MainWin.ursh=null;ManagerWin.ursh=null; ClerkWin.ursh=null;ReceptionWin.ursh=null; } } public static void main(String s[]) { new UserSearch(); } }
3. User Remove
import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.sql.*; class UserRemove extends JInternalFrame implements ActionListener { JLabel l1,l2,l3,l4; JTextField t1,t2,t3,t4; JButton b1,b2,b3,b4; JPanel p1,p2; Statement stmt; Connection conn;
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; } }
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
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() { String name="",u_id="UID ",pass,desig; name=t1.getText(); pass=t2.getText(); u_id+=t3.getText(); desig=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 Update","Update Record",JOptionPane.OK_CANCEL_OPTION);
298
if(result==JOptionPane.OK_OPTION) { rs=stmt.executeUpdate("update "+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); } } //================================================================== ========================= public void actionPerformed(ActionEvent ae) { if(ae.getSource()==b1) search(); else if(ae.getSource()==b3) { t1.setText("");t4.setText(""); t2.setText("");t3.setText("");
299
userid
set
user_id='"+u_id+"',"+"username="+"'"+name+"',"+"password='"+pass+"',"+"desig='
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(); } public static void main(String s[]) { new UserUpdate(); } } 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.*; class EnquiryReport extends JInternalFrame implements ActionListener,Printable { JTable table1,table2; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row; String data1[][],data2[][]; 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
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.*; class CustomerReport extends JInternalFrame implements ActionListener,Printable { JTable table1,table2; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row;
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","In st_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); } public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException {
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; } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==b1) {
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; } } public static void main(String s[]) { new CustomerReport(); } }
3. Payment Report
import java.sql.*; import javax.swing.table.*; import java.util.*; import java.io.*; import javax.print.*; import java.awt.print.*; import javax.swing.border.*; class PaymentReport extends JInternalFrame implements ActionListener,Printable { JTable table; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row; String data[][]; PaymentReport() { b1=new JButton("Print"); b2=new JButton("Close"); b1.addActionListener(this); b2.addActionListener(this); p1=new JPanel();
313
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); } public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException { String cno,inst_amt,date,due,inst_no; int line=1; pindex=1; pg.translate((int)pf.getImageableX(),(int)pf.getImageableY());
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.*; class GuaranterReport extends JInternalFrame implements ActionListener,Printable { JTable table; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row; String data[][]; GuaranterReport() { b1=new JButton("Print"); b2=new JButton("Close");
318
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.*; class ProductReport extends JInternalFrame implements ActionListener,Printable { JTable table; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row; String data[][]; 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); } String head[]={"P_NO","Name","Shop Name","Shop Address","Price","Rate"}; 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("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; } 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.prrpt=null;ManagerWin.prrpt=null; ClerkWin.prrpt=null;ReceptionWin.prrpt=null; }
327
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.*; class BankReport extends JInternalFrame implements ActionListener,Printable { JTable table; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0;
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.*; class StaffReport extends JInternalFrame implements ActionListener,Printable { JTable table1, table2; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row; String data1[][],data2[][]; StaffReport() { b1=new JButton("Print"); b2=new JButton("Close");
333
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); } public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException { String empno,name,desig,sal,comm,hiredate,add,ph,mob,dob,sex,email; 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 staff"); pg.drawString("EMPNO\t\tNAME\t\tDESIGNATION\t\tSALARY\t\tCOMM\t\t HIREDATE\t\tADDRESS\t\tPHONE\t\tMOBILE\t\tDOB\t\tSEX\t\tEMAIL",line++,1); while(rst.next()) {
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; } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==b1) { try{
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; } } public static void main(String s[]) { new StaffReport(); } }
8. User Report
import javax.swing.table.*; import java.util.*; import java.io.*; import javax.print.*; import java.awt.print.*; import javax.swing.border.*; class UserReport extends JInternalFrame implements ActionListener,Printable { JTable table; JButton b1,b2; JPanel p1; Statement stmt; Connection conn; ResultSet rst; int i=0,row; String data[][]; UserReport() { b1=new JButton("Print"); b2=new JButton("Close"); b1.addActionListener(this); b2.addActionListener(this); p1=new JPanel(); p1.setLayout(null);
339
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); } public int print(Graphics pg,PageFormat pf,int pindex) throws PrinterException { String uid,name,pass,desig; 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));
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; } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==b1) { try{ PrinterJob prn=PrinterJob.getPrinterJob(); prn.setPrintable(this); if(!prn.printDialog()) return;
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; } } public static void main(String s[]) { new UserReport(); } } ***** END OF THE CODING PART ******
class BankEntry extends JInternalFrame implements ActionListener { *// for instantiation of objects Connection conn; Statement stmt; ResultSet rst; *// for error handling try { *// for connecting java program with database(Oracle) 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");*// for receiving value from database String name,branch,b_no; b_no="BNO "; b_no+=t1.getText(); name=t2.getText(); branch=t3.getText();; *// Execution of sql query rs=stmt.executeUpdate("insert into bank values('"+b_no+"','"+name+"','"+branch+"')"); JOptionPane.showMessageDialog(this,"One record is saved"); *// for storing and printing errors,if any. catch(Exception e) { System.out.println(e); } } }
344
VALIDATION CHECK
At the culmination of integration testing, software is completely assembled as a package, interfacing error have been uncovered and connected and final series of software test validation check. Validation can be defined in many ways but a simple definition is that validation succeeds when software functions in a manner that can be reasonably expected by the students. At this point a battle hardened software developer might protest. The following phase occurs during the validation:
Software validation is achieved through a series of black box tests that demonstrate conformity with requirements. A test plan outlines the cases of tests to be conducted and test performance defines specific test cases that will be used to demonstrate conformity with requirements.
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. The errors found while testing each unit are: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
1.1 Unit Testing Report: 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. The errors met were because: 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. Following errors occurred while testing the integration of system: a) Integrity constraint violated parent key not found. b) Object required. c) The link was not working. 2.1 Integration Testing Report :-
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.
Errors met with, while testing, were because: a) Invalid values were inserted. b) Wrong forms were linked or form name was not written properly.
c) The form position was not written or not properly linked. with Main Window.
3. System Testing: 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 programmers 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. Some error occurred while testing are: a) Some buttons were not working. b) Link could not be established. 3.1 System Testing Report: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. The error occurred because:a) The buttons were not linked. b) Improper linking was done.
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. The main objectives of testing are listed below:
Testing is a process of executing a program with the intent of finding an error. A good test case is one that has a high probability of finding an as-yet-undiscovered error. A successful test is one that uncovers an as-yet-undiscovered error.
(1) internal program logic is exercised using "white-box" test case design techniques. (2) Software requirements are exercised using "black-box" test case design techniques. In both cases, the intent is to find the maximum number of errors with the minimum amount of effort and time.
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. TEST CASE DESIGN Following Test Cases Were Prepared: Login check Form
S. No. 1.
Test
Case Do Enter user name in the text box specified. User Name must not be more than 10 characters. Enter password in the text box specified. Password must not be greater than 10 characters. Click on ok button.
Expected Result Display administrators Main Window, if the values are found in database. Otherwise redirect to Login screen with appropriate message.
ID TC-001
349
ID TC-002
Result Enter product no in the New product specified textboxes. number created. Product name must not be null and must not be more than 20 characters. Shop name, shop address must not be null Click on ok button.
ID TC-003
Result Change Product Product information in the information specified textboxes. updated. Product no must not be null and must not be more than 10 characters. Product name, address, must not be null Click on ok button.
350
S. No. 1.
Test
Case Do
Expected
ID TC-004
Result Enter product no in the Product specified box information displayed Click on the search Button
ID TC-005
Result Enter Product no to be Product deleted in the specified information box. deleted. Click on the remove button.
S. No. 1.
Test
Case Do
Expected
ID TC-006
Result Enquiry number will be Enquiry form generated autometicaly. submitted successfully name must not be more and appropriate than 20 characters. message should be displayed. Address must not be more than 30 characters. Phone number not more than 15 characters. Mobile number not more than 12 characters Purpose must not be more than 20 characters Click on ok button.
ID TC-007
Result Enter enquiry number in Enquiry the specified box. Information Click on the search Displayed. Button
Expected Result
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. Enter designation in the specified textbox. It must not be empty and must be a 20 characters. Enter Salary in the specified textbox. It must not be empty and must not be more than 8 digit . Enter commission in the specified textbox and must be a 4 digit. Hire date generated by system. Address must not be more than 30 characters. Phone number not more than 15 characters. Mobile number not more than 12 characters Click on ok button.
Result Change the Staff Staff Information in the field information updated. Click on Update Button.
353
ID TC-010
Result Enter employee number Staff in the specified box. Information Displayed. Click on the search Button
ID TC-011
Result Customer no will be Customer auto generated. information successfully customer name, address, entered. product no,bank no must not be null. customer name must not be more than 20 characters. Address must not be more than 30 characters. Phone number not more than 15 characacters. Click on ok button.
Expected
1.
ID TC-012
Result Enter customer no in the customer specified box. Information Displayed. Click on the search Button
Result 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. Address must not be more than 30 characters. Phone number not more than 15 characacters. Profession must not be null, not more than 20 characters. Click on ok button.
355
1.
TC-014
Enter customer no in the Guaranter specified box. Information Displayed. Click on the search Button.
ID TC-015
Result Enter Customer number Payment in the specified box. information successfully Installment date will auto entered. generated. Enter installment amount in the specified text box . Click on the ok button
Bank Entry Form S. No. 1. Test Case ID Do Expected Result Bank Search Form
S. No. 1.
Enter bank number in the Bank information specified text box. successfully TC-016 entered. Bank name must not be Test Case Do Expected more than 20 characters. ID TC-017 Result Branch must be varchar Enter Bank number in Bank not more than 20 the specified box. information characters. Displayed. Click on the search Click on ok button. Button.
356
ID TC-018
Result Enter Bank number in Bank the specified box. information Deleted. Click on the remove button. TEST REPORT
Function
Purpose
Verification of username and password Entry of new product Updating Product information. Searching Product Information Removing Product Information Entry of Enquiry information.
EnquirySearch
Searching Enquiry Information StaffEntry Creation of new Staff. StaffUpdate Updating staff Information. StaffSearch Searching Staff Information CustomerEntry Creation of new Customer CustomerSearch Searching Customer Information. GuaranterEntry Entry of guaranter information. GuaranterSearch Searching Guaranter Information PaymentEntry Pay new installment. BankEntry Entry of new Bank. BankSearch Searching Bank Information BankRemove. Removing Bank Information.
TC-007 TC-008 TC-009 TC-010 TC-011 TC-012 TC-013 TC-014 TC-015 TC-016 TC-017 TC-018
15 15 20 15 20 15 20 10 15 20 10 20
100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100% 100%
358
S No. 1
of Packages Packages Incorrect syntax near ','. Quotation Quotation Unclosed quotation mark was before the character string missing. ')'. Incorrect syntax near ')'. missing ;Unclosed quotation mark parathesis before the character string ')' was added.
parathesis added
Violation
of
PRIMARY Primary key Exception pk_e_no. violation. was catched and redirected to error age. SYSTEM SECURITY MEASURES
KEY constraint
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. To do an adequate job on security, a system analyst must analyze the risk, exposure, and costs and specify measures such as passwords and encryption to provide protection, the backup copies of software and recovery restart procedure must be available when needed.
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.
359
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 TO Provide better security we had developed an automated LOAN PROCESSING
SYSTEM.All information and management forms are stored within the system and access to this sensitive information is controlled through an intricate password system:one has know the USER NAME,PASSWORD to gain access to any information. In the system we had supplied USER NAME=ARVIND OJHA PASSWORD=ARV123 For security measure I hava taken password in the hidden form.and varchar datatype.so that a user can use in this field both integer and alphabets.
360
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 SSS. 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:1.) Enquiry report 2.) Customer report 3.) Payment report 4.) Guarantor report 5.) Product report 6.) Bank report 7.) Staff report 8.) User report with the help of these report we can find all information according to our need.
363
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 cant be ruled out. The software restricts the activity of LOANS PROVIDED BY LOAN PROCESSING SYSTEM FOR SSSs. Its scope would be enhanced a lot. Slight modification of program can affect this software. Authorized person of Different kinds of test can be designed and incorporated into test program. The major limitation of this project is that we can not access online .We can make it
364
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 SSS, 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 SSS, 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 SSS, 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) (c) B.P.das, an introduction to database system ,asian student edition Galolia publication. Ger S.pressman, software engineering concepts. J2ee:the complete reference, McGraw-hill
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.
365
366