Professional Documents
Culture Documents
SYSTEM ANALYSIS
IDENTIFICATION OF NEED:-
.
EXISTING SYSTEM:- In the existing management system in different
organizations
kept its records in flats files and whole system was handled manually .Different
files were used to keep track of the different kind of information like sale
,purchase & billing etc .All processes are handled manually.
3
System Analysis & Design
MANUAL SYSTEM:- The manual system of data entry & report generation was
very slow and susceptible to human errors leading ,to loss of valid time &
memory.
SALES MODULE:- This module will handle all the activities of SALES process.
(1) The new system will developed in RDBMS concept making it compatible
with the user requirement. As a result there will be minimum redundancy
4
System Analysis & Design
of data and large amount of data can be stored in the database without
any storage problem.
(2) The response time information retrieval will reduced to negligible and the
processing time require for retrieving, the desired information from different
table is less.
(3) Reports can be generated quickly for effective decision making and up-to-
date information are available and answers to queries are also provided
instantly.
REQUIREMENT ANALYSIS:-
In the proposed system the techniques used were interviews, record inspection
and observation interviewing techniques can be used to collect the information
from individuals or from groups. The presence of experienced analyst in fact
finding groups are a boon experience from previous studied can help in
investigation of area that would otherwise go unnoticed by an in experienced
analyst. Having the expertise background to know what question to ask or which
aspect of problem to investigation the process of requirement analysis become
fruitful.
PRELIMINARY INVESTIGATION:-
5
System Analysis & Design
The data that the analysts collect during preliminary investigations are gathered
through three primary methods: reviewing organization documents, on-site
observations, conducting interviews.
6
System Analysis & Design
FEASIBILITY STUDY
The concept of feasibility is to determine whether or not a project is worth doing. The
process followed in making this determination is called feasibility study. Once it has been
determined that a project is feasible, the system analyst can go ahead and prepare the
project specification which finalizes project requirements.
Types of feasibility
1. Technical Feasibility
2. Operational Feasibility
3. Economic Feasibility
4. Social Feasibility
5. Management Feasibility
6. Legal Feasibility
7. Time Feasibility
1. TECHNICAL FEASIBILITY
This is concerned with specifying equipment and software that will successfully satisfy
the user requirement. Technical needs of the system include: -
7
System Analysis & Design
2. OPERATIONAL FEASIBILITY
This is mainly related to human organization and political aspects. The points to be
considered are:
This feasibility study is carried out by a small group of people who are familiar with
information system techniques, who understand the parts of business that are relevant to
the project and are skilled in system analysis and design process. This project is not
developed just for fun. They are developed on demand of the organization for which the
system is being developed. Therefore the chances of resistance from the centre staff is
8
System Analysis & Design
almost nil. Any disturbance to the organization if occurs will be advantageous to the
organization. Also the time required carrying out a transaction will be reduced to a large
extent, which will make the staff and others happy and cheerful. The operators now will
be able to service more customers and Staff members than before in the same time
period. There is no need to recruit new staff to operate the system. The existing staff of
the company can be trained to interact with the system, which is a GUI, based software
and is easy to use. Hence the project is operationally feasible.
3. ECONOMIC FEASIBILITY
Economic analysis is the most frequently used technique for evaluating the effectiveness
of a proposed system. More commonly known as cost-benefit analysis; the procedure is
to determine the benefits and savings that are expected from a proposed system and
compare them with costs. If benefits outweigh costs, a decision is taken to design and
implement the system.
Software Interface
Front End- Java
Back End- Ms-Access
Operating System-Windows 95/98/NT/2000
Hardware Interface
Processor --- P3
Memory --- 64 MB RAM
Hard disk -- 10GB
9
System Analysis & Design
PURPOSE OF SRS:-
The purpose of this document is to:
• document the different business process of department ,in detail.
• document the business requirement clearly in a concise and easily
understood manner to business/end user.
• serve as baseline for validation and verification .
• serve as a baseline document for development team.
• serve as a basis for future enhancements.
SCOPE OF SRS:- The document covers the detailed description of the different
process .The details include:
• Description of process.
• Proposed process model.
• Assumptions dependencies and constraints.
10
System Analysis & Design
REALIZATION OF PROBLEM:
The present day organization work can be classified in two forms, one is the
In manual system all work are done manually on paper. Lots of paper work is
been done in order to enter new item’s records. The data which manual
to any form desired by the users. Their design and development takes much
longer than the corresponding activities for the manual systems but their long-
11
System Analysis & Design
records. Hence it was decided that a new system, customized for sale and
purchase of products, should be developed.
35
There is data entry screens, and queries in this system. The system has the
The problem is to maintain various databases, which record relevant and up-
It is very important to ensure that the data entered is correct and hence
provided quickly.
Most important of all is, the time involved in generating reports should be cut
12
System Analysis & Design
Proper data entry modules are developed which make it easier for the user to
enter data and ensure the validity of data. Facility for the updating of
information should be there. All data entry screens should have the same
way. The system would facilitate the Answering of various queries. The
13
System Analysis & Design
Data validations are at the time of data entry, which minimizes the errors. The
impossible to input data, which doesn't follow integrity rules. Data is entered
through various screens available to the user. This data is stored in the
14
System Analysis & Design
SYSTEM DESIGN
System design phase is a transition from user oriented document (system
proposal) to a document oriented to programmers or database personnel. This is
the pivot point in system development life cycle. The design is a solution, a “how
to” approach compared to analysis, a “what is” orientation.
Frequencies etc.
15
System Analysis & Design
This includes determining the flow of the documents from the input data
source to
Procedures and the controls that ensures processing and file integrity.
16
System Analysis & Design
1.) CONTEXT DIAGRAM:- The top level diagram is often called a context
analysis diagram. It consists a single process, but it plays a very important role in
studying the current system. This gives just an overview of the proposed system.
The context analysis diagram defines the environment of the system that will be
studied in the sense that it determines the boundaries between the different
modules. Anything that is not inside the process identified in the context diagram
will not be the part of the system study.
17
System Analysis & Design
ER-Diagram of RMS
itemname
itemcode
price
Master
stockinhand
M
purchasedate
av
H
e
1
RMS
1 1
Item_des
itemcod c
e
M
e
ad
M N_O_I_S
Made
C_Name
Bill_no Sale
1
Tot_price
Date
Unit_pric
itemcode itemname e
M
Unit_price
Purchase
18
System Analysis & Design
qty
Total_price
hiredate
source
GENERAL ANALYSIS DIAGRAM FOR STORE MANAGEMENT
SALE
PURCHASE
User Identity
STORE
DIALY REPORT MANAGE STOCK
MENT
SYSTEM
STOCK IN BILLING
Searching
HAND
DATA FLOW DIAGRAM (DFD):- This is the graphical tool in hands of system
analyst being a pictorial representation of fact regarding the flow of information or
transformation .
A data flow diagram (DFD) shows the flow of data through a system .The system
may be organization a manual procedure, a software system a mechanical
19
System Analysis & Design
system, hardware system ,or any combination of these .A data flow diagrams
shows the movements of data through the different process in the system .
A data flow diagram might represent data flow between individual statement or
blocks of statement in routine .unlike flow charts ,data flow diagram do not
indicates decision logic or condition under which various processing nodes in the
diagrams might be activated.
It provides an overview of major decomposition of the system .The graphical
representation called bubble chart can be expanded to a hierarchy of diagrams
giving more and more detail.
Login
Authentic
Get user user
Name & Check user
password
Invalid
User or
password
Message
For invalid
user
20
System Analysis & Design
REPORT
GENERATIO
N
PROCESS
STOCK PURCHASE
REPORT REPORT
21
System Analysis & Design
DESCRIPTION: This table keeps all the general information of the PURCHASE
itemcode Number
itemname Text
quantity Number
hiredate Date/Time
unit_price Number
total_price Number
source Text
itemcode NUMBER
itemname TEXT
purchasedate Date/Time
stockinhand NUMBER
22
System Analysis & Design
price NUMBER
itemcode NUMBER
ITEM_DESC TEXT
no_of_item_sold NUMBER
date DATE
cust_name TEXT
bill_no NUMBER
unit_price NUMBER
tot_price NUMBER
23
System Analysis & Design
24
System Analysis & Design
25
System Analysis & Design
26
System Analysis & Design
27
System Analysis & Design
28
System Analysis & Design
Purchase Report
29
System Analysis & Design
Sale Report
30
System Analysis & Design
31
System Analysis & Design
32
System Analysis & Design
33
System Analysis & Design
34
System Analysis & Design
Help
35
System Analysis & Design
INTRODUCTION:
First test of the system is to see whether it produce correct output or not. No
other test can be more crucial than this. Some of the tests, which have been
performed, are given below.
VOLUME TESTING:
In this test, we create as many records as would normally be required to verify
the proper functioning of the hardware and the Software. The user is asked to
provide test data for volume testing. In the system, a huge number of records
were being tested and the test output shows that the system can holds an
amount of data required by the firm.
RECOVERY TESTING:
36
System Analysis & Design
A forced system failure is induced to test back-up recovery procedure for the
integrating files. Inaccurate data are entered to see how the system response in
term of error deduction and production, related to files integrity.
UNIT TESTING:
The user tested each data entering test data. Few error and faults that were
found at the time of data entry were removed.
INTEGRATION TESTING:
Integration testing is technique for constructing the program structure while at the
same time conducting the test error associated with it. The objective is to take
unit-tested module and build a program structure that has been dictated by
design.
In this phase the user enters series of test data and tests the entire software
module. As there is some relation between module the user tests the software to
see whether all the relation was satisfied or not.
37
System Analysis & Design
system life cycle is the successful implementation of the new system design into
operation. This involve creating computer compatible flies , training of the staff
who will operate the system and installing before the system is set up for running.
38
System Analysis & Design
In this project work I have tried to develop a new system which monitors all the
STORE activities, provides timely reports to the management to take effective
decisions.
Through the system has been tested with taking dummy data and built according
to proposed structure, it can be used by any type of organization.
Currently two modules PURCHASE & SALES has been tested and implemented.
The database files and their format can be more generalized to include other
activities like training, promotion, appraisals, transfer, etc with addition of forms
and code to make it a full-fledged information system monitoring all the activities
of a STORE.
39
System Analysis & Design
CODING
import java.awt.*;
import java.awt.event.*;
public class dialog11 extends Frame
{
Container f1;
CheckboxGroup b = new CheckboxGroup();
Checkbox r1 = new Checkbox("Sort By Date",b,true);
Checkbox r2 = new Checkbox("Sort By Bill No",b,false);
Checkbox r3 = new Checkbox("Sort By Product Code",b,false);
Checkbox r4 = new Checkbox("Sort By Product Name",b,false);
b1.setBounds(20,150,100,30);
b2.setBounds(120,150,100,30);
r1.setForeground(Color.black);
r2.setForeground(Color.black);
r3.setForeground(Color.black);
r4.setForeground(Color.black);
setBackground(new Color(142,175,251));
b1.setBackground(new Color(245,160,120));
b2.setBackground(new Color(245,160,120));
40
System Analysis & Design
add(b1);
add(b2);
add(r1);
add(r2);
add(r3);
add(r4);
show();
pack();
b1.addActionListener(new ButtonHandler());
b2.addActionListener(new ButtonHandler());
addWindowListener(new WindowEventHandler());
}
class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent ev)
{
String s=ev.getActionCommand();
if(s=="Ok" && r1.getState())
{
OrderDate1_2 d = new OrderDate1_2();
hide();
}
else if(s=="Ok" && r2.getState())
{
OrderDate1_3 m1 = new OrderDate1_3();
hide();
}
else if(s=="Ok" && r3.getState())
{
OrderDate1 o = new OrderDate1();
hide();
}
else if(s=="Ok" && r4.getState())
{
OrderDate1_1 o = new OrderDate1_1();
hide();
}
else hide();
}
}
class WindowEventHandler extends WindowAdapter
41
System Analysis & Design
{
public void windowClosing(WindowEvent e)
{
hide();
}
}
}
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class Mast2 extends JFrame
{
Container f;
Dialog d;
Mast2 mm;
Font fo = new Font("Courier New",1,17);
42
System Analysis & Design
43
System Analysis & Design
bb4.setFont(fo);
b3.setFont(fo);
t1.setFont(fo);
t2.setFont(fo);
t3.setFont(fo);
t4.setFont(fo);
t5.setFont(fo);
t6.setFont(fo);
b3.addActionListener(new ButtonHandler());
bb1.addActionListener(new ButtonHandler());
bb2.addActionListener(new ButtonHandler());
bb3.addActionListener(new ButtonHandler());
bb4.addActionListener(new ButtonHandler());
t1.addFocusListener(new FocusAdapter()
{
public void focusGained(FocusEvent e)
{
setTitle("Master");
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
44
System Analysis & Design
t6.setBounds(220,300,100,30);
b3.setBounds(150,380,120,30);
bb1.setBounds(470,50,115,30);
bb2.setBounds(470,130,115,30);
bb3.setBounds(470,210,115,30);
bb4.setBounds(470,290,115,30);
f.add(l1);
f.add(l2);
f.add(l3);
f.add(l4);
f.add(l5);
f.add(l6);
f.add(t1);
t1.setToolTipText("Enter Product Code");
f.add(t2);
t2.setToolTipText("Enter Product Name ");
f.add(t3);
t3.setToolTipText("Enter Procurement Date(dd/mm/yyyy)");
f.add(t4);
t4.setToolTipText("Enter Stock in Hand ");
f.add(t5);
t5.setToolTipText("Enter Price ");
f.add(t6);
b3.setToolTipText("Click here to cancel data");
f.add(b3);
b3.setToolTipText("Click here to the unload current form");
f.add(bb1);
bb1.setToolTipText("Click here to view the First Record");
f.add(bb2);
bb2.setToolTipText("Click here to view the Last Record");
f.add(bb3);
bb3.setToolTipText("Click here to view the Prev Record");
f.add(bb4);
bb4.setToolTipText("Click here ot view the Next Record");
pack();
addWindowListener(new WindowEventHandler());
rec();
}
/*checks whether item code already exists*/
boolean checkRec(String xx)
{
int x1=0;
try
{
Class.forName(driver);
c=DriverManager.getConnection(url);
45
System Analysis & Design
s1 = c.createStatement();
s1.executeQuery("select * from master where itemcode="+xx);
ResultSet rs1 = s1.getResultSet();
if(rs1!=null)
{
while(rs1.next())
{
if(xx.equals(rs1.getString(1)))
x1=1;
}
}
}
catch(Exception e){System.out.println("--> "+e);}
if(x1==1)
return(true);
else
return(false);
}/*stores the records in array*/
boolean rec()
{
try
{
Class.forName(driver);
c=DriverManager.getConnection(url);
s = c.createStatement();
s.execute("select * from master ORDER BY itemcode");
ResultSet rs = s.getResultSet();
ic = new String[300];
in = new String[300];
pd = new String[300];
sh = new String[300];
pr = new String[300];
tt = new String[300];
while(rs.next())
{
ic[i]=rs.getString(1);
in[i]=rs.getString(2);
String ss = rs.getString(3);
// for Date Column
char arr[]=new char[10];
arr[0]=ss.charAt(8);
arr[1]=ss.charAt(9);
arr[2]=ss.charAt(7);
arr[3]=ss.charAt(5);
46
System Analysis & Design
arr[4]=ss.charAt(6);
arr[5]=ss.charAt(4);
arr[6]=ss.charAt(0);
arr[7]=ss.charAt(1);
arr[8]=ss.charAt(2);
arr[9]=ss.charAt(3);
ss = new String(arr);
pd[i]=ss;
sh[i]=rs.getString(4);
pr[i]=rs.getString(5);
x=i;
i++;
}
}
catch(Exception e){}
return(true);
}/*shows records in textfield & calculates the sale price*/
void showRec(int a)
{
t1.setText(ic[a]);
t2.setText(in[a]);
t3.setText(pd[a]);
t4.setText(sh[a]);
t5.setText(pr[a]);
double f = Double.valueOf(pr[a]).doubleValue();
f=f+(f*.10);
t6.setText(""+f);
}
class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent ev)
{
String s=ev.getActionCommand();
if(s=="Exit")
{
int x = JOptionPane.showConfirmDialog(Mast2.this,"A r e y o u s u r e
y o u w a n t t o E x i t ! "," C o n f i r m a t i o
n",JOptionPane.WARNING_MESSAGE,JOptionPane.YES_NO_OPTION);
if(x==0)
hide() ;
}
if(s.equals("Next"))
{
x++;
if(x>=i)
47
System Analysis & Design
{
x=i-1;
JOptionPane.showMessageDialog(Mast2.this,"I t i s t h e L a s t R e
c o r d . . . ","Data Validation",JOptionPane.WARNING_MESSAGE);
}
showRec(x);
}
if(s.equals("Prev."))
{
x--;
if(x<=0)
{
x=0;
JOptionPane.showMessageDialog(Mast2.this,"I t i s t h e F i r s t R
e c o r d . . . ","Data Validation",JOptionPane.WARNING_MESSAGE);
}
showRec(x);
}
if(s.equals("First"))
{
x=0;
showRec(x);
}
if(s.equals("Last"))
{
x=i-1;
showRec(x);
}
}
}
class WindowEventHandler extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
hide();
}
}
}
48
System Analysis & Design
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
b1.setBounds(200,150,360,50);
b2.setBounds(200,220,360,50);
b3.setBounds(200,290,360,50);
b4.setBounds(200,360,360,50);
b5.setBounds(200,430,360,50);
b1.setFont(fo);
b2.setFont(fo);
b3.setFont(fo);
b4.setFont(fo);
b5.setFont(fo);
add(b1);
49
System Analysis & Design
add(b2);
add(b3);
add(b4);
add(b5);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
}
});
}
void setup()
{ mb = new MenuBar();
m1 = new Menu("File");
m2 = new Menu("Reports");
m3 = new Menu("Help");
i1 = new MenuItem("Master");
i2 = new MenuItem("Procurement");
i3 = new MenuItem("Sale");
i4 = new MenuItem("Exit");
i7 = new MenuItem("Sales Report");
i8 = new MenuItem("About");
i10 = new MenuItem("Purchase Report");
i1.addActionListener(this);
i2.addActionListener(this);
i3.addActionListener(this);
i4.addActionListener(this);
i7.addActionListener(this);
i8.addActionListener(this);
i10.addActionListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
m1.add(i1);
m1.add(i2);
m1.add(i3);
m1.add(i4);
m2.add(i7);
m3.add(i8);
m2.add(i10);
50
System Analysis & Design
mb.add(m1);
mb.add(m2);
mb.add(m3);
setMenuBar(mb);
toolkit = getToolkit();
im = toolkit.getImage("disney2.jpg");
}
public void actionPerformed(ActionEvent e)
{
Object o = e.getSource();
if(o==i1 || o==b1 )
{
Mast2 m= new Mast2();
m.setSize(780,580);
m.show();
}
if(o==i2 || o==b2)
{
Purc p= new Purc();
p.setSize(780,580);
p.show();
}
if(o==i3 || o==b3)
{
Sale s= new Sale();
s.setSize(780,580);
s.show();
}
if(o==i4)
{
setVisible(false);
}
if(o==i7 || o==b5)
{
dialog11 mm= new dialog11();
mm.setBounds(200,150,300,200);
}
if(o==i8)
{
Help m4= new Help();
}
if(o==i10 || o==b4)
{
dialog12 mm1= new dialog12();
mm1.setBounds(200,150,300,200);
51
System Analysis & Design
}
}
public static void main(String aa[])
{
MenuApp a = new MenuApp();
}
}
52
System Analysis & Design
import java.awt.*;
import java.awt.event.*;
class MyDialog1 extends Dialog implements ActionListener
{
Button b,b1;
Label l;
Font f;
int x;
public MyDialog1(Frame ff,String str,String label)
{
super(ff,str,true);
b = new Button("Yes");
b1 = new Button("No");
f = new Font("Times new Roman",1,20);
b.setForeground(Color.black);
b.setBackground(new Color(0,54,108));
b.setFont(f);
b.addActionListener(this);
b1.setForeground(Color.black);
b1.setBackground(new Color(0,54,108));
b1.setFont(f);
b1.addActionListener(this);
l= new Label(" X !. "+label);
l.setFont(new Font("Times New Roman",1,23));
l.setBackground(Color.gray);
l.setForeground(new Color(0,0,64));
l.setBounds(5,30,455,70);
b.setBounds(105,120,85,40);
b1.setBounds(260,120,85,40);
setLayout(null);
setBackground(Color.gray);
add(l);
add(b);
add(b1);
setBounds(150,180,465,200);
setResizable(false);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
Object o = e.getSource();
if(o==b)
{
setVisible(false);
x=1;
53
System Analysis & Design
}
if(o==b1)
{
setVisible(false);
x=0;
}
}
public int retu()
{
return(x);
}import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import java.util.*;
public class OdName extends Frame implements ActionListener
{
MenuBar mb;
Menu m1;
MenuItem i1,i2;
ScrollPane s;
TextPanel t1;
Toolkit tool;
PrintJob pj;
public OdName()
{
super("Report Order by Item Name");
mb = new MenuBar();
m1 = new Menu("File");
i1 = new MenuItem("Exit");
i2 = new MenuItem("Print");
m1.add(i2);
m1.add(i1);
mb.add(m1);
tool=getToolkit();
setMenuBar(mb);
i1.addActionListener(this);
i2.addActionListener(this);
s = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
t1 = new TextPanel();
s.add(t1);
add(s);
setSize(640,450);
setVisible(true);
addWindowListener(new WindowAdapter()
{
54
System Analysis & Design
55
System Analysis & Design
56
System Analysis & Design
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import java.util.*;
public class OdQuan extends Frame implements ActionListener
{
MenuBar mb;
Menu m1;
MenuItem i1,i2;
ScrollPane s;
TextPanel t1;
Toolkit tool;
PrintJob pj;
public OdQuan()
{
super("Report Order by Quantity");
mb = new MenuBar();
m1 = new Menu("File");
i1 = new MenuItem("Exit");
i2 = new MenuItem("Print");
m1.add(i2);
m1.add(i1);
mb.add(m1);
tool=getToolkit();
setMenuBar(mb);
i1.addActionListener(this);
i2.addActionListener(this);
s = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
t1 = new TextPanel();
s.add(t1);
add(s);
setSize(640,450);
setVisible(true);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
}
});
}
57
System Analysis & Design
58
System Analysis & Design
59
System Analysis & Design
import java.util.*;
public class PRepo4 extends Frame implements ActionListener
{
MenuBar mb;
Menu m1;
MenuItem i1,i2;
ScrollPane s;
TextPanel9 t1;
Toolkit tool;
PrintJob pj;
public PRepo4()
{
super("Report Sorted by Item Desc.");
mb = new MenuBar();
m1 = new Menu("File");
i1 = new MenuItem("Exit");
i2 = new MenuItem("Print");
m1.add(i2);
m1.add(i1);
mb.add(m1);
tool=getToolkit();
setMenuBar(mb);
i1.addActionListener(this);
i2.addActionListener(this);
s = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
t1 = new TextPanel9();
s.add(t1);
add(s);
setSize(780,580);
setVisible(true);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
setVisible(false);
}
});
}
public void actionPerformed(ActionEvent e)
{
Object o = e.getSource();
if(o==i1)
setVisible(false);
if(o==i2)
{
60
System Analysis & Design
int x=80,y=80;
try
{
String driver,url;
driver="sun.jdbc.odbc.JdbcOdbcDriver";
url="jdbc:odbc:lib";
Class.forName(driver);
Connection c=DriverManager.getConnection(url);
Statement s = c.createStatement();
s.execute("select
itemname,itemcode,source,quantity,unit_price,total_price,hiredate from purchase
order by itemname");
ResultSet r=s.getResultSet();
ResultSetMetaData rmeta = r.getMetaData();
int numColumns=rmeta.getColumnCount();
g.setFont(new Font("Times new Roman",1,34));
g.setColor(Color.red);
g.drawString("Procurement Status Report by Product Desc .",30,30);
g.drawLine(30,40,730,40);
g.setFont(new Font("Times new Roman",1,14));
// setBackground(Color.pink);
g.setColor(Color.red);
61
System Analysis & Design
g.drawString("S.No.",20,80);
for(int i=1;i<=numColumns;++i)
{
String cap=rmeta.getColumnName(i);
g.drawString(cap,x,y);
if(i==1)
x+=120;
else
x+=100;
}
int xx=1;
g.setColor(Color.black);
while(r.next())
{
x=90;
y+=22;
g.drawString(xx+" . ",25,y);
xx++;
for(int i=1;i<=numColumns;++i)
{
String ss=r.getString(i);
if(i==7)
{
char a[]=new char[10];
a[0]=ss.charAt(8);
a[1]=ss.charAt(9);
a[2]=ss.charAt(7);
a[3]=ss.charAt(5);
a[4]=ss.charAt(6);
a[5]=ss.charAt(4);
a[6]=ss.charAt(0);
a[7]=ss.charAt(1);
a[8]=ss.charAt(2);
a[9]=ss.charAt(3);
ss = new String(a);
}
// System.out.print(ss);
if(i==1)
x=65;
g.drawString(ss,x,y);
if(i==1)x+=150;
else if(i==2)x+=70;
else if(i==3)x+=140;
else if(i==4)x+=105;
else if(i==5)x+=85;
62
System Analysis & Design
else if(i==6)x+=90;
else if(i==7)x+=70;
else x+=110;
}
//System.out.println();
}
}
catch(Exception e){System.out.println("--> "+e);}
}
}
63
System Analysis & Design
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class Purc extends JFrame
{
Container f;
JTextField t1 = new JTextField("0",10);
JTextField t2 = new JTextField(20);
JTextField t3 = new JTextField(20);
JTextField t4 = new JTextField(20);
JTextField t5 = new JTextField(20);
JTextField t6 = new JTextField(20);
JTextField t7 = new JTextField(20);
Font fo = new Font("Courier New",1,17);
JLabel l1 = new JLabel("Prod Code :");
JLabel l2 = new JLabel("Prod Name :");
JLabel l3 = new JLabel("Quantity :");
JLabel l4 = new JLabel("Proc. Date:");
JLabel l5 = new JLabel("Unit Price:");
JLabel l6 = new JLabel("Tot Price :");
JLabel l7 = new JLabel("Source :");
JButton b1 = new JButton("Submit");
JButton b2 = new JButton("Cancel");
JButton b3 = new JButton("Exit");
public static void main(String args[])
{
Purc app = new Purc();
}
public Purc()
{
super("Procurement");
b1.setBackground(new Color(208,208,255));
b2.setBackground(new Color(208,208,255));
b3.setBackground (new Color(208,208,255));
l1.setFont(fo);
l2.setFont(fo);
l3.setFont(fo);
l4.setFont(fo);
l5.setFont(fo);
l6.setFont(fo);
l7.setFont(fo);
b1.setFont(fo);
b2.setFont(fo);
64
System Analysis & Design
b3.setFont(fo);
t1.setFont(fo);
t2.setFont(fo);
t3.setFont(fo);
t4.setFont(fo);
t5.setFont(fo);
t6.setFont(fo);
t7.setFont(fo);
t1.setForeground(Color.magenta);
t2.setForeground(Color.magenta);
t1.addFocusListener(new FocusAdapter()
{
public void focusLost(FocusEvent e)
{
String ss = t1.getText();
checkRec(ss);
}
});
t3.setForeground(Color.magenta);
t4.setForeground(Color.magenta);
t5.setForeground(Color.magenta);
t6.setForeground(Color.magenta);
t7.setForeground(Color.magenta);
b1.addActionListener(new ButtonHandler());
b2.addActionListener(new ButtonHandler());
b3.addActionListener(new ButtonHandler());
t5.addFocusListener(new FocusAdapter()
{
public void focusLost(FocusEvent e)
{
double x = Double.valueOf(t3.getText()).doubleValue();
double y = Double.valueOf(t5.getText()).doubleValue();
t6.setText(""+(x*y));
}
});
f=getContentPane();
f.setBackground(new Color(255,215,255));
f.setLayout(null);
l1.setBounds(60,50,160,30);
l2.setBounds(60,100,160,30);
l3.setBounds(60,150,160,30);
l4.setBounds(60,200,160,30);
l5.setBounds(60,250,160,30);
l6.setBounds(60,300,160,30);
65
System Analysis & Design
l7.setBounds(60,350,160,30);
t1.setBounds(210,50,70,30);
t2.setBounds(210,100,200,30);
t3.setBounds(210,150,100,30);
t4.setBounds(210,200,140,30);
t5.setBounds(210,250,90,30);
t6.setBounds(210,300,100,30);
t7.setBounds(210,350,180,30);
b1.setBounds(50,420,120,30);
b2.setBounds(190,420,105,30);
b3.setBounds(310,420,100,30);
f.add(l1);
f.add(l2);
f.add(l3);
f.add(l4);
f.add(l5);
f.add(l6);
f.add(l7);
f.add(t1);
t1.setToolTipText("Enter Product Code");
f.add(t2);
t2.setToolTipText("Enter Product Name");
f.add(t3);
t3.setToolTipText("Enter Quantity ");
f.add(t4);
t4.setToolTipText("Enter Proc Date(dd/mm/yyyy)");
f.add(t5);
t5.setToolTipText("Enter Unit Price ");
f.add(t6);
t6.setEditable(false);
f.add(t7);
t7.setEditable(true);
t7.setToolTipText("Enter source ");
f.add(b1);
b1.setToolTipText("Click here to submit data");
f.add(b2);
b3.setToolTipText("Click here to cancel data");
f.add(b3);
b3.setToolTipText("Click here to unload the current form");
pack();
addWindowListener(new WindowEventHandler());
}
void accessDB()
{
try
{
66
System Analysis & Design
String driver,url;
driver="sun.jdbc.odbc.JdbcOdbcDriver";
url="jdbc:odbc:lib";
Class.forName(driver);
Connection connection=DriverManager.getConnection(url);
Statement s,s1,s2,s3;
s= connection.createStatement();
String sql;
sql = "INSERT INTO purchase VALUES ("+t1.getText()+",'"+t2.getText()
+"'";
sql+=","+t3.getText()+",'"+t4.getText();
sql+="',"+t5.getText()+","+t6.getText();
sql+=",'"+t7.getText()+"')";
boolean hasResults = s.execute(sql);
s1= connection.createStatement();
s2= connection.createStatement();
s3= connection.createStatement();
67
System Analysis & Design
Class.forName(driver);
Connection c1=DriverManager.getConnection(url);
Statement s3;
s3 = c1.createStatement();
s3.execute("select * from master where itemcode="+xx);
ResultSet rs1 = s3.getResultSet();
if(rs1!=null)
{
while(rs1.next())
{
if(xx.equals(rs1.getString(1)))
{
x1=1;
t2.setText(rs1.getString(2));
}
}
}
}
catch(Exception e){System.out.println("--> "+e);}
if(x1==1)
return(true);
else
return(false);
}
68
System Analysis & Design
t5.setText("");
t6.setText("");
t7.setText("");
}
else if(x==1)
{
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
t7.setText("");
}
}
else
{
accessDB();
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
t7.setText("");
}
}
if(s=="Exit")
{
int x = JOptionPane.showConfirmDialog(Purc.this,"A r e y o u s u r e y
o u w a n t t o E x i t ! "," C o n f i r m a t i o
n",JOptionPane.WARNING_MESSAGE,JOptionPane.YES_NO_OPTION);
if(x==0)
hide() ;
}
if(s=="Cancel")
{
t1.setText(" ");
t2.setText(" ");
t3.setText(" ");
t4.setText(" ");
t5.setText(" ");
t6.setText(" ");
t7.setText(" ");
69
System Analysis & Design
}
}
}
class WindowEventHandler extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
hide();
}
}
}
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
public class Sale extends JFrame
{
int index;
Container f;
int i,x;
String driver,url;
Connection c;
Statement s,s1;
String rr1[],rr2[],rr3[],rr4[],rr5[],rr6[],rr7[],rr8[];
boolean flag = false;
boolean flag1 = false;
String data[];
JList t1;
Font fo = new Font("Courier New",1,17);
70
System Analysis & Design
bb1.setFont(fo);
bb2.setFont(fo);
bb3.setFont(fo);
bb4.setFont(fo);
b1.setFont(fo);
b2.setFont(fo);
b3.setFont(fo);
t2.setFont(fo);
t3.setFont(fo);
t4.setFont(fo);
t5.setFont(fo);
t6.setFont(fo);
t7.setFont(fo);
t8.setFont(fo);
71
System Analysis & Design
b1.setBackground(new Color(215,254,171));
b2.setBackground(new Color(215,254,171));
b3.setBackground(new Color(215,254,171));
b1.setForeground(Color.black);
b2.setForeground(Color.black);
b3.setForeground(Color.black);
t1 = new JList(data);
t1.setFont(fo);
t1.setForeground(new Color(0,48,96));
t2.setForeground(new Color(0,48,96));
t3.setForeground(new Color(0,48,96));
t4.setForeground(new Color(0,48,96));
t5.setForeground(new Color(0,48,96));
t6.setForeground(new Color(0,48,96));
t7.setForeground(new Color(0,48,96));
t8.setForeground(new Color(0,48,96));
bb1.setBackground(new Color(215,254,171));
bb2.setBackground(new Color(215,254,171));
bb3.setBackground(new Color(215,254,171));
bb4.setBackground(new Color(215,254,171));
b1.addActionListener(new ButtonHandler());
b2.addActionListener(new ButtonHandler());
b3.addActionListener(new ButtonHandler());
bb1.addActionListener(new ButtonHandler());
bb2.addActionListener(new ButtonHandler());
bb3.addActionListener(new ButtonHandler());
bb4.addActionListener(new ButtonHandler());
checkRec3();
t1=new JList(data);
t1.addFocusListener(new FocusAdapter()
{
public void focusLost(FocusEvent e)
{
String ss=(String)t1.getSelectedValue();
checkRec4(ss);
rec();
}
});
t2.addFocusListener(new FocusAdapter()
{/*for quantity sold*/
public void focusLost(FocusEvent e1)
{
72
System Analysis & Design
int cc=0;
String y1 = t2.getText();
for(int i=0;i<y1.length();i++)
{
int c = (int)y1.charAt(i);
if(c<48 || c>=57)
cc=1;
}
if(cc==1)
{
JOptionPane.showMessageDialog(Sale.this,"Please Enter Only 0 to 9
Number ....","Data Validation",JOptionPane.WARNING_MESSAGE);
}
else
{
String ss=(String)t1.getSelectedValue();
checkRec2(ss);
// System.out.println(ss);
}
}
});
JScrollPane sc=new JScrollPane(t1);
f=getContentPane();
f.setLayout(null);
f.setBackground(new Color(217,236,255));
l1.setBounds(100,50,160,30);
l2.setBounds(100,100,160,30);
l3.setBounds(100,150,160,30);
l4.setBounds(100,200,160,30);
l5.setBounds(100,250,160,30);
l6.setBounds(100,300,160,30);
l7.setBounds(100,350,160,30);
l8.setBounds(100,400,160,30);
sc.setBounds(235,50,80,25);
t8.setBounds(235,100,200,30);
t2.setBounds(235,150,100,30);
t3.setBounds(235,200,140,30);
t4.setBounds(235,250,200,30);
t5.setBounds(235,300,100,30);
t6.setBounds(235,350,100,30);
t7.setBounds(235,400,120,30);
b1.setBounds(50,460,100,30);
b2.setBounds(170,460,100,30);
73
System Analysis & Design
b3.setBounds(290,460,100,30);
bb1.setBounds(530,120,120,35);
bb2.setBounds(530,190,120,35);
bb3.setBounds(530,260,120,35);
bb4.setBounds(530,330,120,35);
f.add(l1);
f.add(l2);
f.add(l3);
f.add(l4);
f.add(l5);
f.add(l6);
f.add(l7);
f.add(l8);
f.add(sc);
t1.setToolTipText("Product Code");
f.add(t2);
t2.setToolTipText("Enter Product sold");
f.add(t3);
t3.setToolTipText("Enter Date");
f.add(t4);
t4.setToolTipText("Enter Customer name");
f.add(t5);
t5.setToolTipText("Bill no");
t5.setEditable(false);
f.add(t6);
t6.setToolTipText("Unit price");
f.add(t7);
t7.setToolTipText("Total price");
f.add(t8);
t8.setEditable(false);
t8.setToolTipText("Product Name");
f.add(b1);
b1.setToolTipText("Click here to submit data");
f.add(b2);
b3.setToolTipText("Click here to cancel data");
f.add(b3);
b3.setToolTipText("Click here to unload the current form");
f.add(bb1);
bb1.setToolTipText("Click here to view the First Record");
f.add(bb2);
bb2.setToolTipText("Click here to view the Last Record");
f.add(bb3);
bb3.setToolTipText("Click here to view the Prev Record");
f.add(bb4);
74
System Analysis & Design
75
System Analysis & Design
if(r!=null)
{
ResultSetMetaData rmeta = r.getMetaData();
int counts=rmeta.getColumnCount();
data = new String[200];
int oo=0;
while(r.next())
{
data[oo]=r.getString(1);
// System.out.println(data[oo]);
oo++;
}
t1=new JList(data);
t1.setVisibleRowCount(2);
}
}
catch(Exception e){System.out.println("--> "+e);}
}/*for getting tot price & sale price*/
void checkRec2(String xx)
{
try
{
Class.forName(driver);
c=DriverManager.getConnection(url);
s1 = c.createStatement();
s1.execute("select * from master");
ResultSet rs = s1.getResultSet();
if(rs!=null)
{
while(rs.next())
{
if(rs.getString(1).equals(xx))
{
double ff = Double.valueOf(rs.getString(5)).doubleValue();
ff=ff*.10+ff;
t6.setText(""+ff);
float tot = Float.valueOf(t2.getText()).floatValue();
t7.setText(""+tot*ff);
}
}
}
}
catch(Exception e){System.out.println("--> "+e);}
java.util.Date date = new java.util.Date();
t3.setText(date.getDate()+"/"+(date.getMonth()+1)+"/2008");
76
System Analysis & Design
Class.forName(driver);
c=DriverManager.getConnection(url);
s1 = c.createStatement();
s1.execute("select Itemname from master where itemcode="+xx);
ResultSet rs = s1.getResultSet();
if(rs!=null)
{
while(rs.next())
{
t8.setText(rs.getString(1));
}
}
}
catch(Exception e){System.out.println("--> "+e);}
}/*for putting limitations on sold quantity*/
boolean checkRec1(String xx)
{
int x=0;
try
{
Class.forName(driver);
c=DriverManager.getConnection(url);
s1 = c.createStatement();
s1.execute("select stockinhand from master where itemcode="+xx);
ResultSet rs = s1.getResultSet();
if(rs!=null)
{
while(rs.next())
{
int sc=Integer.parseInt(rs.getString(1));
if(sc<=10)
{
x=1;
}
if(sc<=Integer.parseInt(t2.getText()))
77
System Analysis & Design
flag1=true;
else
flag1=false;
}
}
}
catch(Exception e){System.out.println("--> "+e);}
if(x==1)
return(true);
else
return(false);
}/*to put records in array & getting the bill no.*/
boolean rec()
{
i=0;
x=0;
index=1;
try
{
driver="sun.jdbc.odbc.JdbcOdbcDriver";
url="jdbc:odbc:lib";
Class.forName(driver);
c=DriverManager.getConnection(url);
s = c.createStatement();
s.execute("select * from sale ORDER BY bill_No");
ResultSet rs = s.getResultSet();
rr1 = new String[300];
rr2 = new String[300];
rr3 = new String[300];
rr4 = new String[300];
rr5 = new String[300];
rr6 = new String[300];
rr7 = new String[300];
rr8 = new String[300];
while(rs.next())
{
index++;
rr1[i]=rs.getString(1);
rr2[i]=rs.getString(2);
rr3[i]=rs.getString(3);
// for Date Column
String ss = rs.getString(4);
char arr[]=new char[10];
arr[0]=ss.charAt(8);
arr[1]=ss.charAt(9);
78
System Analysis & Design
arr[2]='/';
arr[3]=ss.charAt(5);
arr[4]=ss.charAt(6);
arr[5]='/';
arr[6]=ss.charAt(0);
arr[7]=ss.charAt(1);
arr[8]=ss.charAt(2);
arr[9]=ss.charAt(3);
ss = new String(arr);
rr4[i]=ss;
rr5[i]=rs.getString(5);
rr6[i]=rs.getString(6);
rr7[i]=rs.getString(7);
rr8[i]=rs.getString(8);
x=i;
i++;
}
}
catch(Exception e){System.out.println(" --> "+e);}
t5.setText(""+index);
return(true);
}/*to show records in the textfields*/
void showRec(int a)
{
t1.setSelectedValue(rr1[a],true);
t2.setText(rr3[a]);
t3.setText(rr4[a]);
t4.setText(rr5[a]);
t5.setText(rr6[a]);
t6.setText(rr7[a]);
t7.setText(rr8[a]);
t8.setText(rr2[a]);
}
class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent ev)
{
String s=ev.getActionCommand();
if(s=="Submit")
{
String ss = (String)t1.getSelectedValue();
boolean fla1 = checkRec1(ss);
if(fla1)
{
79
System Analysis & Design
}
}
if(s=="Exit")
{
int x = JOptionPane.showConfirmDialog(Sale.this,"A r e y o u s u r e y
o u w a n t t o E x i t ! "," C o n f i r m a t i o
n",JOptionPane.WARNING_MESSAGE,JOptionPane.YES_NO_OPTION);
if(x==0)
hide() ;
}
if(s=="Cancel")
{
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
t7.setText("");
t8.setText("");
}
if(s.equals("Next"))
{
x++;
80
System Analysis & Design
if(x>=i)
{
x=i-1;
JOptionPane.showMessageDialog(Sale.this,"I t i s t h e L a s t R e c
o r d . . . ","Data Validation",JOptionPane.WARNING_MESSAGE);
}
showRec(x);
}
if(s.equals("Prev."))
{
x--;
if(x<=0)
{
x=0;
JOptionPane.showMessageDialog(Sale.this,"I t i s t h e F i r s t R e
c o r d . . . ","Data Validation",JOptionPane.WARNING_MESSAGE);
}
showRec(x);
}
if(s.equals("First"))
{
x=0;
showRec(x);
}
if(s.equals("Last"))
{
x=i-1;
showRec(x);
}
}
}
class WindowEventHandler extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
setVisible(true);
}
}
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Welc extends Frame implements ActionListener
{
81
System Analysis & Design
Toolkit t;
Image im;
Label l1,l2,l3,l4,l5;
TextField t1,t2;
Font f;
Button b1,b2;
Welc()
{
super("WELCOME TO RETAIL MANAGEMENT SYSTEM");
l1=new Label("Login ID ");
l2=new Label("Password.");
l3=new Label("Developed by : Juhi Parmar, Prachi Saraswat and
Abhishek Jagga");
l4=new Label("MCA IV Semester");
l5=new Label("IMs, Ghaziabad");
t1 = new TextField(20);
t2 = new TextField(20);
b1 = new Button("Enter");
b2 = new Button("Cancel");
t2.setEchoChar('*');
f = new Font("Courier New",1,18);
l1.setForeground(Color.red);
l2.setForeground(Color.red);
l3.setForeground(Color.black);
l4.setForeground(Color.black);
l5.setForeground(Color.black);
t1.setForeground(Color.black);
t2.setForeground(Color.black);
b1.setForeground(Color.red);
b2.setForeground(Color.red);
t1.setBackground(Color.white);
t2.setBackground(Color.white);
b1.setBackground(new Color(192,192,192));
b2.setBackground(new Color(192,192,192));
setBackground(new Color(255,190,125));
//setBackground(Color.pink);
l1.setFont(f);
l2.setFont(f);
t1.setFont(f);
t2.setFont(f);
b1.setFont(f);
b2.setFont(f);
l3.setFont(f);
l4.setFont(f);
l5.setFont(f);
b1.addActionListener(this);
82
System Analysis & Design
b2.addActionListener(this);
l1.setBounds(220,270,80,30);
l2.setBounds(220,330,100,30);
l3.setBounds(50,450,800,30);
l4.setBounds(310,490,400,30);
l5.setBounds(160,520,700,30);
t1.setBounds(350,270,200,30);
t2.setBounds(350,330,150,30);
b1.setBounds(270,390,100,30);
b2.setBounds(390,390,100,30);
setLayout(null);
add(l1);
add(l2);
add(l3);
add(l4);
add(t1);
add(t2);
add(b1);
add(b2);
add(l5);
t = getToolkit();
im = t.getImage("visacard.jpg");
setSize(800,600);
setVisible(true);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e)
{
Object o = e.getSource();
if(o==b1)
{
String ss=t2.getText();
String login=t1.getText();
if(!login.equalsIgnoreCase("amit"))
{
JOptionPane.showMessageDialog(Welc.this,"I n v a l i d L o g i n . . .
C l i c k O K "," A c c e s s D e n i e d ",JOptionPane.WARNING_MESSAGE);
}
else if(!ss.equalsIgnoreCase("babu"))
{
83
System Analysis & Design
JOptionPane.showMessageDialog(Welc.this,"I n v a l i d P a s s w o
r d . . . C l i c k O K "," A c c e s s D e n i e d
",JOptionPane.WARNING_MESSAGE);
}
if((ss.equalsIgnoreCase("babu"))&&(login.equalsIgnoreCase("amit")))
{
MenuApp aa = new MenuApp();
aa.setSize(780,570);
aa.setVisible(true);
hide();
}
}
else if(o==b2)
{
int x = JOptionPane.showConfirmDialog(Welc.this,"A r e y o u s u r e
y o u w a n t t o E x i t ! "," C o n f i r m a t i o
n",JOptionPane.WARNING_MESSAGE,JOptionPane.YES_NO_OPTION);
if(x==0)
{
hide() ;
System.exit(0);
}
}
}
public void paint(Graphics g)// = getGraphics();
{
g.drawImage(im,180,110,500,100,this);
}
public static void main(String aa[])
{
Welc w = new Welc();
}
84
System Analysis & Design
REFERENCES
1. Java
BalaGru Swamy
BPB Publications.
85