-
Notifications
You must be signed in to change notification settings - Fork 0
/
bill.java
308 lines (267 loc) · 13.8 KB
/
bill.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
import java.sql.*;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author User
*/
public class bill extends javax.swing.JFrame {
/**
* Creates new form bill
*/
public bill() {
initComponents();
}
public bill(String para){
initComponents();
l1.setText(para);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jPopupMenu1 = new javax.swing.JPopupMenu();
jDialog1 = new javax.swing.JDialog();
jLayeredPane1 = new javax.swing.JLayeredPane();
jToggleButton1 = new javax.swing.JToggleButton();
jLabel1 = new javax.swing.JLabel();
a = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
l1 = new javax.swing.JLabel();
l2 = new javax.swing.JLabel();
l3 = new javax.swing.JLabel();
l4 = new javax.swing.JLabel();
l5 = new javax.swing.JLabel();
l6 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jSeparator2 = new javax.swing.JSeparator();
jSeparator3 = new javax.swing.JSeparator();
jSeparator4 = new javax.swing.JSeparator();
l7 = new javax.swing.JLabel();
l8 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
jButton1.setText("jButton1");
javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
javax.swing.GroupLayout jLayeredPane1Layout = new javax.swing.GroupLayout(jLayeredPane1);
jLayeredPane1.setLayout(jLayeredPane1Layout);
jLayeredPane1Layout.setHorizontalGroup(
jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jLayeredPane1Layout.setVerticalGroup(
jLayeredPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jToggleButton1.setText("jToggleButton1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(255, 141, -1, -1));
a.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
a.setText("BOOKING NO :");
getContentPane().add(a, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 200, -1, -1));
jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel3.setText("CUSTOMER NAME :");
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 270, -1, -1));
jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel4.setText("CONTACT NUMBER :");
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 360, -1, -1));
jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel5.setText("CHARGES PER DAY:");
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 450, -1, -1));
jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel6.setText("GRAND TOTAL :");
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 610, -1, -1));
jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jLabel7.setText("NO OF DAYS:");
getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 540, -1, -1));
l1.setFont(new java.awt.Font("Lucida Calligraphy", 1, 14)); // NOI18N
l1.setForeground(new java.awt.Color(0, 0, 204));
getContentPane().add(l1, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 188, 194, 25));
l2.setFont(new java.awt.Font("Lucida Calligraphy", 1, 14)); // NOI18N
l2.setForeground(new java.awt.Color(0, 51, 255));
getContentPane().add(l2, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 270, 194, 26));
l3.setFont(new java.awt.Font("Lucida Calligraphy", 1, 14)); // NOI18N
l3.setForeground(new java.awt.Color(51, 51, 255));
getContentPane().add(l3, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 350, 194, 28));
l4.setFont(new java.awt.Font("Lucida Calligraphy", 1, 14)); // NOI18N
l4.setForeground(new java.awt.Color(51, 51, 255));
getContentPane().add(l4, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 530, 194, 26));
l5.setFont(new java.awt.Font("Lucida Calligraphy", 1, 14)); // NOI18N
l5.setForeground(new java.awt.Color(0, 0, 255));
getContentPane().add(l5, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 460, 194, 27));
l6.setFont(new java.awt.Font("Lucida Bright", 3, 16)); // NOI18N
l6.setForeground(new java.awt.Color(0, 0, 255));
getContentPane().add(l6, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 600, 194, 30));
jLabel10.setFont(new java.awt.Font("Felix Titling", 1, 40)); // NOI18N
jLabel10.setText("IMPERIAL HOTEL");
getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 20, 361, -1));
jLabel11.setFont(new java.awt.Font("Felix Titling", 1, 24)); // NOI18N
jLabel11.setText("NEW DELHI ,INDIA");
getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 80, -1, -1));
getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 147, 652, 10));
getContentPane().add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 163, 652, 10));
getContentPane().add(jSeparator3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 580, 652, 10));
getContentPane().add(jSeparator4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 640, 650, 20));
l7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
l7.setForeground(new java.awt.Color(0, 0, 255));
getContentPane().add(l7, new org.netbeans.lib.awtextra.AbsoluteConstraints(497, 394, 110, 28));
l8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
l8.setForeground(new java.awt.Color(0, 0, 255));
getContentPane().add(l8, new org.netbeans.lib.awtextra.AbsoluteConstraints(501, 527, 123, 26));
jButton2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton2.setText("SHOW DETAILS");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 660, -1, -1));
jButton3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton3.setText("PRINT");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 660, 120, -1));
jButton4.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton4.setText("HOME");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(470, 660, 110, -1));
jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\User\\Desktop\\pictures\\bill.jpg")); // NOI18N
jLabel2.setText("jLabel2");
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 650, 700));
jButton5.setText("jButton5");
getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 660, -1, -1));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try{
Class.forName("java.sql.Driver");
Connection con= DriverManager.getConnection("jdbc:mysql://localhost/rishita","root","opjs");
Statement stmt=con.createStatement();
int a=Integer.parseInt(l1.getText());
String q="select * from imperial where booking_no= "+a+";";
ResultSet rs= stmt.executeQuery(q);
rs.next();
String b=rs.getString("name");
long c= rs.getLong("contact_no");
int d=rs.getInt("no_of_days");
int e=rs.getInt("charges_per_day");
int f=rs.getInt("total_amount");
l2.setText(""+b);
l3.setText(""+c);
l4.setText(""+d);
l5.setText(""+e);
l6.setText(""+f);
rs.close();
stmt.close();
con.close();
}
catch (Exception e){
JOptionPane.showMessageDialog(null,e.getMessage());
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
new bookings().setVisible(true);
this.setVisible(false);// TODO add your handling code here:
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
JOptionPane.showMessageDialog(null,"YOUR RECEIPT PRINTED SUCCESSFULLY");
new lastpage().setVisible(true);
this.setVisible(false);// TODO add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
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(bill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(bill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new bill().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel a;
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.JDialog jDialog1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
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.JLayeredPane jLayeredPane1;
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JToggleButton jToggleButton1;
private javax.swing.JLabel l1;
private javax.swing.JLabel l2;
private javax.swing.JLabel l3;
private javax.swing.JLabel l4;
private javax.swing.JLabel l5;
private javax.swing.JLabel l6;
private javax.swing.JLabel l7;
private javax.swing.JLabel l8;
// End of variables declaration//GEN-END:variables
}