Anda di halaman 1dari 74

DOABA INSTITUTE OF

ENGINEERING & TECHNOLOGY

Project Report on :-

STOCK MANAGEMENT SYSTEM

Submitted by:

TARUN CHOPRA

Under the Guidance


of
Mr. PAWAN MAHI

ACKNOWLEDGEMENT
I take this opportunity to express my profound sense of gratitude &
respect to all those who helped me throughout the duration of this project.
An understanding of the study like this is never the outcome of the
efforts of a single person; rather it bears the imprints of a no. of persons who directly
or indirectly helped me in completing the present study. I would be failing in my duty
if dont say a word of thanks to all those whose sincere advice made my training period
a real educative & pleasurable one.
I have immense pleasure in teacher Mr. PAWAN MAHI for his
unending support & to encourage in preparing this project.

PREFACE
It has been a tremendous learning process, developing the project
documentation on the topic STOCK MANAGEMENT SYSTEM.
While making this project, I learnt a lot about the software & its
intricacies, which helped me in designing & producing an automated version of the
traditional registration, admission, and fee collection. In the process of developing the
project, I have applied all the learnt facts about JAVA.
During the development of the project, I have put in best of my efforts
in developing this system.
The STOCK MANAGEMENT SYSTEM has been developed in
JAVA. It is easy to understand with little knowledge about working on the computer.
This software can be used more efficiently if the user has experience in handling the
operations related to the project in manual way too.

CONTENT
1.

Introduction

2.

Organization Overview

3.

Profile of the Problem

4.

Existing System
Introduction
Existing System
System Analysis
Limitations
Data Collection

5.

Problem Analysis

Product Definition

Feasibility Analysis

Project Plan

Advantages of the Software

6.

ER Diagram

7.

Requirement Analysis
Software Requirement
Hardware Requirement

8. Introduction to Project
General Description
9.

Design

10.

Coding

11.

Benefits of proposed System

INTRODUCTION
Software has become a key element in the evolution of computer based systems &
product. Software can basically be defined as:
1.

Instructions that when executed provide the desired function & performance.

2.

Data structures that enable the programs to adequately manipulate


information.

3.

Documents that describes the operation & use of programs.

Softwares impact on our society & culture continues to be profound. Hence, a


technology has to be developed that makes it easier, faster & less expensive.
The software development not only involves developing the software systems but also
documentation supporting the software.
It is essential that the software that is delivered to the user to be user-friendly &
graphically explicit software.
This software attempts to create a paperless office. This would enhance the efficiency
& productivity of the staff & also reduces the man-hours put in.

ORGANIZATION OVERVIEW
In earlier time, when sales and purchase takes place between customer and retailer, the
record of sales and purchase of items are kept on the paper. It is difficult to keep the
monstrous amount of data on paper, so we need an application which helps us to keep
the huge amount of data of sales and purchases between customer and retailer.

This type of application will make us able to keep the records of sales and purchase in
a safe way. It is easy to maintain the records for retailer in a computer system using
this application.

This application is easy to use and a retailer can easily interact with it to meet his/her
goals. Data on papers cannot be kept for a large time or it can lost accidently. Here
comes the need of STOCK MANAGEMENT SYSTEM.

It is an applilcation which help us to keep the records securely in a computer system


and it will be easy for a retailer to interact with this application.

STOCK MANAGEMENT SYSTEM help us to keep the record of Billing, Purchase


and it also supports Account Management.

PROFILE OF THE PROBLEM


STATEMENT ABOUT THE PROBLEM
An automated system where all details would be stored & updated from time to time
can help in locating required information & delivering it as & when required.
Moreover, any leftovers, dues can also be generated quickly. This would be made
possible by keeping all the units of the proposed system integrated.

EXISTING SYSTEM
It has been observed that a firm maintains details of items or stocks, right from the
time of purchase, till selling. This creates a huge database of all items. At any time, if
any query regarding any item is to be answered, then the database, in the form of files,
is to be accessed & relevant information is to be retrieved.
The above topic is chosen to automate such processes so that queries can be
handled & the relevant information can be retrieved in time.

Introduction
The payment of bill between customer and shopkeeper or between shopkeeper and
wholesaler may lead to some errors when we handle them manually as there are
different rates of different items having different quantities so this existing system
prevent that errors which lead issues.

Existing software
The currently existing software is concern more on Account Management rather than
Stock Management.

System Analysis & Design


Before looking for an automated solution to the existing system, an exhaustive analysis
is must to identify the troubles & anomalies of the current system. The present system
is studied in a detail, where data is collected from all reliable resources & then an
outline is designed to overcome & remove all problems in the proposed system.

Limitations
1.

Keeping of records of sales and purchase on papers was time


consuming and was difficult to store it for long time

2.

Any enquiry regarding a customers bill is very slow as the process is


done manually and it involves a lot of paper work.

3.

Sometimes a small error in doing entries for the entries of bill and bill
particulars that cause to major problems in managing the data.

4.

The calculator (an additional instrument) was required to sum of the


amount of items and to calculate the balance amount on paid of amount by
customer. It limits the earlier way.

5.

It needs a lot of care to handle the huge number of files and it needs a
lot of storage space.

6.

It takes a lot of time to generate reports that to have a question of 100%


accuracy in one time.

7.

There is no security of the data as any one can view files.

8.

More manpower is needed to handle the system in case of manual


system, which can be avoided with help of the customer system.

So, to overcome all these limitations an automated system is being proposed.

Data Collection
The following can serve to be the sources of information:
1.

The stores administrative staff.

2.

The management of bills.

3.

The old bills or the history of bills.

PROBLEM ANALYSIS
It becomes difficult to managing the records of sales and purchases and handling of
bills in a firm as number of sales and purchases increases. So we cannot hold the
record of data for more time. As well, there is not any type of security of records and
anyone can access that information. To overcome this problem and obtain the secured
system, we need an application which helps us to manage the sales and purchases
between customer and a shopkeeper, or between a shopkeeper and wholesaler.
We also need additional instrument such as calculator to perform some operations like
addition, subtraction etc. When we keep record of large amount of bills , then we
generally have large amount of paper work as well as there is not any guarantee of
keeping the bill for large time.
To solve this problem, we develop an application named "EarnLite" which enables us
to managing the stock. It is also called Stock Management System. It performs various
tasks such as Billing, Account Management, Stock Management and Purchase. It also
perform the task of Invoicing. By having this application we did not need an additional
instrument for performing addition, subtraction and other operations while issuing the
bills. Because this application is used on a computer system , we built many functions
in it which can automatically perform operations like addition, subtraction
automatically.

Hence we did not need any additional instrument to perform the operations such as
calculating the remaining balance after the payment being paid by customer and to add
the amount of every item to calculate the whole amount of bill.

Product Definition
On encountering the problems, the proposed system is recommended, to be prepared &
made functional in the institute. It is introduced in the organization; it will help to
make the functioning smoother & orderly.

Feasibility Analysis
The proposed project is simply an automation of the various process associated with a
customer, shopkeeper and wholesaler. It includes the major tasks starting from issuing
bills to customers by shopkeeper and issuing of bill by wholesaler to shopkeeper.. All
these tasks are interrelated & when done manually, an error may exist, affecting the
integrity.
The automated system removes all discrepancies & updates the data in all databases so
that interdependence doesnt give fatal errors.

Also, procedures are developed for all the modules where data is collected, processed
upon & delivered to the end user in desired format. The data is first entered through
forms & screens & gets stored in the database. The data gets retrieved when any query
or dealing has to be done & then generates reports relevant to any module.

Project Plan
Benefits can be enumerated as:

Automating the issuing of bill of sales and purchases between customers


and shopkeepers and wholesalers. Keeping the records of old bills and record
of balance payment.

The whole system of printing of bills that is invoicing. It also contain


information about items present in stock.

Advantages Of The Software


1)

Accuracy:

The s/w will provide an accurate interface for the retailers to keep the records of sales
and purchases between customers and shopkeepers and wholesalers. It decreases the
possibility of errors while issuing or managing the bills. Bills will be issued and
conducted electrically so there is very minimum chance of error.
2)

Analysis:

The present manual system does not allow for Account Management. Account
Management feature of this software is still under progress.
3)

Speed:

The speed of issuing of bill and processing the old bills or records of sales and
purchases is extremely fast.
4)

Presentation:

The input/output specification of the s/w will allow better and next presentation of the
reports.

5)

Processing of data:

The s/w will provide faster and accurate data processing capabilities.

6)

Storage:

The large number of bulky registers presently being used by JLJ ACT will be replaced
by compact and fewer Pcs.
7)

Retrieval:

The retrieval of data related to a particular student of faculty member will be made fast
and easy.

ENTITY RELATIONSHIP DIAGRAM

REQUIREMENTS ANALYSIS

SOFTWARE REQUIREMENTS
PLATFORM (OS)

WIN-2000 /XP / 7

FRONTEND

JDK1.6

BACKEND

SQL Server 2005 or 2008

APPLICATION SYSTEM

STOCK MANAGEMENT SYSTEM

HARDWARE REQUIREMENTS
MICROPROCESSOR

500 MHz

RAM

128 MB, 64 KB Cache

Min. Storage Requirement

1 GB

Server

1 (For maintaining database)

INTRODUCTION TO PROJECT

The project contributes in a large way by serving following purposes:

It reduces the dependency on paper work, thereby making the retrievals


of queries easier.

It allows the addition, modifications & deletions of data very logical &
efficient. All data and manipulation is real time & allows no redundancies.

GENERAL DESCRIPTION
The project needs the following resources at various steps:

Manual paper work & documented records of all modules of the

software generation like administration. Basically, it needs to know the format in


which records are customized & maintained in institute. The reason being, that the
software should be feasible on all fronts of current & old years.

The human resources who actually perform the work manually.

DESIGN

SCREEN 1:

SCREEN 2:

SCREEN 3:

SCREEN 4:

SCREEN 5:

SCREEN 6:

SCREEN 7:

SCREEN 8:

SCREEN 10:

SCREEN 11:

SCREEN 12:

SCREEN 13:

SCREEN 14:

SCREEN 15:

SCREEN 16:

SCREEN 17:

SCREEN 18:

SCREEN 19:

SCREEN 20:

SCREEN 21:

SCREEN 22:

SCREEN 23:

SCREEN 24:

SCREEN 25:

SCREEN 26:

SCREEN 27:

SCREEN 28:

SCREEN 29:

SCREEN 30:

CODING

Login Form:package project;


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.*;
public class login
{
public JFrame f1;
public JLabel login;
public JTextField txtlogin;
public JLabel password;
public JPasswordField txtpassword;
public JButton b1;
public JButton b2;
public JSeparator sep;
int bno=1;
int b=0;
public login()
{
f1=new JFrame("Login form");
login=new JLabel("Login Id:");
txtlogin=new JTextField(20);
password=new JLabel("Password");
txtpassword=new JPasswordField(20);
b1=new JButton("Login");
b2=new JButton("Cancel");
sep=new JSeparator();
login.setBounds(30,50,100,20);
txtlogin.setBounds(150,50,250,20);
password.setBounds(30,75,100,20);
txtpassword.setBounds(150,75,250,20);
b1.setBounds(150,130,100,20);
b2.setBounds(300,130,100,20);
}
public void lonchFrame()

{
f1.setSize(450, 200);
f1.setResizable(true);
f1.setLayout(null);
f1.setResizable(false);
f1.add(sep);
f1.add(login);
f1.add(txtlogin);
f1.add(password);
f1.add(txtpassword);
txtpassword.addKeyListener(new key());
f1.add(b1);
b1.addActionListener(new action());
f1.add(b2);
b2.addActionListener(new cancel());
f1.setLocation(450, 250);
f1.setVisible(true);
f1.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
try
{
String str="SELECT top 1 [sno] FROM ulog order by [sno] desc";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(str);
while(rs.next())
{
b=rs.getInt(1);
}
bno=b+1;
// System.out.println(bno);
}
catch(Exception ex2)
{
System.out.println("error 2: "+ex2);
}
}

class action implements ActionListener

{
@Override
public void actionPerformed(ActionEvent e)
{
try
{
String str="select * from users where
username='"+txtlogin.getText().toString()+"' AND
password='"+txtpassword.getText().toString()+"'";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery(str);
String id;
String pass;
while(rs.next())
{
id=rs.getString(1);
pass=rs.getString(2);
CurrentDate c=new CurrentDate();
Time t=new Time();
if((id.equals(txtlogin.getText()))&&(pass.equals(txtpassword.getText())))
{
String str2="insert ulog (sno,login_time,[user],status) Values
('"+bno+"','"+c.date()+" "+t.ctime()+"','"+txtlogin.getText().toString()+"','active')";
Statement stmt2=con.createStatement();
stmt2.executeUpdate(str2);
con.close();
mainf mf=new mainf();
f1.dispose();
}
else
{
JOptionPane.showMessageDialog(f1, "Wrong Username or
Password");
}
}
}
catch(Exception ex)
{
System.out.println(ex);
}

}
}
class cancel implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
f1.dispose();
}
}

//
//
//

//public static void main(String arg [])


//{
login d=new login();
d.lonchFrame();
}
class key implements KeyListener
{
public void keyTyped(KeyEvent e)
{
if(e.getKeyChar()=='\n')
{
action a=new action();
a.actionPerformed(null);
}
}
public void keyPressed(KeyEvent e)
{
}
public void keyReleased(KeyEvent e)
{
}
}

Main Page Form:package project;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
public class mainf
{
public static void main(String args[])
{
mainf obj=new mainf();
}
JFrame frame;
public mainf()
{
frame=new JFrame("EarnLite");
JPanel panel=new JPanel();
panel.setLayout(null);
panel.setBounds(10,10,500,400);
JButton b=new JButton("BILLING");
JButton s=new JButton("STOCK MANAGEMENT");
JButton a=new JButton("ACCOUNT MANAGEMENT");
JButton p=new JButton("PURCHASE");
JButton l=new JButton("LOG OUT");
b.setBounds(125,100,200,200);
s.setBounds(350,100,200,200);
a.setBounds(125,325,200,200);
p.setBounds(350,325,200,200);
l.setBounds(550,525,100,100);
l.addActionListener(new laction());
panel.add(l);
panel.add(b);
b.addActionListener(new action());
panel.add(s);
s.addActionListener(new action2());
panel.add(a);
a.addActionListener(new action3());
panel.add(p);
p.addActionListener(new action4());
frame.add(panel);

frame.setSize(710,700);
frame.setVisible(true);
frame.setLocation(300, 10);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class action implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
newbill n=new newbill();
}
}
class action2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
stockmanagement stock=new stockmanagement();
}
}
class action3 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
accmanagement account=new accmanagement();
}
}
class action4 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
purchase pur=new purchase();
}
}
class laction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
CurrentDate c=new CurrentDate();
Time t=new Time();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:java");


String str2="UPDATE [earnlite_db].[dbo].[ulog] SET [status] = 'inactive',
[logout_time] = '"+c.date() + " " + t.ctime() + "' WHERE status='active'";
Statement stmt = con.createStatement();
stmt.executeUpdate(str2);
con.close();
frame.dispose();
}
catch (Exception ex)
{
Logger.getLogger(mainf.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}

Billing Form:package project;

import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.*;
import javax.swing.table.*;
public class billing
{
JComboBox combo;
JTextField ctxt;
JFrame bframe;
JTextField quantity;
JTextField btxt;
JTextField ptxt;
static int bno;
static int b;
static int cnt=1;
PreparedStatement ps;
Connection con;
ResultSet rs;
Statement st;
JLabel l1;
String particulars;
int sno1,quantity1;
float ppu,amount;
int rows = 0;
Object data1[][];
JScrollPane scroller;
JTable table;
public billing()
{
bno=1;
// int b = 0;
b=b+1;
bno=bno+1;

CurrentDate d=new CurrentDate();

bframe = new JFrame("BILLING");


JPanel upanel = new JPanel();
JPanel mpanel = new JPanel();
JPanel lpanel = new JPanel();
JLabel blabel = new JLabel("Bill No. "+b+"");
JLabel slabel = new JLabel("Seven Eleven Store");
JLabel dlabel = new JLabel(d.date());
btxt = new JTextField(100);
quantity = new JTextField(10);
upanel.setLayout(null);
mpanel.setLayout(null);
lpanel.setLayout(null);
bframe.setSize(900, 700);
bframe.setLocationRelativeTo(null);
upanel.setBounds(1, 1, 800, 225);
blabel.setBounds(50, 30, 125, 125);
slabel.setBounds(325, 30, 400, 125);
dlabel.setBounds(675, 30, 175, 125);
upanel.add(slabel);
upanel.add(blabel);
upanel.add(dlabel);
bframe.add(upanel);
btxt.setBounds(50, 125, 730, 30);
quantity.setBounds(50, 180, 150, 30);
upanel.add(quantity);
upanel.add(btxt);
String[] str = {"Pcs", "Kg", "g", "l", "ml"};
combo = new JComboBox(str);
ctxt = new JTextField(10);
ctxt.setBounds(225, 180, 100, 30);
combo.setBounds(350, 180, 80, 30);
upanel.add(combo);
// upanel.add(ctxt);
JLabel rlabel = new JLabel("Rate per unit");
rlabel.setBounds(460, 180, 125, 30);
upanel.add(rlabel);
ptxt = new JTextField(10);
ptxt.setBounds(550, 180, 100, 30);
upanel.add(ptxt);
JButton addbutton = new JButton("ADD");
addbutton.setBounds(670, 180, 110, 30);
addbutton.addActionListener(new myaction());
upanel.add(addbutton);
mpanel.setBounds(1, 275, 550, 450);

bframe.add(mpanel);
JScrollPane pane = new JScrollPane();
pane.setBounds(50, 300, 800, 80);
mpanel.add(pane);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:java","","");
}catch(Exception e){}

try {
st = con.createStatement ();

//Creating Statement Object.

}
catch (Exception sqlex) {
//If Problem then Show the
User a Message.
JOptionPane.showMessageDialog (null, "A Problem Occurs
While Loading Form.");
}
try{
rs=st.executeQuery("SELECT * from temp_bill");
while(rs.next())
{
sno1= rs.getInt(1);
particulars = rs.getString(2);
quantity1 = rs.getInt(3);
ppu = rs.getFloat(4);
amount = rs.getFloat(5);
rows++;
}
data1=new Object[rows][5];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)

{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);

pane.add(jsp);
}catch(Exception e)
{
}
try{
data1=new Object[rows][8];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
pane.add(jsp);
}
catch(Exception e){

}
JButton editbutton = new JButton("EDIT ENTRY");
editbutton.setBounds(50, 500, 100, 30);
editbutton.addActionListener(new editaction());
mpanel.add(editbutton);
JButton deletebutton = new JButton("DELETE ENTRY");
deletebutton.setBounds(175, 500, 125, 30);
deletebutton.addActionListener(new deleteaction());
mpanel.add(deletebutton);
JButton paybutton = new JButton("PAY");
paybutton.setBounds(325, 500, 75, 30);
paybutton.addActionListener(new payaction());
mpanel.add(paybutton);
JButton savebutton = new JButton("SAVE");
savebutton.setBounds(425, 500, 75, 30);
savebutton.addActionListener(new saveaction());
mpanel.add(savebutton);
JButton printbutton = new JButton("CLOSE");
printbutton.setBounds(525, 500, 80, 30);
printbutton.addActionListener(new closeaction());
mpanel.add(printbutton);
JButton newbutton = new JButton("NEW BILL");
newbutton.setBounds(630, 500, 100, 30);
newbutton.addActionListener(new newaction());
JButton openbutton = new JButton("OPEN BILL");
openbutton.setBounds(750, 500, 100, 30);
openbutton.addActionListener(new openaction());
mpanel.add(openbutton);
mpanel.add(newbutton);
bframe.setVisible(true);
bframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class payaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
pay p=new pay();
}
}
class saveaction implements ActionListener
{
public void actionPerformed(ActionEvent e)

{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt = con.createStatement();
String str2 = "insert into bill_log([memo]) Values('bill "+b+"')";
stmt.executeUpdate(str2);
String str3="CREATE TABLE Bill"+b+" ([S.No.] int NOT
NULL,Particulars nvarchar(50) NOT NULL,
Quantity int NOT NULL,pricepu
float(53) NOT NULL,amount float(53) NOT NULL) ON [PRIMARY]";
stmt.executeUpdate(str3);
savebill save = new savebill();
con.close();
}
catch (Exception ex2)
{
System.out.println("err2:"+ex2);
}
}
}
class openaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
openbill open=new openbill();
}
}
class editaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
editbill edit=new editbill();
}
}
class closeaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
bframe.dispose();
}
}
class deleteaction implements ActionListener
{

public void actionPerformed(ActionEvent e)


{
delbill del=new delbill();
}
}
class newaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
bframe.dispose();
newbill n=new newbill();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
String str2 = "drop temp_bill";
stmt.executeUpdate(str2);
String str1="CREATE TABLE temp_bill(
[sno] [int] IDENTITY(1,1)
NOT NULL, [particulars] [nvarchar](50) NOT NULL,
[quantity] [int] NOT
NULL,[ppu] [float] NOT NULL,
[amount] [float] NULL) ON [PRIMARY]";
stmt.executeUpdate(str1);
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);
}
}
}
class myaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
// String str2 = "insert into temp_bill ([particulars],[quantity],[ppu],
[amount]) Values(?,?,?,?)";
//PreparedStatement stmt=con.prepareStatement(str2);

//stmt.setString(1,item);
//stmt.setInt(2, qnt);
//stmt.setFloat(3, ppu);
//stmt.setFloat(4, amt);
//stmt.executeUpdate();

//System.out.println("\n"+ppu+"\n"+qnt);
String str2 = "insert into temp_bill ([particulars],[quantity],[ppu])
Values('"+btxt.getText().toString()+"','"+Integer.parseInt(quantity.getText().toString())
+"','"+Float.parseFloat(ptxt.getText().toString())+"')";
stmt.executeUpdate(str2);
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);
}
}
}
}

Stock Management Form:package project;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.*;
public class stockmanagement
{
JFrame sframe;
JTextField item;
JLabel stocks;
int r;
public stockmanagement()
{
sframe=new JFrame("STOCK MANAGEMENT");
JPanel upanel=new JPanel();
JPanel lpanel=new JPanel();
JLabel slabel=new JLabel("Seven Eleven Store");
JLabel dlabel=new JLabel("20-June-2012");
item=new JTextField(50);
upanel.add(item);
item.setBounds(50,100,700,30);
JButton sbutton=new JButton("SEARCH");
sbutton.addActionListener(new search());
upanel.add(sbutton);
sbutton.setBounds(770,100,90,30);
JButton cbutton=new JButton("CLOSE");
upanel.setLayout(null);
lpanel.setLayout(null);
sframe.setSize(900,700);
sframe.setLocationRelativeTo(null);
upanel.setBounds(1,1,890,225);
sframe.add(upanel);
upanel.add(slabel);
slabel.setBounds(300,20,200,40);
dlabel.setBounds(560,20,100,40);
upanel.add(dlabel);
lpanel.setBounds(1,300,700,350);
stocks=new JLabel("IN STOCK = ");
stocks.setBounds(350,300,200,200);
lpanel.add(stocks);

cbutton.setBounds(400,550,90,40);
cbutton.addActionListener(new close());
lpanel.add(cbutton);
sframe.add(lpanel);
sframe.setVisible(true);
sframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class close implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
sframe.dispose();
}
}
class search implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
String str2 = "Select instock from items where
name='"+item.getText().toString()+"'";
r=stmt.executeUpdate(str2);
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);
}
stocks=new JLabel("IN STOCK = "+r);
}
}
}

Purchase Form:package project;

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class purchase {
JComboBox combo;
JTextField btxt;
JTextField ctxt;
JFrame bframe;
JTextField quantity;
JTextField ptxt;
static int b=0;
PreparedStatement ps;
Connection con;
ResultSet rs;
Statement st;
JLabel l1;
String particulars;
int sno1,quantity1;
float ppu,amount;
int rows = 0;
Object data1[][];
JScrollPane scroller;
JTable table;

public purchase()
{
b=b+1;
bframe=new JFrame("PURCHASE");
JPanel upanel=new JPanel();
JPanel mpanel=new JPanel();
JPanel lpanel=new JPanel();
JLabel blabel=new JLabel("Bill No. "+b);
JLabel slabel=new JLabel("Seven Eleven Store");
JLabel dlabel=new JLabel("23-June-2012");

btxt=new JTextField(100);
JTextField quantity=new JTextField(10);
upanel.setLayout(null);
mpanel.setLayout(null);
lpanel.setLayout(null);
bframe.setSize(900,700);
bframe.setLocationRelativeTo(null);
upanel.setBounds(1,1,800,225);
blabel.setBounds(50,30,125,125);
slabel.setBounds(325,30,400,125);
dlabel.setBounds(675,30,175,125);
upanel.add(slabel);
upanel.add(blabel);
upanel.add(dlabel);
bframe.add(upanel);
btxt.setBounds(50,125,730,30);
quantity.setBounds(50,180,150,30);
upanel.add(quantity);
upanel.add(btxt);
String str[]={"Pcs","Kg","g","l","ml"};
combo=new JComboBox(str);
ctxt=new JTextField(10);
ctxt.setBounds(225,180,100,30);
combo.setBounds(350,180,80,30);
upanel.add(combo);
upanel.add(ctxt);
JLabel rlabel=new JLabel("Rate per unit");
rlabel.setBounds(460,180,125,30);
upanel.add(rlabel);
JTextField ptxt=new JTextField(10);
ptxt.setBounds(550,180,100,30);
upanel.add(ptxt);
JButton addbutton=new JButton("ADD");
addbutton.setBounds(670,180,110,30);
addbutton.addActionListener(new myaction());
upanel.add(addbutton);
mpanel.setBounds(1,275,800,450);
bframe.add(mpanel);
JScrollPane pane=new JScrollPane();
pane.setBounds(50,300,800,80);
mpanel.add(pane);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con = DriverManager.getConnection("Jdbc:Odbc:java","","");
}catch(Exception e){}
try {
st = con.createStatement ();

//Creating Statement Object.

}
catch (Exception sqlex) {
//If Problem then Show the
User a Message.
JOptionPane.showMessageDialog (null, "A Problem Occurs
While Loading Form.");
}
try{
rs=st.executeQuery("SELECT * from temp_bill");
while(rs.next())
{
sno1= rs.getInt(1);
particulars = rs.getString(2);
quantity1 = rs.getInt(3);
ppu = rs.getFloat(4);
amount = rs.getFloat(5);
rows++;
}
data1=new Object[rows][5];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);

pane.add(jsp);
}catch(Exception e)
{
}
try{
data1=new Object[rows][8];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
pane.add(jsp);
}
catch(Exception e){
}
JButton editbutton=new JButton("EDIT ENTRY");
editbutton.setBounds(50,500,100,30);
editbutton.addActionListener(new editaction());
mpanel.add(editbutton);
JButton deletebutton=new JButton("DELETE ENTRY");
deletebutton.setBounds(175,500,125,30);
deletebutton.addActionListener(new deleteaction());
mpanel.add(deletebutton);
JButton paybutton=new JButton("PAY");
paybutton.setBounds(325,500,75,30);
paybutton.addActionListener(new payaction());
mpanel.add(paybutton);
JButton savebutton=new JButton("SAVE");

savebutton.setBounds(425,500,75,30);
savebutton.addActionListener(new saveaction());
mpanel.add(savebutton);
JButton printbutton=new JButton("CLOSE");
printbutton.setBounds(525,500,80,30);
printbutton.addActionListener(new close());
mpanel.add(printbutton);
JButton newbutton=new JButton("NEW BILL");
newbutton.addActionListener(new newaction());
newbutton.setBounds(630,500,100,30);
mpanel.add(newbutton);
bframe.setVisible(true);
bframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class payaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
pay p=new pay();
}
}
class saveaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
savebill save = new savebill();
}
}
class editaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
editbill edit=new editbill();
}
}
class deleteaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
delbill del=new delbill();
}
}
class myaction implements ActionListener

{
public void actionPerformed(ActionEvent e)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
// String str2 = "insert into temp_bill ([particulars],[quantity],[ppu],
[amount]) Values(?,?,?,?)";
//PreparedStatement stmt=con.prepareStatement(str2);
//stmt.setString(1,item);
//stmt.setInt(2, qnt);
//stmt.setFloat(3, ppu);
//stmt.setFloat(4, amt);
//stmt.executeUpdate();
//System.out.println("\n"+ppu+"\n"+qnt);
String str2 = "insert into temp_bill ([particulars],[quantity],[ppu])
Values('"+btxt.getText().toString()+"','"+Integer.parseInt(quantity.getText().toString())
+"','"+Float.parseFloat(ptxt.getText().toString())+"')";
stmt.executeUpdate(str2);
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);
}
}
}
class close implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
bframe.dispose();
}
}
class newaction implements ActionListener
{
public void actionPerformed(ActionEvent e)

{
bframe.dispose();
newpurchase n=new newpurchase();
}
}
}

Account Management Form:package project;

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class accmanagement
{
JFrame aframe;
PreparedStatement ps;
Connection con;
ResultSet rs;
Statement st;
JLabel l1;
String particulars;
int sno1,quantity1;
float ppu,amount;
int rows = 0;
Object data1[][];
JScrollPane scroller;
JTable table;
public accmanagement()
{
aframe=new JFrame("ACCOUNT MANAGEMENT");
JPanel upanel=new JPanel();
JPanel mpanel=new JPanel();
upanel.setLayout(null);
mpanel.setLayout(null);
aframe.setSize(900,700);
aframe.setLocationRelativeTo(null);
upanel.setBounds(1,1,800,200);
JLabel slabel=new JLabel("Seven Eleven Store");
slabel.setBounds(20,20,500,50);
upanel.add(slabel);
JLabel dlabel=new JLabel("20-June-2012");
dlabel.setBounds(700,20,800,50);
upanel.add(dlabel);
JTextField itxt=new JTextField(50);

itxt.setBounds(20,100,600,30);
JButton sbutton=new JButton("SEARCH");
sbutton.setBounds(650,100,125,30);
upanel.add(sbutton);
upanel.add(itxt);
aframe.add(upanel);
mpanel.setBounds(1,200,800,500);
JScrollPane pane=new JScrollPane(table);
pane.setBounds(30,300,725,80);
mpanel.add(pane);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:java","","");
}catch(Exception e){}
try {
st = con.createStatement ();

//Creating Statement Object.

}
catch (Exception sqlex) {
//If Problem then Show the
User a Message.
JOptionPane.showMessageDialog (null, "A Problem Occurs
While Loading Form.");
}
try{
rs=st.executeQuery("SELECT * from "+itxt.getText().toString()+"");
while(rs.next())
{

sno1= rs.getInt(1);
particulars = rs.getString(2);
quantity1 = rs.getInt(3);
ppu = rs.getFloat(4);
amount = rs.getFloat(5);
rows++;
}
data1=new Object[rows][5];

Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
pane.add(jsp);
}catch(Exception e)
{
}
try{
data1=new Object[rows][8];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;

JScrollPane jsp=new JScrollPane(table,v,h);


pane.add(jsp);
}
catch(Exception e){
}
JButton ebutton=new JButton("EDIT ENTRY");
ebutton.setBounds(30,450,110,30);
ebutton.addActionListener(new editaction());
mpanel.add(ebutton);
JButton dbutton=new JButton("DELETE ENTRY");
dbutton.setBounds(165,450,120,30);
dbutton.addActionListener(new deleteaction());
mpanel.add(dbutton);
JButton abutton=new JButton("ADD ENTRY");
abutton.setBounds(310,450,110,30);
abutton.addActionListener(new addaction());
mpanel.add(abutton);
JButton savebutton=new JButton("SAVE");
savebutton.setBounds(430,450,90,30);
savebutton.addActionListener(new saction());
mpanel.add(savebutton);
JButton pbutton=new JButton("PAY");
pbutton.setBounds(540,450,90,30);
pbutton.addActionListener(new paction());
mpanel.add(pbutton);
JButton cbutton=new JButton("CLOSE");
cbutton.setBounds(650,450,90,30);
cbutton.addActionListener(new close());
mpanel.add(cbutton);
aframe.add(mpanel);
aframe.setVisible(true);
aframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class paction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
payee pay=new payee();
}
}
class saction implements ActionListener
{

public void actionPerformed(ActionEvent e)


{
saveaccount save=new saveaccount();
}
}
class editaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
editbill edit=new editbill();
}
}
class deleteaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
delbill del=new delbill();
}
}
class addaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
aframe.dispose();
purchase n=new purchase();
}
}
class close implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
aframe.dispose();
}
}
}

Edit Bill Form:package project;

import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class editbill {
JFrame eframe;
PreparedStatement ps;
Connection con;
ResultSet rs;
Statement st;
JLabel l1;
String particulars;
int sno,quantity;
float ppu,amount;
int rows = 0;
Object data1[][];
JScrollPane scroller;
JTable table;
JPanel epanel;
public editbill()
{
eframe=new JFrame("EDIT ENTRY");
epanel=new JPanel();
epanel.setLayout(null);

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:java","","");
}catch(Exception e){}

try {
st = con.createStatement ();
}

//Creating Statement Object.

catch (SQLException sqlex) {


//If Problem then
Show the User a Message.
JOptionPane.showMessageDialog (null, "A Problem Occurs
While Loading Form.");
}
try{
rs=st.executeQuery("SELECT * from temp_bill");
while(rs.next())
{
sno = rs.getInt(1);
particulars = rs.getString(2);
quantity = rs.getInt(3);
ppu = rs.getFloat(4);
amount = rs.getFloat(5);
rows++;
}
data1=new Object[rows][5];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
epanel.add(jsp);
}catch(Exception e)

{
}
try{
data1=new Object[rows][8];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
epanel.add(jsp);
}
catch(Exception e){
}
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel elabel=new JLabel("Enter the S.No. of the entry to be edited:");
elabel.setBounds(30,190,230,20);
epanel.add(elabel);
JTextField etxt=new JTextField(4);
etxt.setBounds(270,185,70,30);
epanel.add(etxt);
JButton editbutton=new JButton("EDIT");
editbutton.setBounds(290,240,90,40);
editbutton.addActionListener(new editing());
epanel.add(editbutton);
JButton canbutton=new JButton("CANCEL");
canbutton.setBounds(395,240,90,40);
canbutton.addActionListener(new cancel());
epanel.add(canbutton);

eframe.add(epanel);
eframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
eframe.setVisible(true);
}
class editing implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
update u=new update();
}
}
class cancel implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
eframe.dispose();
}
}
}

Delete Bill Form:package project;

import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class delbill
{
JFrame eframe;
PreparedStatement ps;
Connection con;
ResultSet rs;
Statement st;
JLabel l1;
String particulars;
int sno,quantity;
float ppu,amount;
int rows = 0;
Object data1[][];
JScrollPane scroller;
JTable table;
public delbill()
{
eframe=new JFrame("DELETE ENTRY");
JPanel epanel=new JPanel();
epanel.setLayout(null);
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("Jdbc:Odbc:java","","");
}catch(Exception e){}

try {
st = con.createStatement ();
}
catch (Exception sqlex) {
User a Message.

//Creating Statement Object.


//If Problem then Show the

JOptionPane.showMessageDialog (null, "A Problem Occurs


While Loading Form.");
}
try{
rs=st.executeQuery("SELECT * from temp_bill");
while(rs.next())
{
sno = rs.getInt(1);
particulars = rs.getString(2);
quantity = rs.getInt(3);
ppu = rs.getFloat(4);
amount = rs.getFloat(5);
rows++;
}
data1=new Object[rows][5];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);
epanel.add(jsp);
}
catch(Exception e)
{

}
try{
data1=new Object[rows][8];
Object[]
Colheads={"S.No.","Particulars","Quantity","Price per Unit","Amount"};
rs=st.executeQuery("Select * from temp_bill");
for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
JTable table=new JTable(data1,Colheads);
int
v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int
h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp=new JScrollPane(table,v,h);

epanel.add(jsp);
}
catch(Exception e){
}
JLabel elabel=new JLabel("Enter the S.No. of the entry to be deleted:");
elabel.setBounds(30,190,230,20);
epanel.add(elabel);
JTextField etxt=new JTextField(4);
etxt.setBounds(270,185,70,30);
epanel.add(etxt);
JButton delbutton=new JButton("DELETE");
delbutton.setBounds(290,240,90,40);
delbutton.addActionListener(new dconfirma());
epanel.add(delbutton);
JButton canbutton=new JButton("CANCEL");
canbutton.setBounds(395,240,90,40);
canbutton.addActionListener(new cancel());
epanel.add(canbutton);
epanel.add(epanel);

eframe.add(epanel);
eframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
eframe.setVisible(true);
}
class dconfirma implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
dconfirm d=new dconfirm();
try
{
int b=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
String str1="Select top 1 from temp_bill oder by sno desc";
ResultSet rs=stmt.executeQuery(str1);
while(rs.next())
{
b=rs.getInt(1);
}
//String str2 = "delete temp_bill where sno='"+b"'";
//error
//stmt.executeUpdate(str2);
//error
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);
}
}
}
class cancel implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
eframe.dispose();
}
}
}

Update Bill Form:-

package project;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
public class update {
JFrame frame;
JComboBox l;
JTextField l1;
JTextField l2;
JTextField k;
public update(){
frame = new JFrame("Update Entry");
JPanel panel = new JPanel();
JPanel panel1=new JPanel();
JPanel panel2=new JPanel();
l1=new JTextField("Enter Bill Particulars");
l2=new JTextField("Enter Quantity");
JButton b=new JButton("UPDATE");
JButton d=new JButton("CANCEL");
String str[]={"Pcs","Kg","mg","l","ml"};
l=new JComboBox(str);
JLabel j=new JLabel("Rate per pc");
k=new JTextField("Enter Price");
frame.add(panel);
//frame.add(panel1);
panel.add(l1);
panel.add(l2);
panel.add(b);
b.addActionListener(new updateaction());
panel.add(d);
panel.add(l);
panel.add(j);
panel.add(k);
panel.setLayout(null);
panel1.setLayout(null);
panel.setBackground(Color.LIGHT_GRAY);
//panel1.setBackground(Color.LIGHT_GRAY);

panel.setBounds(0,0,500,39);
//panel1.setBounds(0,10,500,40);
l1.setBounds(10,0,470,25);
l2.setBounds(10, 25, 100, 25);
b.setBounds(300,55,90,25);
b.addActionListener(new actions());
d.setBounds(400,55,90,25);
d.addActionListener(new actions2());
l.setBounds(120,25,90,25);
j.setBounds(220,25,100,25);
k.setBounds(320, 25, 90, 25);
frame.setResizable(false);
frame.setBackground(Color.black);
frame.setSize(500, 300);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
class actions implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
uconfirm u=new uconfirm();
}
}
class actions2 implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
frame.dispose();
}
}
class updateaction implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");

Statement stmt=con.createStatement();
//String str2 = "Update temp_bill set
[particulars]='"+l1.getText().toString()"'
[quantity]='"+Integer.parseInt(l2.getText().toString())+"'
[ppu]='"+Float.parseFloat(k.getText().toString())+"'";
//
// stmt.executeUpdate(str2);
// error
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);

}
}
}
}

Pay Bill Form:package project;

error

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.*;
public class pay
{
JFrame pframe;
int amount=0;
public pay()
{
pframe=new JFrame("PAY");
JPanel ppanel=new JPanel();
ppanel.setLayout(null);
JLabel label1=new JLabel("BILL AMOUNT :");
JLabel label2=new JLabel("PAID AMOUNT :");
JLabel label3=new JLabel("BALANCE :");
JTextField ptxt=new JTextField(10);
JLabel blabel=new JLabel();
JLabel balance=new JLabel();
JButton okbutton=new JButton("OK");
JButton cancelbutton=new JButton("CANCEL");
pframe.setSize(300,200);
pframe.setLocationRelativeTo(null);
ppanel.setBounds(3,3,140,190);
pframe.add(ppanel);
label1.setBounds(5,10,100,30);
ppanel.add(label1);
blabel.setBounds(165,10,50,30);
ppanel.add(blabel);
label2.setBounds(5,45,100,30);
ptxt.setBounds(110,45,75,25);
ppanel.add(ptxt);
label3.setBounds(5,85,75,30);
ppanel.add(label3);
balance.setBounds(90,85,100,30);
ppanel.add(balance);
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:java");
Statement stmt=con.createStatement();
String str2 = "Select * from temp_bill";
ResultSet rs=stmt.executeQuery(str2);
while(rs.next())
{
amount=amount+rs.getInt(amount);
}
con.close();
}
catch (Exception ex3)
{
System.out.println("ERE:"+ex3);
}
blabel.setText(""+amount);
int p=Integer.parseInt(ptxt.getText().toString());
int bal=amount-p;
balance.setText(""+bal);
okbutton.setBounds(50,115,90,40);
okbutton.addActionListener(new ok());
ppanel.add(okbutton);
cancelbutton.setBounds(145,115,90,40);
cancelbutton.addActionListener(new cancel());
ppanel.add(cancelbutton);
ppanel.add(label2);
pframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pframe.setVisible(true);
}

class ok implements ActionListener


{
public void actionPerformed(ActionEvent e)
{
pframe.dispose();
}
}
class cancel implements ActionListener
{
public void actionPerformed(ActionEvent e)

{
pframe.dispose();
}
}
}

BENEFITS OF THE PROPOSED SYSTEM

The proposed system overcomes the limitation of the current system. The proposed
system has following advantages:
-

The proposed system is much faster and reliable as compared to manual

system.
-

Proposed system will provide a facility of security. In this we have a user name

& password system, so as to avoid unauthorized access.


-

Reports are generated in almost no time.

It reduces the burden of maintaining registers and bill memos.

Our system capable of providing backup so that no data is lost in case of any

damage to the system.


-

Paper work will be minimized.

It omits the manual error and thus provides accuracy.

The files can be kept as long as wanted.

System is dynamic. Any number of enquiries can be entered.

Any number of bills can be registered.

There will be no more checking errors.

It is easy to operate as the software is graphical & menu driven.

Anda mungkin juga menyukai