-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneratebill.java
More file actions
266 lines (235 loc) · 11.8 KB
/
generatebill.java
File metadata and controls
266 lines (235 loc) · 11.8 KB
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
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 generatebill extends javax.swing.JFrame {
private int CVV;
/**
* Creates new form generatebill
*/
public generatebill() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jTF1 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
jTF4 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jButton4 = new javax.swing.JButton();
l4 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
l5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTF5 = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jTF7 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jButton1.setText("jButton1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jTF1, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 80, 194, 30));
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel2.setText("GRAND TOTAL");
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 430, -1, -1));
jButton2.setBackground(new java.awt.Color(204, 255, 102));
jButton2.setFont(new java.awt.Font("Tempus Sans ITC", 1, 14)); // NOI18N
jButton2.setText("DISPLAY ");
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(310, 310, 110, 50));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel4.setText("ENTER YOUR CVV");
getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 150, -1, -1));
jButton3.setBackground(new java.awt.Color(204, 255, 102));
jButton3.setFont(new java.awt.Font("Tempus Sans ITC", 1, 14)); // NOI18N
jButton3.setText("MOVE TO HOME PAGE");
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(80, 310, 210, 50));
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel10.setText("ENTER BOOKING NO.");
getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 100, -1, -1));
jTF4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTF4ActionPerformed(evt);
}
});
getContentPane().add(jTF4, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 130, 194, 30));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
jLabel1.setText("# ENTER FOLLOWING TWO DETAILS:");
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 390, -1));
jButton4.setBackground(new java.awt.Color(204, 255, 102));
jButton4.setFont(new java.awt.Font("Tempus Sans ITC", 1, 14)); // NOI18N
jButton4.setText("CLEAR TEXT");
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(670, 310, 140, 50));
l4.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 16)); // NOI18N
getContentPane().add(l4, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 420, 200, 30));
jButton5.setBackground(new java.awt.Color(204, 255, 102));
jButton5.setFont(new java.awt.Font("Tempus Sans ITC", 1, 14)); // NOI18N
jButton5.setText("PAYMENT SUCCESSFULL");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(440, 310, 210, 50));
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel3.setText("CUSTOMER NAME");
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 380, -1, -1));
l5.setFont(new java.awt.Font("Yu Gothic UI Semilight", 1, 18)); // NOI18N
getContentPane().add(l5, new org.netbeans.lib.awtextra.AbsoluteConstraints(490, 370, 200, 30));
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel6.setText("ENTER CUSTOMER ID");
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 200, -1, -1));
getContentPane().add(jTF5, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 190, 190, 30));
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel7.setText("ENTER CARD NUMBER");
getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 250, -1, -1));
getContentPane().add(jTF7, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 240, 190, 30));
jLabel5.setIcon(new javax.swing.ImageIcon("C:\\Users\\User\\Desktop\\pictures\\krabi-best-beach-resorts.jpg.jpg")); // NOI18N
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 910, 480));
pack();
setLocationRelativeTo(null);
}// </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;
a=Integer.parseInt(jTF1.getText());
int b=Integer.parseInt(jTF4.getText());
int d=Integer.parseInt(jTF5.getText());
int e=Integer.parseInt(jTF7.getText());
String q1="select name,total_amount from imperial where booking_no="+a+";";
ResultSet rs=stmt.executeQuery(q1);
if(rs.next()){
String c=rs.getString("name");
int h=rs.getInt("total_amount");
l5.setText(""+c);
l4.setText(""+h);
}
else{
JOptionPane.showMessageDialog(null,"ENTERED BOOKING NUMBER DOES NOT EXIST");
}
String q2="update imperial set CVV=' "+b+"' where booking_no="+a+";";
String q3="update imperial set customer_id='"+d+"' where booking_no="+a+";";
String q4="update imperial set card_no='"+e+"' where booking_no="+a+";";
stmt.executeUpdate(q2);
stmt.executeUpdate(q3);
stmt.executeUpdate(q4);
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e.getMessage());
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jTF4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTF4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTF4ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
new bookings().setVisible(true);
this.setVisible(false);// TODO add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
jTF1.setText("");
jTF4.setText("");
l4.setText("");
l5.setText("");
jTF5.setText("");// TODO add your handling code here:
}//GEN-LAST:event_jButton4ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
String z =jTF1.getText();
new bill(z).setVisible(true);
this.setVisible(false);
String a=l5.getText();
JOptionPane.showMessageDialog(null,"PAYMENT SUCCESSFULL USER '"+a+"'");
}//GEN-LAST:event_jButton5ActionPerformed
/**
* @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(generatebill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(generatebill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(generatebill.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(generatebill.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 generatebill().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
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.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JTextField jTF1;
private javax.swing.JTextField jTF4;
private javax.swing.JTextField jTF5;
private javax.swing.JTextField jTF7;
private javax.swing.JLabel l4;
private javax.swing.JLabel l5;
// End of variables declaration//GEN-END:variables
}