ABSTRACT
ACKNOWLEDGEMENT
I express my sincere thanks to Mr. Khalid K. A,
respected Principal of JDT Islam Polytechnic & Mr. Manuel
George, Head of Computer Department for giving
permission to conduct the project and giving lot of
encouragement.
It is very pleasure to extend the deep gratitude to our
internal project guides Mr. Muhammad Akbar M and Mrs.
Remya M K, who gives their valuable guidance and support
to continuously promote us for the progress of the project.
I am thankful to each and every friend of mine and the
faculty members in Computer department who helped me
directly or indirectly. At last, but not the least I would like to
express my thanks to omnipotent God give the strength to
conduct the project.
CONTENTS
1. INTRODUCTION
2. SYSTEM ANALYSIS
2.1
Existing System
2.2
Proposed System
2.3
Feasibility Study
2.3.1 Technical feasibility
2.3.2 Operational Feasibility
2.3.3 Economic Feasibility
3. SYSTEM DEVELOPMENT
3.1 Hardware Specification
3.2 Software Specification
3.3 System Study
4. SYSTEM DESIGN
4.1 Design Development Process
4.2 Data Base Design
5. TESTING
5.1 Testing Methodology
6. FORMS USED
7. PROJECT CODES
8. CONCLUSION
9. REFERENCE
INTRODUCTION
This project help the hotels to simplify the job of
Receptionist.
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
SYSTEM ANALYSIS
2.1
Existing System
2.2
Proposed System
2.3
Feasibility Study
2.3.2
Operational Feasibility:
2.3.3
Economic Feasibility:
SYSTEM DEVELOPMENT
3.1
Hardware Specification
Processor
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
Hard disk
: 40 GB
RAM
: 512 MB
3.2
Software Specification
Platform
: Windows XP
Language used
: JAVA
Editor
3.3
: NetBeans
System Study
* NetBeans Overview
NetBeans is an integrated development environment (IDE)
for developing primarily with java. NetBeans IDE is written in
Java and can run on Windows, OS X, Linux, Solaris and other
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
SYSTEM DESIGN
4.1
Database
Design
10
Table Bill
11
TESTING
Testing is the process of creating a program with the
explicit intention of finding error that is making the program
fail. Successful test then, is one that finds and as yet
undiscovered error. As an additional benefit, Testing
demonstrates that software functions appear to be working
to the specifications.
Testing has several purpose
* To affirm the quality of project.
* To find and eliminate any errors from previous stage.
* To
validate the software and to eliminate the
operational reliability of the system.
5.1
Testing Methodology
12
- Unit Testing
In this phase the program modules is individually tested.
During the unit testing the functions of the program unit
validation and the limitations are tested.
- Integration Testing
Integration testing is the complete testing of the set of
modules which makes up the product. It is a systematic
technique for the construction of program structure.
13
FORMS USED
Login page
Home page
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
14
New Entry
15
Search Result
Extra Bill
16
Bill Preview
Daily Report
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
17
Admin
Create New User
18
Update Rent
Monthly Report
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
19
20
PROJECT CODES
Login Page
package forms;
21
import
import
import
import
import
dbconnection.LoadData;
java.sql.*;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.JOptionPane;
22
23
Home Page
package forms;
import
import
import
import
import
import
import
import
import
import
dbconnection.LoadData;
java.sql.Connection;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.text.SimpleDateFormat;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.DefaultListModel;
javax.swing.JOptionPane;
javax.swing.table.DefaultTableModel;
24
Logger.getLogger(FrmHome.class.getName()).log(Level.SE
VERE, null, ex);
}
};
private
void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
FrmNewEntry fne=new FrmNewEntry();
this.dispose();
fne.show();
LoadData.check=0;
}
private
void
jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
FrmReport fr=new FrmReport();
this.dispose();
fr.show();
}
private
void
jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
FrmAdmin fa=new FrmAdmin();
this.dispose();
fa.show();
}
private
void
btnSrchByNoActionPerformed(java.awt.event.ActionEvent evt) {
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sql="select * from tblvisitorentry where slno=?";
PreparedStatement ps=cnn.prepareStatement(sql);
ps.setInt(1, Integer.parseInt(txtSrchByNo.getText()));
ResultSet rs = ps.executeQuery();
if(rs.next())
{
LoadData.slno=rs.getInt("slno");
LoadData.name=rs.getString("name");
LoadData.addr=rs.getString("address");
LoadData.from=rs.getString("comming_from");
LoadData.rno=rs.getString("room_no");
LoadData.adnvc=rs.getInt("advance");
LoadData.rtype=rs.getString("room_type");
LoadData.d=rs.getDate("date_checkin");
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
25
void
if(evt.getKeyCode()==40)
{
lstLiveName.requestFocus();
lstLiveName.setSelectedIndex(0);
}
else
{
String s=txtSrchByName.getText()+evt.getKeyChar();
Connection
cnn=dbconnection.DBConnection.getConnection();
String sql="Select name from tblvisitorentry where name
like ?";
PreparedStatement ps= cnn.prepareStatement(sql);
ps.setString(1, s+"%");
ResultSet rs=ps.executeQuery();
DefaultListModel
ls=(DefaultListModel)lstLiveName.getModel();
ls.removeAllElements();
while(rs.next())
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
26
{
ls.addElement(rs.getString(1));
}
lstLiveName.setVisible(true);
}
if(evt.getKeyCode()==10)
{
btnSrchByName.doClick();
}
} catch (Exception ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.
SEVERE, null, ex);
}
}
private
void
btnSrchByNameActionPerformed(java.awt.event.ActionEvent evt)
{
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sql="select * from tblvisitorentry where name=?";
PreparedStatement ps=cnn.prepareStatement(sql);
ps.setString(1, txtSrchByName.getText());
ResultSet rs = ps.executeQuery();
if(rs.next())
{
LoadData.slno=rs.getInt("slno");
LoadData.name=rs.getString("name");
LoadData.addr=rs.getString("address");
LoadData.from=rs.getString("comming_from");
LoadData.rno=rs.getString("room_no");
LoadData.adnvc=rs.getInt("advance");
LoadData.rtype=rs.getString("room_type");
LoadData.d=rs.getDate("date_checkin");
FrmSearch f=new FrmSearch();
this.dispose();
f.show();
}
else
{
}
} catch (Exception ex) {
Logger.getLogger(FrmHome.class.getName()).log(Level.SE
VERE, null, ex);
}
}
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
27
New entry
package forms;
import
import
import
import
import
import
import
import
dbconnection.LoadData;
java.awt.Color;
java.sql.*;
java.text.SimpleDateFormat;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.DefaultComboBoxModel;
javax.swing.JOptionPane;
cnn
28
PreparedStatement ps=cnn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
if(rs.next())
{
rs.last();
lblSLno.setText(rs.getInt("slno")+1+"");
}
String sqlshow="select room_type from tblroomtype";
PreparedStatement
pss=cnn.prepareStatement(sqlshow);
ResultSet rss = pss.executeQuery();
DefaultComboBoxModel
c=(DefaultComboBoxModel)cmbRT.getModel();
c.removeAllElements();
while(rss.next())
{
c.addElement(rss.getString("room_type"));
}
29
if(rs3.next())
{
lblSLno.setText(LoadData.sslno);
txtName.setText(rs2.getString("name"));
textAddress.setText(rs2.getString("address"));
txtPin.setText(rs2.getString("pin"));
txtComFrom.setText(rs2.getString("comming_from"));
textPOV.setText(rs2.getString("purpose_of_visit"));
spnrDurtn.setValue(rs2.getInt("duration"));
spnrNOP.setValue(rs2.getInt("no_of_persons"));
cmbRT.setSelectedItem(rs2.getString("room_type").to
String());
cmbrno.setSelectedItem(rs2.getString("room_no").to
String());
cmbIDP.setSelectedItem(rs2.getString("id_proof").toS
tring());
txtIDno.setText(rs2.getString("id_no"));
txtAdvnc.setText(rs2.getString("advance"));
lblBlnc.setText(rs2.getString("balance"));
lblDateDisp.setText(rs2.getString("date_checkin"));
}
}
} catch (Exception ex) {
Logger.getLogger(FrmNewEntry.class.getName()).log(Le
vel.SEVERE, null, ex);
}
}
private
void
btnChkCanActionPerformed(java.awt.event.ActionEvent evt) {
FrmHome fh = new FrmHome();
this.dispose();
fh.show();
}
private
void
btnCheckInActionPerformed(java.awt.event.ActionEvent evt) {
String status="Checked IN";
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
if(txtName.getText().equals("")||
textAddress.getText().equals("")||txtPin.getText().equals("")||
txtComFrom.getText().equals("")||textPOV.getText().equals("")||
txtIDno.getText().equals(""))
{
JOptionPane.showMessageDialog(this, "Plese Fill all
Fields...");
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
30
}
else
{
String sql="Insert into tblvisitorentry
(`name`,`address`,`pin`,`comming_from`,`purpose_of_visit`,`du
ration`,`no_of_persons`,`room_type`,`room_no`,`id_proof`,`id_n
o`,`advance`,`balance`,`date_checkin`,`status`)
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement ps=cnn.prepareStatement(sql);
ps.setString(1, txtName.getText());
ps.setString(2, textAddress.getText());
ps.setInt(3, Integer.parseInt(txtPin.getText()));
ps.setString(4, txtComFrom.getText());
ps.setString(5, textPOV.getText());
ps.setInt(6,
Integer.parseInt(spnrDurtn.getValue().toString()));
ps.setInt(7,
Integer.parseInt(spnrNOP.getValue().toString()));
ps.setString(8, cmbRT.getSelectedItem().toString());
ps.setString(9, cmbrno.getSelectedItem().toString());
ps.setString(10, cmbIDP.getSelectedItem().toString());
ps.setString(11, txtIDno.getText() );
ps.setInt(12, Integer.parseInt(txtAdvnc.getText()));
lblBlnc.setText("8888");
ps.setInt(13, Integer.parseInt(lblBlnc.getText()));
java.util.Date d=new java.util.Date();
lblDateDisp.setText(d.toString());
java.sql.Date d1=new java.sql.Date(d.getTime());
ps.setDate(14, d1);
ps.setString(15, status);
ps.executeUpdate();
JOptionPane.showMessageDialog(this,"Data inserted");
}
String sqlAvail ="update tblavail set no_of_rooms
=no_of_rooms -1 where room_type=? ";
PreparedStatement
ps2=cnn.prepareStatement(sqlAvail);
ps2.setString(1, cmbRT.getSelectedItem().toString());
ps2.executeUpdate();
txtName.setText("");
textAddress.setText("");
txtPin.setText("");
txtComFrom.setText("");
txtAdvnc.setText("");
textPOV.setText("");
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
31
txtIDno.setText("");
lblBlnc.setText("XXXX");
String sqlrno ="update tblroomno set status = 1 where
room_no=? ";
PreparedStatement
ps3=cnn.prepareStatement(sqlrno);
ps3.setString(1, cmbrno.getSelectedItem().toString());
ps3.executeUpdate();
}
catch (Exception ex) {
Logger.getLogger(FrmLogin.class.getName()).log(Level.
SEVERE, null, ex);
JOptionPane.showMessageDialog(this, ex);
}
}
private
void
cmbRTActionPerformed(java.awt.event.ActionEvent evt) {
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sqlrt="select * from tblroomno where room_type=?
and status = 0";
PreparedStatement ps2=cnn.prepareStatement(sqlrt);
ps2.setString(1, cmbRT.getSelectedItem().toString());
ResultSet rs2 = ps2.executeQuery();
DefaultComboBoxModel
cr=(DefaultComboBoxModel)cmbrno.getModel();
cr.removeAllElements();
while(rs2.next())
{
cr.addElement(rs2.getString("room_no"));
}
32
Connection
dbconnection.DBConnection.getConnection();
cnn
}
} catch (Exception ex) {
Logger.getLogger(FrmNewEntry.class.getName()).log(Le
vel.SEVERE, null, ex);
}
}
private
formWindowClosed(java.awt.event.WindowEvent evt) {
FrmHome f=new FrmHome();
f.show();
}
void
33
Search
package forms;
import
import
import
import
import
import
import
import
import
import
dbconnection.LoadData;
java.awt.Color;
java.sql.Connection;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.text.SimpleDateFormat;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.DefaultComboBoxModel;
javax.swing.JOptionPane;
lblsSlNo.setText (LoadData.slno+"");
lblsName.setText (LoadData.name+"");
lblsAddr.setText (LoadData.addr+"");
lblsFrom.setText (LoadData.from+"");
lblsRno.setText (LoadData.rno+"");
java.util.Date dd=new java.util.Date();
long x =Math.abs(dd.getTime()- LoadData.d.getTime());
long day =x/(24*60*60*1000);
lblsNOD.setText(day+"");
if(0==Integer.parseInt(lblsNOD.getText()))
{
lblsNOD.setText("1");
}
try {
Connection
dbconnection.DBConnection.getConnection();
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
cnn
=
34
35
private
void
btnsCanActionPerformed(java.awt.event.ActionEvent evt) {
FrmHome fh= new FrmHome();
this.dispose();
fh.show();
}
Report
package forms;
import
import
import
import
import
import
import
import
import
dbconnection.LoadData;
java.sql.Connection;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.text.SimpleDateFormat;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.JOptionPane;
javax.swing.table.DefaultTableModel;
36
tb.setRowCount(0);
while (rs.next()) {
Object o[] = {rs.getString("room_type"),
rs.getString(2),rs.getInt(3)};
tb.addRow(o);
}
String sqltotal="select sum(total_amount) from
tblbill where date=?";
PreparedStatement ps2=
cnn.prepareStatement(sqltotal);
ps2.setDate(1, d1);
ResultSet rs2 = ps2.executeQuery();
if(rs2.next())
{
lbDRTA.setText(rs2.getString(1));
}
Admin
package forms;
import
import
import
import
import
import
import
import
import
import
dbconnection.LoadData;
java.sql.Connection;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.text.SimpleDateFormat;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.DefaultComboBoxModel;
javax.swing.JOptionPane;
javax.swing.table.DefaultTableModel;
37
cnn
38
panAdUpR.setVisible(false);
jPanel4.setVisible(false);
panRno.setVisible(false);
}
private
void
btnAdUpdateActionPerformed(java.awt.event.ActionEvent evt)
{
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sql = "update tblroomtype set room_rent =?
where room_type =?";
PreparedStatement ps = cnn.prepareStatement(sql);
ps.setInt(1, Integer.parseInt(txtAdUpRnt.getText()));
ps.setString(2,
cmbAdUpRT.getSelectedItem().toString());
ps.executeUpdate();
JOptionPane.showMessageDialog(this, "update ok");
txtAdUpRnt.setText("");
} catch (Exception ex) {
Logger.getLogger(FrmAdmin.class.getName()).log(Level
.SEVERE, null, ex);
JOptionPane.showMessageDialog(this, ex);
}
}
private
void
btnAdUsrCreateActionPerformed(java.awt.event.ActionEvent
evt) {
if (pwdAdPswd.getText().equals(pwdAdRePswd.getText()))
{
try {
Connection
dbconnection.DBConnection.getConnection();
cnn
39
txtAdAddr.setText("");
pwdAdPswd.setText("");
pwdAdRePswd.setText("");
} catch (Exception ex) {
Logger.getLogger(FrmAdmin.class.getName()).log(Le
vel.SEVERE, null, ex);
}
} else {
JOptionPane.showMessageDialog(this, "Password Does
Not Match");
}
}
private
void
btnAdAddActionPerformed(java.awt.event.ActionEvent evt) {
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sql = "Insert into tblroomtype
(`room_type`,`no_of_rooms`) values (?,?)";
PreparedStatement ps = cnn.prepareStatement(sql);
ps.setString(1, txtAdRT.getText());
ps.setInt(2, Integer.parseInt(txtAdNOR.getText()));
ps.executeUpdate();
sql = "Insert into tblavail (`room_type`,`no_of_rooms`)
values (?,?)";
PreparedStatement ps2 = cnn.prepareStatement(sql);
ps2.setString(1, txtAdRT.getText());
ps2.setInt(2, Integer.parseInt(txtAdNOR.getText()));
ps2.executeUpdate();
String sqlshow = "select `room_type`,`no_of_rooms`
from tblroomtype";
PreparedStatement
pss
=
cnn.prepareStatement(sqlshow);
ResultSet rs = pss.executeQuery();
DefaultTableModel tb = (DefaultTableModel)
tblAdRT.getModel();
tb.setRowCount(0);
while (rs.next()) {
Object o[] = {rs.getString("room_type"),
rs.getInt("no_of_rooms")};
tb.addRow(o);
}
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
40
pss.executeUpdate();
JOptionPane.showMessageDialog(this, "Insert ok");
} catch (Exception ex) {
Logger.getLogger(FrmAdmin.class.getName()).log(Level
.SEVERE, null, ex);
}
}
private
void
btnAdCNUActionPerformed(java.awt.event.ActionEvent evt) {
txtAdUserName.setText("");
txtAdAddr.setText("");
pwdAdPswd.setText("");
pwdAdRePswd.setText("");
panAdCNU.setVisible(true);
panAdRT.setVisible(false);
panAdUpR.setVisible(false);
jPanel4.setVisible(false);
}
private
void
btnAdARTActionPerformed(java.awt.event.ActionEvent evt) {
panAdCNU.setVisible(false);
panAdRT.setVisible(true);
panAdUpR.setVisible(false);
jPanel4.setVisible(false);
panRno.setVisible(false);
try {
Connection
dbconnection.DBConnection.getConnection();
cnn
41
}
private
void
btnAdURRActionPerformed(java.awt.event.ActionEvent evt) {
panAdCNU.setVisible(false);
panAdRT.setVisible(false);
panAdUpR.setVisible(true);
jPanel4.setVisible(false);
panRno.setVisible(false);
}
private
void
btnAdUsrCrtCanActionPerformed(java.awt.event.ActionEvent
evt) {
panAdCNU.setVisible(false);
panAdRT.setVisible(false);
panAdUpR.setVisible(false);
jPanel4.setVisible(false);
panRno.setVisible(false);
}
private
btnAdDeleteActionPerformed(java.awt.event.ActionEvent
{
void
evt)
tblAdRT.getSelectedRow();
}
private
void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
panAdCNU.setVisible(false);
panAdRT.setVisible(false);
panAdUpR.setVisible(false);
jPanel4.setVisible(true);
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
42
panRno.setVisible(false);
}
private
void
btnAdRokActionPerformed(java.awt.event.ActionEvent evt) {
try {
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String
sqlshow
=
"select
`room_type`,count(room_type),sum(total_amount) from tblbill
where date>=? and date<=? group by`room_type` ";
PreparedStatement
pss
=
cnn.prepareStatement(sqlshow);
java.util.Date c1 = dtAdRFrom.getDate();
java.sql.Date d1 = new java.sql.Date(c1.getTime());
pss.setDate(1, d1);
java.util.Date c2 = dtAdRTo.getDate();
java.sql.Date d2 = new java.sql.Date(c2.getTime());
pss.setDate(2, d2);
ResultSet rs = pss.executeQuery();
DefaultTableModel tb = (DefaultTableModel)
tblAdreport.getModel();
tb.setRowCount(0);
while (rs.next()) {
Object o[] = {rs.getString("room_type"),
rs.getString(2), rs.getInt(3)};
tb.addRow(o);
}
String sqltotal = "select sum(total_amount) from tblbill
where date>=? and date<=?";
PreparedStatement
ps2
=
cnn.prepareStatement(sqltotal);
java.util.Date c3 = dtAdRFrom.getDate();
java.sql.Date d3 = new java.sql.Date(c3.getTime());
ps2.setDate(1, d3);
java.util.Date c4 = dtAdRTo.getDate();
java.sql.Date d4 = new java.sql.Date(c4.getTime());
ps2.setDate(2, d4);
ResultSet rs2 = ps2.executeQuery();
if (rs2.next()) {
lbAdRTA.setText(rs2.getString(1));
}
43
}
private
void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
panRno.setVisible(true);
panAdCNU.setVisible(false);
panAdRT.setVisible(false);
panAdUpR.setVisible(false);
jPanel4.setVisible(false);
}
private
void
btnAddActionPerformed(java.awt.event.ActionEvent evt) {
try {
int tno = 0, no = 0;
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sqlcheck = "Select no_of_rooms from tblroomtype
where room_type=?";
PreparedStatement
ps1
=
cnn.prepareStatement(sqlcheck);
ps1.setString(1, cmbRT.getSelectedItem().toString());
ResultSet rs1 = ps1.executeQuery();
if (rs1.next()) {
no = Integer.parseInt(rs1.getString("no_of_rooms"));
}
String sqlc = "select count(*) from tblroomno where
room_type=?";
PreparedStatement ps2 = cnn.prepareStatement(sqlc);
ps2.setString(1, cmbRT.getSelectedItem().toString());
ResultSet rs2 = ps2.executeQuery();
while (rs2.next()) {
tno = Integer.parseInt(rs2.getString(1));
}
if (tno < no) {
String sql = "Insert into tblroomno
(`room_type`,`room_no`,`status`) values (?,?,0)";
PreparedStatement ps = cnn.prepareStatement(sql);
ps.setString(1, cmbRT.getSelectedItem().toString());
ps.setString(2, txtRno.getText());
ps.executeUpdate();
txtRno.setText("");
// JOptionPane.showMessageDialog(this, "Room
Added");
txtRno.requestFocus();
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
44
} else {
JOptionPane.showMessageDialog(this, "error... rooms
exparied");
}
} catch (Exception ex) {
Logger.getLogger(FrmAdmin.class.getName()).log(Level
.SEVERE, null, ex);
JOptionPane.showConfirmDialog(this, "Room No already
exists");
}
}
private void txtRnoKeyReleased(java.awt.event.KeyEvent
evt) {
if (evt.getKeyCode() == 10) {
btnAdd.doClick();
}
}
private
void
jFrame1WindowClosed(java.awt.event.WindowEvent evt) {
FrmHome f = new FrmHome();
f.show();
}
private
formWindowClosed(java.awt.event.WindowEvent evt) {
FrmHome f = new FrmHome();
f.show();
}
void
Bill Preview
package forms;
import
import
import
import
import
import
import
import
dbconnection.LoadData;
java.sql.Connection;
java.sql.PreparedStatement;
java.sql.ResultSet;
java.util.logging.Level;
java.util.logging.Logger;
javax.swing.JOptionPane;
java.text.SimpleDateFormat;
45
public FrmBillPrev() {
try {
initComponents();
java.util.Date d=new java.util.Date();
java.sql.Date d1=new java.sql.Date(d.getTime());
SimpleDateFormat sdf= new SimpleDateFormat("ddMM-yyyy");
String mydate=sdf.format(d);
lblbDate.setText(mydate);
lblDateDisp.setText(mydate);
lblUser.setText(LoadData.user);
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sql="select bilno from tblbill";
PreparedStatement ps=cnn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
if(rs.next())
{
rs.last();
lblbBillno.setText(rs.getInt("bilno")+1+"");
}
lblbslno.setText (LoadData.slno+"");
lblbName.setText (LoadData.name+"");
lblbRno.setText (LoadData.rno+"");
lblbAdvnc.setText (LoadData.adnvc+"");
lblbTOA.setText (LoadData.d+"");
lblbAdvnc.setText(LoadData.adnvc+"");
lblbRT.setText(LoadData.rtype+"");
lblExtraBill.setText(LoadData.extra+"");
java.util.Date dd=new java.util.Date();
long x =Math.abs(dd.getTime()- LoadData.d.getTime());
long day =x/(24*60*60*1000);
lblbNOD.setText(day+"");
String sqlshow="select room_rent from tblroomtype
where room_type=?";
PreparedStatement
pss=cnn.prepareStatement(sqlshow);
pss.setString(1,lblbRT.getText());
ResultSet rs2 = pss.executeQuery();
if(rs2.next())
{
int amount = rs2.getInt("room_rent");
if(0==Integer.parseInt(lblbNOD.getText()))
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
46
{
lblbNOD.setText("1");
}
int
price=
(amount*Integer.parseInt(lblbNOD.getText())+
(Integer.parseInt(lblExtraBill.getText())));
lblbTot.setText(price+"");
int b=Integer.parseInt( lblbAdvnc.getText())-price;
lblbBncRorR.setText(b+"");
}
} catch (Exception ex) {
Logger.getLogger(FrmBillPrev.class.getName()).log(Lev
el.SEVERE, null, ex);
}
}
private
void
btnBilConfActionPerformed(java.awt.event.ActionEvent evt) {
int x= JOptionPane.showConfirmDialog(this, "Are You Sure
to Check Out??", "Confirm", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
if(x==0)
{
try {
java.util.Date d=new java.util.Date();
java.sql.Date d1=new java.sql.Date(d.getTime());
Connection
cnn
=
dbconnection.DBConnection.getConnection();
String sql="Insert into tblBill
values(?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement ps=cnn.prepareStatement(sql);
ps.setInt(1, Integer.parseInt(lblbBillno.getText()));
ps.setInt(2, Integer.parseInt(lblbslno.getText()));
ps.setString(3, lblbRno.getText());
ps.setInt(4, Integer.parseInt(lblbAdvnc.getText()));
ps.setInt(5, Integer.parseInt(lblbNOD.getText()));
ps.setInt(6, Integer.parseInt(lblbTot.getText()));
ps.setInt(7, Integer.parseInt(lblbBncRorR.getText()));
ps.setDate(8,d1);
ps.setString(9,lblbTOA.getText());
ps.setString(10, lblbRT.getText());
ps.setInt(11, Integer.parseInt(lblExtraBill.getText()));
ps.executeUpdate();
JOptionPane.showMessageDialog(this,"Ckecked Out");
String status="Checked Out";
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
47
48
CONCLUSION
The output of the project is successfully executed. This
software allows to book rooms in the hotel with the help of
receptionist. And it also reduce the work of receptionist.
This application works in windows XP or its latest versions.
It is user friendly to software users.
REFERENCES
Stackoverflow.com
W3schools.com
Toutorialspoint.com
Dept. Of Computer Engg.
J.D.T.Islam Polytechnic
49
Youtube.com
50