More Related Content Similar to Restaurant Management System Project Report Similar to Restaurant Management System Project Report (20) Restaurant Management System Project Report1. Mini Project Report 1 Government Polytechnic College Nedumangad
Introduction
The “Restaurant Management System” is a multi-user based
Windows Application which helps people to input details about various
events involves in a restaurant and store it in a local database.
User can provide details about various Menu Items and other
Transactions using this app. These information contains name of Menu
item, Menu id, Category and much more. So users can associate billing
with a money transaction in either of these parcel or home delivery. The
applications will automatically the amount of each transaction. Based on
each transactions for various life events.
Users can store Details of Employees including description about
Employee ID, time, date, amount obtained or spended for that event and
the bank account that is used to deposit or withdraw money for that event.
It also provides a facility to search for life events based on a keyword.
It can also perform other common tasks like insertion, deletion, updating.
2. Mini Project Report 2 Government Polytechnic College Nedumangad
Application User and Characteristics
There is only many type of user for this app, privileged users and
non-privileged users
Product Perspective
The product will be indented for work in a multi user environment.
So each user account in a Windows PC requires to be installed separate
instances of the product. So, each users in a Windows PC can maintain
their own application instance and the database.
Assumptions and dependencies
One assumption about the product is that it will always be used in a
Windows PC that have enough performance. If the PC does not meet the
minimum system requirements, for example, if there is not enough disk
space to store database, this app will not run correctly.
Functional Requirements
I. Welcome screen: It provides a welcome message with the user
II. Login Window: This feature allows users work multiple accounts
with privileged or non-privileged account
III. Settings: The Corresponded logged pearson can change his
password by confirming his old password
IV. Employee Details : A user should be able to view all detailed list of
Employees Working in Organization Use Full details on it
V. Menu : The user can also find available list of updated Menu
3. Mini Project Report 3 Government Polytechnic College Nedumangad
VI. View Transactions: The user must be able to view detailed
information about transaction done by user(only deleted by
privileged Account)
VII. Admin Options : Here, A privileged User Can add new
account,Modify,Remove Accounts
VIII. Order Now:User can bill the transactions and print to hard copy
IX. Change Name: Privileged user can change name of shop
X. About :User can see the app developers
Development tools and environment
OS: Windows 10 Pro x64
IDE: NetBeans 8.1 RC2
Language: Java
Runtime: Java Runtime 8
Database: MYSQL 5.5
Data Provider: MySQL JDBC
Graphics Design Tools: MS Paint, Photoshop CS6
Software Requirements
Operating System: Windows 10, Windows 8.1
Runtime : Java Runtime Environment 8
DBMS : MySQL with JDBC
4. Mini Project Report 4 Government Polytechnic College Nedumangad
Hardware Requirements
CPU : Intel x86 or x64 based CPU with 1 GHz or higher clock rate *
Physical Memory : 1 GB for 32bit OS and 2 GB for 64bit OS *Disk Space
: At least 40 MB of System Hard Disk space
Display Adapter : 1024x768 24bit color DirectX supported display *
Keyboard : 104 key standard keyboard
*Recommended hardware for best performance
Demonstration
Application will open up the loading screen directly. It will show
a login page after login, it show main page. Where there
Through the shortcuts users can navigate into following windows,
Settings: Logged user can change the password.
Menu: Details about available menu.
Employees: Shows details Employees.
View Transactions: Shows details billed transactions.
Order Now: Through which users can input details to bill a
product.
Admin Options: A privileged user can access user controls
5. Mini Project Report 5 Government Polytechnic College Nedumangad
ER-Model
PriceItem
Has
nam
Category
m_id
Sales
net
cust
billed
mname
t_id
mid
date
total
order
6. Mini Project Report 6 Government Polytechnic College Nedumangad
Data Model
login
Field Type Constrain
UserName Varchar(50)
password Varchar(50)
adm text
menu
Field Type Constrain
id Varchar(250)
nam Varchar(250)
Category Varchar(250)
Price Varchar(250)
supplier
Field Type Constrain
id Varchar(200)
Name Varchar(250)
Phone Varchar(250)
State Varchar(250)
Salary Varchar(250)
7. Mini Project Report 7 Government Polytechnic College Nedumangad
trans
Field Type Constrain
id Varchar(200)
menuid Varchar(250)
mname Varchar(250)
net Varchar(250)
ordr Varchar(250)
cust Varchar(250)
total Varchar(250)
billed Varchar(250)
dat Varchar(250)
temp
Field Type Constrain
nm Varchar(200)
8. Mini Project Report 8 Government Polytechnic College Nedumangad
Source Code
Loading.java
import java.awt.Cursor;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Loading extends javax.swing.JFrame {
private Timer timer;
public Loading() {
initComponents();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
jButton1.setVisible(true);
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
Login Frame2=new Login();
Loading.this.dispose();
Frame2.setVisible(true);
}
private void jLabel3MouseClicked(java.awt.event.MouseEvent evt)
{
aboutdev m=new aboutdev();
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jLabel3MouseEntered(java.awt.event.MouseEvent evt)
{
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/restaurant-red-
icon.png")));
jLabel1.setForeground(Color.red);
jLabel1.updateUI();
}
private void jLabel3MouseExited(java.awt.event.MouseEvent evt) {
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/restaurant-blue-
icon.png")));
jLabel1.setForeground(Color.blue);
jLabel1.updateUI();
9. Mini Project Report 9 Government Polytechnic College Nedumangad
}
private void jButton1KeyPressed(java.awt.event.KeyEvent evt) {
Login Frame2=new Login();
Loading.this.dispose();
Frame2.setVisible(true);
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Loading.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Loading.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Loading.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Loading.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Loading().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
10. Mini Project Report 10 Government Polytechnic College Nedumangad
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
}
Login.java
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.*;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.swing.BorderFactory;
import restuarant.dbm;
public class Login extends javax.swing.JFrame {
public Statement s=null;
public ResultSet rs;
public Connection con;
public int S;
int i=0;
public Login()
{
initComponents();
jLabel3.requestFocus();
jPanel2.setBorder(BorderFactory.createTitledBorder("User
Login"));
con=dbm.doconnect();
try
{
if(con!=null)
System.out.println("SUCCESS");
else
System.out.println("Failed To connect");
}
11. Mini Project Report 11 Government Polytechnic College Nedumangad
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
}
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
String sl;
S=0;
try
{
String SQL="select*from Login";
s=con.createStatement();
rs=s.executeQuery(SQL);
while(rs.next())
{
if(rs.getString("UserName").equals(jTextField1.getText())&&rs.getStr
ing("password").equals(jPasswordField1.getText()))
{
Login.this.dispose();
String p=rs.getString("adm");
sl=jTextField1.getText();
Mainwindow m=new Mainwindow();
Mainwindow.userid(sl,p);
S++;
try{
String t="Audio/Logon.wav";
AudioInputStream audioInputStream =
AudioSystem.getAudioInputStream(new File(t).getAbsoluteFile());
Clip clip=AudioSystem.getClip();
clip.open(audioInputStream);
clip.start();
}
catch(UnsupportedAudioFileException | IOException |
LineUnavailableException ex)
{
javax.swing.JOptionPane.showMessageDialog(this,"Some Files
Missing.......!");
System.out.println(ex);
}
m.setVisible(true);
jLabel4.setForeground(Color.red);
jLabel4.setText("Checking .....");
}
else
{
12. Mini Project Report 12 Government Polytechnic College Nedumangad
jLabel4.setForeground(Color.red);
jLabel4.setText("Login Error");
}
}
}
catch(SQLException
err){System.out.println(err.getMessage());}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
i=0;
jTextField1.setForeground(new java.awt.Color(204, 204,
204));
jTextField1.setText("User Name");
jTextField1.updateUI();
//jTextField1.setText("");
jPasswordField1.setText("");
jTextField2.setLocation(140,100);
jTextField2.setVisible(true);
}
private void jLabel3MouseEntered(java.awt.event.MouseEvent evt)
{
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/locked-icon.png")));
//jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/locked-icon.png")));
}
private void jLabel3MouseExited(java.awt.event.MouseEvent evt) {
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/man-2-icon.png")));
}
private void jTextField1MouseClicked(java.awt.event.MouseEvent
evt) {
if(i==0)
{
jTextField1.setForeground(new java.awt.Color(0, 0, 0));
jTextField1.setText(null);
jTextField1.updateUI();
i=3;
System.out.print(i);
}
}
private void jTextField2MouseClicked(java.awt.event.MouseEvent
evt) {
jTextField2.setLocation(90, 87);
13. Mini Project Report 13 Government Polytechnic College Nedumangad
jTextField2.setVisible(false);
jPasswordField1.requestFocus();
}
private void jTextField1FocusGained(java.awt.event.FocusEvent
evt) {
if(i==0)
{jTextField1.setForeground(new java.awt.Color(0, 0, 0));
jTextField1.setText(null);
jTextField1.updateUI();
i=3;
System.out.print(i);
}
}
private void jButton1KeyPressed(java.awt.event.KeyEvent evt) {
String sl;
S=0;
try{
String SQL="select*from Login";
s=con.createStatement();
rs=s.executeQuery(SQL);
while(rs.next())
{
if(rs.getString("UserName").equals(jTextField1.getText())&&rs.getStr
ing("password").equals(jPasswordField1.getText()))
{
Login.this.dispose();
String p=rs.getString("adm");
sl=jTextField1.getText();
Mainwindow m=new Mainwindow();
Mainwindow.userid(sl,p);
S++;
try{
String t="Audio/Logon.wav";
AudioInputStream audioInputStream =
AudioSystem.getAudioInputStream(new File(t).getAbsoluteFile());
Clip clip=AudioSystem.getClip();
clip.open(audioInputStream);
clip.start();
}
catch(UnsupportedAudioFileException | IOException |
LineUnavailableException ex)
{
javax.swing.JOptionPane.showMessageDialog(this,"Some Files
Missing.......!");
System.out.println(ex);
}
m.setVisible(true);
jLabel4.setForeground(Color.red);
jLabel4.setText("Checking .....");
}
14. Mini Project Report 14 Government Polytechnic College Nedumangad
else
{
jLabel4.setForeground(Color.red);
jLabel4.setText("Login Error");
}
}
}
catch(SQLException
err){System.out.println(err.getMessage());}
}
private void jTextField2FocusGained(java.awt.event.FocusEvent
evt) {
jTextField2.setLocation(90, 87);
jTextField2.setVisible(false);
jPasswordField1.requestFocus(); System.out.print("Yessss....");
}
private void
jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
15. Mini Project Report 15 Government Polytechnic College Nedumangad
new Login().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JFrame jFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
}
Main Window.java
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import java.sql.*;
import restuarant.dbm;
public class Mainwindow extends javax.swing.JFrame {
public static String user,control;
Statement s;
ResultSet rs;
Connection cn;
static void userid(String sl,String p) {
user=sl;
control=p;
jLabel8.setText(user);
if("y".equals(control))
{
jButton8.setVisible(true);
}
else
{
jButton8.setVisible(false);
}
}
public Mainwindow() {
initComponents();
16. Mini Project Report 16 Government Polytechnic College Nedumangad
String p="Restuarant Manegement System";
cn=dbm.doconnect();
jButton1.setSize(25, 25);
sl();
if(control=="yes")
{
jButton8.setVisible(true);
}
else
{
jButton8.setVisible(false);
}
}
public static void sl()
{
Statement s;
ResultSet rs;
Connection cn;
String p="Restuarant Manegement System";
cn=dbm.doconnect();
try{
String sql="Select * from temp";
s=cn.createStatement();
rs=s.executeQuery(sql);
while(rs.next())
{
p= rs.getString("nm");
}
jLabel10.setText(p);
jLabel10.updateUI();
}
catch(Exception e)
{
System.out.print(e);
}
}
private void initComponents() {…}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt)
{
employeetable m=new employeetable();
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
try{
String t="Audio/logoff.wav";
AudioInputStream audioInputStream =
AudioSystem.getAudioInputStream(new File(t).getAbsoluteFile());
Clip clip=AudioSystem.getClip();
17. Mini Project Report 17 Government Polytechnic College Nedumangad
clip.open(audioInputStream);
clip.start();
}catch(UnsupportedAudioFileException | IOException |
LineUnavailableException ex)
{
javax.swing.JOptionPane.showMessageDialog(this,"Some Files
Missing.......!");
System.out.println(ex);
}
Mainwindow.this.dispose();
Login n=new Login();
n.setVisible(true);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{
Settings p = new Settings();
Settings.user(user);
p.setVisible(true);
p.setAlwaysOnTop(true);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt)
{
Menu m=new Menu();
m.isAlwaysOnTopSupported();
m.setAlwaysOnTop(true);
m.setVisible(true);
}
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt)
{
adminoption n=new adminoption();
n.setVisible(true);
n.setAlwaysOnTop(true);
}
private void jButton10ActionPerformed(java.awt.event.ActionEvent
evt) {
aboutdev m=new aboutdev();
aboutdev.user(user);
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)
{
order m=new order();
order.user(user);
m.setVisible(true);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
transview m=new transview();
18. Mini Project Report 18 Government Polytechnic College Nedumangad
transview.usr(control);
m.setVisible(true);
}
private void jButton10MouseEntered(java.awt.event.MouseEvent evt) {
jLabel9.setForeground(Color.red);
jLabel9.updateUI();
}
private void jButton10MouseExited(java.awt.event.MouseEvent evt) {
jLabel9.setForeground(Color.BLUE);
jLabel9.updateUI();
}
private void jButton3MouseEntered(java.awt.event.MouseEvent evt) {
jLabel1.setForeground(Color.red);
jLabel1.updateUI();
}
private void jButton3MouseExited(java.awt.event.MouseEvent evt) {
jLabel1.setForeground(Color.BLACK);
jLabel1.updateUI();
}
private void jButton4MouseEntered(java.awt.event.MouseEvent evt) {
jLabel2.setForeground(Color.red);
jLabel2.updateUI();
}
private void jButton4MouseExited(java.awt.event.MouseEvent evt) {
jLabel2.setForeground(Color.BLACK);
jLabel2.updateUI();
}
private void jButton5MouseEntered(java.awt.event.MouseEvent evt) {
jLabel3.setForeground(Color.red);
jLabel3.updateUI();
}
private void jButton5MouseExited(java.awt.event.MouseEvent evt) {
jLabel3.setForeground(Color.BLACK);
jLabel3.updateUI();
}
private void jButton6MouseEntered(java.awt.event.MouseEvent evt) {
jLabel5.setForeground(Color.red);
jLabel5.updateUI();
}
private void jButton6MouseExited(java.awt.event.MouseEvent evt) {
jLabel5.setForeground(Color.BLACK);
jLabel5.updateUI();
}
private void jButton2MouseEntered(java.awt.event.MouseEvent evt) {
jLabel6.setForeground(Color.red);
jLabel6.updateUI();
}
private void jButton2MouseExited(java.awt.event.MouseEvent evt) {
jLabel6.setForeground(Color.BLACK);
jLabel6.updateUI();
}
19. Mini Project Report 19 Government Polytechnic College Nedumangad
private void jButton1MouseEntered(java.awt.event.MouseEvent evt) {
jButton1.setBackground(Color.red);
jLabel8.setForeground(Color.red);
jLabel8.updateUI();
}
private void jButton1MouseExited(java.awt.event.MouseEvent evt) {
jButton1.setBackground(Color.white);
jLabel8.setForeground(Color.BLACK);
jLabel8.updateUI();
}
private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) {
if("y".equals(control))
{
editnam n=new editnam();
n.setVisible(true);
n.setAlwaysOnTop(true);
}
}
private void jLabel10MouseEntered(java.awt.event.MouseEvent evt) {
jLabel10.setForeground(Color.RED);
jLabel10.updateUI();
}
private void jLabel10MouseExited(java.awt.event.MouseEvent evt) {
jLabel10.setForeground(Color.BLACK);
jLabel10.updateUI();
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Mainwindow.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Mainwindow.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Mainwindow.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
20. Mini Project Report 20 Government Polytechnic College Nedumangad
java.util.logging.Logger.getLogger(Mainwindow.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Mainwindow().setVisible(true);
}
});
}
private java.awt.Canvas canvas1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton2;
public javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
public static javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JDialog jDialog1;
private javax.swing.JDialog jDialog2;
private javax.swing.JLabel jLabel1;
public static javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
public static javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
}
Menu.java
import java.awt.Color;import static
java.awt.image.ImageObserver.WIDTH;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import restuarant.dbm;
public class Menu extends javax.swing.JFrame {
public static Connection con;
public static Statement s=null;
public static ResultSet rs;
static String s1,s2,s3,s4;
21. Mini Project Report 21 Government Polytechnic College Nedumangad
public Menu() {
initComponents();
con=dbm.doconnect();
jLabel1.setText("Click Load") ;
jButton1.setText("Load");
try
{
if(con!=null)
{
System.out.println("SUCCESS");
jLabel1.setText("Connection Successfull ") ;
}
else
{
System.out.println("Failed To connect");
jLabel1.setText("Oops Some Thing Went Wrong")
;
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
String qp=("select * from Menu");
try
{
s=con.createStatement();
jButton1.setText("ReLoad");
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Nam");
s3=rs.getString("Category");
s4=rs.getString("Price");
m.addRow(new Object[]{s1,s2,s3,s4});
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went
Wrong") ;
System.out.println("Error"+e.getMessage());
}
22. Mini Project Report 22 Government Polytechnic College Nedumangad
jLabel1.setText("Click ReLoad To Refresh") ;
}
public static void refersh()
{
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
int rowCount = m.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
}
try
{String qp=("select * from Menu");
s=con.createStatement();
jButton1.setText("ReLoad");
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Nam");
s3=rs.getString("Category");
s4=rs.getString("Price");
m.addRow(new Object[]{s1,s2,s3,s4});
}
}
catch(Exception e)
{
System.out.println("Error"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
int rowCount = m.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
}
String qp=("select * from Menu");
try
{
s=con.createStatement();
23. Mini Project Report 23 Government Polytechnic College Nedumangad
jButton1.setText("ReLoad");
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Nam");
s3=rs.getString("Category");
s4=rs.getString("Price");
m.addRow(new Object[]{s1,s2,s3,s4});
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went
Wrong") ;
System.out.println("Error"+e.getMessage());
}
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent
evt) {
addmenu n=new addmenu();
n.setVisible(true);
n.setAlwaysOnTop(true);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{
String g=(jTable2.getValueAt(jTable2.getSelectedRow(),
0).toString());
jLabel1.setText(g);
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
int rowCount = m.getRowCount();
try
{
String sql=("delete from Menu where ID='"+g+"';");
s=con.createStatement();
s.executeUpdate(sql);
refersh();
jButton1.setText("ReLoad");
System.out.println(s);
}
catch(Exception e)
{
System.out.println(e);
}
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
24. Mini Project Report 24 Government Polytechnic College Nedumangad
}
String qp=("select * from Menu");
try
{
jButton1.setText("ReLoad");
System.out.println(s);
s=con.createStatement();
s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Nam");
s3=rs.getString("Category");
s4=rs.getString("Price");
m.addRow(new Object[]{s1,s2,s3,s4});
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went
Wrong") ;
System.out.println("Error"+e.getMessage());
} }
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
editmenu j=new editmenu();
String g=(jTable2.getValueAt(jTable2.getSelectedRow(),
0).toString());
String l=(jTable2.getValueAt(jTable2.getSelectedRow(),
1).toString());
String m=(jTable2.getValueAt(jTable2.getSelectedRow(),
2).toString());
String n=(jTable2.getValueAt(jTable2.getSelectedRow(),
3).toString());
jLabel1.setText(g);
editmenu.ser(g,l,m,n);
j.setVisible(true);
j.setAlwaysOnTop(true);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt)
{
String g=(jTable2.getValueAt(jTable2.getSelectedRow(),
0).toString());
jLabel1.setText(g);
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
int rowCount = m.getRowCount();
try
{
String sql=("delete from Menu;");
s=con.createStatement();
25. Mini Project Report 25 Government Polytechnic College Nedumangad
s.executeUpdate(sql);
refersh();
}
catch(Exception e)
{
}
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
}
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Menu().setVisible(true);
}
});
}
public static javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
26. Mini Project Report 26 Government Polytechnic College Nedumangad
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane2;
public static javax.swing.JTable jTable2;
}
Settings.java
import java.awt.Color;
import restuarant.dbm;
import java.sql.*;
public class Settings extends javax.swing.JFrame {
public static String id;
public static String h;
static String c,d,f,g,s1,s2,s3,s4,m;
public static Connection con;
public static Statement s=null;
public static ResultSet rs;
static void user(String user) {
id=user;
jTextField1.setText(id);
}
static void ns()
{
System.out.println("In NS");
try
{
String sqp=("select * from Login where
UserName='"+jTextField1.getText()+"';");
s=con.createStatement();
System.out.println(s);
System.out.println(rs);
s.execute(sqp);
while(rs.next())
{
s1=rs.getString("password");
System.out.println("H1");
System.out.println("s1");
}
c=jTextField1.getText();
d=jPasswordField1.getText();
f=jPasswordField2.getText();
m=jPasswordField3.getText();
}
catch(Exception e)
{
System.out.println("ERROR");
27. Mini Project Report 27 Government Polytechnic College Nedumangad
System.out.println(e);
}
}
void addsr()
{
String qp=("select * from Login where
UserName='"+id+"';");
try
{
s=con.createStatement();
//jButton1.setText("ReLoad");
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("password");
}
System.out.println(s1);
}
catch(Exception e)
{
System.out.println(e);
}
}
public Settings() {
initComponents();
jTextField1.disable();
jPasswordField2.setText("");
jPasswordField3.setText("");
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
addsr();
28. Mini Project Report 28 Government Polytechnic College Nedumangad
if(s1.equals(jPasswordField1.getText()))
{
c=jTextField1.getText();
f=jPasswordField2.getText();
m=jPasswordField3.getText();
try{
if(jPasswordField2.getText().equals(jPasswordField3.getText()))
{s=con.createStatement();
String sql=("update Login set password='"+m+"' where
UserName='"+c+"';");
s=con.createStatement();
System.out.println(s);
jButton5.setText("Back");
System.out.println("in if s");
s.executeUpdate(sql);
jLabel.setForeground(Color.red);
jLabel.setText("Updation Successfull");
System.out.println(s);
jPasswordField1.setText("");
jPasswordField2.setText("");
jPasswordField3.setText("");
}
else
{
jLabel.setForeground(Color.red);
jLabel.setText("Password Match Faild");
}
} catch (SQLException ex) {
System.out.print(ex);
}
}
else
{
jLabel.setText("Check Old Password");
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent
evt) {
jPasswordField1.setText("");
jPasswordField2.setText("");
jPasswordField3.setText("");
}
private void
jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
}
29. Mini Project Report 29 Government Polytechnic College Nedumangad
private void jButton5ActionPerformed(java.awt.event.ActionEvent
evt) {
Settings.this.dispose();
}
private void
jPasswordField1ActionPerformed(java.awt.event.ActionEvent evt) {
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Settings.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Settings.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Settings.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Settings.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Settings().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JDialog jDialog1;
private static javax.swing.JLabel jLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
30. Mini Project Report 30 Government Polytechnic College Nedumangad
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private static javax.swing.JPasswordField jPasswordField1;
public static javax.swing.JPasswordField jPasswordField2;
public static javax.swing.JPasswordField jPasswordField3;
public static javax.swing.JTextField jTextField1;
}
UserTable.java
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import restuarant.dbm;
public class Usertable extends javax.swing.JFrame {
public static Connection con;
public static Statement s;
public static ResultSet rs;
static String s1,s2,s3,s4,gn;
public static void refresh()
{
DefaultTableModel m=(DefaultTableModel)jTable1.getModel();
int rowCount = m.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
}
int sl=0;
String qp=("select * from Login");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("UserName");
s2=rs.getString("adm");
if("y".equals(s2))
{
m.addRow(new Object[]{s1,"Yes"});
}
else
{
m.addRow(new Object[]{s1,"No"});;
}
}
catch(Exception e)
31. Mini Project Report 31 Government Polytechnic College Nedumangad
{
System.out.println("Error"+e.getMessage());
}
}
public Usertable() {
initComponents();
jPanel2.setBorder(BorderFactory.createTitledBorder("Quick
Acess Panel"));
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable1.getModel();
String qp=("select * from Login");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("UserName");
s2=rs.getString("adm");
if("y".equals(s2))
{
m.addRow(new Object[]{s1,"Yes"});
}
else
{
m.addRow(new Object[]{s1,"No"});;
}
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went
Wrong") ;
32. Mini Project Report 32 Government Polytechnic College Nedumangad
System.out.println("Error"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton5ActionPerformed(java.awt.event.ActionEvent
evt) {
adduser m=new adduser();
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt)
{
String g=(jTable1.getValueAt(jTable1.getSelectedRow(),
0).toString());
jLabel1.setText(g);
gn=g;
edituser m=new edituser();
edituser.per(gn);
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt)
{
String g=(jTable1.getValueAt(jTable1.getSelectedRow(),
0).toString());
jLabel1.setText(g);
gn=g;
deleteuser m=new deleteuser();
deleteuser.end(g);
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{
DefaultTableModel m=(DefaultTableModel)jTable1.getModel();
int rowCount = m.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
}
int sl=0;
String qp=("select * from Login");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("UserName");
33. Mini Project Report 33 Government Polytechnic College Nedumangad
s2=rs.getString("adm");
if("y".equals(s2))
{
m.addRow(new Object[]{s1,"Yes"});
}
else
{
m.addRow(new Object[]{s1,"No"});;
}
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went
Wrong") ;
System.out.println("Error"+e.getMessage());
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
String g=(jTable1.getValueAt(jTable1.getSelectedRow(),
0).toString());
jLabel1.setText(g);
gn=g;
String k=(jTable1.getValueAt(jTable1.getSelectedRow(),
1).toString());
viewuser m=new viewuser();
jLabel2.setText(k);
viewuser.per(gn,k);
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
Usertable.this.dispose();
}
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {
String g=(jTable1.getValueAt(jTable1.getSelectedRow(),
0).toString());
jLabel1.setText(g);
String k=(jTable1.getValueAt(jTable1.getSelectedRow(),
1).toString());
jLabel2.setText(k);
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
34. Mini Project Report 34 Government Polytechnic College Nedumangad
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Usertable.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Usertable.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Usertable.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Usertable.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Usertable().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JDesktopPane jDesktopPane2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
public static javax.swing.JTable jTable1;
}
35. Mini Project Report 35 Government Polytechnic College Nedumangad
About Dev.java
import javax.swing.BorderFactory;
public class aboutdev extends javax.swing.JFrame {
static void user(String user) {
jLabel14.setText(user);
}
public aboutdev() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(aboutdev.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(aboutdev.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(aboutdev.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(aboutdev.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new aboutdev().setVisible(true);
}
});
}
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
36. Mini Project Report 36 Government Polytechnic College Nedumangad
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private static javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
}
Add Menu.java
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import restuarant.dbm;
public class addmenu extends javax.swing.JFrame {
public static Connection con;
public Statement s=null;
public ResultSet rs;
String s1,s2,s3,s4,sq;
int sl,a=999;
public addmenu() {
initComponents();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
String qp=("select * from Menu");
try {
37. Mini Project Report 37 Government Polytechnic College Nedumangad
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
sq=rs.getString("ID");
}
if(sq==null)
{
sq="999";
}
a=Integer.parseInt(sq);
a=a+1;
sq=Integer.toString(a);
jTextField1.setText(sq);
jTextField1.disable();
}
catch (SQLException ex) {
System.out.println(ex);
javax.swing.JOptionPane.showMessageDialog(this,ex);
}
}
@SuppressWarnings("unchecked")
private void initComponents() {….}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
try {
String c,d,f,g;
a=a+1;
c=jTextField1.getText();
d=jTextField2.getText();
f=jTextField3.getText();
g=jTextField4.getText();
String sql= ("INSERT INTO Menu (ID, Nam,Category,Price)
VALUES ('"+c+"', '"+d+"','"+f+"','"+g+"')");
s=con.createStatement();
System.out.println(s);
s.executeUpdate(sql);
Menu.refersh();
} catch (SQLException ex) {
System.out.print(ex);
javax.swing.JOptionPane.showMessageDialog(this,"Error........!");
}
addmenu.this.dispose();
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
jTextField2.setText("");
jTextField3.setText("");
38. Mini Project Report 38 Government Polytechnic College Nedumangad
jTextField4.setText("");
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(addmenu.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(addmenu.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(addmenu.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(addmenu.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new addmenu().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
39. Mini Project Report 39 Government Polytechnic College Nedumangad
}
Add Supplier.java
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import restuarant.dbm;
public class addsupplier extends javax.swing.JFrame {
public static Connection con;
public Statement s=null;
public ResultSet rs;
String s1,s2,s3,s4,sq;
int sl,a=999;
int jj=0;
public addsupplier() {
initComponents();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
String qp=("select * from supplier");
try {
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
sq=rs.getString("ID");
}
if(sq==null)
{
40. Mini Project Report 40 Government Polytechnic College Nedumangad
sq="999";
}
a=Integer.parseInt(sq);
a=a+1;
sq=Integer.toString(a);
jTextField1.setText(sq);
jTextField1.disable();
}
catch (SQLException ex) {
System.out.println(ex);
javax.swing.JOptionPane.showMessageDialog(this,ex);
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
try {
String c,d,f,g,l;
a=a+1;
c=jTextField1.getText();
d=jTextField2.getText();
l=jComboBox1.getSelectedItem().toString();
f=jTextField3.getText();
g=jTextField4.getText();
System.out.println(l);
if("-Select-"==(l))
{
jLabel1.setText("Select A Category");
}
else
{
String sql= ("INSERT INTO supplier (ID,`Name`,State,Phone,salary)
VALUES ('"+c+"', '"+d+"','"+l+"','"+f+"','"+g+"')");
s=con.createStatement();
System.out.println(s);
System.out.println("ppp");
s.executeUpdate(sql);
employeetable.refresh();
addsupplier.this.dispose();
}
} catch (SQLException ex) {
System.out.print(ex);
}
}
private void
jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
41. Mini Project Report 41 Government Polytechnic College Nedumangad
if(jj==0)
{
jComboBox1.removeItemAt(0);
jj++;
}
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(addsupplier.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(addsupplier.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(addsupplier.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(addsupplier.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new addsupplier().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
42. Mini Project Report 42 Government Polytechnic College Nedumangad
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
}
Add User.java
import java.awt.Color;
import java.sql.*;
import restuarant.dbm;
public class adduser extends javax.swing.JFrame {
public static Connection con;
public Statement s=null;
public ResultSet rs;
public adduser() {
initComponents();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
try {
String c,d,f,g;
c=jTextField1.getText();
d=jPasswordField1.getText();
f=jPasswordField2.getText();
if(jCheckBox1.isSelected())
{
g="y";
}
else
{
43. Mini Project Report 43 Government Polytechnic College Nedumangad
g="n";
}
if(d.equals(f))
{
String sql= ("INSERT INTO Login (UserName,password,adm)
VALUES ('"+c+"', '"+d+"','"+g+"')");
s=con.createStatement();
System.out.println(s);
jLabel1.setForeground(Color.red);
jLabel1.setText("Added Successfully");
s.executeUpdate(sql);
Usertable.refresh();
adduser.this.dispose();
}
else
{
jLabel1.setForeground(Color.red);
jLabel1.setText("Password Mismatch");
}
} catch (SQLException ex) {
System.out.print(ex);
}
}
private void
jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(adduser.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(adduser.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(adduser.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
44. Mini Project Report 44 Government Polytechnic College Nedumangad
java.util.logging.Logger.getLogger(adduser.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new adduser().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JLabel jLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel2;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JPasswordField jPasswordField2;
private javax.swing.JTextField jTextField1;
}
Admin Options.java
public class adminoption extends javax.swing.JFrame {
public adminoption() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {..}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
adduser m=new adduser();
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
Usertable m=new Usertable();
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt) {
edituser m=new edituser();
45. Mini Project Report 45 Government Polytechnic College Nedumangad
m.setVisible(true);
m.setAlwaysOnTop(true);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent
evt) {
deleteuser m=new deleteuser();
m.setVisible(true);
m.setAlwaysOnTop(true);
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(adminoption.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(adminoption.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(adminoption.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(adminoption.class.getName()).log(
java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new adminoption().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
46. Mini Project Report 46 Government Polytechnic College Nedumangad
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
}
Bill.java
import java.awt.Color;
import javax.swing.JOptionPane;
import restuarant.dbm;
import java.sql.*;
import javax.swing.table.DefaultTableModel;
public class bill extends javax.swing.JFrame {
public static Connection con;
public static Statement s=null;
public static ResultSet rs;
String s1,s2,s3,s4,s5,s6,s7,s8,s9;
String p="Resturant Manegement System";
public bill() {
initComponents();
con=dbm.doconnect();
DefaultTableModel lm=(DefaultTableModel)jTable.getModel();
try
{
s=con.createStatement();
String sql="select * from temp;";
rs=s.executeQuery(sql);
while(rs.next())
{
p=rs.getString("nm");
}
jLabel10.setText(p);
jLabel10.updateUI();
}
catch(Exception e)
{
System.out.print(e);
}
try{
s=con.createStatement();
String qph=("select * from trans");
rs=s.executeQuery(qph);
while(rs.next())
{
s1=rs.getString("ID");
s3=rs.getString("mname");
s4=rs.getString("net");
s6=rs.getString("cust");
47. Mini Project Report 47 Government Polytechnic College Nedumangad
s7=rs.getString("total");
s9=rs.getString("dat");
}
jLabel2.setText(s6);
jLabel2.updateUI();
lm.addRow(new Object[]{s1,s3,s4,s7,s9});
}
catch(Exception l)
{
System.out.print(l);
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
try
Boolean complete=jTable.print();
if(complete)
{
JOptionPane.showMessageDialog(null,"Done Printing....");
}
else
{
JOptionPane.showMessageDialog(null,"Printing....");
}
}catch(Exception e){}
}
private void jLabel10MouseEntered(java.awt.event.MouseEvent evt)
{
jLabel10.setForeground(Color.RED);
jLabel10.updateUI();
}
private void jLabel10MouseExited(java.awt.event.MouseEvent evt)
{
jLabel10.setForeground(Color.BLACK);
jLabel10.updateUI();
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
48. Mini Project Report 48 Government Polytechnic College Nedumangad
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.ut
il.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new bill().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
public static javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
public javax.swing.JTable jTable;
void ser(String b1, String c1, String d1, String e1, String f1,
String op) {
DefaultTableModel lm=(DefaultTableModel)jTable.getModel();
lm.addRow(new Object[]{b1,c1,d1,e1,f1,op});
}
}
Delete User.java
import java.awt.Color;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import restuarant.dbm;
public class deleteuser extends javax.swing.JFrame {
public static Connection con;
public Statement s=null;
public ResultSet rs;
public static String f;
49. Mini Project Report 49 Government Polytechnic College Nedumangad
static void end(String gn) {
f=gn;
jTextField1.setText(f);
jTextField1.disable();
.
}
static void uss(String gn) {
f=gn;
jTextField1.setText(f);
jTextField1.disable();
gss();
}
public static void gss()
{
jTextField1.setText(f);
jTextField1.disable();
}
public deleteuser() {
initComponents();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {….}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
50. Mini Project Report 50 Government Polytechnic College Nedumangad
if("admin".equals(f))
{
jLabel3.setForeground(Color.red);
jLabel3.setText("Error Deleting Admin Account");
}
else
{
String sql= ("delete from login where UserName='"+f+"'
;");
s=con.createStatement();
System.out.println(s);
jLabel3.setForeground(Color.red);
s.executeUpdate(sql);
Usertable.refresh();
deleteuser.this.dispose();
}
}
catch (SQLException ex) {
}
jLabel3.setText("");
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(deleteuser.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(deleteuser.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(deleteuser.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(deleteuser.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
51. Mini Project Report 51 Government Polytechnic College Nedumangad
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new deleteuser().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
public static javax.swing.JTextField jTextField1;
}
Edit Employee.java
import java.awt.Color;
import java.sql.*;
import restuarant.dbm;
public class editemp extends javax.swing.JFrame {
static String sl;
int jj=0;
public static String h;
static void clore() {
}
static void clore(String g, String l, String m, String n, String
h) {
jTextField1.setText(g);
jTextField1.disable();
jTextField2.setText(l);
if("Cook".equals(n))
{
jComboBox1.setSelectedIndex(1);
}
if("Supplier".equals(n))
{
jComboBox1.setSelectedIndex(2);
}
if("Maneger".equals(n))
{
jComboBox1.setSelectedIndex(3);
} if("Security".equals(n))
{
jComboBox1.setSelectedIndex(4);
}
if("Cleaner".equals(n))
{
jComboBox1.setSelectedIndex(5);
}
52. Mini Project Report 52 Government Polytechnic College Nedumangad
jTextField4.setText(m);
jTextField5.setText(h);
}
String c,d,f,g;
public static Connection con;
public Statement s=null;
public ResultSet rs;
public editemp() {
initComponents();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void
jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
if(jj==0)
{
jComboBox1.removeItemAt(0);
jj++;
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
String a,b,c,d,e,f;
a=jTextField1.getText();
b=jTextField2.getText();
d=jComboBox1.getSelectedItem().toString();
e=jTextField5.getText();
f=jTextField4.getText();
if(jj==0)
{
}
53. Mini Project Report 53 Government Polytechnic College Nedumangad
else
{
try{
String sql=("update supplier set
Name='"+b+"',state='"+d+"',phone='"+f+"',salary='"+e+"' where
id='"+a+"';");
s=con.createStatement();
s.executeUpdate(sql);
System.out.println(s);
employeetable.refresh();
editemp.this.dispose();
}
catch (SQLException ex) {
System.out.print(ex);
javax.swing.JOptionPane.showMessageDialog(this,"Error
Updation.......!");
;}
}
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(editemp.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(editemp.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(editemp.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(editemp.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new editemp().setVisible(true);
}
54. Mini Project Report 54 Government Polytechnic College Nedumangad
});
}
private javax.swing.JButton jButton1;
private static javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private static javax.swing.JTextField jTextField1;
private static javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private static javax.swing.JTextField jTextField4;
private static javax.swing.JTextField jTextField5;
}
Edit Menu.java
import java.awt.Color;
import java.sql.*;
import restuarant.dbm;
public class editmenu extends javax.swing.JFrame {
static String sl;
public static String h;
String c,d,f,g;
public static Connection con;
public Statement s=null;
public ResultSet rs;
static void ser(String g,String l,String m,String n) {
sl=g;
jTextField1.setText(g);
jTextField1.disable();
jTextField2.setText(l);
jTextField3.setText(m);
jTextField4.setText(n);
}
public editmenu() {
initComponents();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
55. Mini Project Report 55 Government Polytechnic College Nedumangad
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {…}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
try
{
c=jTextField1.getText();
d=jTextField2.getText();
f=jTextField3.getText();
g=jTextField4.getText();
String sql=("update Menu set
Nam='"+d+"',Category='"+f+"',Price='"+g+"' where ID='"+c+"';");
s=con.createStatement();
jLabel.setForeground(Color.red);
jLabel1.setText("Updation Successfull");
s.executeUpdate(sql);
System.out.println(s);
Menu.refersh();
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
editmenu.this.dispose();
}
catch(Exception e)
{
}
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(editmenu.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
56. Mini Project Report 56 Government Polytechnic College Nedumangad
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(editmenu.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(editmenu.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(editmenu.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new editmenu().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel2;
public static javax.swing.JTextField jTextField1;
private static javax.swing.JTextField jTextField2;
private static javax.swing.JTextField jTextField3;
private static javax.swing.JTextField jTextField4;
}
Edit Name.java
import java.sql.*;
import restuarant.dbm;
public class editnam extends javax.swing.JFrame {
Statement s=null;
ResultSet rs;
Connection cn;
public editnam() {
initComponents();
cn=dbm.doconnect();
refresh();
}
public void refresh()
57. Mini Project Report 57 Government Polytechnic College Nedumangad
{
try{
String sql="Select distinct nm from temp";
s=cn.createStatement();
rs=s.executeQuery(sql);
while(rs.next())
{
String p= rs.getString("nm");
jComboBox1.addItem(p);
}
}
catch(Exception e)
{
System.out.print(e);
}
}
@SuppressWarnings("unchecked")
private void initComponents() {..}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
try{
s=cn.createStatement();
String k="Insert into temp (nm)
values('"+jComboBox1.getSelectedItem().toString()+"')";
s.executeUpdate(k);
refresh();
Mainwindow.sl();
editnam.this.dispose();
}
catch(Exception e)
{
System.out.print(e);
} }
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(editnam.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
58. Mini Project Report 58 Government Polytechnic College Nedumangad
java.util.logging.Logger.getLogger(editnam.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(editnam.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(editnam.class.getName()).log(java
.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new editnam().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
}
Edit User.java
import java.awt.Color;
import restuarant.dbm;
import java.sql.*;
public class edituser extends javax.swing.JFrame {
public static String h;
public String s1;
String c,d,f,g;
public static Connection con;
public Statement s=null;
public ResultSet rs;
public static void per(String gn) {
h=gn;
jTextField1.setText(h);
jTextField1.disable();
}
public edituser() {
initComponents();
jPasswordField1.disable();
jPasswordField1.updateUI();
jPasswordField2.disable();
jPasswordField2.updateUI();
jPasswordField1.disable();
jLabel3.disable();
jLabel5.disable();
59. Mini Project Report 59 Government Polytechnic College Nedumangad
jPasswordField1.updateUI();
jPasswordField2.disable();
jPasswordField2.updateUI();
jLabel3.updateUI();
jLabel5.updateUI();
con=dbm.doconnect();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
try{
String h=jTextField1.getText();
String sql=("select * from login where UserName='"+h+"';");
//System.out.println(s);
s=con.createStatement();
s.executeUpdate(sql);
while(rs.next())
{
s1=rs.getString("password");
}
}
catch(Exception e)
{
}
}
@SuppressWarnings("unchecked")
private void initComponents() {..}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
try {
c=jTextField1.getText();
d=jPasswordField1.getText();
f=jPasswordField2.getText();
if(jCheckBox1.isSelected())
{
g="y";
}
else
{
60. Mini Project Report 60 Government Polytechnic College Nedumangad
g="n";
}
if(jCheckBox2.isSelected())
{
if(d.equals(f))
{
String sql=("update login set
password='"+d+"',adm='"+g+"' where UserName='"+h+"';");
s=con.createStatement();
jLabel.setForeground(Color.red);
//jLabel1.setText("Updation Successfull");
s.executeUpdate(sql);
System.out.println(s);
jPasswordField1.setText("");
jPasswordField2.setText("");
Usertable.refresh();
edituser.this.dispose();
}
else{
javax.swing.JOptionPane.showMessageDialog(this,"Confirm
New Password");
jPasswordField2.setText("");
}
}else{
h=jTextField1.getText();
javax.swing.JOptionPane.showMessageDialog(this,"Admin
Option is Updated");
try{
s=con.createStatement();
String sqlk=("update login set adm='"+g+"' where
UserName='"+h+"';");
s.executeUpdate(sqlk);
System.out.println(s);
Usertable.refresh();
edituser.this.dispose();
}
catch(Exception e)
{
}
}
} catch (SQLException ex) {
System.out.print(ex);
}
}
private void jCheckBox2MouseClicked(java.awt.event.MouseEvent
evt) {
System.out.println("pppppppppp");
if(jCheckBox2.isSelected())
61. Mini Project Report 61 Government Polytechnic College Nedumangad
{
jPasswordField1.enable();
jPasswordField2.enable();
jLabel3.enable();
jLabel5.enable();
jPasswordField2.updateUI();
jPasswordField1.updateUI();
jLabel3.updateUI();
jLabel5.updateUI();
}
else
{
jPasswordField1.disable();
jLabel3.disable();
jLabel5.disable(); ;
jPasswordField1.updateUI();
jPasswordField2.disable();
jPasswordField2.updateUI();
jLabel3.updateUI();
jLabel5.updateUI();
}
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(edituser.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(edituser.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(edituser.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(edituser.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
62. Mini Project Report 62 Government Polytechnic College Nedumangad
public void run() {
new edituser().setVisible(true);
}
});
}
private javax.swing.JButton jButton2;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JLabel jLabel;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JPasswordField jPasswordField2;
public static javax.swing.JTextField jTextField1;
}
Employee Table.java
import java.sql.*;
import javax.swing.table.DefaultTableModel;
import restuarant.dbm;
public class employeetable extends javax.swing.JFrame {
public static Connection con;
public static Statement s=null;
public static ResultSet rs;
static String s1,s2,s3,s4,s5;
public employeetable() {
initComponents();
con=dbm.doconnect();
jButton1.setText("Load");
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
63. Mini Project Report 63 Government Polytechnic College Nedumangad
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
String qp=("select * from supplier");
try
{
s=con.createStatement();
jButton1.setText("ReLoad");
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Name");
s3=rs.getString("Phone");
s4=rs.getString("State");
s5=rs.getString("Salary");
m.addRow(new Object[]{s1,s2,s3,s4,s5});
}
}
catch(Exception e)
{
System.out.println("Error"+e.getMessage());
}
}
public static void refresh()
{
DefaultTableModel m=(DefaultTableModel)jTable2.getModel();
int rowCount = m.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
m.removeRow(i);
}
String qp=("select * from supplier");
try
{
s=con.createStatement();
jButton1.setText("ReLoad");
System.out.println(s);
System.out.println("Refreshed");
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Name");
s3=rs.getString("Phone");
s4=rs.getString("State");
s5=rs.getString("Salary");
m.addRow(new Object[]{s1,s2,s3,s4,s5});
}
}
catch(Exception e)
64. Mini Project Report 64 Government Polytechnic College Nedumangad
{
System.out.println("Error"+e.getMessage());
}
}
("unchecked")
private void initComponents() {..}
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt) {
String g=(jTable2.getValueAt(jTable2.getSelectedRow(),
0).toString());
String l=(jTable2.getValueAt(jTable2.getSelectedRow(),
1).toString());
String m=(jTable2.getValueAt(jTable2.getSelectedRow(),
2).toString());
String n=(jTable2.getValueAt(jTable2.getSelectedRow(),
3).toString());
String h=(jTable2.getValueAt(jTable2.getSelectedRow(),
4).toString());
editemp t=new editemp();
editemp.clore(g,l,m,n,h);
t.setVisible(true);
t.setAlwaysOnTop(true);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent
evt) {
addsupplier m=new addsupplier();
m.setAlwaysOnTop(true);
m.setVisible(true);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
refresh();
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
String g=(jTable2.getValueAt(jTable2.getSelectedRow(),
0).toString());
try
{
String sql=("delete from supplier where ID='"+g+"';");
s=con.createStatement();
s.executeUpdate(sql);
jButton1.setText("ReLoad");
System.out.println(s);
}
catch(Exception e)
{
}
65. Mini Project Report 65 Government Polytechnic College Nedumangad
refresh();
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(employeetable.class.getName()).lo
g(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(employeetable.class.getName()).lo
g(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(employeetable.class.getName()).lo
g(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(employeetable.class.getName()).lo
g(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new employeetable().setVisible(true);
}
});
}
public static javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
public static javax.swing.JTable jTable2;
}
Order.java
import java.awt.Color;
import java.sql.*;
import java.text.DateFormat;
import java.util.Date;
import java.text.DateFormat;
66. Mini Project Report 66 Government Polytechnic College Nedumangad
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.swing.table.DefaultTableModel;
import restuarant.dbm;
public class order extends javax.swing.JFrame {
public static Connection con;
public static Statement s=null;
public static ResultSet rs;
static String s1,s2,s3,s4,s5,k,stot,b1,c1,d1,e1,f1,op;
static String bill;
static void user(String user) {
bill=user;
userl.setText(user);
jLabel1.setText("Welcome " +bill+ " To Billing / Ordering") ; }
int sl,a=999;
int jj=0,tot;
public order() {
initComponents();
con=dbm.doconnect();
jTextField2.disable();
jTextField3.disable();
jTextField4.disable();
try
{
if(con!=null)
{
System.out.println("SUCCESS");
}
else
{
System.out.println("Failed To connect");
jLabel1.setText("Oops Some Thing Went Wrong")
;
}
}
catch(Exception e)
{
System.out.println("ERROR"+e.getMessage());
}
int sl=0;
DefaultTableModel m=(DefaultTableModel)jTable1.getModel();
String qp=("select * from menu");
try
{
s=con.createStatement();
//jButton1.setText("ReLoad");
67. Mini Project Report 67 Government Polytechnic College Nedumangad
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Nam");
s3=rs.getString("Category");
s4=rs.getString("Price");
m.addRow(new Object[]{s1,s2,s3,s4});
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went
Wrong") ;
System.out.println("Error"+e.getMessage());
}
DefaultTableModel
l=(DefaultTableModel)jTable2.getModel();
String qph=("select * from trans");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qph);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("mname");
s3=rs.getString("net");
s4=rs.getString("cust");
s5=rs.getString("total");
l.addRow(new Object[]{s1,s2,s3,s4,s5});
}
}
catch(Exception e)
{
System.out.println("Error"+e.getMessage());
}
String lp=("select * from trans");
try {
String slq=null;
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(lp);
while(rs.next())
68. Mini Project Report 68 Government Polytechnic College Nedumangad
{
slq=rs.getString("ID");
}
if(slq==null)
{//int rsp;
slq="999";
}
a=Integer.parseInt(slq);
a=a+1;
slq=Integer.toString(a);
jTextField1.setText(slq);
jTextField1.disable();
}
catch (SQLException ex) {
System.out.println(ex);
javax.swing.JOptionPane.showMessageDialog(this,ex);
}
}
public void refresh()
{
DefaultTableModel ma=(DefaultTableModel)jTable2.getModel();
int rowCount = ma.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
ma.removeRow(i);
}
String qph=("select * from trans");
try
{
s=con.createStatement();
//jButton1.setText("ReLoad");
System.out.println(s);
rs=s.executeQuery(qph);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("mname");
s3=rs.getString("net");
s4=rs.getString("cust");
s5=rs.getString("total");
ma.addRow(new Object[]{s1,s2,s3,s4,s5});
}
}
catch(Exception e)
{
69. Mini Project Report 69 Government Polytechnic College Nedumangad
jLabel1.setText("Oops Some Thing Went Wrong
While Loading Transaction Table") ;
System.out.println("Error"+e.getMessage());
}
DefaultTableModel lz=(DefaultTableModel)jTable1.getModel();
DefaultTableModel p=(DefaultTableModel)jTable2.getModel();
int rowCoun = lz.getRowCount();
for (int i = rowCoun - 1; i >= 0; i--) {
lz.removeRow(i);
}
String qp=("select * from menu");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qp);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("Nam");
s3=rs.getString("Category");
s4=rs.getString("Price");
//s5=rs.getString("Salary");
lz.addRow(new Object[]{s1,s2,s3,s4});
}
}
catch(Exception e)
{
jLabel1.setText("Oops Some Thing Went Wrong
While Loading Available Menu") ;
System.out.println("Error"+e.getMessage());
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {..}
private void jTable1MouseClicked(java.awt.event.MouseEvent evt)
{
String g=(jTable1.getValueAt(jTable1.getSelectedRow(),
0).toString());
jTextField2.setText(g);
String p=(jTable1.getValueAt(jTable1.getSelectedRow(),
1).toString());
jTextField3.setText(p);
70. Mini Project Report 70 Government Polytechnic College Nedumangad
k=(jTable1.getValueAt(jTable1.getSelectedRow(), 3).toString());
jTextField4.setText(k);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jComboBox1.repaint();
jTextField5.setText("");
jTextField6.setText("");
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
String slq;try{
jTextField1.updateUI();
String transid=jTextField1.getText();
String menuid=jTextField2.getText();
b1=menuid;
String name=jTextField3.getText();
c1=name;
String ppo=jTextField4.getText();
d1=ppo;
String net=jTextField6.getText();
e1=net;
String order=jComboBox1.getSelectedItem().toString();
String nam=jTextField5.getText();
int b=0,l;
String y;
b=Integer.parseInt(k);
y=jTextField6.getText();
l=Integer.parseInt(y);
tot=b*l;
stot=Integer.toString(tot);
f1=stot;
jLabel11.setForeground(Color.red);
jLabel11.setText(stot);
try
{DateFormat df = new SimpleDateFormat("dd/MM/yy");
Date dateobj = new Date();
System.out.println(df.format(dateobj));
String daw=df.format(dateobj);
op=daw;
System.out.println(daw);
String sql= ("INSERT INTO trans
(ID,menuid,mname,net,ordr,cust,total,billed,dat) VALUES
('"+transid+"',
'"+menuid+"','"+name+"','"+net+"','"+order+"','"+nam+"','"+tot+"','"
+bill+"','"+daw+"')");
s=con.createStatement();
71. Mini Project Report 71 Government Polytechnic College Nedumangad
System.out.println(s);
System.out.println("ppp");
s.executeUpdate(sql);
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jComboBox1.updateUI();
jTextField5.setText("");
jTextField6.setText("");
refresh();
}
catch(Exception e){}
}
catch(Exception n)
{jLabel1.setForeground(Color.red);
jLabel1.setText("Check Enterd Values");
}
String lp=("select * from trans");
try {
slq=null;
//String slq=null;
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(lp);
while(rs.next())
{
slq=rs.getString("ID");
}
if(slq==null)
{//int rsp;
slq="999";
}
a=Integer.parseInt(slq);
a=a+1;
slq=Integer.toString(a);
jTextField1.setText(slq);
jTextField1.updateUI();
jTextField1.disable();
}
catch (SQLException ex) {
System.out.println(ex);
javax.swing.JOptionPane.showMessageDialog(this,ex);
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
int b=0,l;
72. Mini Project Report 72 Government Polytechnic College Nedumangad
String y;
b=Integer.parseInt(k);
y=jTextField6.getText();
l=Integer.parseInt(y);
tot=b*l;
stot=Integer.toString(tot);
jLabel11.setForeground(Color.red);
jLabel11.setText(stot);
}
catch(Exception n)
{jLabel1.setForeground(Color.red);
jLabel1.setText("Check Enterd Values");
}
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)
{
refresh();
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt) {
bill m=new bill();
m.setVisible(true);
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(order.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(order.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(order.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
73. Mini Project Report 73 Government Polytechnic College Nedumangad
java.util.logging.Logger.getLogger(order.class.getName()).log(java.u
til.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new order().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel;
private static javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable jTable1;
public static javax.swing.JTable jTable2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private static javax.swing.JLabel userl;
}
View Transactions.java
import java.awt.Graphics;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
74. Mini Project Report 74 Government Polytechnic College Nedumangad
import restuarant.dbm;
public class transview extends javax.swing.JFrame {
public static Connection con;
public static Statement s=null;
public static ResultSet rs;
static String s1,s2,s3,s4,s5,k,stot,s6,s7,s8,s9;
static String bill,contro;
static int tot;
static void usr(String control) {
if("y".equals(control))
{
contro=control;
jButton2.enable();
}
if("n".equals(control))
{
jButton2.disable();
} }
public static void refresh()
{ con=dbm.doconnect();
tot=0;
DefaultTableModel lm=(DefaultTableModel)jTable1.getModel();
int rowCount = lm.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
lm.removeRow(i);
}
String qph=("select * from trans");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qph);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("menuid");
s3=rs.getString("mname");
s4=rs.getString("net");
s5=rs.getString("ordr");
s6=rs.getString("cust");
s7=rs.getString("total");
s8=rs.getString("billed");
s9=rs.getString("dat");
int p=Integer.parseInt(s7);
tot=tot+p;
String top=Integer.toString(tot);
jLabel3.setText(top);
75. Mini Project Report 75 Government Polytechnic College Nedumangad
lm.addRow(new
Object[]{s1,s2,s3,s4,s5,s6,s7,s8,s9});
}
}
catch(Exception e)
{
jLabel1.setText("Error While Reloading") ;
System.out.println("Error"+e.getMessage());
}
}
public static void fillcombo()
{
String qh=("select distinct dat from trans");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qh);
while(rs.next())
{
s9=rs.getString("dat");
jComboBox1.addItem(s9);
}
}
catch(Exception e)
{
jLabel1.setText("Error While Reloading") ;
System.out.println("Error"+e.getMessage());
}
}
public transview() {
initComponents();
if("y".equals(contro))
{
jButton2.enable();
}
if("n".equals(contro))
{
jButton2.disable();
}
jComboBox1.addItem("Show All");
fillcombo();
refresh();
}
@SuppressWarnings("unchecked")
76. Mini Project Report 76 Government Polytechnic College Nedumangad
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {..}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
refresh();
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
String qph=("delete from trans;");
try
{
s=con.createStatement();
System.out.println(s);
s.executeUpdate(qph);
refresh();System.out.println(s);
}
catch (Exception e)
{
jLabel1.setText("Error While Clearing History") ;
}
}
private void
jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
con=dbm.doconnect();
DefaultTableModel lm=(DefaultTableModel)jTable1.getModel();
int rowCount = lm.getRowCount();
for (int i = rowCount - 1; i >= 0; i--) {
lm.removeRow(i);
} String p=jComboBox1.getSelectedItem().toString();
int o=0;
tot=0;
if (p=="Show All")
{
String qph=("select * from trans;");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qph);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("menuid");
s3=rs.getString("mname");
s4=rs.getString("net");
s5=rs.getString("ordr");
s6=rs.getString("cust");
s7=rs.getString("total");
77. Mini Project Report 77 Government Polytechnic College Nedumangad
s8=rs.getString("billed");
s9=rs.getString("dat");
o=Integer.parseInt(s7);
tot=tot+o;
String top=Integer.toString(tot);
jLabel3.setText(top);
lm.addRow(new
Object[]{s1,s2,s3,s4,s5,s6,s7,s8,s9});
}
}
catch(Exception e)
{
jLabel1.setText("Error While Reloading") ;
System.out.println("Error"+e.getMessage());
}
}
else
{
String qph=("select * from trans where dat='"+p+"';");
try
{
s=con.createStatement();
System.out.println(s);
rs=s.executeQuery(qph);
while(rs.next())
{
s1=rs.getString("ID");
s2=rs.getString("menuid");
s3=rs.getString("mname");
s4=rs.getString("net");
s5=rs.getString("ordr");
s6=rs.getString("cust");
s7=rs.getString("total");
s8=rs.getString("billed");
s9=rs.getString("dat");
o=Integer.parseInt(s7);
tot=tot+o;
String top=Integer.toString(tot);
jLabel3.setText(top);
lm.addRow(new Object[]{s1,s2,s3,s4,s5,s6,s7,s8,s9});
}
}
catch(Exception e)
{
jLabel1.setText("Error While Reloading") ;
System.out.println("Error"+e.getMessage());
}
}
78. Mini Project Report 78 Government Polytechnic College Nedumangad
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt) {
try
{
Boolean complete=jTable1.print();
if(complete)
{
JOptionPane.showMessageDialog(null,"Done Printing....");
}
else
{
JOptionPane.showMessageDialog(null,"Printing....");
}
}catch(Exception e){}
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(transview.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(transview.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(transview.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(transview.class.getName()).log(ja
va.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new transview().setVisible(true);
}
79. Mini Project Report 79 Government Polytechnic College Nedumangad
});
}
private javax.swing.JButton jButton1;
public static javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private static javax.swing.JComboBox jComboBox1;
public static javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private static javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
public static javax.swing.JTable jTable1;
}
View User.java
public class viewuser extends javax.swing.JFrame {
static void per(String gn, String k) {
jLabel3.setText(gn);
jLabel5.setText(k);
}
public viewuser() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {..}
private void jButton1ActionPerformed(java.awt.event.ActionEvent
evt) {
viewuser.this.dispose();
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
80. Mini Project Report 80 Government Polytechnic College Nedumangad
break;
}
}
}
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new viewuser().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
public static javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
public static javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
DBM.java (Connection Class)
package restuarant;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
public class dbm {
public static Connection cn;
public static Connection doconnect()
{
cn=null;
try
{
Class.forName("com.mysql.jdbc.Driver");
cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/rest","r
oot","tiger");
System.out.print(cn);
}
catch(Exception
e){System.out.println("Error"+e.getMessage());
System.out.print(e);}
return cn;
}
}
81. Mini Project Report 81 Government Polytechnic College Nedumangad
Screen Shots
Program Initializing
Welcome Page
86. Mini Project Report 86 Government Polytechnic College Nedumangad
Print Bill
`
Print Bill (Print Dialog)
88. Mini Project Report 88 Government Polytechnic College Nedumangad
Edit Menu
View Transactions
89. Mini Project Report 89 Government Polytechnic College Nedumangad
Print History (Print Dialog)
Admin Options