Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

DAVY SUPERMARKET

OAKRIDGE INTERNATIONAL SCHOOL

VISAKHAPATNAM

YEAR 2019-20

Page No:- 1 / 30 DAVY Supermarket Inventory Management


CERTIFICATE

Certified that this is the bonafide record work done


by Ms/Mr
of class XII bearing the registration number
Studying in OAKRIDGE INTERNATIONAL
SCHOOL has successfully completed the project in
Informatics Practices during the academic year
2019-20, towards partial fulfilment of his/her
academic course.

Internal Examiner

External Examiner

Page No:- 2 / 30 DAVY Supermarket Inventory Management


ACKNOWLEDGEMENT

The success and final outcome of this project required a lot of guidance and
assistance from many people and I am extremely privileged to have got this
all along the completion of my project, but also throughout the academic year
of 2019-2020. All that I have done is only due to such supervision and
assistance and I would not forget to thank them.

I would like to take this opportunity to thank Ms. I.Sree Geeta, my


Informatics Practices teacher, to have provided me with such a great
opportunity to work on this project. I am so grateful to my teacher for being
so supportive. This project would not have been such a success without her
contribution and guidance.

I would also like to thanks my family and friends who helped me in some or
the other manner in successful completion of this project

Page No:- 3 / 30 DAVY Supermarket Inventory Management


Front-End Application Software

Page No:- 4 / 30 DAVY Supermarket Inventory Management


Back-End Data base

Page No:- 5 / 30 DAVY Supermarket Inventory Management


AIM

The purpose of the project is to provide an


Inventory control system that provides the
complete inventory information about all the goods
and products being sold at DAVY Super market.

It enables the user to retrieve, add, delete and


update information about the products in stock.
Thus making an easy to use application to organize
the inventory through the frontend.

Page No:- 6 / 30 DAVY Supermarket Inventory Management


ABSTRACT

This tool requires an RDBMS, which is used to


store the information and MySQL is the preferred
software for maintaining the data. It maintains the
information in the table form so that it can be
accessed easily.

In this client side we will be using Java Net beans


8.2 providing the user interface. The requests of the
client are made in the interface, which connect to
the tables created in MySQL for getting the current
information.

The application is made user friendly.

Page No:- 7 / 30 DAVY Supermarket Inventory Management


The basic structure and contents of the tables are as
follows:

drop database DAVY;

create database DAVY;

use DAVY;

create table item

(I_code int(5) primary key,

Item_Name varchar(60),

price decimal(7,2),

Quantity int(5));

create table login

(id varchar(20) primary key,

password varchar(20)

);

insert into item values(1001,'Pencil',10,5);

insert into item values(1002,'Curd',25,20);

insert into item values(1003,'Bread',50,10);

insert into item values(1004,'Jam',100,30);

insert into item values(1005,'Lays',20,45);

insert into item values(1006,'Coca Cola',35,40);

insert into item values(1007,'Kinley Water Bottle 1 ltr',20,50);

insert into item values(1008,'SunSilk 600ML Shampoo',350,20);

Page No:- 8 / 30 DAVY Supermarket Inventory Management


insert into item values(1009,'Lifebuoy Soap',30,50);

insert into item values(1010,'Pepsodent',60,50);

insert into item values(111,'Mouse',500,10);

insert into login values(“dhruv”,“dhruv”);

insert into login values(“oakridge”,“oakridge”);

insert into login values('ananya','ananya');

insert into login values('yash','yash');

insert into login values('vasu','vasu');

insert into login values('guest','guest');

Page No:- 9 / 30 DAVY Supermarket Inventory Management


Page No:- 10 / 30 DAVY Supermarket Inventory Management
Project Explorer

Page No:- 11 / 30 DAVY Supermarket Inventory Management


Login Form.java

Coding
import com.mysql.jdbc.Connection;

import com.mysql.jdbc.Statement;

import java.sql.*;

import javax.swing.JOptionPane;

private void LogInBActionPerformed(java.awt.event.ActionEvent evt) {

InvalidL.setText("");

String PWord = PassWordTF.getText();

String ID = IDTF.getText();

String str = null;

Page No:- 12 / 30 DAVY Supermarket Inventory Management


Statement stmt=null;

ResultSet rs = null;

try {

Class.forName("java.sql.Driver");

String database = "jdbc:mysql://localhost:3306/davy";

Connection conn = (Connection) DriverManager.getConnection(database,


"root", "oakridge");

stmt = (Statement) conn.createStatement();

String sql = "select * from LogIn where ID = '" + ID + "'";

rs = stmt.executeQuery(sql);

rs.next();

str = rs.getString("Password");

rs.close();

stmt.close();

conn.close();

if(str.equals(PWord))

Home_Page k=new Home_Page();

k.setVisible(true);

this.setVisible(false);

else

InvalidL.setText("" +"Sorry! Incorrect Login id/Password!Login Denied..");

PassWordTF.setText("");

IDTF.setText("");

Page No:- 13 / 30 DAVY Supermarket Inventory Management


IDTF.requestFocus();

} catch (Exception e)

JOptionPane.showMessageDialog(this, "Error in connectivity");

Page No:- 14 / 30 DAVY Supermarket Inventory Management


Main Menu.java

Coding

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


Display_Items t=new Display_Items();
t.setVisible(true);
this.setVisible(false);
}

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


Search_Items t=new Search_Items();
t.setVisible(true);
this.setVisible(false);
}

Page No:- 15 / 30 DAVY Supermarket Inventory Management


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Add_Items k= new Add_Items();
k.setVisible(true);
this.setVisible(false);
}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {


Delete_Item t=new Delete_Item();
t.setVisible(true);
this.setVisible(false);
}

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


Update_Item t=new Update_Item();
t.setVisible(true);
this.setVisible(false);
}

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


System.exit(0);
}

Page No:- 16 / 30 DAVY Supermarket Inventory Management


Inventory Stock Entry.java

Coding
import java.sql.*;

private void cmdaddActionPerformed(java.awt.event.ActionEvent evt) {


try
{
Class.forName("java.sql.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/davy","root","oakri
dge");
Statement stmt = con.createStatement();
String a = txt1.getText();
String b = txt2.getText();
String c = txt3.getText();
String d = txt4.getText();
String query
="insert into Item values("+a+",\""+b+"\",\""+c+"\",\""+d+"\");";
stmt.executeUpdate(query);
jOptionPane1.showMessageDialog(this,"Record successfully added");

Page No:- 17 / 30 DAVY Supermarket Inventory Management


txt1.setText("");
txt2.setText("");
txt3.setText("");
txt4.setText("");
txt1.requestFocus();
}
catch(Exception e)
{
jOptionPane1.showMessageDialog(this,"Item code Repeated");
txt1.requestFocus();
}
}

private void cmdhomeActionPerformed(java.awt.event.ActionEvent evt) {


Home_Page b= new Home_Page();
b.setVisible(true);
this.setVisible(false);

Page No:- 18 / 30 DAVY Supermarket Inventory Management


Search and Delete Item.java

Coding
public class Delete_Item extends javax.swing.JFrame {

Connection con = null;

Statement stmt = null;

ResultSet rs = null;

public Delete_Item() {

initComponents();

private void cmdsearchActionPerformed(java.awt.event.ActionEvent evt) {

try{

Class.forName("java.sql.Driver");

Page No:- 19 / 30 DAVY Supermarket Inventory Management


con=DriverManager.getConnection("jdbc:mysql://localhost/davy","root","oakri
dge");

stmt=con.createStatement();

String query="Select * from Item where I_code ="+txt1.getText()+";";

rs=stmt.executeQuery(query);

if(rs.next())

String a=rs.getString("I_Code");

String b=rs.getString("Item_name");

String c=rs.getString("price");

String d=rs.getString("quantity");

txt2.setText(b);

txt3.setText(c);

txt4.setText(d);

cmddelete.setEnabled(true);

txt2.setEditable(false);

txt3.setEditable(false);

txt4.setEditable(false);

} else

txt2.setText("");

txt3.setText("");

txt4.setText("");

JOptionPane.showMessageDialog(this,"No Such Records Found");

Page No:- 20 / 30 DAVY Supermarket Inventory Management


}catch (Exception e)

JOptionPane.showMessageDialog(this, "Error in connectivity");

private void cmdmainmenuActionPerformed(java.awt.event.ActionEvent evt) {

Home_Page a=new Home_Page();

a.setVisible(true);

this.setVisible(false);// TODO add your handling code here:

private void formWindowActivated(java.awt.event.WindowEvent evt) {

cmdsearch.setVisible(false); // TODO add your handling code here:

private void txt1FocusLost(java.awt.event.FocusEvent evt) {

cmdsearch.doClick();

private void cmddeleteActionPerformed(java.awt.event.ActionEvent evt) {

int res = JOptionPane.showConfirmDialog(this,"Are you sure you want to


delete?");

if (res == JOptionPane.YES_OPTION)

try

Page No:- 21 / 30 DAVY Supermarket Inventory Management


stmt = con.createStatement();

String query = "delete from item where I_code = "+txt1.getText();

stmt.executeUpdate(query);

JOptionPane.showMessageDialog(this,"Record successfully deleted");

catch(Exception e){

JOptionPane.showMessageDialog(this,"Error in record Deletion");

txt2.setText("");

txt3.setText("");

txt4.setText("");

Page No:- 22 / 30 DAVY Supermarket Inventory Management


Inventory Details.java

Coding
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;

private void cmddisplayActionPerformed(java.awt.event.ActionEvent evt) {


try {
DefaultTableModel model = (DefaultTableModel)
itemtable.getModel();
Class.forName("java.sql.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/davy","root","oakri
dge");
Statement stmt=con.createStatement();
String query="Select * from item;";
ResultSet rs=stmt.executeQuery(query);

Page No:- 23 / 30 DAVY Supermarket Inventory Management


while (rs.next()) {
String a=rs.getString("I_code");
String b=rs.getString("Item_name");
String c=rs.getString("Price");
String d=rs.getString("quantity");
model.addRow(new Object[] {a,b,c,d});
}
rs.close();
stmt.close();
con.close();
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Error in connectivity");
}
}

private void cmdhomeActionPerformed(java.awt.event.ActionEvent evt) {


Home_Page k= new Home_Page();
k.setVisible(true);
this.setVisible(false);
}

private void cmdclearActionPerformed(java.awt.event.ActionEvent evt) {


DefaultTableModel model= (DefaultTableModel) itemtable.getModel();
int rows = model.getRowCount();
if(rows>0)
for(int i =0; i<rows; i++)
{
model.removeRow(0);
}
}

Page No:- 24 / 30 DAVY Supermarket Inventory Management


Search_Item.java

Coding
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.JOptionPane;

public class Search_Items extends javax.swing.JFrame {


Connection con = null;
Statement stmt = null;
ResultSet rs = null;

private void cmdsearchActionPerformed(java.awt.event.ActionEvent evt) {


try{
Class.forName("java.sql.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost/davy","root","oakri
dge");
stmt=con.createStatement();
String query="Select * from item where I_Code ="+txt1.getText()+";";
rs=stmt.executeQuery(query);

Page No:- 25 / 30 DAVY Supermarket Inventory Management


if(rs.next())
{
String a=rs.getString("I_Code");
String b=rs.getString("Item_Name");
String c=rs.getString("price");
String d=rs.getString("Quantity");
txt2.setText(b);
txt3.setText(c);
txt4.setText(d);
txt2.setEditable(false);
txt3.setEditable(false);
txt4.setEditable(false);
}
else
{
txt2.setText("");
txt3.setText("");
txt4.setText("");
txt1.requestFocus();
JOptionPane.showMessageDialog(this,"No Such Records Found");
}

}catch (Exception e)
{
JOptionPane.showMessageDialog(this, "Error in connectivity");
}
}

private void cmdhomeActionPerformed(java.awt.event.ActionEvent evt) {


Home_Page a=new Home_Page();
a.setVisible(true);
this.setVisible(false);
}

Page No:- 26 / 30 DAVY Supermarket Inventory Management


Modify Item Details.java

Coding
import java.sql.*;

private void txt1FocusLost(java.awt.event.FocusEvent evt) {


cmdsearch.doClick();
}

private void cmdupdateActionPerformed(java.awt.event.ActionEvent evt) {


int res = jOptionPane1.showConfirmDialog(this,"Are you sure you want
to update?");
if (res == jOptionPane1.YES_OPTION)
try
{
String n=txt2.getText();
double p=Double.parseDouble(txt3.getText());
int q=Integer.parseInt(txt4.getText());
stmt = con.createStatement();
String query = "update item set Item_name = '"+n+"', price="+p+",
quantity="+q+" where i_code="+txt1.getText()+";";
System.out.println(query);
stmt.executeUpdate(query);

Page No:- 27 / 30 DAVY Supermarket Inventory Management


jOptionPane1.showMessageDialog(this,"Record updated successfully");
}
catch(Exception e){
jOptionPane1.showMessageDialog(this,"Error in record updation");
}
txt2.setText("");
txt3.setText("");
txt4.setText("");
txt1.requestFocus();

private void cmdhomeActionPerformed(java.awt.event.ActionEvent evt) {


Home_Page a=new Home_Page();
a.setVisible(true);
this.setVisible(false);
}

private void cmdsearchActionPerformed(java.awt.event.ActionEvent evt) {


try{
Class.forName("java.sql.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost/davy","root","oakri
dge");
stmt=con.createStatement();
String query="Select * from Item where I_code ="+txt1.getText()+";";
rs=stmt.executeQuery(query);
if(rs.next())
{
String a=rs.getString("I_Code");
String b=rs.getString("Item_name");
String c=rs.getString("price");
String d=rs.getString("quantity");
txt2.setText(b);
txt3.setText(c);
txt4.setText(d);
cmdupdate.setEnabled(true);
}
else

Page No:- 28 / 30 DAVY Supermarket Inventory Management


{
txt2.setText("");
txt3.setText("");
txt4.setText("");
jOptionPane1.showMessageDialog(this,"No Such Records Found");
}

}catch (Exception e)
{
jOptionPane1.showMessageDialog(this, "Error in connectivity");
}
}

Page No:- 29 / 30 DAVY Supermarket Inventory Management


BIBLIOGRAPHY
● Informatics Practices by Sumita Arora
● Move Fast with IP By Sumita Arora
● Together With IP by Rachana Sagar
● Informatic Practices by Preeti Arora
● www.Google.co.in

End

Page No:- 30 / 30 DAVY Supermarket Inventory Management

You might also like