0% found this document useful (0 votes)
61 views23 pages

AJP

The document describes a Java-based inventory management system for food and beverages. It allows users to add, delete, update, and view product inventory information. Products are identified by ID and details like name, cost, and quantity in stock can be managed. Buttons allow refreshing the display after changes or showing all records. The system aims to improve customer service and resolve issues quickly by managing inventory.

Uploaded by

mohit more
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views23 pages

AJP

The document describes a Java-based inventory management system for food and beverages. It allows users to add, delete, update, and view product inventory information. Products are identified by ID and details like name, cost, and quantity in stock can be managed. Buttons allow refreshing the display after changes or showing all records. The system aims to improve customer service and resolve issues quickly by managing inventory.

Uploaded by

mohit more
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

ABSTRACT

We have created an system using java. In Which the food beverages are added ,
deleted , updated, Refresh And sell. We are using product id for saving different id for
different product . And Flavour is used for saving different product name like mango, Apple.
& cost per unit is used for number of product items, & Units in stock is used for it will be
displayed how many number of product are there. The Refresh button is used for whenever
we deleted, updated or added any info then we click on refresh button its saves all changes.
The add button is used for added all information about product id, Delete button is used for
deleted a particular record. The update button is used for we updated a particular stock its
updated all info automatically

1|P age
INTRODUCTION

An inventory management is a technique that's based on putting products into categories in


order of importance, with A being the most valuable products and C being the least valuable.
At its most basic, taking bar inventory is the process of counting everything you have twice.
Then, you figure out how much of it you used over that period of time. That's known as
calculating inventory usage. Based on your inventory usage, you calculate your variance, pour
cost, and par levels. Food waste costs companies millions each year in disposal costs and
reordering. The issue is compounded today by customer expectations for rapid introduction
of new products, ingredients and recipes

We have created an system using java. In Which the food beverages are added ,
deleted , updated, Refresh And sell. We are using product id for saving different id for
different product . And Flavour is used for saving different product name like mango, Apple.
& cost per unit is used for number of product items, & Units in stock is used for it will be
displayed how many number of product are there. The Refresh button is used for whenever
we deleted, updated or added any info then we click on refresh button its saves all changes.
The add button is used for added all information about product id, Delete button is used for
deleted a particular record. The update button is used for we updated a particular stock its
updated all info automatically. And sell button is used for sell the product. Show all button is
used for show all info about added records, deleted records, updated records, selled records
successfully. Its improve customer services and resolve the problem quickly

2|P age
SYSTEM REQUIREMENTS

Hardware Requirement :-

Pc or laptop having hard disk up to atleast 2 GB.

Software Requirement :-

Java jdk 1.8 installed in laptop.

3|P age
CODE

import java.sql.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.JFrame;

import javax.swing.*;

class BeverageInventoryManagement implements ActionListener,ItemListener

Frame f1,f2;

JFrame frame,frame2;

Choice c1;

Button b,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12; //b12 add a textfield

TextField t1,t2,t3,t4,t5,t6,t7,t8;

Dialog d1;

//ResultSet rs;

Label l1,l2,l3,l4,l5,l6,l7,l8;

JLabel l9;

Color clr1 = new Color(51, 255, 153);

Color clr2 = new Color(166, 166, 166);

Color clr3 = new Color(153, 153, 153);

BeverageInventoryManagement()

l9=new JLabel("<html>Beverage Iventory Management System<br> </html>");

4|P age
l9.setBounds(100,50,200,100);

d1 = new Dialog(frame,"Project Info",true);

d1.setLayout(null);

b = new Button ("OK");

b.setBounds(150,200,20,20);

b.addActionListener ( new ActionListener()

public void actionPerformed( ActionEvent e )

d1.setVisible(false);

});

d1.add(l9);

d1.add(b);

d1.setBounds(600,300,350,300);

frame = new CurrentStock();

frame.setTitle("Current Stock");

frame.setSize(500, 300);

frame.setLocationRelativeTo(null);

frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

frame2 = new log();

frame2.setTitle("Sales Log");

frame2.setSize(500, 300);

frame2.setLocationRelativeTo(null);

frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

f1=new Frame("");

5|P age
f1.setLayout(null);

f1.setBounds(50,50,800,800);

f1.setBackground(clr1);

c1=new Choice();

c1.add("Select Genre");

c1.setBounds(50,100,150,50);

c1.addItemListener(this);

b1=new Button("Refresh");

b1.setBounds(50,500,150,50);

b2=new Button("Delete");

b2.setBounds(250,500,150,50);

b3=new Button("Add");

b3.setBounds(450,500,150,50);

b7=new Button("Update");

b7.setBounds(50,600,150,50);

b8 = new Button("Sell");

b8.setBounds(250,600,150,50);

b9 = new Button("Exit");

b9.setBounds(250,700,150,50);

b10 = new Button("Show All");

b10.setBounds(450,600,150,50);

b11 = new Button("Sales log");

b11.setBounds(50,700,150,50);

b12 = new Button("More Info");

6|P age
b12.setBounds(450,700,150,50);

t1=new TextField ();

t1.setBounds(400,100,100,30);

t1.setBackground(clr2);

t2=new TextField ();

t2.setBounds(400,200,100,30);

t2.setBackground(clr2);

t3=new TextField ();

t3.setBounds(400,300,100,30);

t3.setBackground(clr2);

t7=new TextField();

t7.setBounds(400,400,100,30);

t7.setBackground(clr2);

l5=new Label("Product Id");

l5.setBounds(250,100,150,50);

l6=new Label("Flavour");

l6.setBounds(250,200,150,50);

l7=new Label("Cost per Unit");

l7.setBounds(250,300,150,50);

l8=new Label("Units in Stock");

l8.setBounds(250,400,150,50);

f2=new Frame ("Add new Flavour");

f2.setLayout(null);

f2.setBounds(50,50,700,600);

7|P age
l1=new Label("Enter Id");

l1.setBounds(50,50,100,50);

l2=new Label("Enter Flavour");

l2.setBounds(50,150,100,50);

l3=new Label("Enter Cost");

l3.setBounds(50,250,100,50);

l4=new Label("Enter Quantity");

l4.setBounds(50,350,100,50);

t4=new TextField();

t4.setBounds(200,50,100,50);

t5=new TextField();

t5.setBounds(200,150,100,50);

t6=new TextField();

t6.setBounds(200,250,100,50);

t8=new TextField();

t8.setBounds(200,350,100,50);

b4=new Button("Save");

b4.setBounds(50,500,100,50);

b5=new Button("Exit");

b5.setBounds(200,500,100,50);

b6=new Button("Clear");

b6.setBounds(350,500,100,50);

b1.addActionListener(this);

b2.addActionListener(this);

8|P age
b3.addActionListener(this);

b4.addActionListener(this);

b5.addActionListener(this);

b6.addActionListener(this);

b7.addActionListener(this);

b8.addActionListener(this);

b9.addActionListener(this);

b10.addActionListener(this);

b11.addActionListener(this);

b12.addActionListener(this);

f1.add(t1);

f1.add(t2);

f1.add(t3);

f1.add(t7);

f1.add(c1);

f1.add(b1);

f1.add(b2);

f1.add(b3);

f1.add(b7);

f1.add(b8);

f1.add(b9);

f1.add(b10);

f1.add(b11);

f1.add(b12);

9|P age
f1.add(l5);

f1.add(l6);

f1.add(l7);

f1.add(l8);

f2.add(t4);

f2.add(t5);

f2.add(t6);

f2.add(t8);

f2.add(l1);

f2.add(l2);

f2.add(l3);

f2.add(l4);

f2.add(b4);

f2.add(b5);

f2.add(b6);

f1.setVisible(true);

Load();

public void actionPerformed(ActionEvent ae)

try

if (ae.getSource()==b1)

Load();

10 | P a g e
else if(ae.getSource()==b2)

mydelete();

10

else if(ae.getSource()==b3)

add();

else if(ae.getSource()==b7)

updateValue();

else if(ae.getSource()==b8)

sellprocedure();

else if(ae.getSource()==b4)

modify();

else if(ae.getSource()==b10)

frame.setVisible(true);

11 | P a g e
else if(ae.getSource()==b11)

frame2.setVisible(true);

else if(ae.getSource()==b12)

d1.setVisible(true);

else if(ae.getSource()==b9)

f1.dispose();

else if(ae.getSource()==b5)

f2.dispose();

else if(ae.getSource()==b6)

t4.setText("");

t5.setText("");

t6.setText("");

catch (Exception e)

12 | P a g e
System.out.print(""+e);

public void itemStateChanged(ItemEvent ie)

int no1;

no1=Integer.parseInt(c1.getSelectedItem());

try

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

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","","");

Statement st=con.createStatement();

ResultSet rs;

String str;

str="select * from Drinks where Id="+no1;

rs=st.executeQuery(str);

rs.next();

t1.setText(rs.getInt(1)+"");

t2.setText(rs.getString(2));

t3.setText(rs.getInt(3)+"");

t7.setText(rs.getInt(4)+"");

rs.close();

con.close();

13 | P a g e
catch (Exception e)

System.out.print(""+e);

void Load()

try

c1.removeAll();

c1.add("Select Id");

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

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

Statement st=con.createStatement();

ResultSet rs;

String str;

str="select * from Drinks";

rs=st.executeQuery(str);

while(rs.next())

c1.add(+rs.getInt(1)+"");

13

rs.close();

14 | P a g e
con.close();

catch (Exception e)

System.out.print(""+e);

void mydelete()

int no1;

no1=Integer.parseInt(c1.getSelectedItem());

try

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

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

Statement st=con.createStatement();

ResultSet rs;

String str;

str="delete from Drinks where Id="+no1;

st.executeUpdate(str);

str="select * from Drinks";

rs=st.executeQuery(str);

rs.close();

con.close();

15 | P a g e
catch(Exception e)

System.out.print(""+e);

void updateValue()

String name;

int cost,id;

try{

id=Integer.parseInt(t1.getText());

name=t2.getText();

cost=Integer.parseInt(t3.getText());

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

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

Statement st=con.createStatement();

ResultSet rs;

String str;

str="UPDATE Drinks set Name='"+name+"',Cost='"+cost+"' where Id='"+id+"'";

st.executeUpdate(str);

catch (Exception e)

System.out.println("\n\t"+e);

16 | P a g e
}

void sellprocedure()

try{

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

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

CallableStatement st = con.prepareCall("{call sell()}");

st.execute();

catch (Exception e)

System.out.println("\n\t"+e);

void add()

f2.setVisible(true);

void modify()

int id,cost,units;

String name;

try

17 | P a g e
{

id=Integer.parseInt(t4.getText());

name=t5.getText();

cost=Integer.parseInt(t6.getText());

units=Integer.parseInt(t8.getText());

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

Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

Statement st=con.createStatement();

ResultSet rs;

String str;

str="insert into Drinks values ('"+id+"','"+name+"','"+cost+"','"+units+"')";

st.executeUpdate(str);

str="select * from Drinks";

rs=st.executeQuery(str);

/*while(rs.next())

System.out.print("\n\t Emp no="+rs.getInt(1));

System.out.print("\n\t Emp name="+rs.getString(2));

System.out.print("\n\t Emp age="+rs.getInt(3));

}*/

rs.close();

con.close();

Load();

18 | P a g e
catch (Exception e)

System.out.println("\n\t"+e);

public static void main (String args[])

new BeverageInventoryManagement();

import javax.swing.*;

import java.awt.*;

import javax.swing.table.DefaultTableModel;

import java.sql.*;

public class CurrentStock extends JFrame {

DefaultTableModel model = new DefaultTableModel();

Container cnt = this.getContentPane();

JTable jtbl = new JTable(model);

public CurrentStock() {

cnt.setLayout(new FlowLayout(FlowLayout.LEFT));

model.addColumn("Id");

model.addColumn("Name");

model.addColumn("Cost");

model.addColumn("Units");

try {

19 | P a g e
Class.forName("com.mysql.cj.jdbc.Driver");

Connection con =

DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

PreparedStatement pstm = con.prepareStatement("SELECT * FROM Drinks");

ResultSet Rs = pstm.executeQuery();

while(Rs.next()){

model.addRow(new Object[]{Rs.getInt(1),
Rs.getString(2),Rs.getInt(3),Rs.getInt(4)});

} catch (Exception e) {

System.out.println(e.getMessage());

JScrollPane pg = new JScrollPane(jtbl);

cnt.add(pg);

this.pack();

20 | P a g e
Output

21 | P a g e
Conclusion

We have created an Beverage Inventory Management system using java. In Which the food
beverages are added , deleted , updated, Refresh And sell. We are using product id for saving different
id for different product . And Flavour is used for saving different product name like mango, Apple. &
cost per unit is used for number of product items, & Units in stock is used for it will be displayed how
many number of product are there. The Refresh button is used for whenever we deleted, updated or
added any info then we click on refresh button its saves all changes. The add button is used for added
all information about product id, Delete button is used for deleted a particular record. The update
button is used for we updated a particular stock its updated all info automatically. And sell button is
used for sell the product. Show all button is used for show all info about added records, deleted
records, updated records, selled records successfully. Its improve customer services and resolve the
problem quickly

22 | P a g e
References

)1) www.javatpoint.com

2) www.google.com

3) www.edureka.com

4) www.udemy.com

23 | P a g e

You might also like