You are on page 1of 83

A

PROJECT REPORT

ON

Stock Management System

Submitted in Partial Fulfillment of the Requirements


for the award of the degree of

BACHELOR OF COMPUTER APPLICATIONS

Submitted By: Project Guide:


Paras Mittal (190855106146) Mr. Sanjaykant Tyagi
Tushar Verma(190855106199) (Asst. Professor)
BCA Dept., SRC

DEPARTMENT OF Computer Application,


SHRI RAM COLLEGE,
MUZAFFARNAGAR
(Affiliated to Chaudhary Charan Singh University, Meerut)

SESSION 2019-22

1
DECLARATION

We Paras Mittal and Tushar Verma hereby declare that the project report title “Stock Management
System” is an original work carried out by me under the supervision of Mr. Sanjaykant Tyagi. I
further declare that this work has not been submitted to any other Institute/University for the award of
the degree of Bachelor of Computer Applications.

Student Name: Paras Mittal


Roll No: 190855106146

Student Name: Tushar Verma


Roll No: 190855106199

2
Date: 30th April 2013

FORWARDING LETTER

This is to certify that the project entitled “Stock Management System”, which is being submitted for
the partial fulfillment for the award of Degree of Bachelor of Computer Applications from Ch.
Charan Singh U n i v e r s i t y , M e e r u t i s a n a u t h e n t i c w o r k c a r r i e d out by Mr. Paras
Mittal(University Roll No.190855106146) and Tushar Verma(190855106199) under the guidance of
Project Guide Mr.Sanjaykant Tyagi.

The matter embodied in this project work has not been submitted earlier for the award of degree or
diploma.

We wish him/her all the best for the future.

Internal Guide Head - BCA Department

Mr. Sanjaykant Tyagi Mr. Nishant Rathi

3
ACKNOWLEDGEMENT

We would like to acknowledge and give my warmest thanks to my teacher


Mr. Sanjaykant Tyagi who made this work possible for me. His guidance and advice carried me
through all the stages of working on my project.

We have received unfailing encouragement and inspiration of Dr. Sanjaykant Tyagi


whose exceptional knowledge and unparalleled behavior is full of enthusiastic inspiration in it.
However, we can never adequate thank all those who have their assistance, guidance, cooperation
contributed to the improvement of this report.
.
Since performance feedback is essential for effective communication, mistakes and creative feedback
of the report may be strongly communicated to me, who will be as far as possible duly acknowledged
and most welcome.

Finally, I(Paras Mittal) would like to thank God, for letting me through all the difficulties. I have
experienced your guidance day by day. You are the one who let me finish my Project. I will keep on
trusting you for my future.

Paras Mittal
(190855106146)

Tushar Verma
(190855106199)

4
Preface

This project is aimed at developing a desktop based application


named “ STOCK MANAGEMENT SYSTEM” for managing the stock system of any
organization.The STOCK MANAGEMENT SYSTEM (SMS) refers to the system and process
to manage the stock of organization with the involvement of technology system. This System
can be used to store the details of the stock, stock maintenance, update the stock based on
the sales details, and generate sales daily and weekly based. This project is categorize
individual aspects for the sales and stock management system. In this system we are solving
different problem affecting to direct sales management and purchase management. Stock
Management System is important to ensure quality control in businesses that handle
transactions resolving around consumer goods. Without proper stock control, a large retail
store may run out of stock on an important item.

5
INDEX

Ch. 1. Introduction and Objective………………………………………………………..7-10


1.1 Scope of the system……………………………………………………………………………… 8
1.2 Problem Statement……………………………………………………………………………... 8
1.3 Project Description…………………………………………………………………………… 9-10
1.3.1 About Existing System………………………………………………………………........9
1.3.2 Implementation of Proposed System………………………………………………….9-10
1.4 Advantages and Limitations of project ……………………………………………………….... 10

Ch. 2. Project Category Tools & Environment………………………………………….11-12


2.1 Project Category & Development………………………………………………………………...11
2.2 Front end coverage ……………………………………………………………………………….11
2.3 Back end coverage………………………………………………………………………………..11
2.4 Software and Hardware requirements……………………………………………………………12

Ch. 3. Project development stages………………………………………………………..13-17


3.1 Recognition of needs ……………………………………………………………………………..13
3.2 Feasibility study………………………………………………………………………………13-15
3.2.1 Technical Feasibility………………………………………………………………...13-14
3.2.2 Operational Feasibility………………………………………………………………14-15
3.2.3 Economic Feasibility……………………………………………………………………15
3.3 DFD & ER Diagram…………………………………………………………………………16-17

Ch. 4. Project Forms ……………………………………………………………………..18-81


4.1 Database Tables………………………………………………………………………………18-19
4.2 Modules & Coding…………………………………………………………………………...20-78
4.3 Output Screens………………………………………………………………………………..79-81

Ch. 5. Conclusion …………………………………………………………………………….82

Bibliography…………………………………………………………………………….....83

6
CHAPTER.1 INTRODUCTION

Introduction

The project Stock Management System is a complete desktop based application designed on
java using Netbeans Software. The main aim of the project is to develop Stock Management System
Model software in which all the information regarding the stock of the organization will be presented.
It is an Intranet based desktop application which has admits component to manage the stock and
maintenance of the stock system. This desktop application is based on the management of stock of an
organization. The application contains vendors details, sales details, Purchase details and the
remaining stock that are presented in the organization. There is a provision of updating the stock also.
This application also provides the remaining balance of the stock as well as the details of the balance
of transaction. The new product can also be added here. In this project the calculator is also given to
cross check the calculation, google is also in the additional services. Here the login page is created in
order to protect the management of the stock of organization in order to prevent it from the threads
and misuse of the stock.

Objectives

 Primary objective:-
The primary objectives of the project is to know the fundamentals of Java programming and
SQL using Netbeans and MySQL.

 Secondary objective:-
The secondary objectives of this project are mentioned below:

► To develop an application that deals with the day to day requirement of any production
organization To develop the easy management of the stock.
► To handle the stock details like sales details, purchase details and balance stock details.
► To provide details information about the stock balance.
► To make the stock manageable and simplify the use of stock in the organization.
► To keep details of vendors.

7
1.1 Scope of the System

The scope of this document includes an overview of the STOCK


MANAGEMENT SYSTEM project, detailed information about the requirements, including
functional requirements, interface requirements, nonfunctional requirements and additional
constraints of the system.
1. There is only one user of this system who is the owner.
2. Owner can add product in the stock.
3. Owner can also modify the stock of the product.
4. Vendor information is also accessible and can be modified.
5. In the database the date on which the product is purchased can also be seen.

1.2 Problem Statement

After analyzing many existing SMS we have now the obvious vision of the project to be
developed. Before we started to build the application we had many challenges,

We defined problem statement as:

• To make desktop based application small organization.


• To make the system easily managed and can be secured.
• To cover different areas purchase details, sales details, product and managing them…

8
1.3 Project Description
1.3.1About Existing System:-

“Stock Management System” is one can go into almost required solution regarding the stock. This
software package provides guidance for all the stock management purpose, as a perfect guide, the
current demand for such software became needful. This project will provide for computerization of a
small enterprise whose main goal is to keep track on their stock process and wants to change from
paper based data to computerized data. In this System, on starting it the login page will be displayed,
which can only be accessed by the Owner. Six options are provided, one is for vendor information,
second is for purchase details, third is for sales details, fourth for product details, fifth is for additional
services where notepad, calculator and google is given , at last but not the least is logout option.

For stock management processes, you need robust functionality for managing your
logistics facilities. Support for stock management helps you record and track materials on the basis of
both quantity and value.

Stock management functions cover internal warehouse movements and storage.

Additional benefits of stock management include improved cash flow, visibility, and decision
making.

This software is user friendly and hence easy to use.

1.3.2 Implementation of Proposed System

A crucial phase in the system life cycle is the successful implementation of the new system
design. Implementation includes all those activities that take place to convert from the old system to
tee new one. The new system may be completely new, replacing an existing system. In either case,
proper implementation becomes necessary so that a reliable system based on the requirements of the
organization can be provided. Successful implementation may not guarantee improvement in the
organization using the new system, but improper installation will prevent it. It has been observed that
even the best system can’t show good result if the analysts managing the implementation do not

9
attend to every important details. This is an area where the systems analysts need to work with utmost
care. This system will be implemented using java Netbeans as front end and MYSQL as back end.

For the successful implementation of a system, the training of the users of the system plays
an important role. Because even well designed system can succeed or fail because of the way they are
operated and used. Therefore, the quality of the training received by the personnel involved with the
system in various capacities helps or hinders and may even prevent the successful implementation of
management information system. Those who are directly or indirectly related with the system
development work must know in detail what their roles will be, how they can ace efficient use of the
system and what the system will or will not do for them. Therefore both system operators and users
need training.

1.4 Advantages and Limitations of project

Advantages
1. Avoidance of stock-outs and excess stock .
2. Helps save time and money .
3. Fast accessible.
4. Having knowledge of vendors .
5. Easy to maintain .

Limitations
1. This application is not suitable for those organization where there is large quantity.
2. Single admin panel is only made.
3. It is not suitable for large organization.

10
CHAPTER.2 PROJECT CATEGORY & ENVIRONEMENT

2.1 Project Category & Development

Today computer has become the backbone of nearly every occupation. In every industry or company
or any institution, the several employees have to maintain a number of records in various part of the
organization. In a market, there is a need to maintain record about employees, edibles, assets & many
more.

To do this work manually requires a lot of manpower and consumes too much time. Moreover one is
never sure about the efficiency & accuracy of work being done and records being maintained. A bad
part of this style of working is that, if a person concerned for a particular job, say maintaining
customer record, is on leave, some of the process gets standstill, which depends on the records kept
by that employee. That is, where automation comes in to help and allows simple, smooth and most
efficient, secure and easy to handle functionality.

This system will reduce the workload of the employee and time of processing of data from one unit to
another.It also provides the facility to prevent the unauthorized data access of other persons by
categorized the user as normal user and administrator. Only administrator can delete & even modify
the records.

2.2 Front end

JAVA used as FRONT END

Java is used as front end programming language using Netbeans software.

2.3 Back end

SQL used as BACK END

SQL is used as front end language for handling the database using MySQL software.

11
2.4 Software and Hardware Requirements

Technologies Used : Java and SQL


Hardware Requirements:

Processor :- Pentium 4 or higher processor


Ram :- 1gb or higher
Keyboard :- 104 keys

Software Requirements:

Operating System : Windows XP/2003 or Linux/Solaris


Programming Language : Java(jdk 17)
Netbeans : 12.5 Version
MySQL Workbench : 8.0

12
CHAPTER.3 PROJECT DEVELOPMENT STAGES

3.1 RECOGNITION OF NEEDS

We all know the importance of computerization. The world is moving ahead at lightning speed and
everyone is running short of time. One always wants to get the information and perform a task
he/she/they desire(s) within a short period of time and too with amount of efficiency and accuracy.
The application areas for the computerization have been selected on the basis of following factors:

1. Minimizing the manual records kept at different locations.


2. There will be more data integrity.

3. Facilitating desired information display, very quickly, by retrieving information from users.

4. Facilitating various statistical information which helps in decision-making?

5. To reduce manual efforts in activities that involved repetitive work.

6. Updating and deletion of such a huge amount of data will become easier.

3.2 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

Here we describe only few of these in detail:-

3.2.1 TECHNICAL FEASIBILITY

13
This is concerned with specifying equipment and software that will
successfully satisfy the user requirement. Technical needs of the system include:-

Facility to produce output in a given time

Response time under certain conditions

Ability to process a certain volume of transactions at a particular period

Facility to communicate data to distant location

In examining technical feasibility, configuration of the system is given more importance than the
actual make of hardware .Configuration should give the complete picture about the system’s
requirements: how many workstations are required , how these units are interconnected so that they
could operate and communicate smoothly. What speeds of input and output should be achieved at
particular quality of printing.

The computers are easily available in almost all the places, even in villages. The hardware needed to
carry out this project with 64 MB of RAM and 2 GB HDD.

The software needed to carry out this project include Visual Basic 6.0 as front end and oracle 8 as
back end .So the technology required to carry out the project is easily available and affordable, hence
this project is technically feasible

Due to all these reasons implementation of such system becomes not only feasible but reputed to the
organization..

3.2.2OPERATIONAL FEASIBILITY

This is mainly related to human organization and political aspects. The points to be considered are:-

What changes will be brought with the system?


What organizational structures are disturbed?

What new skills will be required? Do the existing staff members have these skills? If not, they be
trained in due course of time.

14
This feasibility study is carried out by a small group of people who are familiar with the information
system techniques who understand the parts of business that are relevant to the project and are skilled
in the 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 company Staff is almost nil. Any disturbance to the organization if
occurs will be advantageous to the organization. Also the time required to carry out a transaction will
be required to a large extent, which will make the students and others happy and cheerful. The
operators now will be able to service more students and staff members than before in same time period.
There is no need to recruit new staff to corporate 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.2.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.

15
3.3DFD
A data flow diagram is a graphical representation of the "flow" of data through an
information system, modelling its process aspects.

16
E-R Diagram:-

ER Diagram stands for Entity Relationship Diagram, also known as ERD is a diagram that displays
the relationship of entity sets stored in a database.

17
CHAPTER.4 PROJECT FORMS

4.1 Database Tables :-


Name of 6 tables of database ‘stockmanagement’ are given shown in diagram : -

• vendor :- Has 5 attributes[id, name, phone, email, address]

• product :- Has 7 attributes[id, pname, description, barcode, cost, price, qty]

18
• purchase :- Has 6 attributes(id, date, vendor, subtotal, pay, bal)

• sales :- Has 5 attributes(id, date, subtotal, pay, bal)

• purchase_item :- Has 6 attributes (id, pur, pid, rprice, qty, total)

• sales_product :- Has 6 attributes (id, sales_id, pid, price, qty, total)

19
Modules and Coding

There are total 6 modules in this project as shown in diagram :-

1.Vendor:
package stock;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.*;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

public class vendor extends javax.swing.JFrame {


public vendor() {
initComponents();
Connect();
load();
}
Connection con;
PreparedStatement pst;
DefaultTableModel df;
public void Connect()
{
try{
Class.forName("com.mysql.cj.jdbc.Driver");
on=DriverManager.getConnection("jdbc:mysql://localhost:3306/stockmanagement","root","IITm@tech0");
}catch(ClassNotFoundException | SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex); } }

20
public void load(){
int a;
try {
pst = con.prepareStatement("Select * from vendor ");
ResultSet rs = pst.executeQuery();
ResultSetMetaData rd = rs.getMetaData();
a=rd.getColumnCount();
df = (DefaultTableModel)jTable1.getModel();
df.setRowCount(0);
while(rs.next())
{
Vector v2 = new Vector();
for(int i=1;i<=a ;i++)
{
v2.add(rs.getString("id"));
v2.add(rs.getString("name"));
v2.add(rs.getString("phone"));
v2.add(rs.getString("email"));
v2.add(rs.getString("address"));
}
df.addRow(v2);
} } catch (SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); }
}
@SuppressWarnings("unchecked")
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txtvendor = new javax.swing.JTextField();
txtPhone = new javax.swing.JTextField();
txtemail = new javax.swing.JTextField();
txtaddress = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jButton5 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

21
getContentPane().setLayout(null);
jPanel1.setBorder(new
javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText("Vendor Name");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setText("Phone");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setText(" Email");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel4.setText("Address");
txtvendor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtvendorActionPerformed(evt);} });
txtaddress.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtaddressActionPerformed(evt); } });
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(35, 35, 35)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtemail, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtvendor, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(64, Short.MAX_VALUE)));
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)

22
.addComponent(txtvendor, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(txtPhone, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(27, 27, 27)
.addComponent(jLabel3))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(txtemail, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4)
.addComponent(txtaddress, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(32, Short.MAX_VALUE))
);
getContentPane().add(jPanel1);
jPanel1.setBounds(10, 108, 352, 221);
jButton1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\add.png"
)); // NOI18N
jButton1.setText(" Add");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt); } });
getContentPane().add(jButton1);
jButton1.setBounds(10, 335, 105, 39);
jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\update.p
ng")); // NOI18N
jButton2.setText("Update");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt); }});
getContentPane().add(jButton2);
jButton2.setBounds(125, 335, 103, 39);
jButton3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\delete.pn
g")); // NOI18N
jButton3.setText("Delete");

23
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt); } });
getContentPane().add(jButton3);
jButton3.setBounds(256, 335, 104, 39);
jButton4.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\clear.png
")); // NOI18N
jButton4.setText("Cancel");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt); } });
getContentPane().add(jButton4);
jButton4.setBounds(386, 335, 102, 39);

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N


jLabel5.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\person.p
ng")); // NOI18N
jLabel5.setText("Vendor");
getContentPane().add(jLabel5);
jLabel5.setBounds(272, 21, 170, 40);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] { },
new String [] {
"Vendor ID", "Vendor Name", "Phone", "Email", "Address" } ));
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt); } });
jScrollPane1.setViewportView(jTable1);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(408, 108, 418, 221);
jButton5.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\icons8-
close-16.png")); // NOI18N
jButton5.setText("Close");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt); } });
getContentPane().add(jButton5);
jButton5.setBounds(506, 335, 92, 39);
jLabel6.setBackground(new java.awt.Color(255, 255, 255));
getContentPane().add(jLabel6);
jLabel6.setBounds(-6, 0, 860, 400);
setSize(new java.awt.Dimension(866, 442));
setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents

24
private void txtvendorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_txtvendorActionPerformed}
private void txtaddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_txtaddressActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtaddressActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton4ActionPerformed
txtvendor.setText("");
txtPhone.setText("");
txtemail.setText("");
txtaddress.setText("");
txtvendor.requestFocus();
load();
jButton1.setEnabled(true); }//GEN-LAST:event_jButton4ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jButton1ActionPerformed
try { String vname = txtvendor.getText();
String phone = txtPhone.getText();
String email = txtemail.getText();
String address = txtaddress.getText();
pst = con.prepareStatement("insert into vendor (name,phone,email,address)values(?,?,?,?)");
pst.setString(1, vname);
pst.setString(2, phone);
pst.setString(3, email);
pst.setString(4, address);
pst.executeUpdate();
JOptionPane.showMessageDialog(this,"Vendor Addedddddd");
txtvendor.setText("");
txtPhone.setText("");
txtemail.setText("");
txtaddress.setText("");
txtvendor.requestFocus();
load();
} catch (SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }//GEN-LAST:event_jButton1ActionPerformed

private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-


FIRST:event_jTable1MouseClicked
df = (DefaultTableModel)jTable1.getModel();
int selected = jTable1.getSelectedRow();
int id = Integer.parseInt(df.getValueAt(selected, 0).toString());
txtvendor.setText(df.getValueAt(selected, 1).toString());
txtPhone.setText(df.getValueAt(selected, 2).toString());

25
txtemail.setText(df.getValueAt(selected, 3).toString());
txtaddress.setText(df.getValueAt(selected, 4).toString());
jButton1.setEnabled(false); }//GEN-LAST:event_jTable1MouseClicked
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jButton2ActionPerformed
df = (DefaultTableModel)jTable1.getModel();
int selected = jTable1.getSelectedRow();
int id = Integer.parseInt(df.getValueAt(selected, 0).toString());
String vname = txtvendor.getText();
String phone = txtPhone.getText();
String email = txtemail.getText();
String address = txtaddress.getText();
try { pst = con.prepareStatement("update vendor set name=?,phone=?,email=?,address=? where
id=?");
pst.setString(1, vname);
pst.setString(2, phone);
pst.setString(3, email);
pst.setString(4, address);
pst.setInt(5, id);
pst.executeUpdate();
JOptionPane.showMessageDialog(this,"Vendor Updatedddddd");
txtvendor.setText("");
txtPhone.setText("");
txtemail.setText("");
txtaddress.setText("");
txtvendor.requestFocus();
load();

jButton1.setEnabled(true);

} catch (SQLException ex) {


java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jButton3ActionPerformed
df = (DefaultTableModel)jTable1.getModel();
int selected = jTable1.getSelectedRow();
int id = Integer.parseInt(df.getValueAt(selected, 0).toString());

try {
pst = con.prepareStatement("delete from vendor where id=?");

pst.setInt(1, id);
pst.executeUpdate();
JOptionPane.showMessageDialog(this,"Vendor Deleteddddd");

26
txtvendor.setText("");
txtPhone.setText("");
txtemail.setText("");
txtaddress.setText("");
txtvendor.requestFocus();
load();
jButton1.setEnabled(true);
} catch (SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} }//GEN-LAST:event_jButton3ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton5ActionPerformed
this.setVisible(false); }
ublic static void main(String args[]) {
try { for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Metal".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break; } } } catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new vendor().setVisible(true); } }); }
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtPhone;

27
private javax.swing.JTextField txtaddress;
private javax.swing.JTextField txtemail;
private javax.swing.JTextField txtvendor;}

2.Login
package stock;
import javax.swing.JOptionPane;

public class Login extends javax.swing.JFrame {

public Login() {
initComponents();
}

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jButton1 = new javax.swing.JButton();


jButton2 = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
txtName = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtPass = new javax.swing.JPasswordField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("LOGIN");
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
getContentPane().setLayout(null);

jButton1.setBackground(new java.awt.Color(153, 153, 255));


jButton1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\loginn.p
ng")); // NOI18N
jButton1.setText("Login");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(350, 230, 110, 31);

28
jButton2.setBackground(new java.awt.Color(255, 102, 102));
jButton2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\icons8-
close-16.png")); // NOI18N
jButton2.setText("Cancel");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2);
jButton2.setBounds(510, 230, 120, 30);

jLabel5.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\login-
icon.png")); // NOI18N
getContentPane().add(jLabel5);
jLabel5.setBounds(10, 0, 320, 360);

jLabel3.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N


jLabel3.setText("Username");
getContentPane().add(jLabel3);
jLabel3.setBounds(350, 77, 110, 40);

txtName.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N


txtName.setForeground(new java.awt.Color(204, 102, 0));
getContentPane().add(txtName);
txtName.setBounds(480, 80, 158, 28);

jLabel4.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N


jLabel4.setText("Password");
getContentPane().add(jLabel4);
jLabel4.setBounds(350, 140, 90, 30);

txtPass.setFont(new java.awt.Font("Trebuchet MS", 1, 18)); // NOI18N


txtPass.setForeground(new java.awt.Color(255, 204, 0));
txtPass.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtPassActionPerformed(evt);
}
});
getContentPane().add(txtPass);
txtPass.setBounds(480, 140, 158, 28);

setSize(new java.awt.Dimension(751, 368));

29
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton1ActionPerformed
String uname,password;

uname = txtName.getText();
password = txtPass.getText();

if(uname.equals("Admin") && password.equals("1413914"))


{
this.hide();
main m = new main();
m.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(this,"Username or Password Do not Match");
}
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton2ActionPerformed

this.setVisible(false);

}//GEN-LAST:event_jButton2ActionPerformed

private void txtPassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtPassActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtPassActionPerformed

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {

30
if ("FlatLaf Light".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables


private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JTextField txtName;
private javax.swing.JPasswordField txtPass;
// End of variables declaration//GEN-END:variables
}

3.Product:
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package stock;

31
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
*
* @author Guide
*/
public class product extends javax.swing.JFrame {

/**
* Creates new form product
*/
public product() {
initComponents();
Connect();
load();
}
Connection con;
PreparedStatement pst;
DefaultTableModel df;

public void Connect()


{
try{
Class.forName("com.mysql.cj.jdbc.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost:3306/stockmanagement","root","IITm@tech0");
//.createStatement();

}catch(ClassNotFoundException | SQLException ex) {


java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}

public void load(){

32
int a;
try {
pst = con.prepareStatement("Select * from product ");
ResultSet rs = pst.executeQuery();

ResultSetMetaData rd = rs.getMetaData();
a=rd.getColumnCount();
df = (DefaultTableModel)jTable1.getModel();
df.setRowCount(0);

while(rs.next())
{
Vector v2 = new Vector();
for(int i=1;i<=a ;i++)
{
v2.add(rs.getString("id"));
v2.add(rs.getString("pname"));
v2.add(rs.getString("description"));
v2.add(rs.getString("barcode"));
v2.add(rs.getString("cprice"));
v2.add(rs.getString("rprice"));
v2.add(rs.getString("qty"));
}
df.addRow(v2);
}
} catch (SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
}

/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jLabel1 = new javax.swing.JLabel();


jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();

33
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
txtpname = new javax.swing.JTextField();
txtdes = new javax.swing.JTextField();
txtbarcode = new javax.swing.JTextField();
txtcprice = new javax.swing.JTextField();
txtrprice = new javax.swing.JTextField();
txtqty = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel9 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
getContentPane().setLayout(null);

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N


jLabel1.setText("Product");
getContentPane().add(jLabel1);
jLabel1.setBounds(307, 11, 142, 44);

jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N


jLabel2.setText("Product Name");

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N


jLabel3.setText("Descrption");

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N


jLabel4.setText("Barcode");

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N


jLabel5.setText("Cost Price");

jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N


jLabel6.setText("Retail Price");

jLabel7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

34
jLabel7.setText("Qty");

txtpname.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtpnameActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);


jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(32, 32, 32)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtqty, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtrprice, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtcprice, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtbarcode, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtdes, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE))

35
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(38, 38, 38)
.addComponent(txtpname, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(24, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(txtpname, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addComponent(jLabel3))
.addComponent(txtdes, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addComponent(jLabel4))
.addComponent(txtbarcode, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jLabel5))
.addComponent(txtcprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jLabel6))
.addComponent(txtrprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

36
.addGap(26, 26, 26)
.addComponent(jLabel7))
.addComponent(txtqty, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(60, Short.MAX_VALUE))
);

getContentPane().add(jPanel1);
jPanel1.setBounds(20, 80, 375, 320);

jButton1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\add.png"
)); // NOI18N
jButton1.setText("Add");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(19, 427, 85, 37);

jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\update.p
ng")); // NOI18N
jButton2.setText("Update");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2);
jButton2.setBounds(112, 427, 110, 37);

jButton3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\delete.pn
g")); // NOI18N
jButton3.setText("Delete");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
getContentPane().add(jButton3);
jButton3.setBounds(239, 427, 100, 37);

37
jButton4.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\clear.png
")); // NOI18N
jButton4.setText("Clear");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
getContentPane().add(jButton4);
jButton4.setBounds(348, 427, 96, 37);

jButton5.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\icons8-
close-16.png")); // NOI18N
jButton5.setText("Close");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
getContentPane().add(jButton5);
jButton5.setBounds(471, 427, 92, 37);

jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {

},
new String [] {
"ProductID", "ProductName", "Description", "Barcode", "CostPrice", "RetailPrice", "Qty"
}
));
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
});
jScrollPane1.setViewportView(jTable1);

getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(404, 73, 604, 327);

jLabel9.setBackground(new java.awt.Color(255, 255, 255));


getContentPane().add(jLabel9);
jLabel9.setBounds(0, 0, 1030, 480);

38
setSize(new java.awt.Dimension(1050, 525));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents

private void txtpnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtpnameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtpnameActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton2ActionPerformed
df = (DefaultTableModel)jTable1.getModel();
int selected = jTable1.getSelectedRow();
int id = Integer.parseInt(df.getValueAt(selected, 0).toString());
String pname = txtpname.getText();
String des = txtdes.getText();
String barc = txtbarcode.getText();
String cprice = txtcprice.getText();
String rprice = txtrprice.getText();
String qty = txtqty.getText();

try {
pst = con.prepareStatement("update product set
pname=?,description=?,barcode=?,cprice=?,rprice=?,qty=? where id=?");
pst.setString(1, pname);
pst.setString(2, des);
pst.setString(3, barc);
pst.setString(4, cprice);
pst.setString(5, rprice);
pst.setString(6, qty);

pst.setInt(7, id);
pst.executeUpdate();
JOptionPane.showMessageDialog(this,"Product Updatedddddd");

txtpname.setText("");
txtdes.setText("");
txtbarcode.setText("");
txtcprice.setText("");
txtrprice.setText("");
txtqty.setText("");

txtpname.requestFocus();
load();

39
jButton1.setEnabled(true);

} catch (SQLException ex) {


java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}

}//GEN-LAST:event_jButton2ActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton1ActionPerformed
try {
String pname = txtpname.getText();
String des = txtdes.getText();
String barcode = txtbarcode.getText();
String costprice = txtcprice.getText();
String retailprice = txtrprice.getText();
String qty = txtqty.getText();

pst = con.prepareStatement("insert into product


(pname,description,barcode,cprice,rprice,qty)values(?,?,?,?,?,?)");
pst.setString(1, pname);
pst.setString(2, des);
pst.setString(3, barcode);
pst.setString(4, costprice);
pst.setString(5, retailprice);
pst.setString(6, qty);
pst.executeUpdate();
JOptionPane.showMessageDialog(this,"Product Addedddddd");

txtpname.setText("");
txtdes.setText("");
txtbarcode.setText("");
txtcprice.setText("");
txtrprice.setText("");
txtqty.setText("");

txtpname.requestFocus();
load();
} catch (SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

40
} // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton5ActionPerformed
this.setVisible(false);
}//GEN-LAST:event_jButton5ActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton4ActionPerformed
txtbarcode.setText("");
txtdes.setText("");
txtcprice.setText("");
txtrprice.setText("");
txtpname.setText("");
txtqty.setText("");
txtpname.requestFocus();
load();

jButton1.setEnabled(true);
}//GEN-LAST:event_jButton4ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton3ActionPerformed
df = (DefaultTableModel)jTable1.getModel();
int selected = jTable1.getSelectedRow();
int id = Integer.parseInt(df.getValueAt(selected, 0).toString());

try {
pst = con.prepareStatement("delete from product where id=?");

pst.setInt(1, id);
pst.executeUpdate();
JOptionPane.showMessageDialog(this,"Product Deleteddddd");

txtpname.setText("");
txtdes.setText("");
txtbarcode.setText("");
txtcprice.setText("");
txtrprice.setText("");
txtqty.setText("");

txtpname.requestFocus();
load();

jButton1.setEnabled(true);

41
} catch (SQLException ex) {
java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}

}//GEN-LAST:event_jButton3ActionPerformed

private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-


FIRST:event_jTable1MouseClicked
df = (DefaultTableModel)jTable1.getModel();
int selected = jTable1.getSelectedRow();
int id = Integer.parseInt(df.getValueAt(selected, 0).toString());

txtpname.setText(df.getValueAt(selected, 1).toString());
txtdes.setText(df.getValueAt(selected, 2).toString());
txtbarcode.setText(df.getValueAt(selected, 3).toString());
txtcprice.setText(df.getValueAt(selected, 4).toString());
txtrprice.setText(df.getValueAt(selected, 5).toString());
txtqty.setText(df.getValueAt(selected, 6).toString());

jButton1.setEnabled(false); }//GEN-LAST:event_jTable1MouseClicked

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("FlatLaf Light".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(product.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {

42
java.util.logging.Logger.getLogger(product.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(product.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(product.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new product().setVisible(true);
}
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables


private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtbarcode;
private javax.swing.JTextField txtcprice;
private javax.swing.JTextField txtdes;
private javax.swing.JTextField txtpname;
private javax.swing.JTextField txtqty;
private javax.swing.JTextField txtrprice;
// End of variables declaration//GEN-END:variables
}

43
4.Purchase
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package stock;

//import com.mysql.cj.xdevapi.Statement;
import java.awt.event.KeyEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.table.DefaultTableModel;
import java.sql.ResultSet;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import javax.swing.JOptionPane;
import java.io.*;
import java.time.LocalDate;
import static java.time.LocalDateTime.now;
import java.time.ZonedDateTime;
/**
*
* @author Guide
*/
public class Purchase extends javax.swing.JFrame {

/**
* Creates new form Purchase
*/
public Purchase() {
initComponents();
Connect();
vendor();
}
Connection con;
PreparedStatement pst;
PreparedStatement pst1;
PreparedStatement pst2;

44
DefaultTableModel df;
ResultSet rs;

public void Connect()


{
try{
Class.forName("com.mysql.cj.jdbc.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost:3306/stockmanagement","root","IITm@tech0");
//.createStatement();

}catch(ClassNotFoundException | SQLException ex) {


java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}

public void vendor()


{
try {
pst = con.prepareStatement("Select Distinct name from vendor");
rs = pst.executeQuery();

txtvendor.removeAllItems();

while(rs.next())
{
txtvendor.addItem(rs.getString("name"));
}

} catch (SQLException ex) {


Logger.getLogger(Purchase.class.getName()).log(Level.SEVERE, null, ex);
}

public void barcode()


{
try {
String pcode = txtpcode.getText();

pst = con.prepareStatement("select * from product where barcode=?");


pst.setString(1, pcode);
rs = pst.executeQuery();

45
if(rs.next() == false)
{
JOptionPane.showMessageDialog(this,"BarCode Not Found");
txtpcode.setText("");
}

else
{
String pname = rs.getString("pname");
String price = rs.getString("rprice");

txtpname.setText(pname.trim());
txtprice.setText(price.trim());
txtqty.requestFocus();
}

} catch (SQLException ex) {


Logger.getLogger(Purchase.class.getName()).log(Level.SEVERE, null, ex);
}
}

public void purchase()


{
int price = Integer.parseInt(txtprice.getText());
int qty = Integer.parseInt(txtqty.getText());

int tot = price*qty;

df = (DefaultTableModel)jTable1.getModel();
df.addRow(new Object[]
{
txtpcode.getText(),
txtpname.getText(),
txtprice.getText(),
txtqty.getText(),
tot
});

int sum = 0;

for(int i=0;i<jTable1.getRowCount();i++)
{
sum=sum+Integer.parseInt(jTable1.getValueAt(i,4).toString());

46
}

txttcost.setText(String.valueOf(sum));

txtpcode.setText("");
txtpname.setText("");
txtprice.setText("");
txtqty.setText("");
}

public void add() //throws ParseException


{
try {
DateTimeFormatter dt = DateTimeFormatter.ISO_DATE_TIME;
LocalDateTime now = LocalDateTime.now();
String date = dt.format(now);
String vendor = txtvendor.getSelectedItem().toString();
String subtotal = txttcost.getText();
String pay = txtpay.getText();
String bal = txtbal.getText();
//SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd"); // your template here

int lastid=0;
String query1 = "Insert into purchase(date,vendor,subtotal,pay,bal) values(?,?,?,?,?)";

pst = con.prepareStatement(query1,Statement.RETURN_GENERATED_KEYS);

pst.setString(1, date);

pst.setString(2, vendor);
pst.setString(3, subtotal);
pst.setString(4, pay);
pst.setString(5, bal);

pst.executeUpdate();
rs=pst.getGeneratedKeys();

if(rs.next())
{
lastid = rs.getInt(1);
}

String query2 = "insert into purchaseitem(purid,pid,rprice,qty,total)values(?,?,?,?,?)";


pst1 = con.prepareStatement(query2);

47
String productid;
String price;
String qty;
int total = 0;

for(int i=0; i<jTable1.getRowCount();i++)


{
productid = (String)jTable1.getValueAt(i,0);
price = (String)jTable1.getValueAt(i,2);
qty = (String)jTable1.getValueAt(i,3);
total = (int)jTable1.getValueAt(i,4);

pst1.setInt(1,lastid);
pst1.setString(2,productid);
pst1.setString(3,price);
pst1.setString(4,qty);
pst1.setInt(5,total);
pst1.executeUpdate();

String query3 = "update product set qty = qty+? where barcode=?";


pst2 = con.prepareStatement(query3);

for(int i=0; i<jTable1.getRowCount();i++)


{
productid = (String)jTable1.getValueAt(i,0);
qty = (String)jTable1.getValueAt(i,3);

pst2.setString(1,qty);
pst2.setString(2,productid);
pst2.executeUpdate();
}

JOptionPane.showMessageDialog(this, "Purchase Completeddddddd...........");

} catch (SQLException ex) {


Logger.getLogger(Purchase.class.getName()).log(Level.SEVERE, null, ex);
}

48
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jLabel1 = new javax.swing.JLabel();


jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
txtpcode = new javax.swing.JTextField();
txtpname = new javax.swing.JTextField();
txtprice = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel7 = new javax.swing.JLabel();
txtqty = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txttcost = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
txtpay = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
txtbal = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
txtvendor = new javax.swing.JComboBox<>();
jLabel6 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
getContentPane().setLayout(null);

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jLabel1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\PURCH
ASEE.png")); // NOI18N
jLabel1.setText("Purchase");
getContentPane().add(jLabel1);

49
jLabel1.setBounds(100, 40, 260, 96);

jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel2.setText("Product Code");

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel4.setText("Product Name");

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel5.setText("Price");

txtpcode.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtpcode.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txtpcodeKeyPressed(evt);
}
});

txtpname.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

txtprice.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtprice.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtpriceActionPerformed(evt);
}
});

jButton1.setText("Add");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {

},
new String [] {
"Product Code", "Product Name", "Price", "Qty", "Total"
}
));
jScrollPane1.setViewportView(jTable1);

50
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel7.setText("Qty");

txtqty.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtqty.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtqtyActionPerformed(evt);
}
});

jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel8.setText("Total Cost");

txttcost.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txttcost.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txttcostActionPerformed(evt);
}
});
txttcost.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txttcostKeyPressed(evt);
}
});

jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel9.setText("Payment");

txtpay.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel10.setText("Balance");

txtbal.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtbal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtbalActionPerformed(evt);
}
});

jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\add.png"
)); // NOI18N
jButton2.setText("Add");
jButton2.addActionListener(new java.awt.event.ActionListener() {

51
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\icons8-
close-16.png")); // NOI18N
jButton3.setText("Close");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);


jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txtpcode, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(txtpname, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(44, 44, 44)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel7)
.addGap(107, 107, 107))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

52
.addComponent(txtqty, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40)))
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 88,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(138, 138, 138))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 126,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(42, 42, 42)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 110,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 576,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(70, 70, 70)
.addComponent(jLabel8))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(52, 52, 52)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtpay, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txttcost, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtbal, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel10))))))
.addGap(20, 20, 20))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)

53
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtpcode, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpname, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtqty, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(22, 22, 22))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txttcost, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtpay, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtbal, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(20, 20, 20))
);

54
getContentPane().add(jPanel1);
jPanel1.setBounds(80, 140, 821, 347);

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\person.p
ng")); // NOI18N
jLabel3.setText("Vendor");
getContentPane().add(jLabel3);
jLabel3.setBounds(700, 60, 110, 24);

txtvendor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtvendorActionPerformed(evt);
}
});
getContentPane().add(txtvendor);
txtvendor.setBounds(700, 90, 103, 29);

jLabel6.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\purchase
_screen.png")); // NOI18N
getContentPane().add(jLabel6);
jLabel6.setBounds(-120, 0, 1120, 870);

setSize(new java.awt.Dimension(1008, 591));


setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents

private void txtqtyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtqtyActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtqtyActionPerformed

private void txtpriceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtpriceActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtpriceActionPerformed

private void txtbalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtbalActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtbalActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton2ActionPerformed

55
int pay = Integer.parseInt(txtpay.getText());
int subtotal = Integer.parseInt(txttcost.getText());

int bal = subtotal-pay;

txtbal.setText(String.valueOf(bal));

add();
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton3ActionPerformed
this.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed

private void txtpcodeKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtpcodeKeyPressed

if(evt.getKeyCode() == KeyEvent.VK_ENTER)
{
barcode();
}

}//GEN-LAST:event_txtpcodeKeyPressed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton1ActionPerformed
purchase();

}//GEN-LAST:event_jButton1ActionPerformed

private void txttcostActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txttcostActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txttcostActionPerformed

private void txttcostKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txttcostKeyPressed


// TODO add your handling code here:
}//GEN-LAST:event_txttcostKeyPressed

private void txtvendorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtvendorActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtvendorActionPerformed

/**

56
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("FlatLaf Light".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Purchase.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Purchase.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Purchase.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Purchase.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Purchase().setVisible(true);
}
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables


private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;

57
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtbal;
private javax.swing.JTextField txtpay;
private javax.swing.JTextField txtpcode;
private javax.swing.JTextField txtpname;
private javax.swing.JTextField txtprice;
private javax.swing.JTextField txtqty;
private javax.swing.JTextField txttcost;
private javax.swing.JComboBox<String> txtvendor;
// End of variables declaration//GEN-END:variables
}

5.Main
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package stock;

import java.awt.Desktop;
import java.awt.Graphics;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Guide
*/
public class main extends javax.swing.JFrame {

/**
* Creates new form main
*/
public main() {/*
JLabel b;

58
setSize(1200,700);
setLayout(null);
ImageIcon img=new
ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\stock.png");

b=new JLabel("",img,JLabel.CENTER);
b.setBounds(0,0,1200,700);
add(b);*/

initComponents();
}

/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jPopupMenu1 = new javax.swing.JPopupMenu();


jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu4 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();

jCheckBoxMenuItem1.setSelected(true);
jCheckBoxMenuItem1.setText("jCheckBoxMenuItem1");

jMenu1.setText("jMenu1");

jMenu2.setText("jMenu2");

59
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("STOCK MANAGEMENT");
setBackground(new java.awt.Color(204, 255, 255));
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
getContentPane().setLayout(null);

jButton1.setBackground(new java.awt.Color(255, 102, 102));


jButton1.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
jButton1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\vendor.p
ng")); // NOI18N
jButton1.setText("Vendor");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(620, 53, 340, 80);

jButton2.setBackground(new java.awt.Color(0, 204, 51));


jButton2.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\product.
png")); // NOI18N
jButton2.setText("Product");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2);
jButton2.setBounds(1020, 233, 310, 80);

jButton3.setBackground(new java.awt.Color(255, 204, 102));


jButton3.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
jButton3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\Purchase
.png")); // NOI18N
jButton3.setText(" Purchase");
jButton3.setMaximumSize(new java.awt.Dimension(147, 73));
jButton3.setMinimumSize(new java.awt.Dimension(147, 73));
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}

60
});
getContentPane().add(jButton3);
jButton3.setBounds(70, 183, 310, 80);

jButton4.setBackground(new java.awt.Color(255, 255, 102));


jButton4.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
jButton4.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\Sales.pn
g")); // NOI18N
jButton4.setText("Sales");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
getContentPane().add(jButton4);
jButton4.setBounds(140, 480, 320, 80);

jLabel2.setBackground(new java.awt.Color(255, 255, 255));


jLabel2.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
jLabel2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\stock.pn
g")); // NOI18N
jLabel2.setText(" ");
getContentPane().add(jLabel2);
jLabel2.setBounds(260, 40, 1030, 590);

jButton5.setBackground(new java.awt.Color(102, 153, 255));


jButton5.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N
jButton5.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\out.png"
)); // NOI18N
jButton5.setText("Logout");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
getContentPane().add(jButton5);
jButton5.setBounds(780, 510, 340, 80);

jMenu4.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\services.
png")); // NOI18N
jMenu4.setText("Additional Services");

61
jMenuItem1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\notepad.
png")); // NOI18N
jMenuItem1.setText("Notepad");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem1);

jMenuItem2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\calculato
r.png")); // NOI18N
jMenuItem2.setText(" Calculator");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem2);

jMenuItem3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\google.p
ng")); // NOI18N
jMenuItem3.setText("Google");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem3);

jMenuBar1.add(jMenu4);

setJMenuBar(jMenuBar1);

setSize(new java.awt.Dimension(1391, 721));


setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton4ActionPerformed
Sales s = new Sales();
s.setVisible(true);
}//GEN-LAST:event_jButton4ActionPerformed

62
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jButton1ActionPerformed
vendor v = new vendor();
v.setVisible(true);

}//GEN-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton2ActionPerformed

product p = new product();


p.setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
Purchase p = new Purchase();
p.setVisible(true);

}//GEN-LAST:event_jButton3ActionPerformed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton5ActionPerformed
System.exit(0);
}//GEN-LAST:event_jButton5ActionPerformed

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jMenuItem1ActionPerformed
try{
Runtime.getRuntime().exec("notepad.exe");
}catch(Exception e){ }
}//GEN-LAST:event_jMenuItem1ActionPerformed

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jMenuItem2ActionPerformed
try{
Runtime.getRuntime().exec("calc.exe");
}catch(Exception e){ }
}//GEN-LAST:event_jMenuItem2ActionPerformed

private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jMenuItem3ActionPerformed
try{
Desktop.getDesktop().browse(new URL("https://www.google.com/").toURI());

63
}catch(Exception e){ }
}//GEN-LAST:event_jMenuItem3ActionPerformed

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("FlatLaf Light".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new main().setVisible(true);
}
});
}

// Variables declaration - do not modify//GEN-BEGIN:variables


private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;

64
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
private javax.swing.JLabel jLabel2;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JPopupMenu jPopupMenu1;
// End of variables declaration//GEN-END:variables
}

6.Sales
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package stock;

import java.awt.event.KeyEvent;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
*
* @author Guide
*/
public class Sales extends javax.swing.JFrame {

/**
* Creates new form Sales
*/
public Sales() {
initComponents();

65
Connect();

}
Connection con;
PreparedStatement pst;
PreparedStatement pst1;
PreparedStatement pst2;
DefaultTableModel df;
ResultSet rs;

public void Connect()


{
try{
Class.forName("com.mysql.cj.jdbc.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost:3306/stockmanagement","root","IITm@tech0");
//.createStatement();

}catch(ClassNotFoundException | SQLException ex) {


java.util.logging.Logger.getLogger(vendor.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}

public void barcode()


{
try {
String pcode = txtpcode.getText();

pst = con.prepareStatement("select * from product where barcode=?");


pst.setString(1, pcode);
rs = pst.executeQuery();

if(rs.next() == false)
{
JOptionPane.showMessageDialog(this,"BarCode Not Found");
txtpcode.setText("");
}

else
{
String pname = rs.getString("pname");
String price = rs.getString("rprice");

66
txtpname.setText(pname.trim());
txtprice.setText(price.trim());
txtqty.requestFocus();
}

} catch (SQLException ex) {


Logger.getLogger(Purchase.class.getName()).log(Level.SEVERE, null, ex);
}
}

public void Sales()


{

try {
String pcode =txtpcode.getText();

pst = con.prepareStatement("Select * from product where barcode = ?");


pst.setString(1, pcode);
rs = pst.executeQuery();

while(rs.next())
{
int currentqty;
currentqty = rs.getInt("qty");

int price = Integer.parseInt(txtprice.getText());


int qty = Integer.parseInt(txtqty.getText());

int tot = price*qty;

if(qty >= currentqty)


{
JOptionPane.showMessageDialog(this, "Qty Not Enough!!!!!!!!!");
}

else
{

df = (DefaultTableModel)jTable1.getModel();
df.addRow(new Object[]
{
txtpcode.getText(),
txtpname.getText(),

67
txtprice.getText(),
txtqty.getText(),
tot
});

int sum = 0;

for(int i=0;i<jTable1.getRowCount();i++)
{
sum=sum+Integer.parseInt(jTable1.getValueAt(i,4).toString());
}

txttcost.setText(String.valueOf(sum));

txtpcode.setText("");
txtpname.setText("");
txtprice.setText("");
txtqty.setText("");
} catch (SQLException ex) {
Logger.getLogger(Sales.class.getName()).log(Level.SEVERE, null, ex);
}
}

public void add() //throws ParseException


{
try {
DateTimeFormatter dt = DateTimeFormatter.ISO_DATE_TIME;
LocalDateTime now = LocalDateTime.now();
String date = dt.format(now);
String subtotal = txttcost.getText();
String pay = txtpay.getText();
String bal = txtbal.getText();
int lastid=0;
String query1 = "Insert into sales(date,subtotal,pay,bal) values(?,?,?,?)";
pst = con.prepareStatement(query1,Statement.RETURN_GENERATED_KEYS);
pst.setString(1, date);

68
pst.setString(2, subtotal);
pst.setString(3, pay);
pst.setString(4, bal);

pst.executeUpdate();
rs=pst.getGeneratedKeys();

if(rs.next())
{
lastid = rs.getInt(1);
}

String query2 = "insert into sales_product(sales_id,pid,price,qty,total)values(?,?,?,?,?)";


pst1 = con.prepareStatement(query2);

String productid;
String price;
String qty;
int total = 0;

for(int i=0; i<jTable1.getRowCount();i++)


{
productid = (String)jTable1.getValueAt(i,0);
price = (String)jTable1.getValueAt(i,2);
qty = (String)jTable1.getValueAt(i,3);
total = (int)jTable1.getValueAt(i,4);

pst1.setInt(1,lastid);
pst1.setString(2,productid);
pst1.setString(3,price);
pst1.setString(4,qty);
pst1.setInt(5,total);
pst1.executeUpdate();

String query3 = "update product set qty = qty-? where barcode=?";


pst2 = con.prepareStatement(query3);
for(int i=0; i<jTable1.getRowCount();i++)
{
productid = (String)jTable1.getValueAt(i,0);
qty = (String)jTable1.getValueAt(i,3);

pst2.setString(1,qty);

69
pst2.setString(2,productid);
pst2.executeUpdate();
}

JOptionPane.showMessageDialog(this, "Sales Completeddddddd...........");

} catch (SQLException ex) {


Logger.getLogger(Purchase.class.getName()).log(Level.SEVERE, null, ex); } }
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

jLabel1 = new javax.swing.JLabel();


jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
txtpcode = new javax.swing.JTextField();
txtpname = new javax.swing.JTextField();
txtprice = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel7 = new javax.swing.JLabel();
txtqty = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txttcost = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
txtpay = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
txtbal = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
getContentPane().setLayout(null);

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jLabel1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\salescoin
.png")); // NOI18N
jLabel1.setText(" Sales");
getContentPane().add(jLabel1);

70
jLabel1.setBounds(80, 10, 150, 40);

jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel2.setText("Product Code");

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel4.setText("Product Name");

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel5.setText("Price");

txtpcode.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtpcode.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txtpcodeKeyPressed(evt);
}
});

txtpname.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

txtprice.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtprice.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtpriceActionPerformed(evt);
}
});

jButton1.setBackground(new java.awt.Color(204, 255, 255));


jButton1.setText("Add");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {

},
new String [] {
"Product Code", "Product Name", "Price", "Qty", "Total"
}
));

71
jScrollPane1.setViewportView(jTable1);

jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel7.setText("Qty");

txtqty.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtqty.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtqtyActionPerformed(evt);
}
});

jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel8.setText("Total Cost");

txttcost.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txttcost.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txttcostActionPerformed(evt);
}
});
txttcost.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txttcostKeyPressed(evt);
}
});

jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel9.setText("Payment");

txtpay.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


jLabel10.setText("Balance");

txtbal.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N


txtbal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtbalActionPerformed(evt);
}
});

jButton2.setBackground(new java.awt.Color(204, 255, 255));


jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\add.png"
)); // NOI18N

72
jButton2.setText("Add");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setBackground(new java.awt.Color(255, 204, 255));


jButton3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\icons8-
close-16.png")); // NOI18N
jButton3.setText("Close");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);


jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txtpcode, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(txtpname, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(44, 44, 44)
.addComponent(jLabel5))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19,
Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

73
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(107, 107, 107))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addComponent(txtqty, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40)))
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 88,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(138, 138, 138))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 576,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 126,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 110,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(70, 70, 70)
.addComponent(jLabel8))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(52, 52, 52)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtpay, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txttcost, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtbal, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel10))))))
.addGap(20, 20, 20))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()

74
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtpcode, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpname, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtprice, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtqty, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(22, 22, 22))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)))
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(txttcost, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtpay, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtbal, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67,
Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)

75
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(44, 44, 44))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 182,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);

getContentPane().add(jPanel1);
jPanel1.setBounds(80, 70, 834, 420);

jLabel3.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Guide\\Documents\\NetBeansProjects\\stockmanagement\\src\\icon\\sales
screen.png")); // NOI18N
getContentPane().add(jLabel3);
jLabel3.setBounds(-50, -150, 1010, 850);

jLabel6.setBackground(new java.awt.Color(255, 255, 255));


getContentPane().add(jLabel6);
jLabel6.setBounds(-6, 0, 990, 540);

setSize(new java.awt.Dimension(1002, 582));


setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents

private void txtpcodeKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtpcodeKeyPressed

if(evt.getKeyCode() == KeyEvent.VK_ENTER)
{
barcode();
}
}//GEN-LAST:event_txtpcodeKeyPressed

private void txtpriceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtpriceActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtpriceActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton1ActionPerformed
Sales();
}//GEN-LAST:event_jButton1ActionPerformed

private void txtqtyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtqtyActionPerformed

76
// TODO add your handling code here:
}//GEN-LAST:event_txtqtyActionPerformed

private void txttcostActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txttcostActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txttcostActionPerformed

private void txttcostKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txttcostKeyPressed


// TODO add your handling code here:
}//GEN-LAST:event_txttcostKeyPressed

private void txtbalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_txtbalActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtbalActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton2ActionPerformed

int pay = Integer.parseInt(txtpay.getText());


int subtotal = Integer.parseInt(txttcost.getText());

int bal = subtotal-pay;

txtbal.setText(String.valueOf(bal));

add();
}//GEN-LAST:event_jButton2ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-


FIRST:event_jButton3ActionPerformed
this.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("FlatLaf Light".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Sales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

77
java.util.logging.Logger.getLogger(Sales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Sales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Sales.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Sales().setVisible(true); } }); }
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txtbal;
private javax.swing.JTextField txtpay;
private javax.swing.JTextField txtpcode;
private javax.swing.JTextField txtpname;
private javax.swing.JTextField txtprice;
private javax.swing.JTextField txtqty;
private javax.swing.JTextField txttcost;
}

78
Output Screens
Outputs of all modules are given below sequencially :-

1.Login

2.Main

79
3.Vendor

4.Purchase

80
5.Product

6.Sales

81
CHAPTER.5 CONCLUSION

To conclude,

1. Stock Management System is a simple desktop based application basically suitable for small
organization.

2. It has every basic items which are used for the small organization.

3. Here, we can update, insert and delete the item as per the requirement.

4. Through it has some limitations, we strongly believes that the implementation of this system will
surely benefit the organization.

82
Bibliography

Following books and eBook are used to complete this project reports.
I. Mastering JAVA Neat Beans
a. Author Tata McGraw-Hill’s
b. Publisher Black Book Publication
II. Oracle The Complete Reference
a. Author Robert Koch
b. Publication Tata McGraw-Hill
III. SQL, PL/SQL The Programming Language of Oracle
a. Author Ivan Bayross
b. Publication BPB Publication
IV. Software Engineering Apractitioner’s Approach
a. Author Roger S. Pressman
b. Publication Tata McGraw-Hill
V. Fundamentals of Software Engineering
a. Author Carlo Ghezzi, Mehdi Jazayeri, DinoMandrioli
b. Publisher Prentice Hall of India

83

You might also like