mini project-dbms & java

328
1 13IT451 - DATABASE MANAGEMENT SYSTEMS LAB 13IT452 - JAVA PROGRAMMING LAB MINI PROJECT REPORT PRINTING PRESS DATABASE MANAGEMENT SUBMITTED BY RAKHAV KRISHNA G [201406044] PAVITHRAN S [201406050] ESAKKI RAJA A [201406018] DEPARTMENT OF INFORMATION TECHNOLOGY MEPCO SCHLENK ENGINEERING COLLEGE (AUTONOMOUS) SIVAKASI. 2015-2016

Upload: rakhav-krishna-g

Post on 14-Apr-2017

160 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Mini project-DBMS & JAVA

1

13IT451 - DATABASE MANAGEMENT SYSTEMS LAB

13IT452 - JAVA PROGRAMMING LAB

MINI PROJECT REPORT

PRINTING PRESS DATABASE MANAGEMENT

SUBMITTED BY

RAKHAV KRISHNA G [201406044]

PAVITHRAN S [201406050]

ESAKKI RAJA A [201406018]

DEPARTMENT OF INFORMATION TECHNOLOGY

MEPCO SCHLENK ENGINEERING COLLEGE (AUTONOMOUS)

SIVAKASI.

2015-2016

Page 2: Mini project-DBMS & JAVA

2

CERTIFICATE

This is to Certify that it is the bonafide work done by

RAKHAV KRISHNA G , PAVITHRAN.S and ESAKKI RAJA A for

their Mini Project on PRINTING PRESS DATABASE MANAGEMENT

in 13IT451- DATABASE MANAGEMENT SYSTEMS & 13IT452 -

JAVA PROGRAMMING LAB at Mepco Schlenk Engineering

College, Sivakasi during the year 2015-2016.

.………………… …………………….. …………………………

Staff in charge Staff in charge Head of the Department

(DBMS LAB) (JAVA PROGRAMMING LAB)

Page 3: Mini project-DBMS & JAVA

3

ACKNOWLEDGEMENT

We have taken efforts in this project. However, it would not have been possible

without the kind support and help of many individuals and our reputed

institution Mepco Schlenk Engineering College, Sivakasi. We would like to

extend our sincere thanks to our Principal Dr. S. Arivazhagan ME., PhD.

We would like to express my special gratitude and thanks to Dr.T.Revathi ME.,

PhD. Senior Professor & Head of the Department for motivating us in doing the

mini project.

We are highly indebted to Mrs.S.Kavi Priya AP(Sr.Grade)/IT, Mrs.S.Haseena

AP/IT, Mr.J.Maruthupandi AP(Sr.Grade)/IT, Mrs.N.Malathy AP/IT,

Mr.S.Muthukumar AP/IT, and Mrs.S.Haseena AP/IT for their guidance and

constant supervision as well as for providing necessary information regarding

the project & also for their support in completing the project.

We would like to express our gratitude towards our technicians of IT

Department for their kind co-operation and encouragement which help us in

completing this project.

Page 4: Mini project-DBMS & JAVA

4

Page 5: Mini project-DBMS & JAVA

5

TABLE OF CONTENTS

1.Abstract 6

2.Goal of this project 8

3.Introduction 9

3.1 Specification 10

3.2 System Requirement 11

3.3 Hardware Requirement 12

4. ER-diagram 13

5. Schema diagram 15

6. Tables 17

7. Source Code 22

8. Screen Shots 285

9. Conclusion 327

Page 6: Mini project-DBMS & JAVA

6

ABSTRACT

Page 7: Mini project-DBMS & JAVA

7

PRINTING PRESS DATABASE MANAGEMENT

Printing Press Database Management is powerful,

flexible and easy to use and is designed and developed to

deliver real conceivable benefits to printing press. System

provides the benefits of enhanced administration and control,

improved response and profitability. This application will

make the printing press data’s more sensitive. By this we can

maintain the branch, manager, employee, customers, order

and finally stocks.Moreover this application will give a user

friendly environment.

Page 8: Mini project-DBMS & JAVA

8

The goals of this project:

To learn the code mechanics of designing tables and databases

To demonstrate mastery in solving concurrency problems

To gain further experience in quantitative system evaluation

To gain further experience in placing order

To study the concepts of connection back end and front end

To study the concept of java data base connectivity

To understand and gain knowledge about swing in java

Page 9: Mini project-DBMS & JAVA

9

Introduction:

The printing press database management involves maintaining

order history of the customer who placed order in the printing press.

The order consists of order details, order date, delivery date,

quantity, total for different customers. It also contains the history of stock

required and its supplier for different branch.

It has high preference for manager and low preference for

employee.

Page 10: Mini project-DBMS & JAVA

10

Specification:

Udupi Sri Krishna Offset Printers situated in

cheranmahadevi, Tirunelveli maintains the order details separate for

customers. Each customers has their own unique customer number. They

were identified by their customer name, mobile number, city. Their order

status were identified by order number. There are different branches and

its has different employees. Each employee has their own employee ID.

Employees are allowed to access the order details

And the branch manager can insert, modify and delete the order placed in

that branch.

Page 11: Mini project-DBMS & JAVA

11

Software Requirements:

ORACLE:

ORACLE is a multithreaded, multi-user SQL database

management system(DBMS). The basic program runs as a server

providing multi-user access to a number of databases.

DATABASE TABLES:

A database most often contains one or more tables. Each table is

identified by a name (e.g. “customers” or “orders” ). Tables contain

records (rows) with data.

QUERIES:

A query is a question or a request. With ORACLE, we can query a

database for specific information and have a record set returned.

JDK AND JRE:

We need java development toolkit and java runtime environment to

run a java program.

CREATE A CONNECTION TO A DATABASE:

Before you can access a data in a database, you must create a

connection to the database. In Java, this is done with the code Class.forName("oracle.jdbc.driver.OracleDriver"); Con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","username","password");

CLOSING CONNECTION:

The connection will be closed automatically when the script ends.

To close the connection before, use

Con.close();

CREATE A TABLE:

Tables typically contain data about a single subject. Each

table has a unique table name that signifies the contents of the table

SYNTAX:

CREATE TABLE <table_name> (<attribute_name1> <type>,

<attribute_name2> <type> ……);

Page 12: Mini project-DBMS & JAVA

12

Hardware requirements:

Table 2-1 Windows 32-Bit Hardware Requirements

Requirement Value

Physical memory (RAM) 1 GB minimum

Virtual memory Double the amount of RAM

Disk space Total: 4.76 GB

Processor 550 MHz minimum

(On Windows Vista, 800 MHz minimum)

Video adapter 256 colors

Table 2-2 Windows x64 Hardware Requirements

Requirement Value

Physical memory (RAM) 1 GB minimum

Virtual memory Double the amount of RAM

Disk space Total: 5.22 GB

Processor AMD64, or Intel Extended memory (EM64T)

Video adapter 256 colors

Page 13: Mini project-DBMS & JAVA

13

ER DIAGRAM

Page 14: Mini project-DBMS & JAVA

14

Page 15: Mini project-DBMS & JAVA

15

SCHEMA DIAGRAM

Page 16: Mini project-DBMS & JAVA

16

Page 17: Mini project-DBMS & JAVA

17

TABLES

Page 18: Mini project-DBMS & JAVA

18

Page 19: Mini project-DBMS & JAVA

19

PRINTING PRESS DATABASE TABLES:

Manager login:

This table is used to check if he is a manager of a branch or not

User login:

This table is for check if he is a employee of a branch or not.

Branch table:

This table is for storing branch details.

Page 20: Mini project-DBMS & JAVA

20

Supplier table:

This table is for storing the Supplier of this Company.

Product-supplier table:

This table is for storing the supplier details from whom the products has been

purchased. The Supplier are chosen from Company Supplier list.

Order table:

This table is for storing Order details of a particular Branch.

Page 21: Mini project-DBMS & JAVA

21

Product table:

This table is for storing product of a particular order.

Employee table:

This table is for storing Employee details of a Branch.

Customer table:

This table is for storing the details of the customer of a Branch.

Page 22: Mini project-DBMS & JAVA

22

Stock table:

This table is for maintaining the Stock Items of a Branch.

Stock –insertion table:

This table is for storing the Stock Item insertion details.

Page 23: Mini project-DBMS & JAVA

23

Source code

Page 24: Mini project-DBMS & JAVA

24

Login page:

package mini_project;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.*;

public class Login implements ActionListener{

JFrame f;

JLabel title,user,pass,store,signemp,power,power1;

JTextField username;

JPasswordField password;

JButton add,login,exit,forgot;

Connection con;

int flg=0,flg1=0,flag=0,flag1=0,flg2=1;

public static void main(String[] args) throws ClassNotFoundException,

SQLException{

Login l=new Login();

l.createLayout();

l.access();

}

public void setConnection() throws SQLException,

ClassNotFoundException {

Class.forName("oracle.jdbc.driver.OracleDriver");

con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe

","rakhav","1234");

}

public void access(){

exit.addActionListener(this);

add.addActionListener(this);

forgot.addActionListener(this);

login.addActionListener(this);

}

Page 25: Mini project-DBMS & JAVA

25

public void createLayout() throws ClassNotFoundException,

SQLException{

Class.forName("oracle.jdbc.driver.OracleDriver");

con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe

","rakhav","1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f=new JFrame();

f.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\digital.jpg")));

//Toolkit t=Toolkit.get

// Container c=f.getContentPane();

//c.setBackground(Color.orange);

store=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

store.setBounds(450,20,800,50);

signemp=new JLabel("*Sign up for new Employee");

signemp.setBounds(620,600,800,50);

f.add(signemp);

Font font = new Font("Algerian", Font.BOLD,30);

store.setFont(font);

f.add(store);

title=new JLabel("LOGIN PAGE");

title.setBounds(650,100,300,30);

Font font1 = new Font("Arial", Font.BOLD,20);

title.setFont(font1);

signemp.setFont(font1);

f.add(title);

// Icon image = new

ImageIcon("C:\\Users\\Pavi\\Downloads\\emblem.jpg");

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(365,17,72,77);

f.add(imagelabel);

user=new JLabel("Username ");

user.setBounds(500,200,500,30);

Font font2 = new Font("TimesNewRoman", Font.BOLD,20);

user.setFont(font2);

Page 26: Mini project-DBMS & JAVA

26

f.add(user);

username=new JTextField(20);

username.setBounds(650, 200, 300, 30);

f.add(username);

pass=new JLabel("Password ");

pass.setBounds(500,300,350,35);

f.add(pass);

pass.setFont(font2);

password = new JPasswordField(10);

password.setBounds(650, 300, 300, 30);

f.add(password);

power=new JLabel("Powered by,");

power.setBounds(1080,620,300,30);

Font f5=new Font("Blackadder ITC", Font.BOLD,30);

power.setForeground(Color.yellow);

power.setFont(f5);

f.add(power);

power1=new JLabel("Rakhav,Pavi,Esakki");

power1.setBounds(1080, 650, 300, 30);

power1.setFont(f5);

power1.setForeground(Color.YELLOW);

f.add(power1);

login=new JButton("Login");

login.setBounds(850,400,100, 30);

f.add(login);

add=new JButton("Sign up");

add.setBounds(650,400,100, 30);

f.add(add);

forgot=new JButton("Forgot Password??");

forgot.setBounds(720,500,200,30);

f.add(forgot);

exit=new JButton("Exit");

exit.setBounds(1200,50,100,30);

f.add(exit);

Page 27: Mini project-DBMS & JAVA

27

f.setSize(width,height);//400 width and 500 height

f.setLayout(null);//using no layout managers

f.setVisible(true);//making the frame visible

}

public void actionPerformed(ActionEvent e) {

String str=e.getActionCommand();

if(e.getSource()==exit)

f.dispose();

else if(str.equals("Sign up"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f.setVisible(false);

Signup sign=new Signup();

try {

sign.createlayout();

} catch (ClassNotFoundException | SQLException e1)

{

// TODO Auto-generated catch block

e1.printStackTrace();

}

sign.access();

}

else if(str.equals("Forgot Password??"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f.setVisible(false);

Forgotpass fp=new Forgotpass();

try {

fp.createlayout("summa");

Page 28: Mini project-DBMS & JAVA

28

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fp.access();

}

else if(str.equals("Login"))

{

Statement stmt;

String user=""+username.getText();

char pass[]=password.getPassword();

String pa=String.valueOf(pass);

if(user.equals("") && pa.equals(""))

{

flg=1;

}

if(user.equals("") && flg==0)

{

flag=1;

}

if(pa.equals("") && flg==0)

{

flag1=1;

}

if(flg==0 && flag==0 && flag1==0)

{

try {

stmt = con.createStatement();

ResultSet rs=stmt.executeQuery("select * from

manager_user where username='"+user+"' and

password='"+String.valueOf(pass)+"'");

Exception rakh = null;

if(rs.next())

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f.setVisible(false);

Page 29: Mini project-DBMS & JAVA

29

JOptionPane.showMessageDialog(null,"LOGIN

Successfully!! WELCOME MANAGER "+user+"");

First en=new First();

en.createlayout(user);

en.access();

}

else

try{

stmt = con.createStatement();

ResultSet rs2=stmt.executeQuery("select

* from users where username='"+user+"' and

password='"+String.valueOf(pass)+"'");

if(rs2.next())

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated

catch block

e2.printStackTrace();

}

f.setVisible(false);

JOptionPane.showMessageDialog(null,"LOGIN Successfully!!

WELCOME EMPLOYEE "+user+"");

First1 en=new First1();

en.createlayout(user);

en.access();

}

else

{

ResultSet

rs5=stmt.executeQuery("select * from users where username='"+user+"'");

if(rs5.next())

{

JOptionPane.showMessageDialog(null, "Invalid Password");

}

else

{

JOptionPane.showMessageDialog(null, "Invalid Username");

Page 30: Mini project-DBMS & JAVA

30

}

username.setText("");

password.setText("");

}

}

catch (SQLException e2) {

e2.printStackTrace();

} catch (ClassNotFoundException e3) {

// TODO Auto-generated catch block

e3.printStackTrace();

}

}

catch (SQLException e1) {

e1.printStackTrace();

} catch (ClassNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(flag==1)

{

JOptionPane.showMessageDialog(null, "Enter

Username");

flag=0;

}

else if(flag1==1)

{

JOptionPane.showMessageDialog(null, "Enter

Password");

flag1=0;

}

else

{

JOptionPane.showMessageDialog(null, "Enter

Username and Password");

flg=0;

}

}

}

}

Page 31: Mini project-DBMS & JAVA

31

Signup page:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.io.File;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.*;

public class Signup implements ActionListener {

/**

* @param args

*/

JFrame j;

JLabel

title,id,store,name,uname,pname,gname,bname,mno,city,salary,bno,hint,mail;

JPasswordField ppname;

JTextField []text=new JTextField[7];

JTextField t,t1;

JRadioButton radio1,radio2;

JFileChooser chooser;

String od;

JLabel pho;

char ch;

int flg=0,flg1=0,flg2=0;

JButton button1,button2,photo,change,exit,back,check;

JComboBox<Comparable> month,day,year,j1;

String

nname,username,password,sex,mon,sql,sql1,city1,salary1,id1,bid1,mai,hin;

int da,ye;

int flag=0,flag1=0;

long mobile;

Page 32: Mini project-DBMS & JAVA

32

Connection con;

int i=0,k=0;

String arry[]=new String[50];

private String[] mmonth = { "jan", "feb","mar","apr", "may", "jun", "jul",

"aug" , "sep", "oct", "nov", "dec"};

int []dday;

int []yyear;

String phname=null;

int setphoto=0;

int flg3=0;

int done=0,done1=0;

public void createlayout() throws SQLException,

ClassNotFoundException

{

j=new JFrame();

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

j.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\digital.jpg")));

store=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

store.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,25);

store.setFont(font);

j.add(store);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

j.add(imagelabel);

for(int i=1;i<7;i++)

text[i]= new JTextField(20);

title=new JLabel("CREATE ACCOUNT");

title.setBounds(530,30, 1000,50);

title.setFont(new Font("Comic Sans MS",Font.BOLD,20));

Page 33: Mini project-DBMS & JAVA

33

j.add(title);

name=new JLabel("Employee Name:");

name.setBounds(400,90,300,25);

j.add(name);

text[1].setBounds(500,90,300,25);

j.add(text[1]);

photo=new JButton(" +\n PHOTO");

photo.setBounds(1000,100,200,200);

j.add(photo);

photo.addActionListener(this);

change=new JButton("CHANGE");

change.setBounds(1050,400,100,50);

j.add(change);

change.setVisible(false);

chooser=new JFileChooser();

chooser.setCurrentDirectory(new File("."));

pho = new JLabel();

exit=new JButton("Exit");

exit.setBounds(1225,50,100,30);

j.add(exit);

back=new JButton("Back");

back.setBounds(100,680,100,30);

j.add(back);

id=new JLabel("Employee id:");

id.setBounds(400,135,300,25);

j.add(id);

text[6].setBounds(500,135,300,25);

j.add(text[6]);

uname=new JLabel("UserName:");

uname.setBounds(400,180,300,25);

j.add(uname);

text[2].setBounds(500,180,300,25);

j.add(text[2]);

check=new JButton("Check");

Page 34: Mini project-DBMS & JAVA

34

check.setBounds(850,180,100,25);

j.add(check);

pname=new JLabel("Password:");

ppname=new JPasswordField();

pname.setBounds(400,230,300,25);

j.add(pname);

ppname.setBounds(500,230,300,25);

j.add(ppname);

hint=new JLabel("Hint");

hint.setBounds(400,290,300,25);

j.add(hint);

t=new JTextField(20);

t.setBounds(500,290,300,25);

j.add(t);

mail=new JLabel("Mail ID:");

mail.setBounds(400,340,300,25);

j.add(mail);

t1=new JTextField(20);

t1.setBounds(500,340,300,25);

j.add(t1);

gname=new JLabel("Gender");

ButtonGroup group = new ButtonGroup();

radio1=new JRadioButton("Male",true);

group.add(radio1);

gname.setBounds(400,450,300,25);

j.add(gname);

radio1.setBounds(500,450,100,25);

j.add(radio1);

radio2=new JRadioButton("Female");

group.add(radio2);

radio2.setBounds(600,450,100,25);

j.add(radio2);

bname=new JLabel("DOB:");

bname.setBounds(400,400,300,25);

j.add(bname);

Page 35: Mini project-DBMS & JAVA

35

bno= new JLabel("Branch No:");

bno.setBounds(400,495,100,30);

j.add(bno);

j1=new JComboBox<Comparable>();

j1.setBounds(500,495,100,30);

j.add(j1);

String sql3=""+"select bid from Branch";

try {

Statement stmt3 = con.createStatement();

ResultSet rs3=stmt3.executeQuery(sql3);

while(rs3.next())

{

arry[k]=rs3.getString(1);

k++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

//arry[0]="BO1";

city=new JLabel("City");

city.setBounds(400,540,300,25);

j.add(city);

text[4].setBounds(500,540,300,25);

j.add(text[4]);

salary=new JLabel("Salary");

salary.setBounds(400,590,300,25);

j.add(salary);

text[5].setBounds(500,590,300,25);

j.add(text[5]);

mno=new JLabel("Phone Number");

mno.setBounds(400,640,300,25);

j.add(mno);

text[3].setBounds(500,640,300,25);

j.add(text[3]);

button1=new JButton("Create");

button1.setBounds(500,680,100,30);

j.add(button1);

Page 36: Mini project-DBMS & JAVA

36

button2=new JButton("Reset");

button2.setBounds(700,680,100,30);

j.add(button2);

month = new JComboBox<Comparable>();

month.setBounds(500,400,75,25);

j.add(month);

day=new JComboBox<Comparable>();

dday=new int[31];

for(int i=0;i<31;i++)

{

dday[i]=i+1;

}

day.setBounds(600,400,50,25);

j.add(day);

year=new JComboBox<Comparable>();

yyear=new int[5000];

for(int i=1960;i<2030;i++)

yyear[i]=i;

year.setBounds(700,400,100,25);

j.add(year);

int count=1;

String sq=""+"select empid from udupi_employee";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

count++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String lab="EMP";

String la=lab+String.valueOf(count);

text[6].setText(la);

j.setSize(width,height);

j.setLayout(null);

Page 37: Mini project-DBMS & JAVA

37

j.setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

int ju=0;

String str=e.getActionCommand();

if(e.getSource()==exit)

j.dispose();

if(e.getSource()==month)

{

od=""+month.getItemAt(month.getSelectedIndex());

if(od.equals("feb"))

{

done=1;

day.removeItem(dday[29]);

if(done1==0)

day.removeItem(dday[30]);

}

else if(od.equals("apr") || od.equals("jun") || od.equals("jun")

|| od.equals("sep") || od.equals("nov"))

{

if(done==1)

{

day.addItem(dday[29]);

done=0;

}

day.removeItem(dday[30]);

done1=1;

}

else if(od.equals("jan") || od.equals("mar") ||

od.equals("may") || od.equals("jul") || od.equals("aug") || od.equals("oct") ||

od.equals("dec"))

{

if(done==1)

{

day.addItem(dday[29]);

day.addItem(dday[30]);

done=0;

}

if(done1==1)

{

day.addItem(dday[30]);

done1=0;

Page 38: Mini project-DBMS & JAVA

38

}

}

}

if(str.equals("Check"))

{

String ono12=text[2].getText();

String sq=""+"select * from users where

username='"+ono12+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

if(e.getSource()==photo || e.getSource()==change)

{

int result=chooser.showOpenDialog(photo);

if(result==JFileChooser.APPROVE_OPTION)

{

phname=chooser.getSelectedFile().getPath();

j.setVisible(false);

pho.setIcon(new ImageIcon(phname));

pho.setBounds(1000,160,200,200);

photo.setVisible(false);

change.setVisible(true);

pho.setVisible(true);

j.add(pho);

j.setVisible(true);

setphoto=1;

}

}

if(str.equals("Back"))

Page 39: Mini project-DBMS & JAVA

39

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

j.setVisible(false);

Login en1=new Login();

try {

en1.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en1.access();

}

bid1 = ""+j1.getItemAt(j1.getSelectedIndex());

nname=text[1].getText();

username=text[2].getText();

id1=text[6].getText();

password=String.valueOf(ppname.getPassword());

city1=text[4].getText();

salary1=text[5].getText();

hin=t.getText();

if(radio1.isSelected())

sex=""+radio1.getText();

if(radio2.isSelected())

sex=""+radio2.getText();

mon=""+month.getItemAt(month.getSelectedIndex());

da=Integer.parseInt(""+day.getItemAt(day.getSelectedIndex()));

ye=Integer.parseInt(""+year.getItemAt(year.getSelectedIndex()));

mon=da+"-"+mon+"-"+ye;

mai=t1.getText();

int l=0;

if(str.equals("Create"))

{

l=0;

flg=0;

flg1=0;

flg2=0;

flg3=0;

flag=0;

Page 40: Mini project-DBMS & JAVA

40

flag1=0;

if(bid1.equals("") || nname.equals("") || username.equals("")

|| id.equals("") || password.equals("") || city.equals("") || salary1.equals("") ||

hin.equals("") || mon.equals("") || mai.equals("") || text[3].equals(""))

{

flg2=1;

}

//JOptionPane.showMessageDialog(null,flg2);

int n=mai.length();

for(int o=0;o<n;o++)

{

ch=mai.charAt(o);

if(ch=='@')

{

flg=1;

}

if(ch=='.')

{

flg1=1;

}

}

//JOptionPane.showMessageDialog(null,flg);

//JOptionPane.showMessageDialog(null,flg1);

if(flg==1 && flg1==1 && flg2==0)

{

mobile=Long.valueOf(text[3].getText());

String mo=Long.toString(mobile);

long mob=mobile;

while(mob!=0)

{

mob=mob/10;

l++;

}

// JOptionPane.showMessageDialog(null,l);

if(l==10)

{

// JOptionPane.showMessageDialog(null,l);

sql="insert into udupi_employee

values('"+id1+"','"+nname+"','"+sex+"','"+mon+"','"+salary1+"','"+mobile+"','"+

city1+"','"+bid1+"','"+username+"','"+phname+"')";

sql1="insert into users

values('"+username+"','"+password+"','"+hin+"','"+mai+"')";

// JOptionPane.showMessageDialog(null,l);

Page 41: Mini project-DBMS & JAVA

41

Statement stm;

try {

stm = con.createStatement();

int d1 = stm.executeUpdate(sql1);

//JOptionPane.showMessageDialog(null,l);

} catch (SQLException e21) {

// TODO Auto-generated catch block

//e21.printStackTrace();

JOptionPane.showMessageDialog(null,"Account Already exist");

flag=1;

flg3=1;

}

//JOptionPane.showMessageDialog(null,flag);

//JOptionPane.showMessageDialog(null,flg3);

if(flg3!=1)

{

Statement stmt;

try {

stmt = con.createStatement();

int d = stmt.executeUpdate(sql);

//int d1= stmt.executeUpdate(sql1);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

JOptionPane.showMessageDialog(null,"Username Already Exist");

flag=1;

}

}

//JOptionPane.showMessageDialog(null,flag);

if(flag==0)

{

flag1=1;

JOptionPane.showMessageDialog(null,"CREATED");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

j.setVisible(false);

Login en=new Login();

Page 42: Mini project-DBMS & JAVA

42

try {

en.createLayout();

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

}

else

{

l=0;

JOptionPane.showMessageDialog(null,"INVALID MOBILE

NUMBER");

}

}

else if(flg2==1)

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUE IN ALL FIELDS");

flg2=0;

l=0;

flg=0;

flg1=0;

}

else if(flag1==0 && flg==1 && flg1==1)

{

flag1=1;

flg=0;

flg1=0;

l=0;

}

else

{

if(flg==0 || flg1==0)

{

l=0;

flg2=0;

JOptionPane.showMessageDialog(null,"INVALID MAIL ID");

}

Page 43: Mini project-DBMS & JAVA

43

else

{

l=0;

flg=0;

flg1=0;

JOptionPane.showMessageDialog(null,"INVALID MOBILE

NUMBER");

}

}

}

else if(str.equals("Reset"))

{

text[1].setText("");

text[2].setText("");

text[3].setText("");

text[4].setText("");

text[5].setText("");

text[6].setText("");

t.setText("");

ppname.setText("");

}

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

t.addActionListener(this);

photo.addActionListener(this);

for(int j=0;j<k;j++)

j1.addItem(arry[j]);

for (int i = 0; i < 12; i++)

month.addItem(mmonth[i]);

for (int i = 0; i < 31; i++)

day.addItem(dday[i]);

for (int i = 1960; i < 2030; i++)

year.addItem(yyear[i]);

for(int i=1;i<7;i++)

text[i].addActionListener(this);

button1.addActionListener(this);

Page 44: Mini project-DBMS & JAVA

44

change.addActionListener(this);

check.addActionListener(this);

button2.addActionListener(this);

}

}

Forgot password:

package mini_project;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

import java.awt.event.ActionListener;

public class Forgotpass implements ActionListener {

JFrame f6;

JButton ok,exit,back;

int i=0,qty1,flag=0;

Connection con;

JLabel uname,head,head1,info;

String use;

Page 45: Mini project-DBMS & JAVA

45

JTextField t;

public void createlayout(String user) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f6=new JFrame();

use=user;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f6.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\digital.jpg")));

head=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

head.setBounds(390,20,650, 30);

//head.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

head.setFont(font);

f6.add(head);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(305,10,72,77);

f6.add(imagelabel);

head1=new JLabel("FORGOT PASSWORD PAGE");

head1.setBounds(500,100,500,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

//head1.setForeground(Color.white);

head1.setFont(font1);

f6.add(head1);

uname= new JLabel("USERNAME:");

uname.setBounds(500,300,100,30);

f6.add(uname);

t=new JTextField();

t.setBounds(600, 300, 100, 30);

f6.add(t);

Page 46: Mini project-DBMS & JAVA

46

ok=new JButton("OK");

ok.setBounds(550,400,100,30);

f6.add(ok);

back=new JButton("Back");

back.setBounds(100,610,100,30);

f6.add(back);

exit=new JButton("Exit");

exit.setBounds(1200,50,100,30);

f6.add(exit);

f6.setSize(width,height);

f6.setLayout(null);

f6.setVisible(true);

}

public void access()

{

exit.addActionListener(this);

back.addActionListener(this);

ok.addActionListener(this);

t.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(e.getSource()==exit)

f6.dispose();

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

Login fi1=new Login();

try {

Page 47: Mini project-DBMS & JAVA

47

fi1.createLayout();

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("OK"))

{

flag=0;

String bid1=t.getText();

if(bid1.equals(""))

{

flag=1;

}

if(flag==0)

{

int o=0;

String sq=""+"select hint from users where

username='"+bid1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

{

String t1=rs1.getString(1);

o=1;

JOptionPane.showMessageDialog(null,"HINT

OF YOUR PASSWORD IS "+t1+"");

}

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

if(o==0)

{

String sq1=""+"select hint from manager_user where

username='"+bid1+"'";

try {

Statement st2=con.createStatement();

ResultSet rs2=st2.executeQuery(sq1);

Page 48: Mini project-DBMS & JAVA

48

if(rs2.next())

{

String t2=rs2.getString(1);

JOptionPane.showMessageDialog(null,"HINT OF YOUR PASSWORD

IS "+t2+"");

}

else

JOptionPane.showMessageDialog(null,"INVALID USERNAME");

}catch(HeadlessException |

NullPointerException| SQLException e6){

e6.printStackTrace();

}

}

}

else

JOptionPane.showMessageDialog(null,"ENTER THE

USERNAME");

}

}

}

Menu page for manager:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

Page 49: Mini project-DBMS & JAVA

49

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class First implements ActionListener{

JFrame f1;

JLabel title, orderno, full;

JButton display, exit, update,supplier, delete,insert1,stockinsert,

insbranch;

JComboBox ono;

Connection con;

int i=0;

String use,bi;

String arry[]=new String[50];

public void createlayout(String user) throws ClassNotFoundException,

SQLException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f1=new JFrame();

use=user;

f1.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\select1.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

Font fo = new Font("TimesNewRoman", Font.BOLD,20);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(305,40, 800, 30);

Font font = new Font("Algerian", Font.BOLD,40);

title.setFont(font);

title.setForeground(Color.white);

f1.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(225,27,72,77);

f1.add(imagelabel);

Page 50: Mini project-DBMS & JAVA

50

orderno= new JLabel("ORDER NO");

orderno.setBounds(470,200,200,30);

orderno.setForeground(Color.white);

orderno.setFont(fo);

f1.add(orderno);

ono=new JComboBox();

ono.setBounds(600,200,100,30);

f1.add(ono);

//text1=new JTextField(20);

//text1.setBounds(600,200,100,30);

//f1.add(text1);

display=new JButton("Display");

display.setBounds(300,350,100,30);

f1.add(display);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f1.add(exit);

update=new JButton("Update");

update.setBounds(600,350,100,30);

f1.add(update);

delete=new JButton("Delete");

delete.setBounds(900,350,100,30);

f1.add(delete);

full=new JLabel("<<<<FOR INSERTING CLICK ON INSERT

BUTTONS>>>>");

full.setBounds(367,450,800,30);

Font font1 = new Font("Times New Roman", Font.BOLD,25);

full.setFont(font1);

full.setForeground(Color.white);

f1.add(full);

insert1=new JButton("To Insert New Order");

insert1.setBounds(300,550,200,30);

f1.add(insert1);

Page 51: Mini project-DBMS & JAVA

51

supplier=new JButton("To Insert New Supplier");

supplier.setBounds(550,550,200,30);

f1.add(supplier);

stockinsert=new JButton("Stock Maintenance");

stockinsert.setBounds(550,625,200,30);

f1.add(stockinsert);

insbranch=new JButton("To Insert New Branch");

insbranch.setBounds(800,550,200,30);

f1.add(insbranch);

String sq1=""+"select bid from Branch where

username='"+user+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sq1);

while(rs.next())

{

bi=rs.getString(1);

}

} catch (SQLException e2) {

e2.printStackTrace();

}

String sql1=""+"select ono from udupi_order where bid='"+bi+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

e2.printStackTrace();

}

f1.setSize(width,height);

f1.setLayout(null);

f1.setVisible(true);

Page 52: Mini project-DBMS & JAVA

52

}

public void access()

{

for(int j=0;j<i;j++)

ono.addItem(arry[j]);

exit.addActionListener(this);

display.addActionListener(this);

update.addActionListener(this);

delete.addActionListener(this);

insert1.addActionListener(this);

supplier.addActionListener(this);

stockinsert.addActionListener(this);

insbranch.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

String ono1=""+ono.getItemAt(ono.getSelectedIndex());

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Delete"))

{

/*String ono12 = ""+ono.getItemAt(ono.getSelectedIndex());

String s1="Cancelled!";

String sqli=""+"update udupi_order set status='"+s1+"'

where ono='"+ono12+"'";

Statement stmt;

Page 53: Mini project-DBMS & JAVA

53

try {

stmt = con.createStatement();

stmt.executeQuery(sqli);

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Marked As

Cancelled!!");*/

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Deletepage en0=new Deletepage();

try {

en0.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en0.access();

}

else if(str.equals("To Insert New Supplier"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Supplierinsert si=new Supplierinsert();

try {

si.createlayout(use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

si.access();

}

Page 54: Mini project-DBMS & JAVA

54

else if(str.equals("To Insert New Order"))

{

//JOptionPane.showMessageDialog(null,"Insert");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Order en1=new Order();

try {

en1.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException |

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en1.access();

}

else if(str.equals("Stock Maintenance"))

{

// JOptionPane.showMessageDialog(null,"Stock Insert");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

StockManagement en=new StockManagement();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException

|SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else if(str.equals("To Insert New Branch"))

{

Page 55: Mini project-DBMS & JAVA

55

// JOptionPane.showMessageDialog(null,"You Have Seleted

to Insert a New Branch");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Branch en=new Branch();

try {

en.createlayout(use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else if(str.equals("Update"))

{

// JOptionPane.showMessageDialog(null,"Going for Order

Updation!!");

String ono3=(""+ono.getItemAt(ono.getSelectedIndex()));

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Update en=new Update();

try {

en.createlayout(ono3,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else if(str.equals("Display"))

Page 56: Mini project-DBMS & JAVA

56

{

String ono2=(""+ono.getItemAt(ono.getSelectedIndex()));

//JOptionPane.showMessageDialog(null,"Dispalying the

Details of Order No:"+ono2);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Display en=new Display();

try {

en.createlayout(ono2,use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

}

}

Menu page for employee:

package mini_project;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import javax.swing.*;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

Page 57: Mini project-DBMS & JAVA

57

import java.sql.Statement;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.Statement;

public class First1 implements ActionListener

{

JFrame f8;

JButton

exit,branch,stock,supplier,customer,employee,back,mybranch,order,current;

JLabel title,head,bno,info,ono,infor,bno11;

JComboBox j1,j;

int i=0,j12=0;

String bi;

String arry[]=new String[50];

String arry1[]=new String[50];

Connection con;

String use;

String bno1;

public void createlayout(String user) throws ClassNotFoundException,

SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

Font fo = new Font("TimesNewRoman", Font.BOLD,15);

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

use=user;

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

//title.setForeground(Color.white);

Page 58: Mini project-DBMS & JAVA

58

f8.add(title);

JLabel imagelabel = new JLabel( new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

head= new JLabel("EMPLOYEE DISPLAY MENU PAGE");

head.setBounds(507,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

//head.setForeground(Color.white);

f8.add(head);

mybranch=new JButton("BIO DATA");

mybranch.setBounds(550,300,200,30);

f8.add(mybranch);

ono= new JLabel("ORDER NO:");

ono.setBounds(150,300,100,30);

//ono.setForeground(Color.white);

ono.setFont(fo);

f8.add(ono);

j=new JComboBox();

j.setBounds(250,300,100,30);

f8.add(j);

order=new JButton("DISPLAY ORDER");

order.setBounds(200,400,200,30);

f8.add(order);

String sl=""+"select bid from udupi_employee where

username='"+user+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sl);

while(rs.next())

{

Page 59: Mini project-DBMS & JAVA

59

bi=rs.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql12=""+"select ono from udupi_order where bid='"+bi+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sql12);

while(rs1.next())

{

arry1[j12]=rs1.getString(1);

j12++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

branch=new JButton("DISPLAY ALL BRANCHES");

branch.setBounds(550,400,200,30);

f8.add(branch);

supplier=new JButton("DISPLAY ALL SUPPLIER");

supplier.setBounds(550,500,200,30);

f8.add(supplier);

employee=new JButton("DISPLAY EMPLOYEE");

employee.setBounds(1000,350,200,30);

f8.add(employee);

customer=new JButton("DISPLAY CUSTOMER");

customer.setBounds(1000,400,200,30);

f8.add(customer);

bno= new JLabel("BRANCH NO:");

bno.setBounds(1000,300,100,30);

bno.setFont(fo);

//bno.setForeground(Color.white);

f8.add(bno);

bno11=new JLabel(bi);

Page 60: Mini project-DBMS & JAVA

60

bno11.setBounds(1100,300,100,30);

bno11.setFont(fo);

f8.add(bno11);

bno1=bi;

stock=new JButton("ADDED STOCK DETAILS");

stock.setBounds(1000,450,200,30);

f8.add(stock);

current=new JButton("CURRENT STATUS OF STOCK ITEM");

current.setBounds(1000,500,250,30);

f8.add(current);

//back=new JButton("Back");

// back.setBounds(600,650,100,30);

// f8.add(back);

info=new JLabel("<<<<<Select any One Branch ID to Display the

Employee Details, Customer Details or Stock Details>>>>>");

info.setBounds(300,580,750,30);

Font font3 = new Font("TimesNewRoman", Font.BOLD,15);

info.setFont(font3);

info.setForeground(Color.white);

f8.add(info);

infor=new JLabel("<<<<<Select any One Order No to Display the

Complete Order Details>>>>");

infor.setBounds(370,630,750,30);

//Font font3 = new Font("TimesNewRoman", Font.BOLD,15);

infor.setFont(font3);

infor.setForeground(Color.white);

f8.add(infor);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

employee.addActionListener(this);

exit.addActionListener(this);

branch.addActionListener(this);

Page 61: Mini project-DBMS & JAVA

61

stock.addActionListener(this);

supplier.addActionListener(this);

current.addActionListener(this);

customer.addActionListener(this);

// back.addActionListener(this);

mybranch.addActionListener(this);

order.addActionListener(this);

for(int k=0;k<j12;k++)

j.addItem(arry1[k]);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

// String bno1=""+j1.getItemAt(j1.getSelectedIndex());

String ono1=""+j.getItemAt(j.getSelectedIndex());

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("DISPLAY ALL BRANCHES"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Branch

Details!!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

Page 62: Mini project-DBMS & JAVA

62

}

f8.setVisible(false);

Disbranch en=new Disbranch();

try {

en.createlayout(use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en.access();

}

else if(str.equals("DISPLAY EMPLOYEE"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Employee

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Employeedis en4=new Employeedis();

try {

en4.createlayout(bno1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en4.access();

}

else if(str.equals("ADDED STOCK DETAILS"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Employee

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

Page 63: Mini project-DBMS & JAVA

63

f8.setVisible(false);

Displaystock en4=new Displaystock();

try {

en4.createlayout(bno1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en4.access();

}

else if(str.equals("CURRENT STATUS OF STOCK ITEM"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Employee

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

CurrentEmp en4=new CurrentEmp();

try {

en4.createlayout(bno1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en4.access();

}

else if(str.equals("DISPLAY ALL SUPPLIER"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Employee

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Page 64: Mini project-DBMS & JAVA

64

Supplierdis en4=new Supplierdis();

try {

en4.createlayout(use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en4.access();

}

else if(str.equals("DISPLAY ORDER"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Employee

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

OrderDisplay en41=new OrderDisplay();

try {

en41.createlayout(ono1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en41.access();

}

else if(str.equals("DISPLAY CUSTOMER"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Customer

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Page 65: Mini project-DBMS & JAVA

65

Customerdis en2=new Customerdis();

try {

en2.createlayout(bno1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en2.access();

}

else if(str.equals("DISPLAY STOCK"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Stock

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Displaystock en1=new Displaystock();

try {

en1.createlayout(bno1,use);

} catch (ClassNotFoundException |

NullPointerException|SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en1.access();

}

/*else if(str.equals("Back"))

{

f8.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException |

NullPointerException|SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

Page 66: Mini project-DBMS & JAVA

66

}*/

else if(str.equals("BIO DATA"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Biodata mb=new Biodata();

try {

mb.createlayout(use);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

mb.access();

}

}

}

Biodata:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.*;

public class Biodata implements ActionListener {

/**

* @param args

*/

Page 67: Mini project-DBMS & JAVA

67

JFrame j;

JLabel

title,id,store,name,uname,pname,gname,bname,mno,city,salary,bno,hint,mail,jp

hoto;

JPasswordField ppname;

JLabel

title1,id1,store1,name1,uname1,pname1,gname1,bname1,mno1,city1,salary1,bn

o1,hint1,mail1,pas;

JButton exit,back;

String[] t=new String[13];

String photo;

int[] t1=new int[13];

int da,ye;

long mobile;

Connection con;

int i=0,k=0;

long phn;

String use;

public void createlayout(String user) throws SQLException,

ClassNotFoundException

{

j=new JFrame();

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

j.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\side.jpg")));

store=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

store.setBounds(250,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,25);

store.setFont(font);

j.add(store);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(165,0,72,77);

Page 68: Mini project-DBMS & JAVA

68

j.add(imagelabel);

String sql=""+"select * from udupi_employee where

username='"+user+"'";

String sql2=""+"select * from users where username='"+user+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql);

while(rs5.next())

{

t[0]=rs5.getString(1);

t[1]=rs5.getString(2);

t[2]=rs5.getString(3);

t[3]=rs5.getString(4);

t[4]=rs5.getString(5);

phn=Long.valueOf(rs5.getString(6)).longValue();

t[5]=rs5.getString(7);

t[6]=rs5.getString(8);

t[11]=rs5.getString(10);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

try {

Statement stmt31 = con.createStatement();

ResultSet rs51=stmt31.executeQuery(sql2);

while(rs51.next())

{

t[7]=rs51.getString(1);

t[8]=rs51.getString(2);

t[9]=rs51.getString(3);

t[10]=rs51.getString(4);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

name=new JLabel(" NAME:");

name.setBounds(300,90,460,25);

Page 69: Mini project-DBMS & JAVA

69

j.add(name);

name1=new JLabel(t[0]);

name1.setBounds(460,90,460,25);

j.add(name1);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

j.add(exit);

back=new JButton("Back");

back.setBounds(100,680,100,30);

j.add(back);

id=new JLabel(" ID:");

id.setBounds(300,135,460,25);

j.add(id);

id1=new JLabel(t[1]);

id1.setBounds(460,135,460,25);

j.add(id1);

uname=new JLabel("UserName:");

uname.setBounds(300,180,460,25);

j.add(uname);

uname1=new JLabel(t[7]);

uname1.setBounds(460,180,460,25);

j.add(uname1);

jphoto=new JLabel();

jphoto.setIcon(new ImageIcon(t[11]));

jphoto.setBounds(1000,100,200,200);

jphoto.setVisible(true);

j.add(jphoto);

pname=new JLabel("Password:");

ppname=new JPasswordField();

pname.setBounds(300,230,460,25);

j.add(pname);

pas=new JLabel(t[8]);

pas.setBounds(460,230,460,25);

j.add(pas);

hint=new JLabel("Hint");

Page 70: Mini project-DBMS & JAVA

70

hint.setBounds(300,280,460,25);

j.add(hint);

hint1=new JLabel(t[9]);

hint1.setBounds(460,280,460,25);

j.add(hint1);

mail=new JLabel("Mail ID:");

mail.setBounds(300,340,460,25);

j.add(mail);

mail1=new JLabel(t[10]);

mail1.setBounds(460,340,460,25);

j.add(mail1);

gname=new JLabel("Gender");

gname.setBounds(300,400,460,25);

j.add(gname);

gname1=new JLabel(t[2]);

gname1.setBounds(460,400,460,25);

j.add(gname1);

bname=new JLabel("DOB:");

bname.setBounds(300,460,460,25);

j.add(bname);

bname1=new JLabel(t[3]);

bname1.setBounds(460,460,460,25);

j.add(bname1);

bno= new JLabel("Branch No:");

bno.setBounds(300,495,100,30);

j.add(bno);

bno1=new JLabel(t[6]);

bno1.setBounds(460,495,460,25);

j.add(bno1);

city=new JLabel("City");

city.setBounds(300,540,460,25);

j.add(city);

city1=new JLabel(t[5]);

city1.setBounds(460,540,460,25);

j.add(city1);

salary=new JLabel("Salary");

Page 71: Mini project-DBMS & JAVA

71

salary.setBounds(300,590,460,25);

j.add(salary);

salary1=new JLabel(t[4]);

salary1.setBounds(460,590,460,25);

j.add(salary1);

mno=new JLabel("Phone Number");

mno.setBounds(300,640,460,25);

j.add(mno);

String ph=Long.toString(phn);

mno1=new JLabel(ph);

mno1.setBounds(460,640,460,25);

j.add(mno1);

j.setSize(width,height);

j.setLayout(null);

j.setVisible(true);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(str.equals("Sign Out"))

{

j.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

if(str.equals("Back"))

{

j.setVisible(false);

First1 en1=new First1();

try {

en1.createlayout(use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

Page 72: Mini project-DBMS & JAVA

72

e1.printStackTrace();

}

en1.access();

}

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

}

Branch:

package mini_project;

import java.awt.event.ActionListener;

import java.io.File;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFileChooser;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

Page 73: Mini project-DBMS & JAVA

73

public class Branch implements ActionListener {

JFrame f3;

JTextField t1,t2,t3,t4,t5,t6,t7;

JButton insert,exit,back,photo,change,check;

Connection con;

JPasswordField ppname;

JFileChooser chooser;

JLabel pho;

String phname=null;

int setphoto=0;

String bid,bman,city1,usern,hint1,mail1,pass;

JLabel branchid, branchname, phnno, city, head,

head1,username,pname,hint,mail;

long phn;

String use,lab;

char ch;

int f=0;

int flg=0,l=0,flg1=0,flag=0,flag1=0,count=1;

public void createlayout(String user) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f3=new JFrame();

use=user;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f3.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

head=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

head.setBounds(400,20, 800, 30);

Font font = new Font("Algerian", Font.BOLD,30);

head.setFont(font);

head.setForeground(Color.white);

f3.add(head);

head1=new JLabel("BRANCH INSERTION PAGE");

Page 74: Mini project-DBMS & JAVA

74

head1.setBounds(500,100,500,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head1.setFont(font1);

head1.setForeground(Color.white);

f3.add(head1);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(315,10,72,77);

f3.add(imagelabel);

branchid= new JLabel("Branch ID:");

branchid.setBounds(500,160,100,30);

branchid.setForeground(Color.white);

f3.add(branchid);

t1=new JTextField();

t1.setBounds(600,160,100,30);

f3.add(t1);

photo=new JButton(" +\n PHOTO");

photo.setBounds(1000,50,200,200);

f3.add(photo);

photo.addActionListener(this);

change=new JButton("CHANGE");

change.setBounds(1050,400,100,50);

f3.add(change);

change.setVisible(false);

chooser=new JFileChooser();

chooser.setCurrentDirectory(new File("."));

pho = new JLabel();

check=new JButton("Check");

check.setBounds(800,160,100,30);

f3.add(check);

branchname= new JLabel("Manager Name:");

branchname.setBounds(500,220,100,30);

branchname.setForeground(Color.white);

f3.add(branchname);

t2=new JTextField();

t2.setBounds(600,220,100,30);

f3.add(t2);

Page 75: Mini project-DBMS & JAVA

75

username=new JLabel("Username:");

username.setBounds(500,280,100,30);

f3.add(username);

username.setForeground(Color.white);

t5=new JTextField(20);

t5.setBounds(600,280,100,30);

f3.add(t5);

hint=new JLabel("Hint:");

hint.setBounds(500,400,100,30);

f3.add(hint);

hint.setForeground(Color.white);

t6=new JTextField();

t6.setBounds(600, 400, 100, 30);

f3.add(t6);

mail=new JLabel("Mail ID:");

mail.setBounds(500,460,100,30);

mail.setForeground(Color.white);

f3.add(mail);

t7=new JTextField();

t7.setBounds(600, 460, 100, 30);

f3.add(t7);

pname=new JLabel("Password:");

ppname=new JPasswordField();

pname.setForeground(Color.white);

pname.setBounds(500,340,100,30);

f3.add(pname);

ppname.setBounds(600,340,100,30);

f3.add(ppname);

phnno= new JLabel("Phone No:");

phnno.setBounds(500,520,100,30);

phnno.setForeground(Color.white);

f3.add(phnno);

t3=new JTextField();

t3.setBounds(600,520,100,30);

f3.add(t3);

city=new JLabel("City:");

Page 76: Mini project-DBMS & JAVA

76

city.setBounds(500,580,100,30);

city.setForeground(Color.white);

f3.add(city);

t4=new JTextField();

t4.setBounds(600,580,100,30);

f3.add(t4);

insert=new JButton("Insert");

insert.setBounds(600,650,100,30);

f3.add(insert);

back=new JButton("Back");

back.setBounds(100,650,100,30);

f3.add(back);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f3.add(exit);

String sq=""+"select bid from Branch";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

count++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

lab="BRH";

String la=lab+String.valueOf(count);

String sq1=""+"select * from Branch where bid='"+la+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq1);

if(rs1.next())

f=1;

else

f=0;

} catch (HeadlessException | NullPointerException| SQLException

e1) {

Page 77: Mini project-DBMS & JAVA

77

// TODO Auto-generated catch block

e1.printStackTrace();

}

if(f==1)

{

String lab1="BRHA";

String la1=lab1+String.valueOf(count);

t1.setText(la1);

}

else

t1.setText(la);

f3.setSize(width,height);

f3.setLayout(null);

f3.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

insert.addActionListener(this);

check.addActionListener(this);

photo.addActionListener(this);

change.addActionListener(this);

t1.addActionListener(this);

t2.addActionListener(this);

t3.addActionListener(this);

t4.addActionListener(this);

t5.addActionListener(this);

t6.addActionListener(this);

t7.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

Page 78: Mini project-DBMS & JAVA

78

f3.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(e.getSource()==photo || e.getSource()==change)

{

int result=chooser.showOpenDialog(photo);

if(result==JFileChooser.APPROVE_OPTION)

{

phname=chooser.getSelectedFile().getPath();

f3.setVisible(false);

pho.setIcon(new ImageIcon(phname));

pho.setBounds(1000,150,200,200);

photo.setVisible(false);

change.setVisible(true);

pho.setVisible(true);

f3.add(pho);

f3.setVisible(true);

setphoto=1;

}

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f3.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

Page 79: Mini project-DBMS & JAVA

79

}

fi1.access();

}

else if(str.equals("Check"))

{

String bid1=t1.getText();

String sq=""+"select * from Branch where bid='"+bid1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Insert"))

{

l=0;

flag=0;

flg=0;

flg1=0;

bid=t1.getText();

bman=t2.getText();

city1=t4.getText();

usern=t5.getText();

pass=String.valueOf(ppname.getPassword());

hint1=t6.getText();

mail1=t7.getText();

if(bid.equals("")||bman.equals("")||city1.equals("")||t3.getText().equals("")

||usern.equals("")||pass.equals("")||hint1.equals("")||mail1.equals(""))

{

flag=1;

}

int n=mail1.length();

Page 80: Mini project-DBMS & JAVA

80

for(int o=0;o<n;o++)

{

ch=mail1.charAt(o);

if(ch=='@')

{

flg=1;

}

if(ch=='.')

{

flg1=1;

}

}

if(flg1==1 && flg==1 && flag==0)

{

phn=Long.valueOf(t3.getText()).longValue();

long phn1=phn;

while(phn1!=0)

{

phn1=phn1/10;

l++;

}

if(l==10)

{

String sql="insert into Branch

values('"+bman+"','"+phn+"','"+city1+"','"+bid+"','"+usern+"','"+phname+"','"+u

sern+"')";

String sql2="insert into manager_user

values('"+usern+"','"+pass+"','"+hint1+"','"+mail1+"')";

Statement stmt2;

try {

stmt2 = con.createStatement();

stmt2.executeUpdate(sql2);

} catch (SQLException e12) {

// TODO Auto-generated catch block

e12.printStackTrace();

}

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

Page 81: Mini project-DBMS & JAVA

81

e2.printStackTrace();

}

//JOptionPane.showMessageDialog(null,"Inserted");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f3.setVisible(false);

First en=new First();

try {

en.createlayout(use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

JOptionPane.showMessageDialog(null,

"INVALID MOBILE NUMBER");

l=0;

flg=0;

flg1=0;

}

}

else if(flag==1)

{

JOptionPane.showMessageDialog(null, "ENTER VALUE

IN ALL FIELDS");

flag=0;

}

else if(flg==0 && flg1==0)

{

JOptionPane.showMessageDialog(null, "INVALID

MAIL ID");

}

}

}

Page 82: Mini project-DBMS & JAVA

82

}

Branch display:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Branchdis implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

long[][] r14=new long[50][50];

JTextField t1,t2;

String use;

String bi;

Page 83: Mini project-DBMS & JAVA

83

public void createlayout(String user,String bi1) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

use=user;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("BRANCH DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

Page 84: Mini project-DBMS & JAVA

84

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[4];

column[0]="BRANCH NO";

column[1]="MANAGER NAME";

column[2]="PHONE NO";

column[3]="CITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[4];

}

String sql1=""+"select * from Branch";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(4);

r[i1][2]=rs5.getString(1);

r14[i1][3]=Long.valueOf(rs5.getString(2)).longValue();

r[i1][4]=rs5.getString(3);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=Long.toString(r14[i][3]);

rows[i][3]=r[i][4];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

Page 85: Mini project-DBMS & JAVA

85

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

DisplayMenu fi1=new DisplayMenu();

try {

fi1.createlayout(use,bi);

Page 86: Mini project-DBMS & JAVA

86

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Current employee:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class CurrentEmp implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

Page 87: Mini project-DBMS & JAVA

87

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

JTextField t1,t2;

String use;

String bi;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bno;

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

//title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

Page 88: Mini project-DBMS & JAVA

88

f8.add(back);

head= new JLabel("CURRENT STATUS OF STOCK ITEMS");

head.setBounds(515,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

// head.setForeground(Color.white);

f8.add(head);

String column[]=new String[3];

column[0]="BRANCH NO";

column[1]="STOCK NAME";

column[2]="QUANTITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[3];

}

String sql1=""+"select * from udupi_stock1 where bid='"+bno+"'"

;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(3);

r[i1][2]=rs5.getString(1);

r1[i1][1]=Integer.parseInt(rs5.getString(2));

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=Integer.toString(r1[i][1]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

Page 89: Mini project-DBMS & JAVA

89

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(165,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

Page 90: Mini project-DBMS & JAVA

90

f8.setVisible(false);

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | NullPointerException |

SQLException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Current status:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Currentstatus implements ActionListener{

Page 91: Mini project-DBMS & JAVA

91

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

JTextField t1,t2;

String use;

String bi;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bno;

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

Page 92: Mini project-DBMS & JAVA

92

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("CURRENT STATUS OF STOCK ITEMS");

head.setBounds(515,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[3];

column[0]="BRANCH NO";

column[1]="STOCK NAME";

column[2]="QUANTITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[3];

}

String sql1=""+"select * from udupi_stock1 where bid='"+bno+"'"

;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(3);

r[i1][2]=rs5.getString(1);

r1[i1][1]=Integer.parseInt(rs5.getString(2));

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

Page 93: Mini project-DBMS & JAVA

93

rows[i][2]=Integer.toString(r1[i][1]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(165,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

Page 94: Mini project-DBMS & JAVA

94

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Displaysta fi1=new Displaysta();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException |

SQLException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Customer:

package mini_project;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

Page 95: Mini project-DBMS & JAVA

95

import javax.swing.JTextField;

public class Customer implements ActionListener{

JFrame f5;

JTextField t[]=new JTextField[5];

JComboBox j1;

String cno1,cname1,city1,j12;

String arry[]=new String[50];

int i=0,flag=0;

Connection con;

JButton insert,exit,back,check;

String use;

JLabel cno,cname,phoneno,city,bno,head,head1;

long phn;

int count=1;

String bi;

public void createlayout(String user,String bi1) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f5=new JFrame();

use=user;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f5.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

head=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

head.setBounds(410,20, 800, 30);

Font font = new Font("Algerian", Font.BOLD,30);

head.setForeground(Color.white);

head.setFont(font);

f5.add(head);

head1=new JLabel("CUSTOMER INSERTION PAGE");

head1.setBounds(480,100,500,30);

Page 96: Mini project-DBMS & JAVA

96

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head1.setFont(font1);

head1.setForeground(Color.white);

f5.add(head1);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(325,7,72,77);

f5.add(imagelabel);

back=new JButton("Back");

back.setBounds(100,590,100,30);

f5.add(back);

bno= new JLabel("Branch No:");

bno.setBounds(500,180,100,30);

bno.setForeground(Color.white);

f5.add(bno);

j1=new JComboBox();

j1.setBounds(600,180,100,30);

f5.add(j1);

cno= new JLabel("Customer No:");

cno.setBounds(500,260,100,30);

cno.setForeground(Color.white);

f5.add(cno);

t[1]=new JTextField();

t[1].setBounds(600,260,100,30);

f5.add(t[1]);

check=new JButton("Check");

check.setBounds(800,260,100,30);

f5.add(check);

cname= new JLabel("Customer Name:");

cname.setBounds(500,340,100,30);

cname.setForeground(Color.white);

f5.add(cname);

t[2]=new JTextField();

t[2].setBounds(600,340,100,30);

f5.add(t[2]);

phoneno= new JLabel("Phone No:");

Page 97: Mini project-DBMS & JAVA

97

phoneno.setBounds(500,420,100,30);

phoneno.setForeground(Color.white);

f5.add(phoneno);

t[3]=new JTextField();

t[3].setBounds(600,420,100,30);

f5.add(t[3]);

city= new JLabel("City:");

city.setBounds(500,500,100,30);

city.setForeground(Color.white);

f5.add(city);

t[4]=new JTextField();

t[4].setBounds(600,500,100,30);

f5.add(t[4]);

String lab="CUS";

String sq=""+"select cno from udupi_customer";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

count++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String la=lab+String.valueOf(count);

t[1].setText(la);

insert=new JButton("Insert");

insert.setBounds(600,600,100,30);

f5.add(insert);

/*String sql1=""+"select bid from Branch";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

Page 98: Mini project-DBMS & JAVA

98

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

*/

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f5.add(exit);

f5.setSize(width,height);

f5.setLayout(null);

f5.setVisible(true);

}

public void access()

{

//for(int j=0;j<i;j++)

//j1.addItem(arry[j]);

j1.addItem(bi);

exit.addActionListener(this);

insert.addActionListener(this);

back.addActionListener(this);

check.addActionListener(this);

for(int i=1;i<5;i++)

t[i].addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f5.setVisible(false);

Login l=new Login();

try {

l.createLayout();

Page 99: Mini project-DBMS & JAVA

99

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f5.setVisible(false);

Order fi1=new Order();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1)

{

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Check"))

{

String bid1=t[1].getText();

String sq=""+"select * from udupi_customer where

cno='"+bid1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

Page 100: Mini project-DBMS & JAVA

100

}

}

else if(str.equals("Insert"))

{

j12=(""+j1.getItemAt(j1.getSelectedIndex()));

cno1=t[1].getText();

cname1=t[2].getText();

city1=t[4].getText();

int l=0;

if(j12.equals("") || cno1.equals("") || cname1.equals("") ||

t[3].getText().equals("")|| city1.equals(""))

{

flag=1;

}

if(flag==0)

{

phn=Long.valueOf(t[3].getText()).longValue();

long phn1=phn;

while(phn1!=0)

{

phn1=phn1/10;

l++;

}

if(l==10)

{

String sql="insert into udupi_customer

values('"+cno1+"','"+j12+"','"+cname1+"','"+phn+"','"+city1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

int d = stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

//JOptionPane.showMessageDialog(null,"Inserted");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f5.setVisible(false);

Page 101: Mini project-DBMS & JAVA

101

Order en=new Order();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

JOptionPane.showMessageDialog(null,"INVALID

MOBILE NUMBER");

l=0;

}

}

else if(flag==1)

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUES IN ALL FIELDS");

flag=0;

}

}

}

}

Customer display:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

Page 102: Mini project-DBMS & JAVA

102

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Customerdis implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

long[][] r1=new long[50][50];

JTextField t1,t2;

String use;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

use=user;

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Page 103: Mini project-DBMS & JAVA

103

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

// title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("CUSTOMER DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

//head.setForeground(Color.white);

f8.add(head);

String column[]=new String[5];

column[0]="BRANCH NO";

column[1]="CUSTOMER NO";

column[2]="CUSTOMER NAME";

column[3]="PHONE NO";

column[4]="CITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[5];

}

String sql1=""+"select * from udupi_customer where

bid='"+bno+"'" ;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

Page 104: Mini project-DBMS & JAVA

104

r[i1][1]=rs5.getString(2);

r[i1][2]=rs5.getString(1);

r[i1][3]=rs5.getString(3);

r1[i1][1]=Long.parseLong(rs5.getString(4));

r[i1][4]=rs5.getString(5);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=Long.toString(r1[i][1]);

rows[i][4]=r[i][4];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

Page 105: Mini project-DBMS & JAVA

105

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Delete page:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

Page 106: Mini project-DBMS & JAVA

106

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class Deletepage implements ActionListener{

JFrame f1;

JLabel dno,sno,cno,fno,title,head,full;

JComboBox t1,t2,t3,t4;

JButton b1,b2,b3,b4,back,exit;

Connection con;

String use,use1;

int i=0,i1=0,i2=0,i3=0;

String arry[]=new String[40];

String arry1[]=new String[40];

String arry2[]=new String[40];

String arry3[]=new String[40];

String bi;

public void createlayout(String user,String bi1) throws

ClassNotFoundException, SQLException

{

f1=new JFrame();

Class.forName("oracle.jdbc.driver.OracleDriver");

con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe

","rakhav","1234");

f1.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\bars.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

Page 107: Mini project-DBMS & JAVA

107

int height = (int) screenSize.getHeight();

use=user;

bi=bi1;

Font fo = new Font("TimesNewRoman", Font.BOLD,15);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(380,40, 800, 30);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f1.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(295,25,72,77);

f1.add(imagelabel);

head=new JLabel("DELETING MENU PAGE");

head.setBounds(510,110, 700, 30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f1.add(head);

dno=new JLabel("Branch No:");

dno.setBounds(400,250,100,30);

dno.setForeground(Color.white);

f1.add(dno);

dno.setFont(fo);

t1=new JComboBox<String>();

t1.setBounds(500,250,100,30);

f1.add(t1);

b1=new JButton("Delete Branch");

b1.setBounds(700,250,250,30);

f1.add(b1);

sno=new JLabel("Order No:");

sno.setBounds(400,350,200,30);

sno.setForeground(Color.white);

f1.add(sno);

sno.setFont(fo);

t2=new JComboBox<String>();

Page 108: Mini project-DBMS & JAVA

108

t2.setBounds(500,350,100,30);

f1.add(t2);

b2=new JButton("Delete Order");

b2.setBounds(700,350,250,30);

f1.add(b2);

cno=new JLabel("Employee No:");

cno.setBounds(400,450,100,30);

cno.setForeground(Color.white);

f1.add(cno);

cno.setFont(fo);

t3=new JComboBox<String>();

t3.setBounds(500,450,100,30);

f1.add(t3);

b3=new JButton("Delete Employee");

b3.setBounds(700,450,250,30);

f1.add(b3);

fno=new JLabel("Supplier No:");

fno.setBounds(400,550,100,30);

fno.setForeground(Color.white);

f1.add(fno);

fno.setFont(fo);

t4=new JComboBox<String>();

t4.setBounds(500,550,100,30);

f1.add(t4);

b4=new JButton("Delete Supplier");

b4.setBounds(700,550,250,30);

f1.add(b4);

exit=new JButton("Logout");

exit.setBounds(1200,50,100,30);

f1.add(exit);

full=new JLabel("<<<Select the Required One from the List and

Click Delete Buttons to Delete>>>");

full.setBounds(300,600,1000,30);

full.setForeground(Color.white);

full.setFont(font1);

f1.add(full);

back=new JButton("Back");

Page 109: Mini project-DBMS & JAVA

109

back.setBounds(100,600,100,30);

f1.add(back);

String sql1=""+"select bid from Branch";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql2=""+"select ono from udupi_order where bid='"+bi+"'";

try {

Statement stmt1 = con.createStatement();

ResultSet rs1=stmt1.executeQuery(sql2);

while(rs1.next())

{

arry1[i1]=rs1.getString(1);

i1++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql3=""+"select empid from udupi_employee where

bid='"+bi+"'";

try {

Statement stmt2 = con.createStatement();

ResultSet rs2=stmt2.executeQuery(sql3);

while(rs2.next())

{

arry2[i2]=rs2.getString(1);

i2++;

}

Page 110: Mini project-DBMS & JAVA

110

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql4=""+"select sno from udupi_supplier";

try {

Statement stmt3 = con.createStatement();

ResultSet rs3=stmt3.executeQuery(sql4);

while(rs3.next())

{

arry3[i3]=rs3.getString(1);

i3++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setSize(width,height);

f1.setLayout(null);

f1.setVisible(true);

}

public void access()

{

for(int j=0;j<i;j++)

t1.addItem (arry[j]);

for(int j1=0;j1<i1;j1++)

t2.addItem(arry1[j1]);

for(int j2=0;j2<i2;j2++)

t3.addItem(arry2[j2]);

for(int j3=0;j3<i3;j3++)

t4.addItem(arry3[j3]);

exit.addActionListener(this);

back.addActionListener(this);

b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

b4.addActionListener(this);

}

public void actionPerformed(ActionEvent e) {

Page 111: Mini project-DBMS & JAVA

111

String str=e.getActionCommand();

String dno1=(""+t1.getItemAt(t1.getSelectedIndex()));

String sno1=(""+t2.getItemAt(t2.getSelectedIndex()));

String cno1=(""+t3.getItemAt(t3.getSelectedIndex()));

String fno1=(""+t4.getItemAt(t4.getSelectedIndex()));

if(e.getSource()==exit)

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | SQLException e1)

{

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Delete Branch"))

Page 112: Mini project-DBMS & JAVA

112

{

//JOptionPane.showMessageDialog(null,"Deleted!");

String us="select username from Branch whre

bid='"+dno+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs3=stmt3.executeQuery(us);

while(rs3.next())

{

use1=rs3.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String us1="delete from manager_user where

username='"+use1+"'";

Statement stmt3;

try {

stmt3= con.createStatement();

stmt3.executeUpdate(us1);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sq="delete from Branch where bid='"+dno1+"'";

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeUpdate(sq);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Deleted!");

f1.setVisible(false);

Deletepage d=new Deletepage();

Page 113: Mini project-DBMS & JAVA

113

try {

d.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

d.access();

}

else if(str.equals("Delete Order"))

{

// JOptionPane.showMessageDialog(null,"Deleted!");

String sq1="delete from udupi_order where

ono='"+sno1+"'";

Statement stmt2;

try {

stmt2 = con.createStatement();

stmt2.executeUpdate(sq1);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Deleted!");

f1.setVisible(false);

Deletepage d=new Deletepage();

try {

d.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

d.access();

}

else if(str.equals("Delete Employee"))

{

//JOptionPane.showMessageDialog(null,"Deleted!");

Page 114: Mini project-DBMS & JAVA

114

String us="select username from udupi_employee where

empid='"+cno1+"'";

try {

Statement stt3 = con.createStatement();

ResultSet rs3=stt3.executeQuery(us);

while(rs3.next())

{

use1=rs3.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sq2="delete from udupi_employee where

empid='"+cno1+"'";

Statement stmt3;

try {

stmt3 = con.createStatement();

stmt3.executeUpdate(sq2);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String us1="delete from users where username='"+use1+"'";

Statement stmt31;

try {

stmt31= con.createStatement();

stmt31.executeUpdate(us1);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Deleted!");

f1.setVisible(false);

Deletepage d=new Deletepage();

try {

Page 115: Mini project-DBMS & JAVA

115

d.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

d.access();

}

else if(str.equals("Delete Supplier"))

{

//JOptionPane.showMessageDialog(null,"Deleted!");

String sq3="delete from udupi_supplier where

sno='"+fno1+"'";

Statement stmt3;

try {

stmt3 = con.createStatement();

stmt3.executeUpdate(sq3);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Deleted!");

f1.setVisible(false);

Deletepage d=new Deletepage();

try {

d.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

d.access();

}

}

}

Display branch:

package mini_project;

Page 116: Mini project-DBMS & JAVA

116

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Disbranch implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

long[][] r14=new long[50][50];

JTextField t1,t2;

String use;

public void createlayout(String user) throws ClassNotFoundException,

SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Page 117: Mini project-DBMS & JAVA

117

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

use=user;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

//title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("BRANCH DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

//head.setForeground(Color.white);

f8.add(head);

String column[]=new String[4];

column[0]="BRANCH NO";

column[1]="MANAGER NAME";

column[2]="PHONE NO";

Page 118: Mini project-DBMS & JAVA

118

column[3]="CITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[4];

}

String sql1=""+"select * from Branch";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(4);

r[i1][2]=rs5.getString(1);

r14[i1][3]=Long.valueOf(rs5.getString(2)).longValue();

r[i1][4]=rs5.getString(3);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=Long.toString(r14[i][3]);

rows[i][3]=r[i][4];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

Page 119: Mini project-DBMS & JAVA

119

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

Page 120: Mini project-DBMS & JAVA

120

}

}

Display:

package mini_project;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import javax.swing.*;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.Statement;

public class Display implements ActionListener

{

JFrame f7;

JButton exit,stockdisp,back,sta,report;

JLabel

title,head,cust,odes,deldate,ppu,prono,proname,proqty,supno,supname,amtpaid,

order;

Connection con;

int d=0,e=0;

String r[]=new String[50];

String r2[][]=new String[50][50];

int r3[][]=new int[40][40];

int r1[]=new int[40];

String r4[]=new String[40];

String r41[]=new String[40];

String r42[]=new String[40];

int r51[]=new int[40];

int r52[]=new int[40];

Page 121: Mini project-DBMS & JAVA

121

int r5[]=new int[40];

String ri[]=new String[10];

String sql3,sql4,sql5,sql6;

int k=0,d1;

Long t[]=new Long[5];

Long t1[]=new Long[5];

String[][]rows=new String[5][];

String use;

String on1;

String bi;

public void createlayout(String ono1,String user,String bi1) throws

SQLException, ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f7=new JFrame();

use=user;

on1=ono1;

f7.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

Container c=f7.getContentPane();

c.setBackground(Color.yellow);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(440,0, 800, 50);

title.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

f7.add(title);

bi=bi1;

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(355,0,72,77);

f7.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f7.add(exit);

Page 122: Mini project-DBMS & JAVA

122

order=new JLabel("Order Details of Order No: "+ono1+"");

order.setBounds(595,150,300,25);

order.setForeground(Color.white);

Font fo=new Font("Comic Sans MS", Font.BOLD,15);

order.setFont(fo);

f7.add(order);

cust=new JLabel("CUST NO ->Customer No");

cust.setBounds(1100,330,200,30);

cust.setForeground(Color.white);

f7.add(cust);

odes=new JLabel("ORDER DESC -> Order Discription");

odes.setBounds(1100,350,200,30);

odes.setForeground(Color.white);

f7.add(odes);

deldate=new JLabel("DEL DATE -> Delivery Date");

deldate.setBounds(1100,370,200,30);

deldate.setForeground(Color.white);

f7.add(deldate);

ppu=new JLabel("PPU -> Price per unit");

ppu.setBounds(1100,390,200,30);

ppu.setForeground(Color.white);

f7.add(ppu);

prono=new JLabel("PRO NO -> Product No");

prono.setBounds(1100,410,200,30);

prono.setForeground(Color.white);

f7.add(prono);

proname=new JLabel("PRO NAME -> Product Name");

proname.setBounds(1100,430,200,30);

proname.setForeground(Color.white);

f7.add(proname);

proqty=new JLabel("PRO QTY -> Product Quantity");

proqty.setBounds(1100,450,200,30);

proqty.setForeground(Color.white);

f7.add(proqty);

supno=new JLabel("SUP NO -> Supplier No");

supno.setBounds(1100,470,200,30);

supno.setForeground(Color.white);

f7.add(supno);

supname=new JLabel("SUP NAME -> Supplier Name");

supname.setBounds(1100,490,200,30);

supname.setForeground(Color.white);

Page 123: Mini project-DBMS & JAVA

123

f7.add(supname);

amtpaid=new JLabel("Amt Paid -> Amout Paid");

amtpaid.setBounds(1100,510,200,30);

amtpaid.setForeground(Color.white);

f7.add(amtpaid);

head= new JLabel("ORDER DISPLAY PAGE");

head.setBounds(570,90,400,30);

head.setForeground(Color.white);

Font font1 = new Font("Times New Roman", Font.BOLD,25);

head.setFont(font1);

f7.add(head);

back=new JButton("Back");

back.setBounds(650,600,100,30);

f7.add(back);

report=new JButton("FOR GETTING REPORT");

report.setBounds(550,400,300,30);

f7.add(report);

stockdisp=new JButton("FOR DISPLAYING OTHER

DETAILS");

stockdisp.setBounds(550,450,300,30);

f7.add(stockdisp);

sta=new JButton("PENDING ORDERS");

sta.setBounds(550,500,300,30);

f7.add(sta);

String column[]=new String[16];

column[0]="BRANCH NO";

column[1]="CUST NO";

column[2]="ORDER DESC";

column[3]="DEL DATE";

column[4]="QUANTITY";

column[5]="PPU";

column[6]="TOTAL PAID";

column[7]="PRO NO";

column[8]="PRO NAME";

column[9]="PRO QTY";

column[10]="SUP NO";

column[11]="SUP NAME";

column[12]="AMT PAID";

Page 124: Mini project-DBMS & JAVA

124

column[13]="PHONE NO";

column[14]="CITY";

column[15]="STATUS";

for(int i=0;i<5;i++)

{

rows[i]=new String[16];

}

//JOptionPane.showMessageDialog(null, ono1);

String sql1=""+"select * from udupi_order where ono='"+ono1+"'";

try {

Statement stmt1 = con.createStatement();

ResultSet rs1=stmt1.executeQuery(sql1);

while(rs1.next())

{

r[1]=rs1.getString(1);

r[2]=rs1.getString(2);

r[3]=rs1.getString(3);

r[4]=rs1.getString(4);

r1[1]=Integer.parseInt(rs1.getString(5));

r1[2]=Integer.parseInt(rs1.getString(6));

r1[3]=Integer.parseInt(rs1.getString(7));

r[5]=rs1.getString(8);

r[6]=rs1.getString(9);

// JOptionPane.showMessageDialog(null, r[1]);

// JOptionPane.showMessageDialog(null,r[2]);

//JOptionPane.showMessageDialog(null, r[3]);

// JOptionPane.showMessageDialog(null,

rs1.getString(9));

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql2=""+"select * from udupi_product where

ono='"+ono1+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs12=stmt.executeQuery(sql2);

while(rs12.next())

{

r2[d][1]=rs12.getString(1);

r2[d][2]=rs12.getString(3);

Page 125: Mini project-DBMS & JAVA

125

r3[d][1]=Integer.parseInt(rs12.getString(4));

//JOptionPane.showMessageDialog(null,

rs1.getString(4));

d++;

}

d1=d;

// JOptionPane.showMessageDialog(null, d1);

// JOptionPane.showMessageDialog(null, r2[0][1]);

// JOptionPane.showMessageDialog(null, r2[1][1]);

k=0;

// JOptionPane.showMessageDialog(null, k);

d1--;

//JOptionPane.showMessageDialog(null, d1);

while(d1>=0)

{

ri[d1]=r2[d1][1];

d1--;

k=k+1;

}

} catch (SQLException e3) {

// TODO Auto-generated catch block

e3.printStackTrace();

}

k--;

//JOptionPane.showMessageDialog(null, k);

//JOptionPane.showMessageDialog(null, ri[0]);

//JOptionPane.showMessageDialog(null, ri[1]);

int p=k;

switch(k)

{

case 0:

sql3=""+"select * from udupi_Supplier where

pno='"+ri[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs3=stmt3.executeQuery(sql3);

while(rs3.next())

{

r4[1]=rs3.getString(1);

r4[2]=rs3.getString(3);

r5[1]=Integer.parseInt(rs3.getString(4));

r4[4]=rs3.getString(5);

r4[3]=rs3.getString(6);

Page 126: Mini project-DBMS & JAVA

126

}

} catch (SQLException e3) {

// TODO Auto-generated catch block

e3.printStackTrace();

}

rows[0][10]=r4[1];

rows[0][11]=r4[2];

rows[0][12]=Integer.toString(r5[1]);

rows[0][13]=r4[4];

rows[0][14]=r4[3];

break;

case 1:

sql3=""+"select * from udupi_supplier where

pno='"+ri[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs4=stmt3.executeQuery(sql3);

while(rs4.next())

{

r4[1]=rs4.getString(1);

r4[2]=rs4.getString(3);

r5[1]=Integer.parseInt(rs4.getString(4));

r4[4]=rs4.getString(5);

r4[3]=rs4.getString(6);

}

} catch (SQLException e4) {

// TODO Auto-generated catch block

e4.printStackTrace();

}

sql4=""+"select * from udupi_supplier where

pno='"+ri[1]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql4);

while(rs5.next())

{

r41[1]=rs5.getString(1);

r41[2]=rs5.getString(3);

r51[1]=Integer.parseInt(rs5.getString(4));

r41[4]=rs5.getString(5);

r41[3]=rs5.getString(6);

Page 127: Mini project-DBMS & JAVA

127

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

rows[0][10]=r4[1];

rows[0][11]=r4[2];

rows[0][12]=Integer.toString(r5[1]);

rows[0][13]=r4[4];

rows[0][14]=r4[3];

rows[1][10]=r41[1];

rows[1][11]=r41[2];

rows[1][12]=Integer.toString(r51[1]);

rows[1][13]=r41[4];

rows[1][14]=r41[3];

break;

case 2:

sql3=""+"select * from udupi_supplier where

pno='"+ri[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs4=stmt3.executeQuery(sql3);

while(rs4.next())

{

r4[1]=rs4.getString(1);

r4[2]=rs4.getString(3);

r5[1]=Integer.parseInt(rs4.getString(4));

r4[4]=rs4.getString(5);

r4[3]=rs4.getString(6);

}

} catch (SQLException e4) {

// TODO Auto-generated catch block

e4.printStackTrace();

}

sql4=""+"select * from udupi_supplier where

pno='"+ri[1]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql4);

while(rs5.next())

{

Page 128: Mini project-DBMS & JAVA

128

r41[1]=rs5.getString(1);

r41[2]=rs5.getString(3);

r51[1]=Integer.parseInt(rs5.getString(4));

r41[4]=rs5.getString(5);

r41[3]=rs5.getString(6);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

sql5=""+"select * from udupi_supplier where

pno='"+ri[2]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql4);

while(rs5.next())

{

r42[1]=rs5.getString(1);

r42[2]=rs5.getString(3);

r52[1]=Integer.parseInt(rs5.getString(4));

r42[4]=rs5.getString(5);

r42[3]=rs5.getString(6);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

rows[0][10]=r4[1];

rows[0][11]=r4[2];

rows[0][12]=Integer.toString(r5[1]);

rows[0][13]=r4[4];

rows[0][14]=r4[3];

rows[1][10]=r41[1];

rows[1][11]=r41[2];

rows[1][12]=Integer.toString(r51[1]);

rows[1][13]=r41[4];

rows[1][14]=r42[3];

rows[1][10]=r42[1];

rows[1][11]=r42[2];

rows[1][12]=Integer.toString(r52[1]);

rows[1][13]=r42[4];

rows[1][14]=r42[3];

break;

Page 129: Mini project-DBMS & JAVA

129

}

for(int i=0;i<d;i++)

{

rows[i][0]=r[2];

rows[i][1]=r[3];

rows[i][2]=r[6];

rows[i][3]=r[4];

rows[i][4]=Integer.toString(r1[1]);

rows[i][5]=Integer.toString(r1[2]);

rows[i][6]=Integer.toString(r1[3]);

rows[i][15]=r[5];

}

for(int i=0;i<d;i++)

{

rows[i][7]=r2[i][1];

rows[i][8]=r2[i][2];

rows[i][9]=Integer.toString(r3[i][1]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(0,200,1366,102);

panel.add(scrollPane, BorderLayout.CENTER);

f7.add(panel);

f7.setSize(width,height);

f7.setLayout(null);

f7.setVisible(true);

}

public void access()

{

back.addActionListener(this);

stockdisp.addActionListener(this);

sta.addActionListener(this);

exit.addActionListener(this);

report.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

Page 130: Mini project-DBMS & JAVA

130

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f7.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

if(str.equals("FOR DISPLAYING OTHER DETAILS"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f7.setVisible(false);

// JOptionPane.showMessageDialog(null,"Displaying the

Menu!!");

DisplayMenu fi=new DisplayMenu();

try {

fi.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi.access();

}

if(str.equals("FOR GETTING REPORT"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

Page 131: Mini project-DBMS & JAVA

131

e2.printStackTrace();

}

f7.setVisible(false);

// JOptionPane.showMessageDialog(null,"Displaying the

Menu!!");

Report fi=new Report();

try {

fi.createlayout(on1,use,bi);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi.access();

}

if(str.equals("PENDING ORDERS"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f7.setVisible(false);

// JOptionPane.showMessageDialog(null,"Displaying the

Menu!!");

Status fi=new Status();

try {

fi.createlayout(on1,use,bi);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi.access();

}

if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f7.setVisible(false);

Page 132: Mini project-DBMS & JAVA

132

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Display customer:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Displaycustomer implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

Page 133: Mini project-DBMS & JAVA

133

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

long[][] r1=new long[50][50];

JTextField t1,t2;

String use,bi;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

use=user;

bi=bno;

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

Page 134: Mini project-DBMS & JAVA

134

f8.add(back);

head= new JLabel("CUSTOMER DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[5];

column[0]="BRANCH NO";

column[1]="CUSTOMER NO";

column[2]="CUSTOMER NAME";

column[3]="PHONE NO";

column[4]="CITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[5];

}

String sql1=""+"select * from udupi_customer where

bid='"+bno+"'" ;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(2);

r[i1][2]=rs5.getString(1);

r[i1][3]=rs5.getString(3);

r1[i1][1]=Long.parseLong(rs5.getString(4));

r[i1][4]=rs5.getString(5);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

Page 135: Mini project-DBMS & JAVA

135

rows[i][2]=r[i][3];

rows[i][3]=Long.toString(r1[i][1]);

rows[i][4]=r[i][4];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

Page 136: Mini project-DBMS & JAVA

136

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

DisplayMenu fi1=new DisplayMenu();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Display employee:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

Page 137: Mini project-DBMS & JAVA

137

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Displayemployee implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

long[][] r14=new long[50][50];

JTextField t1,t2;

String use,bi;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

use=user;

bi=bno;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

Page 138: Mini project-DBMS & JAVA

138

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("EMPLOYEE DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[8];

column[0]="BRANCH NO";

column[1]="EMPLOYEE ID";

column[2]="EMPLOYEE NAME";

column[3]="SEX";

column[4]="DOB";

column[5]="SALARY";

column[6]="MOBILE NO";

column[7]="CITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[8];

}

String sql1=""+"select * from udupi_employee where

bid='"+bno+"'" ;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(8);

r[i1][2]=rs5.getString(1);

Page 139: Mini project-DBMS & JAVA

139

r[i1][3]=rs5.getString(2);

r[i1][4]=rs5.getString(3);

r[i1][5]=rs5.getString(4);

r1[i1][1]=Integer.parseInt(rs5.getString(5));

r14[i1][2]=Long.valueOf(rs5.getString(6)).longValue();

r[i1][6]=rs5.getString(7);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=r[i][4];

rows[i][4]=r[i][5];

rows[i][5]=Integer.toString(r1[i][1]);

rows[i][6]=Long.toString(r14[i][2]);

rows[i][7]=r[i][6];

rows[i][4]=r[i][4];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

Page 140: Mini project-DBMS & JAVA

140

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

DisplayMenu fi1=new DisplayMenu();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Page 141: Mini project-DBMS & JAVA

141

Display menu:

package mini_project;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import javax.swing.*;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.Statement;

public class DisplayMenu implements ActionListener

{

JFrame f8;

JButton exit,branch,stock,customer,employee,back,mybranch,supplier;

JLabel title,head,bno,info;

JComboBox j1;

int i=0;

String arry[]=new String[50];

Connection con;

String use;

String bi;

public void createlayout(String user,String bi1) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

Page 142: Mini project-DBMS & JAVA

142

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

use=user;

bi=bi1;

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

head= new JLabel("DISPLAY MENU PAGE");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

mybranch=new JButton("MY BRANCH");

mybranch.setBounds(550,170,200,30);

f8.add(mybranch);

bno= new JLabel("BRANCH NO:");

bno.setBounds(500,370,100,30);

bno.setForeground(Color.white);

f8.add(bno);

j1=new JComboBox();

j1.setBounds(600,370,100,30);

Page 143: Mini project-DBMS & JAVA

143

f8.add(j1);

/*String sql1=""+"select bid from Branch";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}*/

branch=new JButton("DISPLAY ALL BRANCHES");

branch.setBounds(550,240,200,30);

f8.add(branch);

supplier=new JButton("DISPLAY ALL SUPPLIERS");

supplier.setBounds(550,300,200,30);

f8.add(supplier);

employee=new JButton("DISPLAY EMPLOYEE");

employee.setBounds(550,440,200,30);

f8.add(employee);

customer=new JButton("DISPLAY CUSTOMER");

customer.setBounds(550,510,200,30);

f8.add(customer);

// stock=new JButton("DISPLAY STOCK");

//stock.setBounds(550,580,200,30);

// f8.add(stock);

back=new JButton("Back");

back.setBounds(600,630,100,30);

f8.add(back);

info=new JLabel("<<<<<Select any One Branch ID to Display the

Employee Details, Customer Details or Stock Details>>>>>");

Page 144: Mini project-DBMS & JAVA

144

info.setBounds(340,570,750,30);

Font font3 = new Font("TimesNewRoman", Font.BOLD,15);

info.setFont(font3);

info.setForeground(Color.white);

f8.add(info);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

//for(int j=0;j<i;j++)

//j1.addItem(arry[j]);

j1.addItem(bi);

employee.addActionListener(this);

exit.addActionListener(this);

branch.addActionListener(this);

//stock.addActionListener(this);

customer.addActionListener(this);

supplier.addActionListener(this);

back.addActionListener(this);

mybranch.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

String bno1=""+j1.getItemAt(j1.getSelectedIndex());

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

Page 145: Mini project-DBMS & JAVA

145

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("DISPLAY ALL BRANCHES"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Branch

Details!!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Branchdis en=new Branchdis();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en.access();

}

else if(str.equals("DISPLAY ALL SUPPLIERS"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Branch

Details!!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

DisplaySupplier en8=new DisplaySupplier();

try {

en8.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

Page 146: Mini project-DBMS & JAVA

146

// TODO Auto-generated catch block

e.printStackTrace();

}

en8.access();

}

else if(str.equals("DISPLAY EMPLOYEE"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Employee

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Displayemployee en4=new Displayemployee();

try {

en4.createlayout(bno1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en4.access();

}

else if(str.equals("DISPLAY CUSTOMER"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Customer

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Displaycustomer en2=new Displaycustomer();

try {

en2.createlayout(bno1,use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

Page 147: Mini project-DBMS & JAVA

147

// TODO Auto-generated catch block

e.printStackTrace();

}

en2.access();

}

else if(str.equals("DISPLAY STOCK"))

{

//JOptionPane.showMessageDialog(null,"Displaying the Stock

Details of Branch No:" +bno1);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Displaystock en1=new Displaystock();

try {

en1.createlayout(bno1,use);

} catch (ClassNotFoundException |

NullPointerException|SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en1.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException |

NullPointerException|SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Page 148: Mini project-DBMS & JAVA

148

fi1.access();

}

else if(str.equals("MY BRANCH"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Mybranch mb=new Mybranch();

try {

mb.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

mb.access();

}

}

}

Display stock main:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

Page 149: Mini project-DBMS & JAVA

149

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class Displaysta implements ActionListener{

JFrame f1;

JLabel dno,sno,cno,fno,title,head,full;

JComboBox t1,t2,t3,t4;

JButton b1,b2,b3,b4,back,exit;

Connection con;

String use,use1;

int i=0,i1=0,i2=0,i3=0;

String arry[]=new String[40];

String arry1[]=new String[40];

String arry2[]=new String[40];

String arry3[]=new String[40];

String bi;

public void createlayout(String user,String bi1) throws

ClassNotFoundException, SQLException

{

f1=new JFrame();

Class.forName("oracle.jdbc.driver.OracleDriver");

con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe

","rakhav","1234");

f1.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bi1;

Font fo = new Font("TimesNewRoman", Font.BOLD,15);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(380,40, 800, 30);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f1.add(title);

Page 150: Mini project-DBMS & JAVA

150

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(295,25,72,77);

f1.add(imagelabel);

head=new JLabel("WELCOME TO STOCK MAINTENANCE");

head.setBounds(450,110, 700, 30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f1.add(head);

b2=new JButton("ADDED STOCK INFORMATION");

b2.setBounds(500,350,250,30);

f1.add(b2);

b3=new JButton("CURRENT STATUS OF STOCK ITEMS");

b3.setBounds(500,450,250,30);

f1.add(b3);

exit=new JButton("Logout");

exit.setBounds(1200,50,100,30);

f1.add(exit);

/* full=new JLabel("<<<Select the Required One from the List and

Click Delete Buttons to Delete>>>");

full.setBounds(300,600,1000,30);

full.setForeground(Color.white);

full.setFont(font1);

f1.add(full); */

back=new JButton("Back");

back.setBounds(100,600,100,30);

f1.add(back);

f1.setSize(width,height);

f1.setLayout(null);

f1.setVisible(true);

}

public void access()

{

exit.addActionListener(this);

back.addActionListener(this);

Page 151: Mini project-DBMS & JAVA

151

// b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

//b4.addActionListener(this);

}

public void actionPerformed(ActionEvent e) {

String str=e.getActionCommand();

if(e.getSource()==exit)

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

StockManagement fi1=new StockManagement();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1)

{

// TODO Auto-generated catch block

e1.printStackTrace();

Page 152: Mini project-DBMS & JAVA

152

}

fi1.access();

}

else if(str.equals("ADDED STOCK INFORMATION"))

{

//JOptionPane.showMessageDialog(null,"Deleted!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Stockdis ns=new Stockdis();

try {

ns.createlayout(bi,use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

ns.access();

}

else if(str.equals("CURRENT STATUS OF STOCK ITEMS"))

{

// JOptionPane.showMessageDialog(null,"Deleted!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Currentstatus cs=new Currentstatus();

try {

cs.createlayout(bi, use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

cs.access();

}

Page 153: Mini project-DBMS & JAVA

153

}

}

Display stock:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Displaystock implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

JTextField t1,t2;

String use,bi;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

Page 154: Mini project-DBMS & JAVA

154

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bno;

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

// title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("ADDED STOCK DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

//head.setForeground(Color.white);

f8.add(head);

Page 155: Mini project-DBMS & JAVA

155

String column[]=new String[6];

column[0]="BRANCH NO";

column[1]="STOCK NO";

column[2]="STOCK NAME";

column[3]="QUANTITY";

column[4]="SUPPLIER ID";

column[5]="AMOUNT PAID";

for(int i=0;i<10;i++)

{

rows[i]=new String[6];

}

String sql1=""+"select * from udupi_stock where bid='"+bno+"'" ;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(2);

r[i1][2]=rs5.getString(1);

r[i1][3]=rs5.getString(3);

r[i1][4]=rs5.getString(5);

r1[i1][1]=Integer.parseInt(rs5.getString(4));

r1[i1][2]=Integer.parseInt(rs5.getString(6));

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][4]=r[i][4];

rows[i][3]=Integer.toString(r1[i][1]);

rows[i][5]=Integer.toString(r1[i][2]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

Page 156: Mini project-DBMS & JAVA

156

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Page 157: Mini project-DBMS & JAVA

157

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | NullPointerException |

SQLException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Display supplier:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class DisplaySupplier implements ActionListener{

JFrame f8;

Page 158: Mini project-DBMS & JAVA

158

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[20][];

String[][] r=new String[50][50];

long[][] r1=new long[50][50];

JTextField t1,t2;

String use;

String bi;

public void createlayout(String user,String bi1) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bi1;

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

Page 159: Mini project-DBMS & JAVA

159

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("SUPPLIER DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[4];

column[0]="SUPPLIER NO";

column[1]="SUPPLIER NAME";

column[2]="SUPPLIER CITY";

column[3]="PHONE NUMBER";

for(int i=0;i<20;i++)

{

rows[i]=new String[4];

}

String sql1=""+"select * from udupi_supplier1";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(1);

r[i1][2]=rs5.getString(2);

r[i1][3]=rs5.getString(4);

r1[i1][1]=Long.parseLong(rs5.getString(3));

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

Page 160: Mini project-DBMS & JAVA

160

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=Long.toString(r1[i][1]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,250,1000,200);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

Page 161: Mini project-DBMS & JAVA

161

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

DisplayMenu fi1=new DisplayMenu();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException |

SQLException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Employee display:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

Page 162: Mini project-DBMS & JAVA

162

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Employeedis implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

long[][] r14=new long[50][50];

JTextField t1,t2;

String use;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

use=user;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

//title.setForeground(Color.white);

f8.add(title);

Page 163: Mini project-DBMS & JAVA

163

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("EMPLOYEE DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

//head.setForeground(Color.white);

f8.add(head);

String column[]=new String[8];

column[0]="BRANCH NO";

column[1]="EMPLOYEE ID";

column[2]="EMPLOYEE NAME";

column[3]="SEX";

column[4]="DOB";

column[5]="SALARY";

column[6]="MOBILE NO";

column[7]="CITY";

for(int i=0;i<10;i++)

{

rows[i]=new String[8];

}

String sql1=""+"select * from udupi_employee where

bid='"+bno+"'" ;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(8);

r[i1][2]=rs5.getString(1);

Page 164: Mini project-DBMS & JAVA

164

r[i1][3]=rs5.getString(2);

r[i1][4]=rs5.getString(3);

r[i1][5]=rs5.getString(4);

r1[i1][1]=Integer.parseInt(rs5.getString(5));

r14[i1][2]=Long.valueOf(rs5.getString(6)).longValue();

r[i1][6]=rs5.getString(7);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=r[i][4];

rows[i][4]=r[i][5];

rows[i][5]=Integer.toString(r1[i][1]);

rows[i][6]=Long.toString(r14[i][2]);

rows[i][7]=r[i][6];

rows[i][4]=r[i][4];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

Page 165: Mini project-DBMS & JAVA

165

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Page 166: Mini project-DBMS & JAVA

166

My branch:

package mini_project;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

public class Mybranch implements ActionListener {

JFrame f3;

JLabel t1,t2,t3,t4,t5,t6,t7;

JButton insert,exit,back,check;

Connection con;

JPasswordField ppname;

String bid,bman,city1,usern,hint1,mail1,pass,phn1;

JLabel branchid, branchname, phnno, city, head,

head1,username,pname,hint,mail,pass1,jphoto;

long phn;

String use,photo,bi;

public void createlayout(String user,String bi1) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

Page 167: Mini project-DBMS & JAVA

167

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f3=new JFrame();

use=user;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f3.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

head=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

head.setBounds(400,20,700, 30);

Font font = new Font("Algerian", Font.BOLD,30);

head.setFont(font);

head.setForeground(Color.white);

f3.add(head);

bi=bi1;

Font fo=new Font("TimesNewRoman",Font.BOLD,20);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(315,0,72,77);

f3.add(imagelabel);

head1=new JLabel("BRANCH DETAILS");

head1.setBounds(550,100,500,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head1.setFont(font1);

head1.setForeground(Color.white);

f3.add(head1);

String sql=""+"select * from Branch where mname='"+user+"'";

String sql2=""+"select * from manager_user where

username='"+user+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql);

while(rs5.next())

{

Page 168: Mini project-DBMS & JAVA

168

bman=rs5.getString(1);

phn=Long.valueOf(rs5.getString(2)).longValue();

city1=rs5.getString(3);

bid=rs5.getString(4);

photo=rs5.getString(6);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

try {

Statement stmt31 = con.createStatement();

ResultSet rs51=stmt31.executeQuery(sql2);

while(rs51.next())

{

usern=rs51.getString(1);

pass=rs51.getString(2);

hint1=rs51.getString(3);

mail1=rs51.getString(4);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

branchid= new JLabel("Branch ID:");

branchid.setBounds(500,160,100,30);

branchid.setForeground(Color.white);

branchid.setFont(fo);

f3.add(branchid);

t1=new JLabel(bid);

t1.setForeground(Color.white);

t1.setFont(fo);

t1.setBounds(700,160,200,30);

f3.add(t1);

// check=new JButton("Check");

// check.setBounds(800,160,100,30);

//f3.add(check);

branchname= new JLabel("Manager Name:");

branchname.setBounds(500,220,150,30);

Page 169: Mini project-DBMS & JAVA

169

branchname.setForeground(Color.white);

branchname.setFont(fo);

f3.add(branchname);

t2=new JLabel(bman);

t2.setFont(fo);

t2.setForeground(Color.white);

t2.setBounds(700,220,200,30);

f3.add(t2);

username=new JLabel("Username:");

username.setBounds(500,280,100,30);

f3.add(username);

username.setFont(fo);

username.setForeground(Color.white);

t5=new JLabel(usern);

t5.setFont(fo);

t5.setForeground(Color.white);

t5.setBounds(700,280,200,30);

f3.add(t5);

hint=new JLabel("Hint:");

hint.setBounds(500,400,100,30);

f3.add(hint);

hint.setFont(fo);

hint.setForeground(Color.white);

t6=new JLabel(hint1);

t6.setFont(fo);

t6.setForeground(Color.white);

t6.setBounds(700, 400,200, 30);

f3.add(t6);

mail=new JLabel("Mail ID:");

mail.setBounds(500,460,100,30);

mail.setForeground(Color.white);

mail.setFont(fo);

f3.add(mail);

t7=new JLabel(mail1);

t7.setForeground(Color.white);

t7.setFont(fo);

t7.setBounds(700, 460,200, 30);

f3.add(t7);

jphoto=new JLabel();

Page 170: Mini project-DBMS & JAVA

170

jphoto.setIcon(new ImageIcon(photo));

jphoto.setBounds(1000,100,200,200);

jphoto.setVisible(true);

f3.add(jphoto);

pname=new JLabel("Password:");

pname.setForeground(Color.white);

pname.setBounds(500,340,100,30);

f3.add(pname);

pname.setFont(fo);

pass1=new JLabel(pass);

pass1.setBounds(700,340,200,30);

pass1.setFont(fo);

pass1.setForeground(Color.white);

f3.add(pass1);

phnno= new JLabel("Phone No:");

phnno.setBounds(500,520,100,30);

phnno.setForeground(Color.white);

f3.add(phnno);

phnno.setFont(fo);

phn1=Long.toString(phn);

t3=new JLabel(phn1);

t3.setFont(fo);

t3.setBounds(700,520,200,30);

t3.setForeground(Color.white);

f3.add(t3);

city=new JLabel("City:");

city.setBounds(500,580,100,30);

city.setForeground(Color.white);

city.setFont(fo);

f3.add(city);

t4=new JLabel(city1);

t4.setBounds(700,580,200,30);

t4.setFont(fo);

t4.setForeground(Color.white);

f3.add(t4);

//insert=new JButton("Insert");

//insert.setBounds(600,650,100,30);

//f3.add(insert);

Page 171: Mini project-DBMS & JAVA

171

back=new JButton("Back");

back.setBounds(100,650,100,30);

f3.add(back);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f3.add(exit);

f3.setSize(width,height);

f3.setLayout(null);

f3.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

//insert.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

//String ono=text1.getText();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f3.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

Page 172: Mini project-DBMS & JAVA

172

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f3.setVisible(false);

DisplayMenu fi1=new DisplayMenu();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

}

}

New stock:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

Page 173: Mini project-DBMS & JAVA

173

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class NewStock implements ActionListener{

JLabel stock,branchid, title, stockid, stockname;

int qty;

JButton insert, exit,back,check;

JFrame f2;

JTextField t1,t2,t3,t4;

Connection con;

String sid,sname,bno1;

String arry1[]=new String[50];

int i=0,qty1;

JLabel qty11;

String use;

int flag=0,flag1=0;

int f=0;

String bi;

public void createlayout(String user,String bi1) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f2=new JFrame();

use=user;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f2.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(380,20, 800, 30);

title.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

f2.add(title);

Page 174: Mini project-DBMS & JAVA

174

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(295,10,72,77);

f2.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f2.add(exit);

stock= new JLabel("ITEM INSERTION PAGE");

stock.setBounds(500,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

stock.setFont(font1);

stock.setForeground(Color.white);

f2.add(stock);

branchid= new JLabel("Branch ID:");

branchid.setBounds(500,250,100,30);

branchid.setForeground(Color.white);

f2.add(branchid);

t2=new JTextField(30);

t2.setBounds(600,250,100,30);

t2.setText(bi);

f2.add(t2);

check=new JButton("Check");

check.setBounds(800,350,100,30);

f2.add(check);

stockname= new JLabel("Item Name:");

stockname.setBounds(500,350,100,30);

stockname.setForeground(Color.white);

f2.add(stockname);

t4=new JTextField(30);

t4.setBounds(600,350,100,30);

f2.add(t4);

qty11= new JLabel("Quantity:");

qty11.setBounds(500,450,100,30);

qty11.setForeground(Color.white);

f2.add(qty11);

t3=new JTextField(20);

Page 175: Mini project-DBMS & JAVA

175

t3.setBounds(600,450,100,30);

f2.add(t3);

back=new JButton("Back");

back.setBounds(100,600,100,30);

f2.add(back);

insert=new JButton("Insert");

insert.setBounds(600,600,100,30);

f2.add(insert);

//int count=1;

/* try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry1[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}*/

f2.setSize(width,height);

f2.setLayout(null);

f2.setVisible(true);

}

public void access()

{

t4.addActionListener(this);

exit.addActionListener(this);

back.addActionListener(this);

check.addActionListener(this);

insert.addActionListener(this);

t2.addActionListener(this);

t3.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

Page 176: Mini project-DBMS & JAVA

176

String str=e.getActionCommand();

bno1=t4.getText();

sname=t2.getText();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

// JOptionPane.showMessageDialog(null,flag);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setVisible(false);

StockManagement fi1=new StockManagement();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException |

NullPointerException |SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Check"))

{

Page 177: Mini project-DBMS & JAVA

177

String sq=""+"select * from udupi_stock1 where

sname='"+bno1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Insert"))

{

sid=t4.getText();

sname=t2.getText();

if(sid.equals("") || sname.equals("")|| t3.getText().equals(""))

{

flag=1;

}

if(flag==0)

{

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

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

String sql="insert into udupi_stock1

values('"+sid+"','"+qty+"','"+sname+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

Page 178: Mini project-DBMS & JAVA

178

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Inserted");

f2.setVisible(false);

StockManagement en=new StockManagement();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUES IN ALL FIELDS");

flag=0;

}

}

}

}

Order:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

Page 179: Mini project-DBMS & JAVA

179

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class Order implements ActionListener {

JFrame f4;

JButton new1,cust,next,exit,reset,check,back,gettotal;

Connection con;

JComboBox<Integer> day,year,day1,year1;

JComboBox<String> cno,bno,month,month1;

JComboBox odet,sta;

String ono1,mon,mon1,cno1,bno1;

int qty1,pric,tot1,da,da1,ye1,ye,flag=0;

JLabel ono,odetails,odate,sta1, qty,branchno, custno,

ppu,tot,lable,title,head,deldate;

JTextField t[]=new JTextField[7];

private String[] mmonth1 = { "jan", "feb","mar","apr", "may", "jun",

"jul", "aug" , "sep", "oct", "nov", "dec"};

private String[] mmonth = { "jan", "feb","mar","apr", "may", "jun", "jul",

"aug" , "sep", "oct", "nov", "dec"};

String arry2[]={"Invitation","Multicolor Invi","Spiral

Binding","Binding","Magazine","Strinching","Articles","Poster","Multicolor

Poster","Books","Notices"};

String arry3[]={"Delivered","Pending"};

int []dday;

int []yyear;

int []dday1;

int []yyear1;

String arry[]=new String[50];

String arry1[]=new String[50];

int cou1=0,done=0,done1=0,don=0,don1=0,fl=0,fl1=0,fl2=0;

int cou2=0,do1=0,do2=0;

String status;

String use,od,od1,bi;

int f=0;

public void createlayout(String user,String bi1) throws SQLException,

ClassNotFoundException

{

Page 180: Mini project-DBMS & JAVA

180

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f4=new JFrame();

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bi1;

f4.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(440,0, 800, 50);

title.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

f4.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(355,0,72,77);

f4.add(imagelabel);

for(int i=1;i<6;i++)

t[i]= new JTextField(20);

head=new JLabel("ORDER INSERTION PAGE");

head.setBounds(530,50,300,50);

head.setFont(new Font("Comic Sans MS",Font.BOLD,20));

head.setForeground(Color.white);

f4.add(head);

branchno= new JLabel("Branch No:");

branchno.setBounds(400,110,100,30);

branchno.setForeground(Color.white);

f4.add(branchno);

bno = new JComboBox<String>();

bno.setBounds(500,110,75,25);

f4.add(bno);

Page 181: Mini project-DBMS & JAVA

181

custno= new JLabel("Customer No");

custno.setBounds(400,170,100,30);

custno.setForeground(Color.white);

f4.add(custno);

cno = new JComboBox<String>();

cno.setBounds(500,170,75,25);

f4.add(cno);

cust= new JButton("To Insert New Customer");

cust.setBounds(600,170,200,30);

f4.add(cust);

ono=new JLabel("Order No:");

ono.setBounds(400,230,300,25);

ono.setForeground(Color.white);

f4.add(ono);

t[1].setBounds(500,230,300,25);

f4.add(t[1]);

check=new JButton("Check");

check.setBounds(900,230,100,30);

f4.add(check);

odetails=new JLabel("Order Details:");

odetails.setBounds(400,290,300,25);

odetails.setForeground(Color.white);

f4.add(odetails);

odet=new JComboBox();

odet.setBounds(500,290,300,25);

f4.add(odet);

odate=new JLabel("Order Date:");

odate.setBounds(400,350,100,25);

odate.setForeground(Color.white);

f4.add(odate);

month1 = new JComboBox<String>();

month1.setBounds(500,350,75,25);

f4.add(month1);

day1=new JComboBox<Integer>();

dday1=new int[31];

Page 182: Mini project-DBMS & JAVA

182

for(int i=0;i<31;i++)

{

dday1[i]=i+1;

}

day1.setBounds(600,350,50,25);

f4.add(day1);

year1=new JComboBox<Integer>();

yyear1=new int[5000];

for(int i=1960;i<2030;i++)

yyear1[i]=i;

year1.setBounds(700,350,100,25);

f4.add(year1);

/* new1=new JButton("Get Date");

new1.setBounds(900,350,100,25);

f4.add(new1);*/

deldate=new JLabel("Delivery Date:");

deldate.setBounds(400,410,100,25);

deldate.setForeground(Color.white);

f4.add(deldate);

month = new JComboBox<String>();

month.setBounds(500,410,75,25);

f4.add(month);

day=new JComboBox<Integer>();

dday=new int[31];

for(int i=0;i<31;i++)

{

dday[i]=i+1;

}

day.setBounds(600,410,50,25);

f4.add(day);

year=new JComboBox<Integer>();

yyear=new int[5000];

for(int i=1960;i<2030;i++)

yyear[i]=i;

year.setBounds(700,410,100,25);

f4.add(year);

sta1=new JLabel("Status");

Page 183: Mini project-DBMS & JAVA

183

sta1.setBounds(400,470,100,25);

sta1.setForeground(Color.white);

f4.add(sta1);

sta=new JComboBox();

sta.setBounds(500,470,300,30);

f4.add(sta);

qty=new JLabel("Quantity:");

qty.setBounds(400,530,300,25);

qty.setForeground(Color.white);

f4.add(qty);

t[3].setBounds(500,530,300,25);

f4.add(t[3]);

ppu=new JLabel("Price Per Unit:");

ppu.setBounds(400,590,300,25);

ppu.setForeground(Color.white);

f4.add(ppu);

t[4].setBounds(500,590,300,25);

f4.add(t[4]);

tot=new JLabel("Total: ");

tot.setBounds(400,640,300,25);

tot.setForeground(Color.white);

f4.add(tot);

t[5].setBounds(500,640,300,25);

f4.add(t[5]);

/*gettotal=new JButton("Give Total");

gettotal.setBounds(900,640,100,25);

f4.add(gettotal);*/

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f4.add(exit);

next=new JButton("Next");

next.setBounds(700,680,100,30);

f4.add(next);

back=new JButton("Back");

back.setBounds(100,680,100,30);

f4.add(back);

Page 184: Mini project-DBMS & JAVA

184

reset=new JButton("Reset");

reset.setBounds(500,680,100,30);

f4.add(reset);

String sql1=""+"select cno from udupi_customer where

bid='"+bi+"'";

/*String sql2=""+"select bid from Branch where us";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sql2);

while(rs1.next())

{

arry1[cou2]=rs1.getString(1);

cou2++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

} */

try{

Statement stmt1 = con.createStatement();

ResultSet rs=stmt1.executeQuery(sql1);

while(rs.next())

{

arry[cou1]=rs.getString(1);

cou1++;

}

}catch (SQLException e3) {

// TODO Auto-generated catch block

e3.printStackTrace();

}

int count=1;

String sq=""+"select ono from udupi_order";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

count++;

}

Page 185: Mini project-DBMS & JAVA

185

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String lab="ORD";

String la=lab+String.valueOf(count);

String sq1=""+"select * from udupi_order where ono='"+la+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq1);

if(rs1.next())

f=1;

else

f=0;

} catch (HeadlessException | NullPointerException| SQLException

e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

if(f==1)

{

String lab1="ORDA";

String la1=lab1+String.valueOf(count);

t[1].setText(la1);

}

else

t[1].setText(la);

t[1].setText(la);

f4.setSize(width,height);

f4.setLayout(null);

f4.setVisible(true);

}

public void access()

{

//new1.addActionListener(this);

back.addActionListener(this);

for (int i = 0; i < 12; i++)

month.addItem(mmonth[i]);

for (int i = 0; i < 31; i++)

day.addItem(dday[i]);

for (int i = 1960; i < 2030; i++)

Page 186: Mini project-DBMS & JAVA

186

year.addItem(yyear[i]);

for (int i = 0; i < 12; i++)

month1.addItem(mmonth1[i]);

for (int i = 0; i < 31; i++)

day1.addItem(dday1[i]);

for (int i = 1960; i < 2030; i++)

year1.addItem(yyear1[i]);

for(int i=0;i<2;i++)

sta.addItem(arry3[i]);

for(int i=0;i<11;i++)

odet.addItem(arry2[i]);

for(int i=1;i<6;i++)

t[i].addActionListener(this);

for(int j=0;j<cou1;j++)

cno.addItem(arry[j]);

//for(int j1=0;j1<cou2;j1++)

//bno.addItem(arry1[j1]);

bno.addItem(bi);

for(int j = 1;j<6;j++)

t[j].addActionListener(this);

check.addActionListener(this);

//gettotal.addActionListener(this);

month1.addActionListener(this);

day1.addActionListener(this);

year1.addActionListener(this);

month.addActionListener(this);

day.addActionListener(this);

year.addActionListener(this);

next.addActionListener(this);

reset.addActionListener(this);

cust.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(e.getSource()==t[4])

{

int tot1;

int q=Integer.parseInt(t[3].getText());

int q1=Integer.parseInt(t[4].getText());

tot1=q*q1;

Page 187: Mini project-DBMS & JAVA

187

String so=Integer.toString(tot1);

t[5].setText(so);

t[5].setEnabled(false);

}

if(e.getSource()==month1)

{

od=""+month1.getItemAt(month1.getSelectedIndex());

if(od.equals("feb"))

{

done=1;

day1.removeItem(dday1[29]);

if(done1==0)

day1.removeItem(dday1[30]);

}

else if(od.equals("apr") || od.equals("jun") || od.equals("jun")

|| od.equals("sep") || od.equals("nov"))

{

if(done==1)

{

day1.addItem(dday1[29]);

done=0;

}

day1.removeItem(dday1[30]);

done1=1;

}

else if(od.equals("jan") || od.equals("mar") ||

od.equals("may") || od.equals("jul") || od.equals("aug") || od.equals("oct") ||

od.equals("dec"))

{

if(done==1)

{

day1.addItem(dday1[29]);

day1.addItem(dday1[30]);

done=0;

}

if(done1==1)

{

day1.addItem(dday1[30]);

done1=0;

}

}

}

Page 188: Mini project-DBMS & JAVA

188

if(e.getSource()==month)

{

// JOptionPane.showMessageDialog(null,"New Customer");

od=""+month.getItemAt(month.getSelectedIndex());

if(od.equals("feb"))

{

don=1;

day.removeItem(dday[29]);

if(don1==0)

day.removeItem(dday[30]);

}

else if(od.equals("apr") || od.equals("jun") || od.equals("jun")

|| od.equals("sep") || od.equals("nov"))

{

if(don==1)

{

day.addItem(dday[29]);

don=0;

}

day.removeItem(dday[30]);

don1=1;

}

else if(od.equals("jan") || od.equals("mar") ||

od.equals("may") || od.equals("jul") || od.equals("aug") || od.equals("oct") ||

od.equals("dec"))

{

if(don==1)

{

day.addItem(dday[29]);

day.addItem(dday[30]);

don=0;

}

if(don1==1)

{

day.addItem(dday[30]);

don1=0;

}

}

}

if(str.equals("Sign Out"))

{

try {

con.close();

Page 189: Mini project-DBMS & JAVA

189

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f4.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

/* else if(str.equals("Give Total"))

{

qty1=Integer.parseInt(t[3].getText());

pric=Integer.parseInt(t[4].getText());

int total=qty1*pric;

String tot1=Integer.toString(total);

t[5].setText(tot1);

t[5].setEnabled(false);

}*/

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f4.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("To Insert New Customer"))

Page 190: Mini project-DBMS & JAVA

190

{

//JOptionPane.showMessageDialog(null,"New Customer");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f4.setVisible(false);

Customer en=new Customer();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else if(str.equals("Check"))

{

String ono12=t[1].getText();

String sq=""+"select * from udupi_order where

ono='"+ono12+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Next"))

{

Page 191: Mini project-DBMS & JAVA

191

flag=0;

fl=0;

fl1=0;

fl2=0;

ono1=t[1].getText();

String mon2,mon3;

od=""+odet.getItemAt(odet.getSelectedIndex());

//JOptionPane.showMessageDialog(null,odet);

mon=""+month.getItemAt(month.getSelectedIndex());

mon3=mon;

da=Integer.parseInt(""+day.getItemAt(day.getSelectedIndex()));

ye=Integer.parseInt(""+year.getItemAt(year.getSelectedIndex()));

mon=da+"-"+mon+"-"+ye;

mon1=""+month1.getItemAt(month1.getSelectedIndex());

mon2=mon1;

da1=Integer.parseInt(""+day1.getItemAt(day1.getSelectedIndex()));

ye1=Integer.parseInt(""+year1.getItemAt(year1.getSelectedIndex()));

mon1=da1+"-"+mon1+"-"+ye1;

cno1=(""+cno.getItemAt(cno.getSelectedIndex()));

bno1=(""+bno.getItemAt(bno.getSelectedIndex()));

status=""+sta.getItemAt(sta.getSelectedIndex());

int cou1=0,cou2 = 0;

for(int i=0;i<12;i++)

{

if(mmonth[i].equals(mon2))

cou1=i+1;

}

for(int i=0;i<12;i++)

{

if(mmonth[i].equals(mon3))

cou2=i+1;

}

//JOptionPane.showMessageDialog(null,ye1);

// JOptionPane.showMessageDialog(null,ye);

if(ye1>ye)

{

fl1=0;

fl2=0;

Page 192: Mini project-DBMS & JAVA

192

JOptionPane.showMessageDialog(null,"ENTERED

DELIVERY DATE IS WRONG");

fl=1;

}

if(ye1==ye && cou1>cou2)

{

fl=0;

fl2=0;

JOptionPane.showMessageDialog(null,"ENTERED

DELIVERY DATE IS WRONG");

fl1=1;

}

if(ye1==ye && cou1==cou2 && da1>da)

{

fl=0;

fl1=0;

JOptionPane.showMessageDialog(null,"ENTERED

DELIVERY DATE IS WRONG");

fl2=1;

}

if(ono1.equals("")||od.equals("")||t[3].getText().equals("")||t[4].getText().e

quals("")||t[5].getText().equals("")||cno1.equals("")||bno1.equals(""))

{

flag=1;

}

//JOptionPane.showMessageDialog(null,flag);

if(flag==0 && fl==0 && fl1==0 && fl2==0)

{

qty1=Integer.parseInt(t[3].getText());

pric=Integer.parseInt(t[4].getText());

tot1=Integer.parseInt(t[5].getText());

//JOptionPane.showMessageDialog(null,mon1);

String sql="insert into udupi_order

values('"+ono1+"','"+bno1+"','"+cno1+"','"+mon+"','"+qty1+"','"+pric+"','"+tot1

+"','"+status+"','"+od+"','"+mon1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

Page 193: Mini project-DBMS & JAVA

193

}

//JOptionPane.showMessageDialog(null,"Inserted and going

to next page");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f4.setVisible(false);

Product en=new Product();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

// JOptionPane.showMessageDialog(null,fl);

//JOptionPane.showMessageDialog(null,fl1);

//JOptionPane.showMessageDialog(null,fl2);

if(fl!=1 && fl1!=1 && fl2!=1)

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUES IN ALL FIELDS");

flag=0;

fl=0;

fl1=0;

fl2=0;

}

}

}

else if(str.equals("Reset"))

{

t[1].setText("");

t[2].setText("");

t[3].setText("");

t[4].setText("");

t[5].setText("");

Page 194: Mini project-DBMS & JAVA

194

}

}

}

Order display:

package mini_project;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import javax.swing.*;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.Statement;

public class OrderDisplay implements ActionListener

{

JFrame f7;

JButton exit,stockdisp,back;

JLabel

title,order,head,cust,odes,deldate,ppu,prono,proname,proqty,supno,supname,am

tpaid;

Connection con;

int d=0,e=0;

String r[]=new String[50];

String r2[][]=new String[50][50];

int r3[][]=new int[40][40];

int r1[]=new int[40];

String r4[]=new String[40];

String r41[]=new String[40];

String r42[]=new String[40];

int r51[]=new int[40];

Page 195: Mini project-DBMS & JAVA

195

int r52[]=new int[40];

int r5[]=new int[40];

String ri[]=new String[10];

String sql3,sql4,sql5,sql6;

int k=0,d1;

Long t[]=new Long[5];

Long t1[]=new Long[5];

String[][]rows=new String[5][];

String use;

public void createlayout(String ono1,String user) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f7=new JFrame();

use=user;

f7.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

Container c=f7.getContentPane();

c.setBackground(Color.yellow);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(440,0, 800, 50);

// title.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

f7.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(355,0,72,77);

f7.add(imagelabel);

order=new JLabel("Order Details of Order No: "+ono1+"");

order.setBounds(595,150,300,25);

//order.setForeground(Color.white);

Font fo=new Font("Comic Sans MS", Font.BOLD,15);

order.setFont(fo);

Page 196: Mini project-DBMS & JAVA

196

f7.add(order);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f7.add(exit);

cust=new JLabel("CUST NO ->Customer No");

cust.setBounds(1100,330,200,30);

cust.setForeground(Color.red);

f7.add(cust);

odes=new JLabel("ORDER DESC -> Order Discription");

odes.setBounds(1100,350,200,30);

odes.setForeground(Color.red);

f7.add(odes);

deldate=new JLabel("DEL DATE -> Delivery Date");

deldate.setBounds(1100,370,200,30);

deldate.setForeground(Color.red);

f7.add(deldate);

ppu=new JLabel("PPU -> Price per unit");

ppu.setBounds(1100,390,200,30);

ppu.setForeground(Color.red);

f7.add(ppu);

prono=new JLabel("PRO NO -> Product No");

prono.setBounds(1100,410,200,30);

prono.setForeground(Color.red);

f7.add(prono);

proname=new JLabel("PRO NAME -> Product Name");

proname.setBounds(1100,430,200,30);

proname.setForeground(Color.red);

f7.add(proname);

proqty=new JLabel("PRO QTY -> Product Quantity");

proqty.setBounds(1100,450,200,30);

proqty.setForeground(Color.red);

f7.add(proqty);

supno=new JLabel("SUP NO -> Supplier No");

supno.setBounds(1100,470,200,30);

supno.setForeground(Color.red);

f7.add(supno);

supname=new JLabel("SUP NAME -> Supplier Name");

supname.setBounds(1100,490,200,30);

supname.setForeground(Color.red);

f7.add(supname);

amtpaid=new JLabel("Amt Paid -> Amout Paid");

Page 197: Mini project-DBMS & JAVA

197

amtpaid.setBounds(1100,510,200,30);

amtpaid.setForeground(Color.red);

f7.add(amtpaid);

head= new JLabel("ORDER DISPLAY PAGE");

head.setBounds(570,90,400,30);

//head.setForeground(Color.white);

Font font1 = new Font("Times New Roman", Font.BOLD,25);

head.setFont(font1);

f7.add(head);

back=new JButton("Back");

back.setBounds(650,450,100,30);

f7.add(back);

String column[]=new String[16];

column[0]="BRANCH NO";

column[1]="CUST NO";

column[2]="ORDER DESC";

column[3]="DEL DATE";

column[4]="QUANTITY";

column[5]="PPU";

column[6]="TOTAL PAID";

column[7]="PRO NO";

column[8]="PRO NAME";

column[9]="PRO QTY";

column[10]="SUP NO";

column[11]="SUP NAME";

column[12]="AMT PAID";

column[13]="PHONE NO";

column[14]="CITY";

column[15]="STATUS";

for(int i=0;i<5;i++)

{

rows[i]=new String[16];

}

String sql1=""+"select * from udupi_order where ono='"+ono1+"'";

try {

Statement stmt1 = con.createStatement();

ResultSet rs1=stmt1.executeQuery(sql1);

while(rs1.next())

{

r[1]=rs1.getString(1);

Page 198: Mini project-DBMS & JAVA

198

r[2]=rs1.getString(2);

r[3]=rs1.getString(3);

r[4]=rs1.getString(4);

r1[1]=Integer.parseInt(rs1.getString(5));

r1[2]=Integer.parseInt(rs1.getString(6));

r1[3]=Integer.parseInt(rs1.getString(7));

r[5]=rs1.getString(8);

r[6]=rs1.getString(9);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql2=""+"select * from udupi_product where

ono='"+ono1+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sql2);

while(rs1.next())

{

r2[d][1]=rs1.getString(1);

r2[d][2]=rs1.getString(3);

r3[d][1]=Integer.parseInt(rs1.getString(4));

d++;

}

d1=d;

// JOptionPane.showMessageDialog(null, d1);

// JOptionPane.showMessageDialog(null, r2[0][1]);

// JOptionPane.showMessageDialog(null, r2[1][1]);

k=0;

// JOptionPane.showMessageDialog(null, k);

d1--;

//JOptionPane.showMessageDialog(null, d1);

while(d1>=0)

{

ri[d1]=r2[d1][1];

d1--;

k=k+1;

}

} catch (SQLException e3) {

// TODO Auto-generated catch block

e3.printStackTrace();

}

Page 199: Mini project-DBMS & JAVA

199

k--;

//JOptionPane.showMessageDialog(null, k);

//JOptionPane.showMessageDialog(null, ri[0]);

//JOptionPane.showMessageDialog(null, ri[1]);

int p=k;

switch(k)

{

case 0:

sql3=""+"select * from udupi_Supplier where

pno='"+ri[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs3=stmt3.executeQuery(sql3);

while(rs3.next())

{

r4[1]=rs3.getString(1);

r4[2]=rs3.getString(3);

r5[1]=Integer.parseInt(rs3.getString(4));

r4[4]=rs3.getString(5);

r4[3]=rs3.getString(6);

}

} catch (SQLException e3) {

// TODO Auto-generated catch block

e3.printStackTrace();

}

rows[0][10]=r4[1];

rows[0][11]=r4[2];

rows[0][12]=Integer.toString(r5[1]);

rows[0][13]=r4[4];

rows[0][14]=r4[3];

break;

case 1:

sql3=""+"select * from udupi_supplier where

pno='"+ri[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs4=stmt3.executeQuery(sql3);

while(rs4.next())

{

r4[1]=rs4.getString(1);

r4[2]=rs4.getString(3);

r5[1]=Integer.parseInt(rs4.getString(4));

Page 200: Mini project-DBMS & JAVA

200

r4[4]=rs4.getString(5);

r4[3]=rs4.getString(6);

}

} catch (SQLException e4) {

// TODO Auto-generated catch block

e4.printStackTrace();

}

sql4=""+"select * from udupi_supplier where

pno='"+ri[1]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql4);

while(rs5.next())

{

r41[1]=rs5.getString(1);

r41[2]=rs5.getString(3);

r51[1]=Integer.parseInt(rs5.getString(4));

r41[4]=rs5.getString(5);

r41[3]=rs5.getString(6);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

rows[0][10]=r4[1];

rows[0][11]=r4[2];

rows[0][12]=Integer.toString(r5[1]);

rows[0][13]=r4[4];

rows[0][14]=r4[3];

rows[1][10]=r41[1];

rows[1][11]=r41[2];

rows[1][12]=Integer.toString(r51[1]);

rows[1][13]=r41[4];

rows[1][14]=r41[3];

break;

case 2:

sql3=""+"select * from udupi_supplier where

pno='"+ri[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs4=stmt3.executeQuery(sql3);

Page 201: Mini project-DBMS & JAVA

201

while(rs4.next())

{

r4[1]=rs4.getString(1);

r4[2]=rs4.getString(3);

r5[1]=Integer.parseInt(rs4.getString(4));

r4[4]=rs4.getString(5);

r4[3]=rs4.getString(6);

}

} catch (SQLException e4) {

// TODO Auto-generated catch block

e4.printStackTrace();

}

sql4=""+"select * from udupi_supplier where

pno='"+ri[1]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql4);

while(rs5.next())

{

r41[1]=rs5.getString(1);

r41[2]=rs5.getString(3);

r51[1]=Integer.parseInt(rs5.getString(4));

r41[4]=rs5.getString(5);

r41[3]=rs5.getString(6);

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

sql5=""+"select * from udupi_supplier where

pno='"+ri[2]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql4);

while(rs5.next())

{

r42[1]=rs5.getString(1);

r42[2]=rs5.getString(3);

r52[1]=Integer.parseInt(rs5.getString(4));

r42[4]=rs5.getString(5);

r42[3]=rs5.getString(6);

}

Page 202: Mini project-DBMS & JAVA

202

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

rows[0][10]=r4[1];

rows[0][11]=r4[2];

rows[0][12]=Integer.toString(r5[1]);

rows[0][13]=r4[4];

rows[0][14]=r4[3];

rows[1][10]=r41[1];

rows[1][11]=r41[2];

rows[1][12]=Integer.toString(r51[1]);

rows[1][13]=r41[4];

rows[1][14]=r42[3];

rows[1][10]=r42[1];

rows[1][11]=r42[2];

rows[1][12]=Integer.toString(r52[1]);

rows[1][13]=r42[4];

rows[1][14]=r42[3];

break;

}

for(int i=0;i<d;i++)

{

rows[i][0]=r[2];

rows[i][1]=r[3];

rows[i][2]=r[6];

rows[i][3]=r[4];

rows[i][4]=Integer.toString(r1[1]);

rows[i][5]=Integer.toString(r1[2]);

rows[i][6]=Integer.toString(r1[3]);

rows[i][15]=r[5];

}

for(int i=0;i<d;i++)

{

rows[i][7]=r2[i][1];

rows[i][8]=r2[i][2];

rows[i][9]=Integer.toString(r3[i][1]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

Page 203: Mini project-DBMS & JAVA

203

panel.setBounds(0,200,1366,102);

panel.add(scrollPane, BorderLayout.CENTER);

f7.add(panel);

f7.setSize(width,height);

f7.setLayout(null);

f7.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f7.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f7.setVisible(false);

Page 204: Mini project-DBMS & JAVA

204

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Product:

package mini_project;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

import java.awt.event.ActionListener;

public class Product implements ActionListener {

JFrame f6;

JTextField t[]=new JTextField[5];

JButton next,exit,again,check,back;

Page 205: Mini project-DBMS & JAVA

205

JComboBox j1,j;

int i=0,qty1,j22=0;

Connection con;

String name;

String city2;

String phn3;

String pid1,pname1,j12;

String arry[]=new String[50];

String arry1[]=new String[50];

JLabel ono,pno,pname,qty,head,head1,info,sno;

String use,bi;

int flag=0;

public void createlayout(String user,String bi1) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f6=new JFrame();

use=user;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f6.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

head=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

head.setBounds(390,20, 800, 30);

head.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

head.setFont(font);

f6.add(head);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Pavi\\Downloads\\emb.png"));

imagelabel.setBounds(305,10,72,77);

f6.add(imagelabel);

Page 206: Mini project-DBMS & JAVA

206

check=new JButton("Check");

check.setBounds(800,260,100,30);

f6.add(check);

head1=new JLabel("PRODUCT'S FOR ORDER");

head1.setBounds(500,100,500,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head1.setForeground(Color.white);

head1.setFont(font1);

f6.add(head1);

ono= new JLabel("Order No:");

ono.setBounds(500,180,100,30);

ono.setForeground(Color.white);

f6.add(ono);

j1=new JComboBox();

j1.setBounds(600,180,100,30);

f6.add(j1);

pno= new JLabel("Product ID:");

pno.setBounds(500,260,100,30);

pno.setForeground(Color.white);

f6.add(pno);

t[1]=new JTextField();

t[1].setBounds(600,260,100,30);

f6.add(t[1]);

pname= new JLabel("Product Name:");

pname.setBounds(500,340,100,30);

pname.setForeground(Color.white);

f6.add(pname);

t[2]=new JTextField();

t[2].setBounds(600,340,100,30);

f6.add(t[2]);

qty= new JLabel("Quantity:");

qty.setBounds(500,410,100,30);

qty.setForeground(Color.white);

f6.add(qty);

t[3]=new JTextField();

t[3].setBounds(600,410,100,30);

f6.add(t[3]);

Page 207: Mini project-DBMS & JAVA

207

sno= new JLabel("Supplier ID:");

sno.setBounds(500,480,100,30);

sno.setForeground(Color.white);

f6.add(sno);

j=new JComboBox();

j.setBounds(600,480,100,30);

f6.add(j);

JLabel amt=new JLabel("Amount Paid:");

amt.setBounds(500,540,100,30);

amt.setForeground(Color.white);

f6.add(amt);

t[4]=new JTextField();

t[4].setBounds(600,540,100,30);

f6.add(t[4]);

next=new JButton("Insert");

next.setBounds(600,600,100,30);

f6.add(next);

info= new JLabel("*To Insert Another Product Details click

Addanother");

info.setBounds(440,580,600,30);

info.setForeground(Color.white);

f6.add(info);

info.setFont(font1);

again=new JButton("Addanother");

again.setBounds(600,650,100,30);

f6.add(again);

back=new JButton("Back");

back.setBounds(100,610,100,30);

f6.add(back);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f6.add(exit);

int count=1;

String sq=""+"select pno from udupi_product";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

Page 208: Mini project-DBMS & JAVA

208

while(rs1.next())

{

count++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String lab="PRO";

String la=lab+String.valueOf(count);

t[1].setText(la);

String sql1=""+"select ono from udupi_order";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql2=""+"select sno from udupi_supplier1";

try {

Statement stm = con.createStatement();

ResultSet rs1=stm.executeQuery(sql2);

while(rs1.next())

{

arry1[j22]=rs1.getString(1);

j22++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setSize(width,height);

f6.setLayout(null);

Page 209: Mini project-DBMS & JAVA

209

f6.setVisible(true);

}

public void access()

{

for(int j5=0;j5<i;j5++)

j1.addItem(arry[j5]);

for(int j51=0;j51<j22;j51++)

j.addItem(arry1[j51]);

exit.addActionListener(this);

back.addActionListener(this);

next.addActionListener(this);

again.addActionListener(this);

check.addActionListener(this);

for(int i=1;i<5;i++)

t[i].addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

Page 210: Mini project-DBMS & JAVA

210

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

Order fi1=new Order();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Check"))

{

String bid1=t[1].getText();

String sq=""+"select * from udupi_product where

pno='"+bid1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Insert"))

{

pid1=t[1].getText();

pname1=t[2].getText();

String sno1=(""+j.getItemAt(j.getSelectedIndex()));

qty1=Integer.parseInt(t[3].getText());

Page 211: Mini project-DBMS & JAVA

211

j12=(""+j1.getItemAt(j1.getSelectedIndex()));

if(pid1.equals("")||pname.equals("")||sno1.equals("")||t[4].getText().equals

("")||j12.equals(""))

{

flag=1;

}

if(flag==0)

{

int amt1=Integer.parseInt(t[4].getText());

String sql="insert into udupi_product

values('"+pid1+"','"+j12+"','"+pname1+"','"+qty1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

int d = stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

// JOptionPane.showMessageDialog(null,sno1);

String sq1="select * from udupi_supplier1 where

sno='"+sno1+"'";

try {

Statement st = con.createStatement();

ResultSet rs7=st.executeQuery(sq1);

while(rs7.next())

{

name=rs7.getString(2);

city2=rs7.getString(4);

phn3=rs7.getString(3);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

long ph=Long.valueOf(phn3).longValue();

// JOptionPane.showMessageDialog(null,ph);

//JOptionPane.showMessageDialog(null,name);

//JOptionPane.showMessageDialog(null,amt1);

String sq3="insert into udupi_supplier

values('"+sno1+"','"+pid1+"','"+name+"','"+amt1+"','"+ph+"','"+city2+"')";

Statement stmt13;

Page 212: Mini project-DBMS & JAVA

212

try {

stmt13 = con.createStatement();

int d3 = stmt13.executeUpdate(sq3);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Inserted");

f6.setVisible(false);

First en=new First();

try {

en.createlayout(use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUES IN ALL FIELDS");

flag=0;

}

}

else if(str.equals("Addanother"))

{

pid1=t[1].getText();

pname1=t[2].getText();

int amt1=Integer.parseInt(t[4].getText());

qty1=Integer.parseInt(t[3].getText());

String sno1=(""+j.getItemAt(j.getSelectedIndex()));

j12=(""+j1.getItemAt(j1.getSelectedIndex()));

if(pid1.equals("")||pname.equals("")||sno1.equals("")||t[4].getText().equals

("")||j12.equals(""))

{

Page 213: Mini project-DBMS & JAVA

213

flag=1;

}

if(flag==0)

{

String sql="insert into udupi_product

values('"+pid1+"','"+j12+"','"+pname1+"','"+qty1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

int d = stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

//JOptionPane.showMessageDialog(null,"Inserted");

String sq1="select * from udupi_supplier1 where

supno='"+sno1+"'";

try {

Statement st = con.createStatement();

ResultSet rs7=st.executeQuery(sq1);

while(rs7.next())

{

name=rs7.getString(2);

city2=rs7.getString(4);

phn3=rs7.getString(3);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

long ph=Long.valueOf(phn3).longValue();

String sq3="insert into udupi_supplier

values('"+sno1+"','"+pid1+"','"+name+"','"+amt1+"','"+ph+"','"+city2+"')";

Statement stmt13;

try {

stmt13 = con.createStatement();

int d3 = stmt13.executeUpdate(sq3);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

Page 214: Mini project-DBMS & JAVA

214

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

Product en=new Product();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUES IN ALL FIELDS");

flag=0;

}

/*JOptionPane.showMessageDialog(null,"Inserted");

f6.setVisible(false);

First enq=new First();

try {

enq.createlayout(use);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

enq.access();*/

}

}

}

Report:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

Page 215: Mini project-DBMS & JAVA

215

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Report implements ActionListener{

JFrame f8;

JButton exit,back,get;

JComboBox<Integer> day,year,day1,year1;

JComboBox<String> month,month1;

JLabel title,head,bno,info,odate,deldate;

int i=0,i1=0;

Connection con;

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

long[][] r14=new long[50][50];

int []dday;

int []yyear;

int []dday1;

int []yyear1;

String arry[]=new String[50];

String arry1[]=new String[50];

JTextField t1,t2;

int fl,fl1,fl2;

String use;

String ono1;

String mon,mon2,mon3;

Page 216: Mini project-DBMS & JAVA

216

int don=0,don1=0,donn=0,donn1=0;

String bi;

private String[] mmonth1 = { "jan", "feb","mar","apr", "may", "jun",

"jul", "aug" , "sep", "oct", "nov", "dec"};

private String[] mmonth = { "jan", "feb","mar","apr", "may", "jun", "jul",

"aug" , "sep", "oct", "nov", "dec"};

public void createlayout(String on1,String user,String bi1) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

use=user;

ono1=on1;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

Page 217: Mini project-DBMS & JAVA

217

f8.add(back);

odate=new JLabel("From:");

odate.setBounds(300,200,100,25);

odate.setForeground(Color.white);

f8.add(odate);

month1 = new JComboBox<String>();

month1.setBounds(400,200,75,25);

f8.add(month1);

day1=new JComboBox<Integer>();

dday1=new int[31];

for(int i=0;i<31;i++)

{

dday1[i]=i+1;

}

day1.setBounds(500,200,50,25);

f8.add(day1);

year1=new JComboBox<Integer>();

yyear1=new int[5000];

for(int i=1960;i<2030;i++)

yyear1[i]=i;

year1.setBounds(600,200,100,25);

f8.add(year1);

/* new1=new JButton("Get Date");

new1.setBounds(900,350,100,25);

f4.add(new1);*/

deldate=new JLabel("To:");

deldate.setBounds(300,250,100,25);

deldate.setForeground(Color.white);

f8.add(deldate);

month = new JComboBox<String>();

month.setBounds(400,250,75,25);

f8.add(month);

day=new JComboBox<Integer>();

dday=new int[31];

for(int i=0;i<31;i++)

{

Page 218: Mini project-DBMS & JAVA

218

dday[i]=i+1;

}

day.setBounds(500,250,50,25);

f8.add(day);

year=new JComboBox<Integer>();

yyear=new int[5000];

for(int i=1960;i<2030;i++)

yyear[i]=i;

year.setBounds(600,250,100,25);

f8.add(year);

get=new JButton("Get Orders");

get.setBounds(830,250,100,25);

f8.add(get);

head= new JLabel("REPORT BASED ON DATES");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

for (int i = 0; i < 12; i++)

month.addItem(mmonth[i]);

for (int i = 0; i < 31; i++)

day.addItem(dday[i]);

for (int i = 1960; i < 2030; i++)

year.addItem(yyear[i]);

for (int i = 0; i < 12; i++)

month1.addItem(mmonth1[i]);

for (int i = 0; i < 31; i++)

day1.addItem(dday1[i]);

for (int i = 1960; i < 2030; i++)

year1.addItem(yyear1[i]);

Page 219: Mini project-DBMS & JAVA

219

month.addActionListener(this);

year.addActionListener(this);

day.addActionListener(this);

month1.addActionListener(this);

year1.addActionListener(this);

day1.addActionListener(this);

exit.addActionListener(this);

get.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

if(ae.getSource()==month)

{

// JOptionPane.showMessageDialog(null,"New Customer");

String od=""+month.getItemAt(month.getSelectedIndex());

if(od.equals("feb"))

{

don=1;

day.removeItem(dday[29]);

if(don1==0)

day.removeItem(dday[30]);

}

else if(od.equals("apr") || od.equals("jun") || od.equals("jun")

|| od.equals("sep") || od.equals("nov"))

Page 220: Mini project-DBMS & JAVA

220

{

if(don==1)

{

day.addItem(dday[29]);

don=0;

}

day.removeItem(dday[30]);

don1=1;

}

else if(od.equals("jan") || od.equals("mar") ||

od.equals("may") || od.equals("jul") || od.equals("aug") || od.equals("oct") ||

od.equals("dec"))

{

if(don==1)

{

day.addItem(dday[29]);

day.addItem(dday[30]);

don=0;

}

if(don1==1)

{

day.addItem(dday[30]);

don1=0;

}

}

}

if(ae.getSource()==month1)

{

// JOptionPane.showMessageDialog(null,"New Customer");

String od=""+month1.getItemAt(month1.getSelectedIndex());

if(od.equals("feb"))

{

donn=1;

day1.removeItem(dday1[29]);

if(donn1==0)

day1.removeItem(dday1[30]);

}

else if(od.equals("apr") || od.equals("jun") || od.equals("jun")

|| od.equals("sep") || od.equals("nov"))

{

if(donn==1)

{

day1.addItem(dday1[29]);

Page 221: Mini project-DBMS & JAVA

221

donn=0;

}

day1.removeItem(dday1[30]);

donn1=1;

}

else if(od.equals("jan") || od.equals("mar") ||

od.equals("may") || od.equals("jul") || od.equals("aug") || od.equals("oct") ||

od.equals("dec"))

{

if(donn==1)

{

day1.addItem(dday1[29]);

day1.addItem(dday1[30]);

donn=0;

}

if(donn1==1)

{

day1.addItem(dday1[30]);

donn1=0;

}

}

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Display fi1=new Display();

try {

fi1.createlayout(ono1,use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

else if(str.equals("Get Orders"))

{

Page 222: Mini project-DBMS & JAVA

222

int fl=0,fl1=0,fl2=0;

int

da=Integer.parseInt(""+day.getItemAt(day.getSelectedIndex()));

int

ye=Integer.parseInt(""+year.getItemAt(year.getSelectedIndex()));

mon=da+"-"+mon+"-"+ye;

String

mon1=""+month1.getItemAt(month1.getSelectedIndex());

String mon2=mon1;

mon3=mon;

int

da1=Integer.parseInt(""+day1.getItemAt(day1.getSelectedIndex()));

int

ye1=Integer.parseInt(""+year1.getItemAt(year1.getSelectedIndex()));

mon1=da1+"-"+mon1+"-"+ye1;

int cou1=0,cou2 = 0;

for(int i=0;i<12;i++)

{

if(mmonth[i].equals(mon2))

cou1=i+1;

}

for(int i=0;i<12;i++)

{

if(mmonth[i].equals(mon3))

cou2=i+1;

}

// JOptionPane.showMessageDialog(null,ye1);

// JOptionPane.showMessageDialog(null,ye);

if(ye1>ye)

{

fl1=0;

fl2=0;

JOptionPane.showMessageDialog(null,"ENTERED

'TO DATE' IS WRONG1");

fl=1;

}

else if(ye1==ye && cou1>cou2)

{

fl=0;

fl2=0;

JOptionPane.showMessageDialog(null,"ENTERED

'TO DATE' IS WRONG2");

fl1=1;

Page 223: Mini project-DBMS & JAVA

223

}

else if(ye1==ye && cou1==cou2 && da1>da)

{

fl=0;

fl1=0;

JOptionPane.showMessageDialog(null,"ENTERED

'TO DATE' IS WRONG3");

fl2=1;

}

else if( fl==0 && fl1==0 && fl2==0)

{

int count=0;

String[][]rows=new String[10][];

String mon=""+month.getItemAt(month.getSelectedIndex());

String mon3=mon;

int

da2=Integer.parseInt(""+day.getItemAt(day.getSelectedIndex()));

int

ye2=Integer.parseInt(""+year.getItemAt(year.getSelectedIndex()));

mon=da2+"-"+mon+"-"+ye2;

String

mon12=""+month1.getItemAt(month1.getSelectedIndex());

// String mon2=mon12;

int

da12=Integer.parseInt(""+day1.getItemAt(day1.getSelectedIndex()));

int

ye12=Integer.parseInt(""+year1.getItemAt(year1.getSelectedIndex()));

mon1=da12+"-"+mon12+"-"+ye12;

String column[]=new String[10];

column[0]="ORDER NO";

column[1]="BRANCH NO";

column[2]="CUSTOMER NO";

column[3]="ORDER DATE";

column[4]="DELIVERY DATE";

column[5]="ORDER DETAILS";

column[6]="QUANTITY";

column[7]="PPU";

column[8]="TOTAL";

column[9]="STATUS";

for(int i11=0;i11<10;i11++)

{

rows[i11]=new String[10];

}

Page 224: Mini project-DBMS & JAVA

224

String sql1=""+"select * from udupi_order where odate <=

'"+mon+"' and odate >= '"+mon1+"' and bid='"+bi+"'" ;

i1=0;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(1);

r[i1][2]=rs5.getString(2);

r[i1][3]=rs5.getString(3);

r[i1][4]=rs5.getString(10);

r[i1][5]=rs5.getString(4);

r1[i1][1]=Integer.parseInt(rs5.getString(5));

r1[i1][2]=Integer.parseInt(rs5.getString(6));

r1[i1][3]=Integer.parseInt(rs5.getString(7));

r[i1][6]=rs5.getString(9);

r[i1][7]=rs5.getString(8);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

// JOptionPane.showMessageDialog(null,i1);

int n=i1;

//JOptionPane.showMessageDialog(null,n);

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=r[i][4];

rows[i][4]=r[i][5];

rows[i][9]=r[i][7];

rows[i][5]=r[i][6];

rows[i][6]=Integer.toString(r1[i][1]);

rows[i][7]=Integer.toString(r1[i][2]);

rows[i][8]=Integer.toString(r1[i][3]);

}

i=n;

// JOptionPane.showMessageDialog(null,i);

for(int j=i;j<10;j++)

Page 225: Mini project-DBMS & JAVA

225

{

rows[j][0]="";

rows[j][1]="";

rows[j][2]="";

rows[j][3]="";

rows[j][4]="";

rows[j][9]="";

rows[j][5]="";

rows[j][6]="";

rows[j][7]="";

rows[j][8]="";

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(150,330,1000,180);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setVisible(true);

/* f8.setVisible(false);

f8.remove(month);

f8.remove(month1);

f8.remove(day);

f8.remove(day1);

f8.remove(year);

f8.remove(year1);

f8.remove(get);

f8.remove(deldate);

f8.remove(odate);

f8.setVisible(true);*/

}

}

}

}

Status:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

Page 226: Mini project-DBMS & JAVA

226

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Status implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

long[][] r14=new long[50][50];

JTextField t1,t2;

String use;

String ono1,bi;

public void createlayout(String on1,String user,String bi1) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

Page 227: Mini project-DBMS & JAVA

227

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

use=user;

ono1=on1;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("PENDING ORDERS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[9];

column[0]="BRANCH NO";

column[1]="ORDER NO";

Page 228: Mini project-DBMS & JAVA

228

column[2]="CUSTOMER NO";

column[3]="ORDER DESC";

column[4]="DELIVERY DATE";

column[5]="QUANTITY";

column[6]="PPU";

column[7]="TOTAL";

column[8]="STATUS";

for(int i=0;i<10;i++)

{

rows[i]=new String[9];

}

String sql1=""+"select * from udupi_order where status='Pending'

and bid='"+bi+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(2);

r[i1][2]=rs5.getString(1);

r[i1][3]=rs5.getString(3);

r[i1][4]=rs5.getString(9);

r[i1][5]=rs5.getString(4);

r1[i1][1]=Integer.parseInt(rs5.getString(5));

r1[i1][2]=Integer.parseInt(rs5.getString(6));

r1[i1][3]=Integer.parseInt(rs5.getString(7));

r[i1][6]=rs5.getString(8);

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=r[i][4];

rows[i][4]=r[i][5];

rows[i][5]=Integer.toString(r1[i][1]);

rows[i][6]=Integer.toString(r1[i][2]);

Page 229: Mini project-DBMS & JAVA

229

rows[i][7]=Integer.toString(r1[i][3]);

rows[i][8]=r[i][6];

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

Page 230: Mini project-DBMS & JAVA

230

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Display fi1=new Display();

try {

fi1.createlayout(ono1,use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Stock:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

Page 231: Mini project-DBMS & JAVA

231

import javax.swing.JTextField;

public class Stock implements ActionListener{

JLabel stock,branchid, title, stockid, stockname, qty;

JButton insert, exit,back,check;

JFrame f2;

JTextField t1,t2,t3,t4;

Connection con;

JComboBox j,j1;

String st,qt,am,sta;

int qt1,am1;

String arry1[]=new String[50];

String arry[]=new String[50];

int i=0,qty1;

String use;

int flag=0,flag1=0;

int f=0;

String bi,bno1,sna;

int i1=0,q;

public void createlayout(String user,String bi1) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f2=new JFrame();

use=user;

bi=bi1;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f2.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(380,20, 800, 30);

title.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

f2.add(title);

Page 232: Mini project-DBMS & JAVA

232

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(295,10,72,77);

f2.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f2.add(exit);

stock= new JLabel("STOCK INSERTION PAGE");

stock.setBounds(500,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

stock.setFont(font1);

stock.setForeground(Color.white);

f2.add(stock);

branchid= new JLabel("Branch ID:");

branchid.setBounds(500,180,100,30);

branchid.setForeground(Color.white);

f2.add(branchid);

t1=new JTextField(30);

t1.setBounds(600,180,100,30);

t1.setText(bi);

f2.add(t1);

stockid= new JLabel("Stock id:");

stockid.setBounds(500,240,100,30);

stockid.setForeground(Color.white);

f2.add(stockid);

t2=new JTextField(20);

t2.setBounds(600,240,100,30);

f2.add(t2);

check=new JButton("Check");

check.setBounds(800,240,100,30);

f2.add(check);

stockname= new JLabel("Item Name:");

stockname.setBounds(500,300,100,30);

stockname.setForeground(Color.white);

f2.add(stockname);

Page 233: Mini project-DBMS & JAVA

233

j1=new JComboBox();

j1.setBounds(600,300,100,30);

f2.add(j1);

qty= new JLabel("Quantity:");

qty.setBounds(500,360,100,30);

qty.setForeground(Color.white);

f2.add(qty);

t3=new JTextField(20);

t3.setBounds(600,360,100,30);

f2.add(t3);

JLabel sno= new JLabel("Supplier ID:");

sno.setBounds(500,420,100,30);

sno.setForeground(Color.white);

f2.add(sno);

j=new JComboBox();

j.setBounds(600,420,100,30);

f2.add(j);

JLabel amt=new JLabel("Amount Paid:");

amt.setBounds(500,480,100,30);

amt.setForeground(Color.white);

f2.add(amt);

t4=new JTextField();

t4.setBounds(600,480,100,30);

f2.add(t4);

back=new JButton("Back");

back.setBounds(100,600,100,30);

f2.add(back);

insert=new JButton("Insert");

insert.setBounds(600,600,100,30);

f2.add(insert);

int count=1;

String sq=""+"select sid from udupi_stock";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

Page 234: Mini project-DBMS & JAVA

234

{

count++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String lab="STO";

String la=lab+String.valueOf(count);

//t1.setText(la);

String sq1=""+"select * from udupi_stock where sid='"+la+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq1);

if(rs1.next())

f=1;

else

f=0;

} catch (HeadlessException | NullPointerException| SQLException

e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

if(f==1)

{

String lab1="STOA";

String la1=lab1+String.valueOf(count);

t2.setText(la1);

}

else

t2.setText(la);

String sql1=""+"select sname from udupi_stock1 where

bid='"+bi+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry1[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

Page 235: Mini project-DBMS & JAVA

235

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sql2=""+"select sno from udupi_supplier1";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql2);

while(rs.next())

{

arry[i1]=rs.getString(1);

i1++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setSize(width,height);

f2.setLayout(null);

f2.setVisible(true);

}

public void access()

{

for(int j2=0;j2<i;j2++)

j1.addItem (arry1[j2]);

for(int j1=0;j1<i1;j1++)

j.addItem (arry[j1]);

exit.addActionListener(this);

back.addActionListener(this);

check.addActionListener(this);

insert.addActionListener(this);

t1.addActionListener(this);

t2.addActionListener(this);

t3.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

st=t2.getText();

if(str.equals("Sign Out"))

{

try {

Page 236: Mini project-DBMS & JAVA

236

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

// JOptionPane.showMessageDialog(null,flag);

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setVisible(false);

StockManagement fi1=new StockManagement();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException |

NullPointerException |SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Check"))

{

String sq=""+"select * from udupi_stock where

sid='"+st+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

Page 237: Mini project-DBMS & JAVA

237

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Insert"))

{

sta=(""+j.getItemAt(j.getSelectedIndex()));

sna=(""+j1.getItemAt(j1.getSelectedIndex()));

st=t2.getText();

qt=t3.getText();

am=t4.getText();

if(sna.equals("") || sta.equals("") || st.equals("")|| qt.equals("")

|| am.equals(""))

{

flag=1;

}

if(flag==0)

{

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

int a1=Integer.parseInt(t4.getText());

String sql="insert into udupi_stock

values('"+st+"','"+bi+"','"+sna+"','"+qty1+"','"+sta+"','"+a1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String sq=""+"select qty from udupi_stock1 where

sname='"+sna+"'";

try {

Statement stmt = con.createStatement();

Page 238: Mini project-DBMS & JAVA

238

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

q=Integer.parseInt(rs1.getString(1));

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

q=q+qty1;

String sql2="update udupi_stock1 set qty='"+q+"' where

sname='"+sna+"'";

Statement stmt12;

try {

stmt12 = con.createStatement();

stmt12.executeUpdate(sql2);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Inserted");

f2.setVisible(false);

StockManagement en=new StockManagement();

try {

en.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUES IN ALL FIELDS");

flag=0;

Page 239: Mini project-DBMS & JAVA

239

}

}

}

}

Stock display:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Stockdis implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[10][];

String[][] r=new String[50][50];

int[][] r1=new int[50][50];

Page 240: Mini project-DBMS & JAVA

240

JTextField t1,t2;

String use,bi;

public void createlayout(String bno,String user) throws

ClassNotFoundException, SQLException

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\display.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bno;

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("ADDED STOCK DETAILS");

head.setBounds(540,100,400,30);

Page 241: Mini project-DBMS & JAVA

241

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f8.add(head);

String column[]=new String[6];

column[0]="BRANCH NO";

column[1]="STOCK NO";

column[2]="STOCK NAME";

column[3]="QUANTITY";

column[4]="SUPPLIER ID";

column[5]="AMOUNT PAID";

for(int i=0;i<10;i++)

{

rows[i]=new String[6];

}

String sql1=""+"select * from udupi_stock where bid='"+bno+"'" ;

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(2);

r[i1][2]=rs5.getString(1);

r[i1][3]=rs5.getString(3);

r[i1][4]=rs5.getString(5);

r1[i1][1]=Integer.parseInt(rs5.getString(4));

r1[i1][2]=Integer.parseInt(rs5.getString(6));

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][4]=r[i][4];

rows[i][3]=Integer.toString(r1[i][1]);

rows[i][5]=Integer.toString(r1[i][2]);

Page 242: Mini project-DBMS & JAVA

242

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(165,300,1000,100);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

Page 243: Mini project-DBMS & JAVA

243

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Displaysta fi1=new Displaysta();

try {

fi1.createlayout(use,bi);

} catch (ClassNotFoundException | NullPointerException |

SQLException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

}

fi1.access();

}

}

}

Stock management:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class StockManagement implements ActionListener{

Page 244: Mini project-DBMS & JAVA

244

JFrame f1;

JLabel dno,sno,cno,fno,title,head,full;

JComboBox t1,t2,t3,t4;

JButton b1,b2,b3,b4,back,exit;

Connection con;

String use,use1;

int i=0,i1=0,i2=0,i3=0;

String arry[]=new String[40];

String arry1[]=new String[40];

String arry2[]=new String[40];

String arry3[]=new String[40];

String bi;

public void createlayout(String user,String bi1) throws

ClassNotFoundException, SQLException

{

f1=new JFrame();

Class.forName("oracle.jdbc.driver.OracleDriver");

con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe

","rakhav","1234");

f1.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

bi=bi1;

Font fo = new Font("TimesNewRoman", Font.BOLD,15);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(380,40, 800, 30);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f1.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(295,25,72,77);

f1.add(imagelabel);

Page 245: Mini project-DBMS & JAVA

245

head=new JLabel("WELCOME TO STOCK MAINTENANCE");

head.setBounds(450,110, 700, 30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

head.setForeground(Color.white);

f1.add(head);

b1=new JButton("ADD NEW ITEM TO MAINTAIN");

b1.setBounds(500,250,250,30);

f1.add(b1);

b2=new JButton("ADD NEW STOCK TO EXISTING ITEM");

b2.setBounds(500,350,250,30);

f1.add(b2);

b3=new JButton("TAKE ITEM FROM STOCK");

b3.setBounds(500,450,250,30);

f1.add(b3);

b4=new JButton("DISPLAY");

b4.setBounds(500,550,250,30);

f1.add(b4);

exit=new JButton("Logout");

exit.setBounds(1200,50,100,30);

f1.add(exit);

/* full=new JLabel("<<<Select the Required One from the List and

Click Delete Buttons to Delete>>>");

full.setBounds(300,600,1000,30);

full.setForeground(Color.white);

full.setFont(font1);

f1.add(full); */

back=new JButton("Back");

back.setBounds(100,600,100,30);

f1.add(back);

f1.setSize(width,height);

f1.setLayout(null);

f1.setVisible(true);

}

Page 246: Mini project-DBMS & JAVA

246

public void access()

{

exit.addActionListener(this);

back.addActionListener(this);

b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

b4.addActionListener(this);

}

public void actionPerformed(ActionEvent e) {

String str=e.getActionCommand();

if(e.getSource()==exit)

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

Page 247: Mini project-DBMS & JAVA

247

} catch (ClassNotFoundException | SQLException e1)

{

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("ADD NEW ITEM TO MAINTAIN"))

{

//JOptionPane.showMessageDialog(null,"Deleted!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

NewStock ns=new NewStock();

try {

ns.createlayout(use, bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

ns.access();

}

else if(str.equals("ADD NEW STOCK TO EXISTING ITEM"))

{

// JOptionPane.showMessageDialog(null,"Deleted!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Stock s=new Stock();

try {

s.createlayout(use, bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

Page 248: Mini project-DBMS & JAVA

248

s.access();

}

else if(str.equals("TAKE ITEM FROM STOCK"))

{

//JOptionPane.showMessageDialog(null,"Deleted!");

f1.setVisible(false);

Takeout t=new Takeout();

try {

t.createlayout(use, bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

t.access();

}

else if(str.equals("DISPLAY"))

{

//JOptionPane.showMessageDialog(null,"Deleted!");

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f1.setVisible(false);

Displaysta ds=new Displaysta();

try {

ds.createlayout(use,bi);

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

ds.access();

}

}

}

Supplier:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

Page 249: Mini project-DBMS & JAVA

249

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class Supplier implements ActionListener {

JFrame f7;

JTextField t[]=new JTextField[6];

JButton finish,exit,again,check,back;

JComboBox j1;

Connection con;

JLabel pno,sno,sname,phno,amount,city,head,head1,info;

String arry[]=new String[50];

int i=0;

String sid,snam,pid,city1,j12;

int amt;

long phn;

String use;

public void createlayout(String user) throws ClassNotFoundException,

SQLException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","pavi","p

avi");

f7=new JFrame();

Page 250: Mini project-DBMS & JAVA

250

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

f7.setContentPane(new JLabel(new

ImageIcon("C:\\Users\\Pavi\\Downloads\\random.jpg")));

head=new JLabel("UDUPI OFFSET PRINTING PRESS");

head.setBounds(390,20, 500, 30);

Font font = new Font("Algerian", Font.BOLD,30);

head.setForeground(Color.white);

head.setFont(font);

f7.add(head);

head1=new JLabel("PRODUCT SUPPLIER DETAILS");

head1.setBounds(500,100,500,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head1.setForeground(Color.white);

head1.setFont(font1);

f7.add(head1);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Pavi\\Downloads\\emb.png"));

imagelabel.setBounds(305,17,72,77);

f7.add(imagelabel);

pno= new JLabel("Product ID:");

pno.setBounds(500,170,100,30);

pno.setForeground(Color.white);

f7.add(pno);

j1=new JComboBox();

j1.setBounds(600,170,100,30);

f7.add(j1);

check=new JButton("Check");

check.setBounds(800,220,100,30);

// sno.setForeground(Color.white);

f7.add(check);

sno= new JLabel("Supplier ID:");

sno.setBounds(500,220,100,30);

sno.setForeground(Color.white);

Page 251: Mini project-DBMS & JAVA

251

f7.add(sno);

t[1]=new JTextField();

t[1].setBounds(600,220,100,30);

f7.add(t[1]);

sname= new JLabel("Supplier Name:");

sname.setBounds(500,270,100,30);

sname.setForeground(Color.white);

f7.add(sname);

t[2]=new JTextField();

t[2].setBounds(600,270,100,30);

f7.add(t[2]);

amount= new JLabel("Amount Paid:");

amount.setBounds(500,320,100,30);

amount.setForeground(Color.white);

f7.add(amount);

t[3]=new JTextField();

t[3].setBounds(600,320,100,30);

f7.add(t[3]);

phno= new JLabel("Phone No:");

phno.setBounds(500,370,100,30);

phno.setForeground(Color.white);

f7.add(phno);

t[4]=new JTextField();

t[4].setBounds(600,370,100,30);

f7.add(t[4]);

city= new JLabel("City:");

city.setBounds(500,420,100,30);

city.setForeground(Color.white);

f7.add(city);

t[5]=new JTextField();

t[5].setBounds(600,420,100,30);

f7.add(t[5]);

finish=new JButton("Finish");

finish.setBounds(600,470,100,30);

f7.add(finish);

String sql1=""+"select pno from udupi_product";

try {

Page 252: Mini project-DBMS & JAVA

252

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

info= new JLabel("*To Insert Another Supplier Details click

Addanother");

info.setBounds(440,530,450,30);

info.setForeground(Color.white);

f7.add(info);

info.setFont(font1);

again=new JButton("Addanother");

again.setBounds(600,590,100,30);

f7.add(again);

back=new JButton("Back");

back.setBounds(100,590,100,30);

f7.add(back);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f7.add(exit);

f7.setSize(width,height);

f7.setLayout(null);

f7.setVisible(true);

}

public void access()

{

for(int j=0;j<i;j++)

j1.addItem(arry[j]);

check.addActionListener(this);

back.addActionListener(this);

exit.addActionListener(this);

Page 253: Mini project-DBMS & JAVA

253

finish.addActionListener(this);

again.addActionListener(this);

for(int i=1;i<6;i++)

t[i].addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(str.equals("Sign Out"))

{

f7.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

f7.setVisible(false);

Product fi1=new Product();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Check"))

{

String bid1=t[1].getText();

String sq=""+"select * from udupi_supplier where

sno='"+bid1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

if(rs1.next())

Page 254: Mini project-DBMS & JAVA

254

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException

|SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Finish"))

{

sid=t[1].getText();

snam=t[2].getText();

amt=Integer.parseInt(t[3].getText());

phn=Long.valueOf(t[4].getText()).longValue();

city1=t[5].getText();

j12=(""+j1.getItemAt(j1.getSelectedIndex()));

String sql="insert into udupi_supplier

values('"+sid+"','"+j12+"','"+snam+"','"+amt+"','"+phn+"','"+city1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

int d = stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Complete Insertion

of One OrderDetail finished!!");

f7.setVisible(false);

First en=new First();

try {

en.createlayout(use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

Page 255: Mini project-DBMS & JAVA

255

}

else if(str.equals("Addanother"))

{

sid=t[1].getText();

snam=t[2].getText();

amt=Integer.parseInt(t[3].getText());

phn=Long.valueOf(t[3].getText()).longValue();

city1=t[5].getText();

j12=(""+j1.getItemAt(j1.getSelectedIndex()));

long phn1=phn;

int l=0;

while(phn1!=0)

{

phn1=phn1/10;

l++;

}

if(l==10)

{

String sql="insert into udupi_supplier

values('"+sid+"','"+j12+"','"+snam+"','"+amt+"','"+phn+"','"+city1+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

int d = stmt1.executeUpdate(sql);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

//JOptionPane.showMessageDialog(null,"Inserted");

Product en=new Product();

try {

en.createlayout(use);

} catch (ClassNotFoundException | NullPointerException |

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

else

JOptionPane.showMessageDialog(null, "INVALID

MOBILE NUMBER");

}

Page 256: Mini project-DBMS & JAVA

256

}

}

Supplier display:

package mini_project;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

public class Supplierdis implements ActionListener{

JFrame f8;

JButton exit,back;

JLabel title,head,bno,info;

int i=0,i1=0;

String arry[]=new String[50];

Connection con;

String[][]rows=new String[20][];

String[][] r=new String[50][50];

long[][] r1=new long[50][50];

JTextField t1,t2;

String use;

public void createlayout(String user) throws ClassNotFoundException,

SQLException

Page 257: Mini project-DBMS & JAVA

257

{

f8=new JFrame();

f8.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\emplo.jpg")));

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

use=user;

//Container c=f8.getContentPane();

//c.setBackground(Color.cyan);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(420,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

// title.setForeground(Color.white);

f8.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(335,0,72,77);

f8.add(imagelabel);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f8.add(exit);

back=new JButton("Back");

back.setBounds(580,600,100,30);

f8.add(back);

head= new JLabel("SUPPLIER DETAILS");

head.setBounds(540,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head.setFont(font1);

//head.setForeground(Color.white);

f8.add(head);

Page 258: Mini project-DBMS & JAVA

258

String column[]=new String[4];

column[0]="SUPPLIER NO";

column[1]="SUPPLIER NAME";

column[2]="SUPPLIER CITY";

column[3]="PHONE NUMBER";

for(int i=0;i<20;i++)

{

rows[i]=new String[4];

}

String sql1=""+"select * from udupi_supplier1";

try {

Statement stmt3 = con.createStatement();

ResultSet rs5=stmt3.executeQuery(sql1);

while(rs5.next())

{

r[i1][1]=rs5.getString(1);

r[i1][2]=rs5.getString(2);

r[i1][3]=rs5.getString(4);

r1[i1][1]=Long.parseLong(rs5.getString(3));

i1++;

}

} catch (SQLException e5) {

// TODO Auto-generated catch block

e5.printStackTrace();

}

int n=i1;

for(int i=0;i<n;i++)

{

rows[i][0]=r[i][1];

rows[i][1]=r[i][2];

rows[i][2]=r[i][3];

rows[i][3]=Long.toString(r1[i][1]);

}

JTable table = new JTable(rows, column);

JScrollPane scrollPane = new JScrollPane(table);

JPanel panel = new JPanel();

panel.setLayout(new BorderLayout());

panel.setBounds(130,250,1000,200);

panel.add(scrollPane, BorderLayout.CENTER);

f8.add(panel);

f8.setSize(width,height);

f8.setLayout(null);

f8.setVisible(true);

Page 259: Mini project-DBMS & JAVA

259

}

public void access()

{

back.addActionListener(this);

exit.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f8.setVisible(false);

First1 fi1=new First1();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException | NullPointerException |

SQLException e ) {

// TODO Auto-generated catch block

e.printStackTrace();

Page 260: Mini project-DBMS & JAVA

260

}

fi1.access();

}

}

}

Supplier insert:

package mini_project;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

public class Supplierinsert implements ActionListener{

JLabel stock,branchid, title, stockid, stockname, qty;

JButton insert, exit,back,check;

JFrame f2;

JTextField t1,t2,t3,t4;

Connection con;

String sid,sname,bno1;

String arry1[]=new String[50];

int i=0;

long qty1;

String use;

Page 261: Mini project-DBMS & JAVA

261

int flag=0;

public void createlayout(String user) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f2=new JFrame();

use=user;

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f2.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(380,20, 800, 30);

title.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

f2.add(title);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f2.add(exit);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(295,10,72,77);

f2.add(imagelabel);

stock= new JLabel("SUPPLIER INSERTION PAGE");

stock.setBounds(500,100,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

stock.setFont(font1);

stock.setForeground(Color.white);

f2.add(stock);

branchid= new JLabel("Supplier ID:");

branchid.setBounds(500,200,100,30);

Page 262: Mini project-DBMS & JAVA

262

branchid.setForeground(Color.white);

f2.add(branchid);

t4=new JTextField();

t4.setBounds(600,200,100,30);

f2.add(t4);

stockid= new JLabel("Supplier Name:");

stockid.setBounds(500,300,100,30);

stockid.setForeground(Color.white);

f2.add(stockid);

t1=new JTextField(20);

t1.setBounds(600,300,100,30);

f2.add(t1);

check=new JButton("Check");

check.setBounds(800,200,100,30);

f2.add(check);

stockname= new JLabel("City:");

stockname.setBounds(500,400,100,30);

stockname.setForeground(Color.white);

f2.add(stockname);

t2=new JTextField(20);

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

f2.add(t2);

qty= new JLabel("Phone No:");

qty.setBounds(500,500,100,30);

qty.setForeground(Color.white);

f2.add(qty);

t3=new JTextField(20);

t3.setBounds(600,500,100,30);

f2.add(t3);

back=new JButton("Back");

back.setBounds(100,600,100,30);

f2.add(back);

insert=new JButton("Insert");

insert.setBounds(600,600,100,30);

f2.add(insert);

Page 263: Mini project-DBMS & JAVA

263

int count=1;

String sq=""+"select sno from udupi_supplier1";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

count++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

String lab="SUP";

String la=lab+String.valueOf(count);

t4.setText(la);

f2.setSize(width,height);

f2.setLayout(null);

f2.setVisible(true);

}

public void access()

{

exit.addActionListener(this);

back.addActionListener(this);

check.addActionListener(this);

insert.addActionListener(this);

t1.addActionListener(this);

t2.addActionListener(this);

t3.addActionListener(this);

t4.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

bno1=t4.getText();

sid=t1.getText();

sname=t2.getText();

if(str.equals("Sign Out"))

{

Page 264: Mini project-DBMS & JAVA

264

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f2.setVisible(false);

First fi1=new First();

try {

fi1.createlayout(use);

} catch (ClassNotFoundException |

NullPointerException |SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Check"))

{

String sq=""+"select * from udupi_supplier1 where

sno='"+bno1+"'";

try {

Statement st1=con.createStatement();

ResultSet rs1=st1.executeQuery(sq);

Page 265: Mini project-DBMS & JAVA

265

if(rs1.next())

JOptionPane.showMessageDialog(null,"Already Present! Use Another

Key!!");

else

JOptionPane.showMessageDialog(null,"Not

Present!! Continue the Process");

} catch (HeadlessException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

else if(str.equals("Insert"))

{

bno1=t4.getText();

sid=t1.getText();

sname=t2.getText();

if(bno1.equals("") || sid.equals("") || sname.equals("")||

t3.getText().equals(""))

{

flag=1;

}

int l=0;

if(flag==0)

{

qty1=Long.parseLong(t3.getText());

String qt=Long.toString(qty1);

long phn1=qty1;

while(phn1!=0)

{

phn1=phn1/10;

l++;

}

if(l==10)

{

String sql="insert into udupi_supplier1

values('"+bno1+"','"+sid+"','"+qt+"','"+sname+"')";

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeUpdate(sql);

Page 266: Mini project-DBMS & JAVA

266

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Inserted");

f2.setVisible(false);

First en=new First();

try {

en.createlayout(use);

} catch (ClassNotFoundException | NullPointerException|

SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

en.access();

}

}

else if(flag==1)

{

JOptionPane.showMessageDialog(null,"ENTER THE

VALUE IN ALL FIELDS");

flag=0;

}

if(l<10 && l>0)

{

JOptionPane.showMessageDialog(null,"INVALID

MOBILE NUMBER");

l=0;

}

}

}

}

Take out:

Page 267: Mini project-DBMS & JAVA

267

package mini_project;

import java.awt.event.ActionListener;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JComboBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

import java.awt.event.ActionListener;

public class Takeout implements ActionListener {

JFrame f6;

JComboBox j;

JButton ok,exit,back;

int k=0,qty1,flag=0,i=0;

Connection con;

JLabel uname,head,head1,info,sname;

String use;

int q,qty;

JTextField t;

String arry[]=new String[50];

String sum;

String bi,na;

public void createlayout(String user, String bi1) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

Page 268: Mini project-DBMS & JAVA

268

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

//String sum[]=new String[50];

f6=new JFrame();

use=user;

bi=bi1;

/* for(i=0;i<50;i++)

{

arry[i]="abc";

System.out.println(arry[i]);

}*/

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

f6.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\random.jpg")));

head=new JLabel("UDUPI SRI KRISHNA OFFSET

PRINTERS");

head.setBounds(390,20,650, 30);

head.setForeground(Color.white);

Font font = new Font("Algerian", Font.BOLD,30);

head.setFont(font);

f6.add(head);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(305,10,72,77);

f6.add(imagelabel);

head1=new JLabel("ITEM TAKEOUT PAGE");

head1.setBounds(550,100,500,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

head1.setForeground(Color.white);

head1.setFont(font1);

f6.add(head1);

sname=new JLabel("Item Name:");

sname.setBounds(550,250,100,30);

sname.setForeground(Color.white);

f6.add(sname);

j=new JComboBox();

Page 269: Mini project-DBMS & JAVA

269

j.setBounds(650,250,100,30);

f6.add(j);

uname= new JLabel("Quantity:");

uname.setBounds(550,350,100,30);

f6.add(uname);

uname.setForeground(Color.white);

t=new JTextField();

t.setBounds(650, 350, 100, 30);

f6.add(t);

ok=new JButton("Take Out");

ok.setBounds(600,450,100,30);

f6.add(ok);

back=new JButton("Back");

back.setBounds(100,610,100,30);

f6.add(back);

exit=new JButton("Logout");

exit.setBounds(1200,50,100,30);

f6.add(exit);

String sql12=""+"select sname from udupi_stock1 where

bid='"+bi+"'";

try {

Statement stmt31 = con.createStatement();

ResultSet rs31=stmt31.executeQuery(sql12);

while(rs31.next())

{

j.addItem(rs31.getString(1));

}

//JOptionPane.showMessageDialog(null,k);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setSize(width,height);

f6.setLayout(null);

f6.setVisible(true);

}

Page 270: Mini project-DBMS & JAVA

270

public void access()

{

//for(int j1=k;j1<k;j1++)

//j.addItem(arry[j1]);

exit.addActionListener(this);

back.addActionListener(this);

ok.addActionListener(this);

t.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

String str=e.getActionCommand();

if(e.getSource()==exit)

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

StockManagement fi1=new StockManagement();

try {

fi1.createlayout(use,bi);

Page 271: Mini project-DBMS & JAVA

271

} catch (ClassNotFoundException |

NullPointerException| SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

fi1.access();

}

else if(str.equals("Take Out"))

{

String na=""+j.getItemAt(j.getSelectedIndex());

String bid1=t.getText();

qty=Integer.parseInt(bid1);

if(bid1.equals(""))

{

flag=1;

}

if(flag==0)

{

String sq=""+"select qty from udupi_stock1 where

sname='"+na+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs1=stmt.executeQuery(sq);

while(rs1.next())

{

q=Integer.parseInt(rs1.getString(1));

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

q=q-qty;

if(q<0)

JOptionPane.showMessageDialog(null,"ENTER THE QUANTITY IS

GREATER THAN AVAILABLE");

else

{

String sql2="update udupi_stock1 set qty='"+q+"'

where sname='"+na+"'";

Statement stmt12;

try {

stmt12 = con.createStatement();

Page 272: Mini project-DBMS & JAVA

272

stmt12.executeUpdate(sql2);

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

StockManagement sm=new StockManagement();

try {

sm.createlayout(use, bi);

} catch (ClassNotFoundException | SQLException e1)

{

// TODO Auto-generated catch block

e1.printStackTrace();

}

sm.access();

}

}

}

else

JOptionPane.showMessageDialog(null,"ENTER THE

QUANTITY");

}

}

Update:

package mini_project;

import mini_project.*;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.Color;

import java.awt.Container;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Toolkit;

import javax.swing.*;

Page 273: Mini project-DBMS & JAVA

273

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.Statement;

public class Update implements ActionListener

{

JFrame f6;

JButton exit,alter,b1,b2,b3,b4,b5;

JComboBox month,year,day,j1,j12,t1;

JLabel title,update,odetails,qty,t5,deldate,pno,sno,qty1,amt,on;

JTextField t2,t3,t4;

Connection con;

String sql1,sql2,sql3,sql4;

private String[] mmonth = { "jan", "feb","mar","apr", "may", "jun", "jul",

"aug" , "sep", "oct", "nov", "dec"};

int []dday;

int []yyear;

String arry1[]=new String[50];

String arry[]=new String[50];

int i=0,i1,pp,tot,don=0,don1=0,flg1=0,flg2=0,flg3=0;

String use;

public void createlayout(String ono1,String user) throws SQLException,

ClassNotFoundException

{

Class.forName("oracle.jdbc.driver.OracleDriver");

con =

DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","rakhav",

"1234");

f6=new JFrame();

f6.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Rakhav

Krishna\\Downloads\\black.jpg")));

Dimension screenSize =

Toolkit.getDefaultToolkit().getScreenSize();

int width = (int) screenSize.getWidth();

int height = (int) screenSize.getHeight();

Container c=f6.getContentPane();

Page 274: Mini project-DBMS & JAVA

274

use=user;

c.setBackground(Color.lightGray);

title=new JLabel("UDUPI SRI KRISHNA OFFSET PRINTERS");

title.setBounds(440,0, 800, 50);

Font font = new Font("Algerian", Font.BOLD,30);

title.setFont(font);

title.setForeground(Color.white);

f6.add(title);

JLabel imagelabel = new JLabel( new

ImageIcon("C:\\Users\\Rakhav Krishna\\Downloads\\emb.png"));

imagelabel.setBounds(355,0,72,77);

f6.add(imagelabel);

t1= new JComboBox();

t2= new JTextField(20);

t3=new JTextField(20);

t4=new JTextField(20);

exit=new JButton("Sign Out");

exit.setBounds(1200,50,100,30);

f6.add(exit);

Font fo = new Font("TimesNewRoman", Font.BOLD,15);

on=new JLabel("Selected Ordered No:");

on.setBounds(350,200,250,25);

on.setForeground(Color.white);

on.setFont(fo);

f6.add(on);

t5=new JLabel(ono1);

t5.setBounds(600,200,100,25);

t5.setForeground(Color.white);

f6.add(t5);

t5.setFont(fo);

update= new JLabel("UPDATION PAGE");

update.setBounds(600,75,400,30);

Font font1 = new Font("Comic Sans MS", Font.BOLD,20);

update.setForeground(Color.white);

update.setFont(font1);

f6.add(update);

Page 275: Mini project-DBMS & JAVA

275

alter=new JButton("Back");

alter.setBounds(600,650,100,30);

f6.add(alter);

odetails=new JLabel("Order Status:");

odetails.setBounds(400,550,100,25);

odetails.setForeground(Color.white);

f6.add(odetails);

t1.setBounds(500,550,100,25);

f6.add(t1);

b1=new JButton("Alter5");

b1.setBounds(900,550,100,25);

f6.add(b1);

qty=new JLabel("Quantity:");

qty.setBounds(400,250,100,25);

qty.setForeground(Color.white);

f6.add(qty);

t2.setBounds(500,250,100,25);

f6.add(t2);

b2=new JButton("Alter1");

b2.setBounds(900,250,100,30);

f6.add(b2);

deldate=new JLabel("Delivery Date:");

deldate.setBounds(400,300,100,25);

deldate.setForeground(Color.white);

f6.add(deldate);

month = new JComboBox();

month.setBounds(500,300,75,25);

f6.add(month);

day=new JComboBox();

dday=new int[31];

for(int i=0;i<31;i++)

{

dday[i]=i+1;

}

day.setBounds(600,300,50,25);

f6.add(day);

year=new JComboBox();

Page 276: Mini project-DBMS & JAVA

276

yyear=new int[5000];

for(int i=1960;i<2017;i++)

yyear[i]=i;

year.setBounds(700,300,100,25);

f6.add(year);

b3=new JButton("Alter2");

b3.setBounds(900,300,100,30);

f6.add(b3);

pno= new JLabel("Product No:");

pno.setBounds(400,350,100,30);

pno.setForeground(Color.white);

f6.add(pno);

j1=new JComboBox();

j1.setBounds(500,350,100,30);

f6.add(j1);

qty1=new JLabel("Product Quantity:");

qty1.setBounds(400,400,300,25);

qty1.setForeground(Color.white);

f6.add(qty1);

t3.setBounds(500,400,300,25);

f6.add(t3);

b4=new JButton("Alter3");

b4.setBounds(900,400,100,30);

f6.add(b4);

sno= new JLabel("Supplier No:");

sno.setBounds(400,450,100,30);

sno.setForeground(Color.white);

f6.add(sno);

j12=new JComboBox();

j12.setBounds(500,450,100,30);

f6.add(j12);

amt=new JLabel("Amount Paid:");

amt.setBounds(400,500,300,25);

amt.setForeground(Color.white);

f6.add(amt);

t4.setBounds(500,500,300,25);

f6.add(t4);

b5=new JButton("Alter4");

b5.setBounds(900,500,100,30);

Page 277: Mini project-DBMS & JAVA

277

f6.add(b5);

String sql1=""+"select pno from udupi_product where ono='"+ono1+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql1);

while(rs.next())

{

arry[i]=rs.getString(1);

i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

i1=i;

i1--;

switch(i1)

{

case 0:

sql2=""+"select sno from udupi_supplier where

pno='"+arry[0]+"'";

try {

Statement stmt1 = con.createStatement();

ResultSet rs1=stmt1.executeQuery(sql2);

while(rs1.next())

{

arry1[0]=rs1.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

break;

case 1:

sql2=""+"select sno from udupi_supplier where

pno='"+arry[0]+"'";

try {

Statement stmt = con.createStatement();

ResultSet rs=stmt.executeQuery(sql2);

while(rs.next())

Page 278: Mini project-DBMS & JAVA

278

{

arry1[0]=rs.getString(1);

//i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

sql3=""+"select sno from udupi_supplier where

pno='"+arry[1]+"'";

try {

Statement stmt2 = con.createStatement();

ResultSet rs2=stmt2.executeQuery(sql3);

while(rs2.next())

{

arry1[1]=rs2.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

break;

case 2:

sql2=""+"select sno from udupi_supplier where

pno='"+arry[0]+"'";

try {

Statement stmt3 = con.createStatement();

ResultSet rs3=stmt3.executeQuery(sql2);

while(rs3.next())

{

arry1[0]=rs3.getString(1);

//i++;

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

sql3=""+"select sno from udupi_supplier where

pno='"+arry[1]+"'";

try {

Statement stmt4 = con.createStatement();

ResultSet rs4=stmt4.executeQuery(sql3);

while(rs4.next())

Page 279: Mini project-DBMS & JAVA

279

{

arry1[1]=rs4.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

sql4=""+"select sno from udupi_supplier where

pno='"+arry[2]+"'";

try {

Statement stmt5 = con.createStatement();

ResultSet rs5=stmt5.executeQuery(sql4);

while(rs5.next())

{

arry1[2]=rs5.getString(1);

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

break;

}

f6.setSize(width,height);

f6.setLayout(null);

f6.setVisible(true);

}

public void access()

{

exit.addActionListener(this);

alter.addActionListener(this);

b1.addActionListener(this);

b2.addActionListener(this);

b3.addActionListener(this);

b4.addActionListener(this);

b5.addActionListener(this);

t1.addItem("Delivered");

t1.addItem("Pending");

t2.addActionListener(this);

t3.addActionListener(this);

Page 280: Mini project-DBMS & JAVA

280

t4.addActionListener(this);

month.addActionListener(this);

year.addActionListener(this);

day.addActionListener(this);

for (int i = 0; i < 12; i++)

month.addItem(mmonth[i]);

for (int i = 0; i < 31; i++)

day.addItem(dday[i]);

for (int i = 1960; i < 2017; i++)

year.addItem(yyear[i]);

for(int j=0;j<i;j++)

j1.addItem(arry[j]);

for(int k = 0; k <= i1; k++)

j12.addItem(arry1[k]);

//.addActionListener(this);

}

public void actionPerformed(ActionEvent ae)

{

String str=ae.getActionCommand();

String s2=t5.getText();

if(str.equals("Sign Out"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

Login l=new Login();

try {

l.createLayout();

} catch (ClassNotFoundException | SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

l.access();

}

else if(str.equals("Alter5"))

{

String s1=""+t1.getItemAt(t1.getSelectedIndex());

Page 281: Mini project-DBMS & JAVA

281

//JOptionPane.showMessageDialog(null,s1);

String sqli=""+"update udupi_order set status='"+s1+"' where

ono='"+s2+"'";

Statement stmt;

try {

stmt = con.createStatement();

stmt.executeQuery(sqli);

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Updated Successfully!!");

}

if(ae.getSource()==month)

{

// JOptionPane.showMessageDialog(null,"New Customer");

String od=""+month.getItemAt(month.getSelectedIndex());

if(od.equals("feb"))

{

don=1;

day.removeItem(dday[29]);

if(don1==0)

day.removeItem(dday[30]);

}

else if(od.equals("apr") || od.equals("jun") || od.equals("jun")

|| od.equals("sep") || od.equals("nov"))

{

if(don==1)

{

day.addItem(dday[29]);

don=0;

}

day.removeItem(dday[30]);

don1=1;

}

else if(od.equals("jan") || od.equals("mar") ||

od.equals("may") || od.equals("jul") || od.equals("aug") || od.equals("oct") ||

od.equals("dec"))

{

if(don==1)

{

day.addItem(dday[29]);

day.addItem(dday[30]);

Page 282: Mini project-DBMS & JAVA

282

don=0;

}

if(don1==1)

{

day.addItem(dday[30]);

don1=0;

}

}

}

else if(str.equals("Back"))

{

try {

con.close();

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

f6.setVisible(false);

First en=new First();

try {

en.createlayout(use);

} catch (ClassNotFoundException | SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

en.access();

}

else if(str.equals("Alter2"))

{

String mon =

""+month.getItemAt(month.getSelectedIndex());

int da =

Integer.parseInt(""+day.getItemAt(day.getSelectedIndex()));

int ye =

Integer.parseInt(""+year.getItemAt(year.getSelectedIndex()));

mon=da+"-"+mon+"-"+ye;

String sqli=""+"update udupi_order set del='"+mon+"' where

ono='"+s2+"'";

Statement stmt;

try {

stmt = con.createStatement();

stmt.executeQuery(sqli);

} catch (SQLException e) {

Page 283: Mini project-DBMS & JAVA

283

// TODO Auto-generated catch block

e.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Updated

Successfully!!");

}

else if(str.equals("Alter3"))

{

if(t3.getText().equals(""))

{

JOptionPane.showMessageDialog(null,"Enter the

value for updation!!");

}

else

{

String s1=t3.getText();

String pno1 = ""+j1.getItemAt(j1.getSelectedIndex());

String sqli=""+"update udupi_product set qyt='"+s1+"'

where pno='"+pno1+"'";

Statement stmt;

try {

stmt = con.createStatement();

stmt.executeQuery(sqli);

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Updated

Successfully!!");

}

}

else if(str.equals("Alter1"))

{

if(t2.getText().equals(""))

{

JOptionPane.showMessageDialog(null,"Enter the

value for updation!!");

}

else

{

String s1=t2.getText();

String sqlj=""+"select price from udupi_order where

ono='"+s2+"'";

Page 284: Mini project-DBMS & JAVA

284

try {

Statement stmt4 = con.createStatement();

ResultSet rs4=stmt4.executeQuery(sqlj);

while(rs4.next())

{

pp=Integer.parseInt(rs4.getString(1));

}

} catch (SQLException e2) {

// TODO Auto-generated catch block

e2.printStackTrace();

}

int s=Integer.parseInt(s1);

tot=s*pp;

String sqk=""+"update udupi_order set total="+tot+" where

ono='"+s2+"'";

Statement stmt1;

try {

stmt1 = con.createStatement();

stmt1.executeQuery(sqk);

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

String sqli=""+"update udupi_order set qty='"+s1+"' where

ono='"+s2+"'";

Statement stmt;

try {

stmt = con.createStatement();

stmt.executeQuery(sqli);

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Updated

SuccessFully!!");

}

}

else if(str.equals("Alter4"))

{

if(t4.getText().equals(""))

{

JOptionPane.showMessageDialog(null,"Enter the

value for updation!!");

Page 285: Mini project-DBMS & JAVA

285

}

else

{

String s1=t4.getText();

String pno1 = ""+j12.getItemAt(j12.getSelectedIndex());

String sqli=""+"update udupi_supplier set amt='"+s1+"'

where sno='"+pno1+"'";

Statement stmt;

try {

stmt = con.createStatement();

stmt.executeQuery(sqli);

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

JOptionPane.showMessageDialog(null,"Updated

Successfully!!");

}

}

}

}

Page 286: Mini project-DBMS & JAVA

286

SCREEN SHOTS

Page 287: Mini project-DBMS & JAVA

287

Page 288: Mini project-DBMS & JAVA

288

Page 289: Mini project-DBMS & JAVA

289

Page 290: Mini project-DBMS & JAVA

290

Page 291: Mini project-DBMS & JAVA

291

Page 292: Mini project-DBMS & JAVA

292

Page 293: Mini project-DBMS & JAVA

293

Page 294: Mini project-DBMS & JAVA

294

Page 295: Mini project-DBMS & JAVA

295

Page 296: Mini project-DBMS & JAVA

296

Page 297: Mini project-DBMS & JAVA

297

Page 298: Mini project-DBMS & JAVA

298

Page 299: Mini project-DBMS & JAVA

299

Page 300: Mini project-DBMS & JAVA

300

Page 301: Mini project-DBMS & JAVA

301

Page 302: Mini project-DBMS & JAVA

302

Page 303: Mini project-DBMS & JAVA

303

Page 304: Mini project-DBMS & JAVA

304

Page 305: Mini project-DBMS & JAVA

305

Page 306: Mini project-DBMS & JAVA

306

Page 307: Mini project-DBMS & JAVA

307

Page 308: Mini project-DBMS & JAVA

308

Page 309: Mini project-DBMS & JAVA

309

Page 310: Mini project-DBMS & JAVA

310

Page 311: Mini project-DBMS & JAVA

311

Page 312: Mini project-DBMS & JAVA

312

Page 313: Mini project-DBMS & JAVA

313

Page 314: Mini project-DBMS & JAVA

314

Page 315: Mini project-DBMS & JAVA

315

Page 316: Mini project-DBMS & JAVA

316

Page 317: Mini project-DBMS & JAVA

317

Page 318: Mini project-DBMS & JAVA

318

Page 319: Mini project-DBMS & JAVA

319

Page 320: Mini project-DBMS & JAVA

320

Page 321: Mini project-DBMS & JAVA

321

Page 322: Mini project-DBMS & JAVA

322

Page 323: Mini project-DBMS & JAVA

323

Page 324: Mini project-DBMS & JAVA

324

Page 325: Mini project-DBMS & JAVA

325

Page 326: Mini project-DBMS & JAVA

326

Page 327: Mini project-DBMS & JAVA

327

Page 328: Mini project-DBMS & JAVA

328

Conclusion:

To conclude the description about the project: The project,

developed using java and oracle is based on the required specifications of the

user and the analysis of the existing system, with flexibility for future

enhancement. The expanded functionality of today’s software requires an

appropriate approach towards software development. This printing press

database management is designed for people who want to manage various

activity in printing press. This particular project deals with the problem on

managing the order details in printing press and avoids the problems which

occurred when carried manually. Identification of the drawbacks of the existing

system leads to the designing of computerized system that will be compatible to

the existing system with the system which is more user friendly and more GUI

oriented.