-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminRooms.java
More file actions
129 lines (105 loc) · 4.1 KB
/
AdminRooms.java
File metadata and controls
129 lines (105 loc) · 4.1 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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JPanel.java to edit this template
*/
package hms.pro;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import java.util.Locale;
import java.util.Date;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.YearMonth;
import java.time.Year;
import java.time.MonthDay;
import java.time.ZonedDateTime;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.temporal.ChronoField;
import java.lang.Object;
import java.lang.Enum;
import java.sql.SQLException;
import java.util.Formatter;
import java.text.DateFormat;
import javax.swing.*;
/**
*
* @author lt1
*/
public class AdminRooms extends javax.swing.JPanel {
/**
* Creates new form MainDesk
*/
public AdminRooms() {
initComponents();
resListFreeRooms();
calcRooms();
}
/**
* 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() {
jScrollPane1 = new javax.swing.JScrollPane();
jtblRmsDis = new javax.swing.JTable();
jtblRmsDis.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Room", "Floor"
}
) {
boolean[] canEdit = new boolean [] {
false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jtblRmsDis);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 708, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 123, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
public void resListFreeRooms(){
try {
DefaultTableModel dt5 = (DefaultTableModel) jtblRmsDis.getModel();
dt5.setRowCount(0);
String Sdate = LocalDate.now().getDayOfMonth() +"/"+ LocalDate.now().getMonthValue() +"/" + LocalDate.now().getYear();
String Edate = "31/12/" + LocalDate.now().getYear();
Statement s5 = db1.mycon1().createStatement();
ResultSet rs2 = s5.executeQuery("SELECT rooms.room_num, rooms.room_id, rooms.floor ,rooms.price FROM rooms");
while (rs2.next()) {
Vector v = new Vector();
v.add(rs2.getString(1)); //num
v.add(rs2.getString(3)); //floor
dt5.addRow(v);
}
}catch (SQLException e) {
System.out.println(e);
}
}
public void calcRooms(){
int cRoomCount = jtblRmsDis.getRowCount();
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jtblRmsDis;
// End of variables declaration//GEN-END:variables
}