尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
1
The Emerald Heights International School
SESSION 2019-2020
Subject: Informatics Practices
Project on: Mobile Shop
Submitted to: Submitted by:
Mr.AshirwadMahalkari Vidit Singh Rajput
XII ‘G’
2
CERTIFICATE
This is to certify that Vidit Singh Rajputof class XII ‘G’has successfully completed
a project titled “Mobile Shop” of the subject Informatics Practices in the academic
year 2019-20.
Project Incharge Principal
(Mr. Ashirwad Mahalkari) (Mr. Siddharth Singh)
External’s Signature
…………………………………..
3
Acknowledgement
I am extremely thankful to our President Mr. Muktesh Singh and our Principal Mr.
Siddharth Singh for providing me an opportunity to work on project titled
“Mobile Shop”and for giving me their blessings and encouragement.
It is a matter of pride and pleasure to express my warm gratitude to my teacher
Mr.Ashirwad Mahalkari and the computer staff for keen interest, unceasing
resistance and criticism at every stage of this project work.
I am also thankful to the C.B.S.E. for including the project work in the syllabus.
Ujhujhcujasdhcuabsxutquxcgbasioucg
Index
4
 Abstract
 Design-front end & back end
 Source code
 Conclusion
 Bibliography
ABSTRACT
MOBILE SHOP
Mobile shopping is a conceptwhich basically will deal with the sale of mobiles
specifically. It will allow customers to browse through mobile brands only and
then check the different type of mobile phones available in the market for a
specific brand. It will provide an authentic list of mobile brands in the market
5
and make sure reliability and deliverables are 100 percent guaranteed. We came
to this thought as when we go to online sale portals, they deal with a lot of
products and customers sometimes may feel it be too huge and confused with
mobile categories that are available. Hence we came up with Mobile Shopping.
The back end of project is MySQL database where all information related to the
categories, the items and the bill is saved that can be put to use at any time. The
project uses database connectivity where details of the Mobile Shop are stored.
The front end which is the user interface is the GUI form designed in NetBeans.
This is done with the help of various GUI controls such as JButton, JLabel,
JTextField, JTable, and JComboBox. Also pictures through labels are inserted
to add more creativity and pacify the interest of the users.It provides a complete
picture of an efficiently working restaurant billing system that can be
incorporated by many established and upcoming restaurants.
DESIGN
 We have used the JFrame form for showing various forms for the successful
completion of this project and form its core basis.
6
 We have used JButton control in forms to manipulate data and perform
specific action on the click of it.
 We have used JLabel, JTextArea and JTextField which facilitates the user to
see the description and panel control in our forms because it helps in moving
of control anywhere in the form for better designing.
 We have used JRadioButton and JComboBox controls for selecting one out
of few and one out of many respectively facilitating the provision of many
choices for the users.
 We have used JTable controlto showinformation in the form of a table which
serves advantageous for displaying menus and bills.
 We have used JMenuBar and JMenuItem controls to opena particular form to
connect all other forms with the parent form hence providing varied levels of
connectivity.
 try {}….. catch(){} statement :
1. It is used to handle errors and exceptions.
2. The code that we want to execute will be written in try{} block.
3. If any error comes in this codethe program execution will jump to catch
() {} block.
4. Syntax:
Try,
{
//statements
}
catch(Exception e)
{
//statements to execute when error comes
}
5. Exception Class: It is the class used to store errors and exceptions.
7
 e is its object used here for containing error information (if
any).
8
FRONT END
It is the user interface from where the data is collected .It has GUI elements allowing
application to collect data.
 Some Important Classes:-
 ConnectionClass:Its object is used to store connection information as what
database to connect with, username and password(the details of the local
host).
 StatementClass:It is used to execute SQL statements by creating its objects.
 ResultSetClass:Its object stores the result of a select command in the form
of a virtual table.
 Driver Manager Class: This class has to be referred so that we can use
getConnection() method.
 JOptionPane Class:It has inbuilt dialogue boxes which helps in taking input
and displaying output.
 Some Important Methods:-
 getConnection() : We have used this method to establish a connection
between NetBeans java and MySQL.
 executeQuery() : This method is used to fetch data from MySQL to java
using select query.
 executeUpdate(): This method is used when data is to be sent from java to
MySQL that is in case of update, insert and delete commands.
 getText():This method is used to read the text from a control. It always returns
a string type of value
 setText():This method is used to display the output in a control. This method
also gives output in string type of value.
9
 getString(): It is used to read value from a table using resultset object.
o Ex. String name =rs.getString(“name”);
 showInputDialoge():It is used to take input from user in the form ofdialogue
box. It always returns string type of value.
 showMessageDialoge():It is used to show output in the form of message
box. It always shows the result in string type of value.
10
Back End
It is the database where the data is actually stored .Data is mainly stored in DBMS
(MySQL).
Database name: RBill
This was created and used by the use of the following MySQL query –
create database rbill;
use rbill;
The database contains three tables which are as follows:
1. Table Categories:
This table contains the information about the available
categories in the restaurant along with the specific categoryID build to
develop a base for the various diversities the restaurant offers or would
provide in the future.
create table Categories
(
CategoryID int(3) primary key,
CategoryName varchar(30)
);
2. Table Items:
11
The table contains information regarding the names of various items under specific
categories stored with their price which is provided with enhanced featuring of
adding more items at any instant and easy search through items.
create table Items
(
ItemNo int(5) primary key,
Name varchar(50) not null,
Category varchar(50),
Price decimal(7,2) not null
);
3. Table Bill:
This table stores the information of how the bills will be
generated and manages the hectic procedures of manual billing through innovative
use of java and its connectivity with database.It will be very useful for the
adminstator and the customers too. It facilitates data handling.
create table Bill
(
Billid int(3) primary key auto_increment,
billno int(3) not null,
name varchar(50) not null,
DateofBill date,
item varchar(50),
12
qty int(3),
rate decimal(7,2) not null,
amount decimal(7,2) not null
);
13
Source Code
Coding for Parent Form
package Forms;
public class MainForm extends javax.swing.JFrame {
public MainForm()
{
initComponents();
}
 Coding for menuitem mnuItemShowCategories:
14
private void mnuItemShowCategoriesActionPerformed(java.awt.event.ActionEvent evt)
{
Categories frmCategories = new Categories();
frmCategories.setVisible(true);
}
 Coding for menuitem mnuItemShowItems:
private void mnuItemShowItemsActionPerformed(java.awt.event.ActionEvent evt)
{
Items frmItems=new Items();
frmItems.setVisible(true);
}
 Coding for menuitem mnuItemBill:
private void mnuItemBillActionPerformed(java.awt.event.ActionEvent evt)
{
Bill frmBill=new Bill();
frmBill.setVisible(true);
}
 Coding for menuitem mnuItemBillRecords:
private void mnuItemBillRecordsActionPerformed(java.awt.event.ActionEvent evt)
{
ShowAllBills frmRecords = new ShowAllBills();
frmRecords.setVisible(true);
}
15
 Coding for menuitem mnuItemSearchBill:
private void mnuItemSearchBillActionPerformed(java.awt.event.ActionEvent evt)
{
SearchBill frmSearch = new SearchBill();
frmSearch.setVisible(true);
}
 Coding for menuitem mnuItemExit:
private void mnuItemExit ActionPerformed(java.awt.event.ActionEvent evt)
{
System.exit(0);
}
Coding for categories Form
16
package Forms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
public class Categories extends javax.swing.JFrame
{
Connection con;
Statement stmt;
ResultSet rs;
public Categories()
{
initComponents();
try
{
String dbname = "jdbc:mysql://localhost:3306/rbill";
String unm = "root";
String pwd = "root";
con = DriverManager.getConnection(dbname, unm, pwd);
stmt = con.createStatement();
}
catch (Exception e)
{
17
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnLoad:
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String qry = "Select * from Categories categoryId";
rs = stmt.executeQuery(qry);
rs.first();
String CategoryID, Name;
CategoryID = rs.getString("CategoryID");
Name = rs.getString("CategoryName");
txtCatID.setText(CategoryID);
txtcategory.setText(Name);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnNext:
private void btnNextActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.next();
txtCatID.setText(rs.getString("CategoryID"));
txtcategory.setText(rs.getString("CategoryName"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
18
 Coding for button btnPrevious:
private void btnPreviousActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.previous();
txtCatID.setText(rs.getString("CategoryID"));
txtcategory.setText(rs.getString("CategoryName"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnFirst:
private void btnFirstActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.first();
txtCatID.setText(rs.getString("CategoryID"));
txtcategory.setText(rs.getString("CategoryName"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnLast:
private void btnLastActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.last();
txtCatID.setText(rs.getString("CategoryID"));
txtcategory.setText(rs.getString("CategoryName"));
}
19
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnNew:
private void btnNewActionPerformed(java.awt.event.ActionEvent evt)
{
try{
rs.last();
String index=rs.getString("CategoryID");
int i=Integer.parseInt(index);
i++;
txtCatID.setText(i+"");
txtcategory.setText("");
txtcategory.requestFocus();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,e);
}
}
 Coding for button btnUpdate:
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String qry,catid,category;
catid=txtCatID.getText();
category=txtcategory.getText();
qry="update categories set Categoryname='"+ category+"'where
categoryid='"+catid+"'";
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null, "Record Updated");
20
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnDelete:
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String Catid=txtCatID.getText();
String qry="delete from categories where CategoryID="+Catid;
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null,"Record deleted");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnPrevious:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String catid=txtCatID.getText();
String name=txtcategory.getText();
String qry="insert into categories values("+catid+",'"+name+"')";
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null,"Record Saved");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e.toString());
}
}
21
 Coding for button btnCancel:
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String CategoryID = rs.getString("CategoryID");
String Name = rs.getString("CategoryName");
txtCatID.setText(CategoryID);
txtcategory.setText(Name);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
Coding for items Form
22
package Forms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
public class Items extends javax.swing.JFrame
{
Connection con;
Statement stmt;
ResultSet rs;
public Items()
{
initComponents();
try
{
String dbname = "jdbc:mysql://localhost:3306/rbill";
String unm = "root";
String pwd = "root";
con = DriverManager.getConnection(dbname, unm, pwd);
stmt = con.createStatement();
String q = "select * from categories";
rs = stmt.executeQuery(q);
23
while (rs.next()) {
cmbCategory.addItem(rs.getString("categoryname"));
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnLoad:
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String qry="Select * from items";
rs=stmt.executeQuery(qry);
rs.first();
txtItemno.setText(rs.getString("Itemno"));
txtName.setText(rs.getString("name"));
txtPrice.setText(rs.getString("price"));
txtCategory.setText(rs.getString("category"));
}
catch(Exception e)
24
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnNext:
private void btnNextActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.next();
txtItemno.setText(rs.getString("Itemno"));
txtName.setText(rs.getString("name"));
txtPrice.setText(rs.getString("price"));
txtCategory.setText(rs.getString("category"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnLast:
private void btnLastActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
25
rs.last();
txtItemno.setText(rs.getString("Itemno"));
txtName.setText(rs.getString("name"));
txtPrice.setText(rs.getString("price"));
txtCategory.setText(rs.getString("category"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnFirst:
private void btnFirstActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.first();
txtItemno.setText(rs.getString("Itemno"));
txtName.setText(rs.getString("name"));
txtPrice.setText(rs.getString("price"));
txtCategory.setText(rs.getString("category"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
26
}
}
 Coding for button btnDelete:
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String itemno = txtItemno.getText();
String qry = "delete from items where itemno=" + itemno;
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null, "Record Deleted");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnCancel:
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
txtItemno.setText(rs.getString("Itemno"));
27
txtName.setText(rs.getString("name"));
txtPrice.setText(rs.getString("price"));
txtCategory.setText(rs.getString("category"));
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnNew:
private void btnNewActionPerformed(java.awt.event.ActionEvent evt)
{
txtItemno.setText("");
txtName.setText("");
txtCategory.setText("");
txtPrice.setText("");
}
 Coding for button btnUpdate:
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
String qry,itemno,category,name,price;
itemno = txtItemno.getText();
28
name = txtName.getText();
category = txtCategory.getText();
price = txtPrice.getText();
qry="update items set name='"+name+"',Category='"+ category+"',price="+price+"
where itemno="+itemno;
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null, "Record Updated");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for combobox cmbCategory:
private void cmbCategoryActionPerformed(java.awt.event.ActionEvent evt)
{
txtCategory.setText(cmbCategory.getSelectedItem().toString());
}
 Coding for button btnSave:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
{
try {
String itemno = txtItemno.getText();
String name = txtName.getText();
String category = txtCategory.getText();
29
String price = txtPrice.getText();
String qry = "insert into items values(" + itemno + ",'" + name + "','" + category + "'," +
price + ")";
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null, "Record Saved");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e.toString());
}
}
 Coding for button btnPrevious:
private void btnPreviousActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
rs.previous();
txtItemno.setText(rs.getString("Itemno"));
txtName.setText(rs.getString("name"));
txtPrice.setText(rs.getString("price"));
txtCategory.setText(rs.getString("category"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
30
}
}
Coding for Bill Form
package Forms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
31
public class Bill extends javax.swing.JFrame
{
Connection con;
Statement stmt;
ResultSet rs;
double totalAmount = 0;
public Bill()
{
initComponents();
try
{
String dbname = "jdbc:mysql://localhost:3306/rbill";
String unm = "root";
String pwd = "root";
con = DriverManager.getConnection(dbname, unm, pwd);
stmt = con.createStatement();
String qry = "Select curdate()";
rs = stmt.executeQuery(qry);
rs.first();
txtDate.setText(rs.getString("curdate()"));
String q2 = "Select * from items ";
rs = stmt.executeQuery(q2);
rs.first();
32
txtRate.setText(rs.getString("Price"));
String q = "select * from categories";
DefaultComboBoxModel model = new DefaultComboBoxModel();
cmbCategory.setModel(model);
Statement tempstmt = con.createStatement();
ResultSet tempRs = tempstmt.executeQuery(q);
while (tempRs.next())
{
model.addElement(tempRs.getString("categoryname"));
}
int bno = getLatestBillNo();
txtBillno.setText("" + bno);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
int getLatestBillNo()
{
int bno = 0;
try
{
Statement stmt = con.createStatement();
33
ResultSet rs;
String q = "select max(billno) from bill";
rs = stmt.executeQuery(q);
String testBno = "";
rs.first();
testBno = rs.getString("max(billno)");
if(testBno!=null)
{
bno = Integer.parseInt(rs.getString("max(billno)"));
bno++;
}
else
{
bno++;
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
return bno;
}
34
 Coding for combobox cmbItems:
private void cmbItemsActionPerformed(java.awt.event.ActionEvent evt) {
txtItem.setText(cmbItems.getSelectedItem().toString());
try
{
String a = txtItem.getText();
Statement tempstmt = con.createStatement();
String qry = " Select * from items where name = '" + a + "'";
ResultSet tempRs = tempstmt.executeQuery(qry);
tempRs.first();
txtRate.setText(tempRs.getString("Price"));
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for combobox cmbCategory:
private void cmbCategoryActionPerformed(java.awt.event.ActionEvent evt)
{
txtCategory.setText(cmbCategory.getSelectedItem().toString());
String a = txtCategory.getText();
35
try
{
Statement tempstmt = con.createStatement();
String query = "Select * from items where category = '" + a + "'";
ResultSet tempRs = tempstmt.executeQuery(query);
DefaultComboBoxModel model = new DefaultComboBoxModel();
cmbItems.setModel(model);
while (tempRs.next())
{
model.addElement(tempRs.getString("Name"));
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnCalculate:
private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt)
{
String s = txtQuantity.getText();
double r = Double.parseDouble(txtRate.getText());
int i = Integer.parseInt(s);
double a = i * r;
36
txtAmount.setText(a + "");
}
 Coding for button btnAddItem:
private void btnAddItemActionPerformed(java.awt.event.ActionEvent evt)
{
String iName, qty, rate, amount;
iName = txtItem.getText();
qty = txtQuantity.getText();
rate = txtRate.getText();
amount = txtAmount.getText();
DefaultTableModel model = (DefaultTableModel) tblBill.getModel();
tblBill.setModel(model);
model.addRow(new Object[]
{
iName, rate, qty, amount
});
totalAmount = totalAmount + Double.parseDouble(amount);
txtTotal.setText("" + totalAmount);
}
 Coding for button btnNew:
private void btnNewActionPerformed(java.awt.event.ActionEvent evt)
{
int bno = getLatestBillNo();
37
txtName.setText("");
txtCategory.setText("");
txtItem.setText("");
txtQuantity.setText("");
txtRate.setText("");
txtTotal.setText("");
txtAmount.setText("");
txtBillno.setText(bno + "");
DefaultTableModel model = (DefaultTableModel) tblBill.getModel();
model.setRowCount(0);
}
 Coding for button btnSave:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
int billno = Integer.parseInt(txtBillno.getText());
String name = txtName.getText();
String date = txtDate.getText();
int row = 0, column = 0;
for (row = 0; row < tblBill.getRowCount(); row++)
{
column = 0;
String item = tblBill.getValueAt(row, column).toString();
column++;
38
String rate = tblBill.getValueAt(row, column).toString();
column++;
String qty = tblBill.getValueAt(row, column).toString();
column++;
String amt = tblBill.getValueAt(row, column).toString();
String q = "insert into bill(billno,name,dateofbill,item,qty,rate,amount) values(" +
billno + ",'" + name + "','" + date + "','" + item + "'," + qty + "," + rate + "," + amt + ")";
stmt.executeUpdate(q);
}
JOptionPane.showMessageDialog(null, "The bill has been saved");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
btnNewActionPerformed(evt);
}
39
Coding for Show all bills Form
package Forms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class ShowAllBills extends javax.swing.JFrame
40
{
Connection con;
Statement stmt;
ResultSet rs;
double totalAmount = 0;
public ShowAllBills()
{
initComponents();
try
{
String dbname = "jdbc:mysql://localhost:3306/rbill";
String unm = "root";
String pwd = "root";
con = DriverManager.getConnection(dbname, unm, pwd);
stmt = con.createStatement();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnShowBill:
private void btnShowBillActionPerformed(java.awt.event.ActionEvent evt)
{
41
try
{
String qry = "Select billno,name,dateofbill,sum(amount) from bill group by billno";
rs=stmt.executeQuery(qry);
while(rs.next()){
String billno=rs.getString("billno");
String name=rs.getString("name");
String date=rs.getString("dateofbill");
String amount=rs.getString("sum(amount)");
DefaultTableModel model = (DefaultTableModel) tblShowBills.getModel();
tblShowBills.setModel(model);
model.addRow(new Object[]{billno, name, date, amount});
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
Coding for Search bill
42
package Forms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class SearchBill extends javax.swing.JFrame
{
Connection con;
Statement stmt;
ResultSet rs;
43
public SearchBill()
{ initComponents();
try
{ String dbname = "jdbc:mysql://localhost:3306/rbill";
String unm = "root";
String pwd = "root";
con = DriverManager.getConnection(dbname, unm, pwd);
stmt = con.createStatement();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
 Coding for button btnShowBill:
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt)
{
double totalAmount = 0;
try
{
int billno = Integer.parseInt(txtBillno.getText());
String q = "Select * from bill where billno = " + billno;
rs = stmt.executeQuery(q);
rs.first();
txtName.setText(rs.getString("name"));
txtDate.setText(rs.getString("dateofbill"));
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(q);
String iName, qty, rate, amount;
DefaultTableModel model = (DefaultTableModel) tblBill.getModel();
tblBill.setModel(model);
44
while (rs.next())
{
iName = rs.getString("item");
qty = rs.getString("qty");
rate = rs.getString("rate");
amount = rs.getString("amount");
model.addRow(new Object[]
{
iName, rate, qty, amount
});
totalAmount = totalAmount + Double.parseDouble(amount);
}
txtTotal.setText("" + totalAmount);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, e);
}
}
Conclusion
Presentscope:
The project “Restaurant Billing” will help in reducing human labour and efforts in
the efficient management of a restaurant.
It will increase the working efficiency and help in data handling.
Its main features are:
 Taking digital orders
 Printing bills
 Maintaining records
 Reduce human effort
 User friendly
Future scope:
45
In the future there lies scope of a more productive and coherent venture by
including more forms like PARCEL, which would help in making parcel facilities
easier in a restaurant. Concepts of HOME DELIVERY also would be incorporated.
As many restaurants have already adapted the idea of billing softwares, this project
also aims to make the billing and data handling in restaurants more manageable,
easier and user friendly.
Bibliography
The following sources were used as a reference for the successful
completion of the project not to forget the immense help provided by the
computer department.

More Related Content

Similar to Final report mobile shop

Automate 2
Automate 2Automate 2
Automate 2
Niharika Arora
 
Mark Jackson\'s Portfoilo
Mark Jackson\'s PortfoiloMark Jackson\'s Portfoilo
Mark Jackson\'s Portfoilo
Mark_Jackson
 
R Tanenbaum .Net Portfolio
R Tanenbaum .Net PortfolioR Tanenbaum .Net Portfolio
R Tanenbaum .Net Portfolio
Robert Tanenbaum
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
mwillmer
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
Heather Dionne
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
jaymaraltamera
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
JOSEPHINEA6
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
Divyam Pateriya
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc training
icubesystem
 
Jsf intro
Jsf introJsf intro
Jsf intro
vantinhkhuc
 
Asp.NET MVC
Asp.NET MVCAsp.NET MVC
Asp.NET MVC
vrluckyin
 
SQLite Database Tutorial In Android
SQLite Database Tutorial In AndroidSQLite Database Tutorial In Android
SQLite Database Tutorial In Android
Android 5
 
Synopsis
SynopsisSynopsis
Flutter-Dart project || Hotel Management System
Flutter-Dart project || Hotel Management SystemFlutter-Dart project || Hotel Management System
Flutter-Dart project || Hotel Management System
Jiangxi University of Science and Technology (江西理工大学)
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
Akhil Mittal
 
2nd--mac ver
2nd--mac ver2nd--mac ver
2nd--mac ver
Shafeer Khan
 
Mvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senjaMvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senja
alifha12
 
Il 09 T3 William Spreitzer
Il 09 T3 William SpreitzerIl 09 T3 William Spreitzer
Il 09 T3 William Spreitzer
wspreitzer
 
Fahri tugas cloud1
Fahri tugas cloud1Fahri tugas cloud1
Fahri tugas cloud1
FAHRIZAENURIPUTRA
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3
Mahmoud Ouf
 

Similar to Final report mobile shop (20)

Automate 2
Automate 2Automate 2
Automate 2
 
Mark Jackson\'s Portfoilo
Mark Jackson\'s PortfoiloMark Jackson\'s Portfoilo
Mark Jackson\'s Portfoilo
 
R Tanenbaum .Net Portfolio
R Tanenbaum .Net PortfolioR Tanenbaum .Net Portfolio
R Tanenbaum .Net Portfolio
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Vb6.0 intro
Vb6.0 introVb6.0 intro
Vb6.0 intro
 
Server side programming bt0083
Server side programming bt0083Server side programming bt0083
Server side programming bt0083
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc training
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Asp.NET MVC
Asp.NET MVCAsp.NET MVC
Asp.NET MVC
 
SQLite Database Tutorial In Android
SQLite Database Tutorial In AndroidSQLite Database Tutorial In Android
SQLite Database Tutorial In Android
 
Synopsis
SynopsisSynopsis
Synopsis
 
Flutter-Dart project || Hotel Management System
Flutter-Dart project || Hotel Management SystemFlutter-Dart project || Hotel Management System
Flutter-Dart project || Hotel Management System
 
Repository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity FrameworkRepository Pattern in MVC3 Application with Entity Framework
Repository Pattern in MVC3 Application with Entity Framework
 
2nd--mac ver
2nd--mac ver2nd--mac ver
2nd--mac ver
 
Mvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senjaMvc4 crud operations.-kemuning senja
Mvc4 crud operations.-kemuning senja
 
Il 09 T3 William Spreitzer
Il 09 T3 William SpreitzerIl 09 T3 William Spreitzer
Il 09 T3 William Spreitzer
 
Fahri tugas cloud1
Fahri tugas cloud1Fahri tugas cloud1
Fahri tugas cloud1
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3
 

Recently uploaded

Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
intra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_Enintra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_En
NTTDATA INTRAMART
 
Cyber Recovery Wargame
Cyber Recovery WargameCyber Recovery Wargame
Cyber Recovery Wargame
Databarracks
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB
 
So You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental DowntimeSo You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental Downtime
ScyllaDB
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
Cynthia Thomas
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
ScyllaDB
 
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
anilsa9823
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Facilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptxFacilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptx
Knoldus Inc.
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
manji sharman06
 
From NCSA to the National Research Platform
From NCSA to the National Research PlatformFrom NCSA to the National Research Platform
From NCSA to the National Research Platform
Larry Smarr
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
Neeraj Kumar Singh
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
UiPathCommunity
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time MLMongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
ScyllaDB
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
An Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise IntegrationAn Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise Integration
Safe Software
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 

Recently uploaded (20)

Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
intra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_Enintra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_En
 
Cyber Recovery Wargame
Cyber Recovery WargameCyber Recovery Wargame
Cyber Recovery Wargame
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
 
So You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental DowntimeSo You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental Downtime
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
 
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Facilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptxFacilitation Skills - When to Use and Why.pptx
Facilitation Skills - When to Use and Why.pptx
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
 
From NCSA to the National Research Platform
From NCSA to the National Research PlatformFrom NCSA to the National Research Platform
From NCSA to the National Research Platform
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time MLMongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
An Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise IntegrationAn Introduction to All Data Enterprise Integration
An Introduction to All Data Enterprise Integration
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 

Final report mobile shop

  • 1. 1 The Emerald Heights International School SESSION 2019-2020 Subject: Informatics Practices Project on: Mobile Shop Submitted to: Submitted by: Mr.AshirwadMahalkari Vidit Singh Rajput XII ‘G’
  • 2. 2 CERTIFICATE This is to certify that Vidit Singh Rajputof class XII ‘G’has successfully completed a project titled “Mobile Shop” of the subject Informatics Practices in the academic year 2019-20. Project Incharge Principal (Mr. Ashirwad Mahalkari) (Mr. Siddharth Singh) External’s Signature …………………………………..
  • 3. 3 Acknowledgement I am extremely thankful to our President Mr. Muktesh Singh and our Principal Mr. Siddharth Singh for providing me an opportunity to work on project titled “Mobile Shop”and for giving me their blessings and encouragement. It is a matter of pride and pleasure to express my warm gratitude to my teacher Mr.Ashirwad Mahalkari and the computer staff for keen interest, unceasing resistance and criticism at every stage of this project work. I am also thankful to the C.B.S.E. for including the project work in the syllabus. Ujhujhcujasdhcuabsxutquxcgbasioucg Index
  • 4. 4  Abstract  Design-front end & back end  Source code  Conclusion  Bibliography ABSTRACT MOBILE SHOP Mobile shopping is a conceptwhich basically will deal with the sale of mobiles specifically. It will allow customers to browse through mobile brands only and then check the different type of mobile phones available in the market for a specific brand. It will provide an authentic list of mobile brands in the market
  • 5. 5 and make sure reliability and deliverables are 100 percent guaranteed. We came to this thought as when we go to online sale portals, they deal with a lot of products and customers sometimes may feel it be too huge and confused with mobile categories that are available. Hence we came up with Mobile Shopping. The back end of project is MySQL database where all information related to the categories, the items and the bill is saved that can be put to use at any time. The project uses database connectivity where details of the Mobile Shop are stored. The front end which is the user interface is the GUI form designed in NetBeans. This is done with the help of various GUI controls such as JButton, JLabel, JTextField, JTable, and JComboBox. Also pictures through labels are inserted to add more creativity and pacify the interest of the users.It provides a complete picture of an efficiently working restaurant billing system that can be incorporated by many established and upcoming restaurants. DESIGN  We have used the JFrame form for showing various forms for the successful completion of this project and form its core basis.
  • 6. 6  We have used JButton control in forms to manipulate data and perform specific action on the click of it.  We have used JLabel, JTextArea and JTextField which facilitates the user to see the description and panel control in our forms because it helps in moving of control anywhere in the form for better designing.  We have used JRadioButton and JComboBox controls for selecting one out of few and one out of many respectively facilitating the provision of many choices for the users.  We have used JTable controlto showinformation in the form of a table which serves advantageous for displaying menus and bills.  We have used JMenuBar and JMenuItem controls to opena particular form to connect all other forms with the parent form hence providing varied levels of connectivity.  try {}….. catch(){} statement : 1. It is used to handle errors and exceptions. 2. The code that we want to execute will be written in try{} block. 3. If any error comes in this codethe program execution will jump to catch () {} block. 4. Syntax: Try, { //statements } catch(Exception e) { //statements to execute when error comes } 5. Exception Class: It is the class used to store errors and exceptions.
  • 7. 7  e is its object used here for containing error information (if any).
  • 8. 8 FRONT END It is the user interface from where the data is collected .It has GUI elements allowing application to collect data.  Some Important Classes:-  ConnectionClass:Its object is used to store connection information as what database to connect with, username and password(the details of the local host).  StatementClass:It is used to execute SQL statements by creating its objects.  ResultSetClass:Its object stores the result of a select command in the form of a virtual table.  Driver Manager Class: This class has to be referred so that we can use getConnection() method.  JOptionPane Class:It has inbuilt dialogue boxes which helps in taking input and displaying output.  Some Important Methods:-  getConnection() : We have used this method to establish a connection between NetBeans java and MySQL.  executeQuery() : This method is used to fetch data from MySQL to java using select query.  executeUpdate(): This method is used when data is to be sent from java to MySQL that is in case of update, insert and delete commands.  getText():This method is used to read the text from a control. It always returns a string type of value  setText():This method is used to display the output in a control. This method also gives output in string type of value.
  • 9. 9  getString(): It is used to read value from a table using resultset object. o Ex. String name =rs.getString(“name”);  showInputDialoge():It is used to take input from user in the form ofdialogue box. It always returns string type of value.  showMessageDialoge():It is used to show output in the form of message box. It always shows the result in string type of value.
  • 10. 10 Back End It is the database where the data is actually stored .Data is mainly stored in DBMS (MySQL). Database name: RBill This was created and used by the use of the following MySQL query – create database rbill; use rbill; The database contains three tables which are as follows: 1. Table Categories: This table contains the information about the available categories in the restaurant along with the specific categoryID build to develop a base for the various diversities the restaurant offers or would provide in the future. create table Categories ( CategoryID int(3) primary key, CategoryName varchar(30) ); 2. Table Items:
  • 11. 11 The table contains information regarding the names of various items under specific categories stored with their price which is provided with enhanced featuring of adding more items at any instant and easy search through items. create table Items ( ItemNo int(5) primary key, Name varchar(50) not null, Category varchar(50), Price decimal(7,2) not null ); 3. Table Bill: This table stores the information of how the bills will be generated and manages the hectic procedures of manual billing through innovative use of java and its connectivity with database.It will be very useful for the adminstator and the customers too. It facilitates data handling. create table Bill ( Billid int(3) primary key auto_increment, billno int(3) not null, name varchar(50) not null, DateofBill date, item varchar(50),
  • 12. 12 qty int(3), rate decimal(7,2) not null, amount decimal(7,2) not null );
  • 13. 13 Source Code Coding for Parent Form package Forms; public class MainForm extends javax.swing.JFrame { public MainForm() { initComponents(); }  Coding for menuitem mnuItemShowCategories:
  • 14. 14 private void mnuItemShowCategoriesActionPerformed(java.awt.event.ActionEvent evt) { Categories frmCategories = new Categories(); frmCategories.setVisible(true); }  Coding for menuitem mnuItemShowItems: private void mnuItemShowItemsActionPerformed(java.awt.event.ActionEvent evt) { Items frmItems=new Items(); frmItems.setVisible(true); }  Coding for menuitem mnuItemBill: private void mnuItemBillActionPerformed(java.awt.event.ActionEvent evt) { Bill frmBill=new Bill(); frmBill.setVisible(true); }  Coding for menuitem mnuItemBillRecords: private void mnuItemBillRecordsActionPerformed(java.awt.event.ActionEvent evt) { ShowAllBills frmRecords = new ShowAllBills(); frmRecords.setVisible(true); }
  • 15. 15  Coding for menuitem mnuItemSearchBill: private void mnuItemSearchBillActionPerformed(java.awt.event.ActionEvent evt) { SearchBill frmSearch = new SearchBill(); frmSearch.setVisible(true); }  Coding for menuitem mnuItemExit: private void mnuItemExit ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } Coding for categories Form
  • 16. 16 package Forms; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; public class Categories extends javax.swing.JFrame { Connection con; Statement stmt; ResultSet rs; public Categories() { initComponents(); try { String dbname = "jdbc:mysql://localhost:3306/rbill"; String unm = "root"; String pwd = "root"; con = DriverManager.getConnection(dbname, unm, pwd); stmt = con.createStatement(); } catch (Exception e) {
  • 17. 17 JOptionPane.showMessageDialog(null, e); } }  Coding for button btnLoad: private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) { try { String qry = "Select * from Categories categoryId"; rs = stmt.executeQuery(qry); rs.first(); String CategoryID, Name; CategoryID = rs.getString("CategoryID"); Name = rs.getString("CategoryName"); txtCatID.setText(CategoryID); txtcategory.setText(Name); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnNext: private void btnNextActionPerformed(java.awt.event.ActionEvent evt) { try { rs.next(); txtCatID.setText(rs.getString("CategoryID")); txtcategory.setText(rs.getString("CategoryName")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
  • 18. 18  Coding for button btnPrevious: private void btnPreviousActionPerformed(java.awt.event.ActionEvent evt) { try { rs.previous(); txtCatID.setText(rs.getString("CategoryID")); txtcategory.setText(rs.getString("CategoryName")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnFirst: private void btnFirstActionPerformed(java.awt.event.ActionEvent evt) { try { rs.first(); txtCatID.setText(rs.getString("CategoryID")); txtcategory.setText(rs.getString("CategoryName")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnLast: private void btnLastActionPerformed(java.awt.event.ActionEvent evt) { try { rs.last(); txtCatID.setText(rs.getString("CategoryID")); txtcategory.setText(rs.getString("CategoryName")); }
  • 19. 19 catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnNew: private void btnNewActionPerformed(java.awt.event.ActionEvent evt) { try{ rs.last(); String index=rs.getString("CategoryID"); int i=Integer.parseInt(index); i++; txtCatID.setText(i+""); txtcategory.setText(""); txtcategory.requestFocus(); } catch(Exception e) { JOptionPane.showMessageDialog(null,e); } }  Coding for button btnUpdate: private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { try { String qry,catid,category; catid=txtCatID.getText(); category=txtcategory.getText(); qry="update categories set Categoryname='"+ category+"'where categoryid='"+catid+"'"; stmt.executeUpdate(qry); JOptionPane.showMessageDialog(null, "Record Updated");
  • 20. 20 } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnDelete: private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) { try { String Catid=txtCatID.getText(); String qry="delete from categories where CategoryID="+Catid; stmt.executeUpdate(qry); JOptionPane.showMessageDialog(null,"Record deleted"); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnPrevious: private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try { String catid=txtCatID.getText(); String name=txtcategory.getText(); String qry="insert into categories values("+catid+",'"+name+"')"; stmt.executeUpdate(qry); JOptionPane.showMessageDialog(null,"Record Saved"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.toString()); } }
  • 21. 21  Coding for button btnCancel: private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { try { String CategoryID = rs.getString("CategoryID"); String Name = rs.getString("CategoryName"); txtCatID.setText(CategoryID); txtcategory.setText(Name); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } Coding for items Form
  • 22. 22 package Forms; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; public class Items extends javax.swing.JFrame { Connection con; Statement stmt; ResultSet rs; public Items() { initComponents(); try { String dbname = "jdbc:mysql://localhost:3306/rbill"; String unm = "root"; String pwd = "root"; con = DriverManager.getConnection(dbname, unm, pwd); stmt = con.createStatement(); String q = "select * from categories"; rs = stmt.executeQuery(q);
  • 23. 23 while (rs.next()) { cmbCategory.addItem(rs.getString("categoryname")); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnLoad: private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) { try { String qry="Select * from items"; rs=stmt.executeQuery(qry); rs.first(); txtItemno.setText(rs.getString("Itemno")); txtName.setText(rs.getString("name")); txtPrice.setText(rs.getString("price")); txtCategory.setText(rs.getString("category")); } catch(Exception e)
  • 24. 24 { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnNext: private void btnNextActionPerformed(java.awt.event.ActionEvent evt) { try { rs.next(); txtItemno.setText(rs.getString("Itemno")); txtName.setText(rs.getString("name")); txtPrice.setText(rs.getString("price")); txtCategory.setText(rs.getString("category")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnLast: private void btnLastActionPerformed(java.awt.event.ActionEvent evt) { try {
  • 25. 25 rs.last(); txtItemno.setText(rs.getString("Itemno")); txtName.setText(rs.getString("name")); txtPrice.setText(rs.getString("price")); txtCategory.setText(rs.getString("category")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnFirst: private void btnFirstActionPerformed(java.awt.event.ActionEvent evt) { try { rs.first(); txtItemno.setText(rs.getString("Itemno")); txtName.setText(rs.getString("name")); txtPrice.setText(rs.getString("price")); txtCategory.setText(rs.getString("category")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e);
  • 26. 26 } }  Coding for button btnDelete: private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) { try { String itemno = txtItemno.getText(); String qry = "delete from items where itemno=" + itemno; stmt.executeUpdate(qry); JOptionPane.showMessageDialog(null, "Record Deleted"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnCancel: private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { try { txtItemno.setText(rs.getString("Itemno"));
  • 27. 27 txtName.setText(rs.getString("name")); txtPrice.setText(rs.getString("price")); txtCategory.setText(rs.getString("category")); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnNew: private void btnNewActionPerformed(java.awt.event.ActionEvent evt) { txtItemno.setText(""); txtName.setText(""); txtCategory.setText(""); txtPrice.setText(""); }  Coding for button btnUpdate: private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { try { String qry,itemno,category,name,price; itemno = txtItemno.getText();
  • 28. 28 name = txtName.getText(); category = txtCategory.getText(); price = txtPrice.getText(); qry="update items set name='"+name+"',Category='"+ category+"',price="+price+" where itemno="+itemno; stmt.executeUpdate(qry); JOptionPane.showMessageDialog(null, "Record Updated"); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for combobox cmbCategory: private void cmbCategoryActionPerformed(java.awt.event.ActionEvent evt) { txtCategory.setText(cmbCategory.getSelectedItem().toString()); }  Coding for button btnSave: private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try { String itemno = txtItemno.getText(); String name = txtName.getText(); String category = txtCategory.getText();
  • 29. 29 String price = txtPrice.getText(); String qry = "insert into items values(" + itemno + ",'" + name + "','" + category + "'," + price + ")"; stmt.executeUpdate(qry); JOptionPane.showMessageDialog(null, "Record Saved"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.toString()); } }  Coding for button btnPrevious: private void btnPreviousActionPerformed(java.awt.event.ActionEvent evt) { try { rs.previous(); txtItemno.setText(rs.getString("Itemno")); txtName.setText(rs.getString("name")); txtPrice.setText(rs.getString("price")); txtCategory.setText(rs.getString("category")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e);
  • 30. 30 } } Coding for Bill Form package Forms; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.DefaultComboBoxModel; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel;
  • 31. 31 public class Bill extends javax.swing.JFrame { Connection con; Statement stmt; ResultSet rs; double totalAmount = 0; public Bill() { initComponents(); try { String dbname = "jdbc:mysql://localhost:3306/rbill"; String unm = "root"; String pwd = "root"; con = DriverManager.getConnection(dbname, unm, pwd); stmt = con.createStatement(); String qry = "Select curdate()"; rs = stmt.executeQuery(qry); rs.first(); txtDate.setText(rs.getString("curdate()")); String q2 = "Select * from items "; rs = stmt.executeQuery(q2); rs.first();
  • 32. 32 txtRate.setText(rs.getString("Price")); String q = "select * from categories"; DefaultComboBoxModel model = new DefaultComboBoxModel(); cmbCategory.setModel(model); Statement tempstmt = con.createStatement(); ResultSet tempRs = tempstmt.executeQuery(q); while (tempRs.next()) { model.addElement(tempRs.getString("categoryname")); } int bno = getLatestBillNo(); txtBillno.setText("" + bno); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } int getLatestBillNo() { int bno = 0; try { Statement stmt = con.createStatement();
  • 33. 33 ResultSet rs; String q = "select max(billno) from bill"; rs = stmt.executeQuery(q); String testBno = ""; rs.first(); testBno = rs.getString("max(billno)"); if(testBno!=null) { bno = Integer.parseInt(rs.getString("max(billno)")); bno++; } else { bno++; } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } return bno; }
  • 34. 34  Coding for combobox cmbItems: private void cmbItemsActionPerformed(java.awt.event.ActionEvent evt) { txtItem.setText(cmbItems.getSelectedItem().toString()); try { String a = txtItem.getText(); Statement tempstmt = con.createStatement(); String qry = " Select * from items where name = '" + a + "'"; ResultSet tempRs = tempstmt.executeQuery(qry); tempRs.first(); txtRate.setText(tempRs.getString("Price")); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for combobox cmbCategory: private void cmbCategoryActionPerformed(java.awt.event.ActionEvent evt) { txtCategory.setText(cmbCategory.getSelectedItem().toString()); String a = txtCategory.getText();
  • 35. 35 try { Statement tempstmt = con.createStatement(); String query = "Select * from items where category = '" + a + "'"; ResultSet tempRs = tempstmt.executeQuery(query); DefaultComboBoxModel model = new DefaultComboBoxModel(); cmbItems.setModel(model); while (tempRs.next()) { model.addElement(tempRs.getString("Name")); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnCalculate: private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) { String s = txtQuantity.getText(); double r = Double.parseDouble(txtRate.getText()); int i = Integer.parseInt(s); double a = i * r;
  • 36. 36 txtAmount.setText(a + ""); }  Coding for button btnAddItem: private void btnAddItemActionPerformed(java.awt.event.ActionEvent evt) { String iName, qty, rate, amount; iName = txtItem.getText(); qty = txtQuantity.getText(); rate = txtRate.getText(); amount = txtAmount.getText(); DefaultTableModel model = (DefaultTableModel) tblBill.getModel(); tblBill.setModel(model); model.addRow(new Object[] { iName, rate, qty, amount }); totalAmount = totalAmount + Double.parseDouble(amount); txtTotal.setText("" + totalAmount); }  Coding for button btnNew: private void btnNewActionPerformed(java.awt.event.ActionEvent evt) { int bno = getLatestBillNo();
  • 37. 37 txtName.setText(""); txtCategory.setText(""); txtItem.setText(""); txtQuantity.setText(""); txtRate.setText(""); txtTotal.setText(""); txtAmount.setText(""); txtBillno.setText(bno + ""); DefaultTableModel model = (DefaultTableModel) tblBill.getModel(); model.setRowCount(0); }  Coding for button btnSave: private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) { try { int billno = Integer.parseInt(txtBillno.getText()); String name = txtName.getText(); String date = txtDate.getText(); int row = 0, column = 0; for (row = 0; row < tblBill.getRowCount(); row++) { column = 0; String item = tblBill.getValueAt(row, column).toString(); column++;
  • 38. 38 String rate = tblBill.getValueAt(row, column).toString(); column++; String qty = tblBill.getValueAt(row, column).toString(); column++; String amt = tblBill.getValueAt(row, column).toString(); String q = "insert into bill(billno,name,dateofbill,item,qty,rate,amount) values(" + billno + ",'" + name + "','" + date + "','" + item + "'," + qty + "," + rate + "," + amt + ")"; stmt.executeUpdate(q); } JOptionPane.showMessageDialog(null, "The bill has been saved"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } btnNewActionPerformed(evt); }
  • 39. 39 Coding for Show all bills Form package Forms; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; public class ShowAllBills extends javax.swing.JFrame
  • 40. 40 { Connection con; Statement stmt; ResultSet rs; double totalAmount = 0; public ShowAllBills() { initComponents(); try { String dbname = "jdbc:mysql://localhost:3306/rbill"; String unm = "root"; String pwd = "root"; con = DriverManager.getConnection(dbname, unm, pwd); stmt = con.createStatement(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnShowBill: private void btnShowBillActionPerformed(java.awt.event.ActionEvent evt) {
  • 41. 41 try { String qry = "Select billno,name,dateofbill,sum(amount) from bill group by billno"; rs=stmt.executeQuery(qry); while(rs.next()){ String billno=rs.getString("billno"); String name=rs.getString("name"); String date=rs.getString("dateofbill"); String amount=rs.getString("sum(amount)"); DefaultTableModel model = (DefaultTableModel) tblShowBills.getModel(); tblShowBills.setModel(model); model.addRow(new Object[]{billno, name, date, amount}); } } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } } Coding for Search bill
  • 42. 42 package Forms; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; public class SearchBill extends javax.swing.JFrame { Connection con; Statement stmt; ResultSet rs;
  • 43. 43 public SearchBill() { initComponents(); try { String dbname = "jdbc:mysql://localhost:3306/rbill"; String unm = "root"; String pwd = "root"; con = DriverManager.getConnection(dbname, unm, pwd); stmt = con.createStatement(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }  Coding for button btnShowBill: private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) { double totalAmount = 0; try { int billno = Integer.parseInt(txtBillno.getText()); String q = "Select * from bill where billno = " + billno; rs = stmt.executeQuery(q); rs.first(); txtName.setText(rs.getString("name")); txtDate.setText(rs.getString("dateofbill")); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(q); String iName, qty, rate, amount; DefaultTableModel model = (DefaultTableModel) tblBill.getModel(); tblBill.setModel(model);
  • 44. 44 while (rs.next()) { iName = rs.getString("item"); qty = rs.getString("qty"); rate = rs.getString("rate"); amount = rs.getString("amount"); model.addRow(new Object[] { iName, rate, qty, amount }); totalAmount = totalAmount + Double.parseDouble(amount); } txtTotal.setText("" + totalAmount); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } Conclusion Presentscope: The project “Restaurant Billing” will help in reducing human labour and efforts in the efficient management of a restaurant. It will increase the working efficiency and help in data handling. Its main features are:  Taking digital orders  Printing bills  Maintaining records  Reduce human effort  User friendly Future scope:
  • 45. 45 In the future there lies scope of a more productive and coherent venture by including more forms like PARCEL, which would help in making parcel facilities easier in a restaurant. Concepts of HOME DELIVERY also would be incorporated. As many restaurants have already adapted the idea of billing softwares, this project also aims to make the billing and data handling in restaurants more manageable, easier and user friendly. Bibliography The following sources were used as a reference for the successful completion of the project not to forget the immense help provided by the computer department.
  翻译: