Reporting Functionality - added some report
[habeas.git] / src / habeas / MainFrame.java
1 /*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6 package habeas;
7
8 import java.util.ArrayList;
9 import javax.swing.JOptionPane;
10
11 /**
12 *
13 * @author hari
14 */
15 public class MainFrame extends javax.swing.JFrame {
16
17 /**
18 * Creates new form MainFrame
19 */
20 public MainFrame() {
21 initComponents();
22 }
23
24 /**
25 * This method is called from within the constructor to initialize the form.
26 * WARNING: Do NOT modify this code. The content of this method is always
27 * regenerated by the Form Editor.
28 */
29 @SuppressWarnings("unchecked")
30 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
31 private void initComponents() {
32
33 jMenuBar1 = new javax.swing.JMenuBar();
34 menuMaster = new javax.swing.JMenu();
35 menuClientMaster = new javax.swing.JMenuItem();
36 menuLawyerNotices = new javax.swing.JMenu();
37 menuCreateNotice = new javax.swing.JMenuItem();
38 menuManageNotices = new javax.swing.JMenuItem();
39 jSeparator1 = new javax.swing.JPopupMenu.Separator();
40 menuGenerateRaisedBills = new javax.swing.JMenuItem();
41 menuNoticesReports = new javax.swing.JMenu();
42 menuNoticesToBeDrafted = new javax.swing.JMenuItem();
43 menuNoticesClarificationPending = new javax.swing.JMenuItem();
44 menuNoticeDraftAwaitingApproval = new javax.swing.JMenuItem();
45 menuNoticeDraftsApprovedToBeSent = new javax.swing.JMenuItem();
46 menuNoticesSentNotYetDelivered = new javax.swing.JMenuItem();
47 menuAwaitingPayment = new javax.swing.JMenuItem();
48 menuSettings = new javax.swing.JMenu();
49 menuDatabaseSettings = new javax.swing.JMenuItem();
50 menuStationery = new javax.swing.JMenuItem();
51
52 setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
53 setTitle("Habeas - Law Office Manager");
54 setLocationByPlatform(true);
55
56 menuMaster.setMnemonic('M');
57 menuMaster.setText("Master");
58
59 menuClientMaster.setMnemonic('c');
60 menuClientMaster.setText("Client Master...");
61 menuClientMaster.addActionListener(new java.awt.event.ActionListener() {
62 public void actionPerformed(java.awt.event.ActionEvent evt) {
63 menuClientMasterActionPerformed(evt);
64 }
65 });
66 menuMaster.add(menuClientMaster);
67
68 jMenuBar1.add(menuMaster);
69
70 menuLawyerNotices.setMnemonic('L');
71 menuLawyerNotices.setText("Lawyer Notices");
72
73 menuCreateNotice.setMnemonic('C');
74 menuCreateNotice.setText("Create New...");
75 menuCreateNotice.addActionListener(new java.awt.event.ActionListener() {
76 public void actionPerformed(java.awt.event.ActionEvent evt) {
77 menuCreateNoticeActionPerformed(evt);
78 }
79 });
80 menuLawyerNotices.add(menuCreateNotice);
81
82 menuManageNotices.setMnemonic('M');
83 menuManageNotices.setText("Manage Notices...");
84 menuManageNotices.addActionListener(new java.awt.event.ActionListener() {
85 public void actionPerformed(java.awt.event.ActionEvent evt) {
86 menuManageNoticesActionPerformed(evt);
87 }
88 });
89 menuLawyerNotices.add(menuManageNotices);
90 menuLawyerNotices.add(jSeparator1);
91
92 menuGenerateRaisedBills.setMnemonic('G');
93 menuGenerateRaisedBills.setText("Generate Raised Bills...");
94 menuGenerateRaisedBills.addActionListener(new java.awt.event.ActionListener() {
95 public void actionPerformed(java.awt.event.ActionEvent evt) {
96 menuGenerateRaisedBillsActionPerformed(evt);
97 }
98 });
99 menuLawyerNotices.add(menuGenerateRaisedBills);
100
101 menuNoticesReports.setMnemonic('r');
102 menuNoticesReports.setText("Reports");
103
104 menuNoticesToBeDrafted.setText("To Be Drafted...");
105 menuNoticesToBeDrafted.addActionListener(new java.awt.event.ActionListener() {
106 public void actionPerformed(java.awt.event.ActionEvent evt) {
107 menuNoticesToBeDraftedActionPerformed(evt);
108 }
109 });
110 menuNoticesReports.add(menuNoticesToBeDrafted);
111
112 menuNoticesClarificationPending.setMnemonic('c');
113 menuNoticesClarificationPending.setText("Clarifications pending...");
114 menuNoticesClarificationPending.addActionListener(new java.awt.event.ActionListener() {
115 public void actionPerformed(java.awt.event.ActionEvent evt) {
116 menuNoticesClarificationPendingActionPerformed(evt);
117 }
118 });
119 menuNoticesReports.add(menuNoticesClarificationPending);
120
121 menuNoticeDraftAwaitingApproval.setMnemonic('d');
122 menuNoticeDraftAwaitingApproval.setText("Drafts to be approved...");
123 menuNoticeDraftAwaitingApproval.addActionListener(new java.awt.event.ActionListener() {
124 public void actionPerformed(java.awt.event.ActionEvent evt) {
125 menuNoticeDraftAwaitingApprovalActionPerformed(evt);
126 }
127 });
128 menuNoticesReports.add(menuNoticeDraftAwaitingApproval);
129
130 menuNoticeDraftsApprovedToBeSent.setMnemonic('a');
131 menuNoticeDraftsApprovedToBeSent.setText("Drafts Approved not yet sent...");
132 menuNoticeDraftsApprovedToBeSent.addActionListener(new java.awt.event.ActionListener() {
133 public void actionPerformed(java.awt.event.ActionEvent evt) {
134 menuNoticeDraftsApprovedToBeSentActionPerformed(evt);
135 }
136 });
137 menuNoticesReports.add(menuNoticeDraftsApprovedToBeSent);
138
139 menuNoticesSentNotYetDelivered.setMnemonic('s');
140 menuNoticesSentNotYetDelivered.setText("Notices sent not yet delivered...");
141 menuNoticesSentNotYetDelivered.addActionListener(new java.awt.event.ActionListener() {
142 public void actionPerformed(java.awt.event.ActionEvent evt) {
143 menuNoticesSentNotYetDeliveredActionPerformed(evt);
144 }
145 });
146 menuNoticesReports.add(menuNoticesSentNotYetDelivered);
147
148 menuAwaitingPayment.setMnemonic('a');
149 menuAwaitingPayment.setText("Bills awaiting payment...");
150 menuAwaitingPayment.addActionListener(new java.awt.event.ActionListener() {
151 public void actionPerformed(java.awt.event.ActionEvent evt) {
152 menuAwaitingPaymentActionPerformed(evt);
153 }
154 });
155 menuNoticesReports.add(menuAwaitingPayment);
156
157 menuLawyerNotices.add(menuNoticesReports);
158
159 jMenuBar1.add(menuLawyerNotices);
160
161 menuSettings.setMnemonic('S');
162 menuSettings.setText("Settings");
163
164 menuDatabaseSettings.setMnemonic('D');
165 menuDatabaseSettings.setText("Database...");
166 menuDatabaseSettings.addActionListener(new java.awt.event.ActionListener() {
167 public void actionPerformed(java.awt.event.ActionEvent evt) {
168 menuDatabaseSettingsActionPerformed(evt);
169 }
170 });
171 menuSettings.add(menuDatabaseSettings);
172
173 menuStationery.setMnemonic('S');
174 menuStationery.setText("Stationery Settings...");
175 menuStationery.addActionListener(new java.awt.event.ActionListener() {
176 public void actionPerformed(java.awt.event.ActionEvent evt) {
177 menuStationeryActionPerformed(evt);
178 }
179 });
180 menuSettings.add(menuStationery);
181
182 jMenuBar1.add(menuSettings);
183
184 setJMenuBar(jMenuBar1);
185
186 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
187 getContentPane().setLayout(layout);
188 layout.setHorizontalGroup(
189 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
190 .addGap(0, 586, Short.MAX_VALUE)
191 );
192 layout.setVerticalGroup(
193 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
194 .addGap(0, 292, Short.MAX_VALUE)
195 );
196
197 pack();
198 }// </editor-fold>//GEN-END:initComponents
199
200 private void menuDatabaseSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuDatabaseSettingsActionPerformed
201 // TODO add your handling code here:
202 DatabaseSettingsDialog frm = new DatabaseSettingsDialog (this, true);
203 frm.setVisible(true);
204 }//GEN-LAST:event_menuDatabaseSettingsActionPerformed
205
206 private void menuClientMasterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuClientMasterActionPerformed
207 // TODO add your handling code here:
208 ClientMasterDialog frm = new ClientMasterDialog (this, true);
209 frm.setVisible(true);
210 }//GEN-LAST:event_menuClientMasterActionPerformed
211
212 private void menuCreateNoticeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCreateNoticeActionPerformed
213 // TODO add your handling code here:
214 CreateNoticeDialog frm = new CreateNoticeDialog(this, true);
215 frm.setVisible(true);
216 }//GEN-LAST:event_menuCreateNoticeActionPerformed
217
218 private void menuManageNoticesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuManageNoticesActionPerformed
219 // TODO add your handling code here:
220 ManageNoticesDialog frm = new ManageNoticesDialog(this, true);
221 frm.setVisible(true);
222 }//GEN-LAST:event_menuManageNoticesActionPerformed
223
224 private void menuStationeryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStationeryActionPerformed
225 // TODO add your handling code here:
226 StationerySettingsDialog frm = new StationerySettingsDialog(this, true);
227 frm.setVisible(true);
228 }//GEN-LAST:event_menuStationeryActionPerformed
229
230 private void menuGenerateRaisedBillsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuGenerateRaisedBillsActionPerformed
231 // TODO add your handling code here:
232 GenerateRaisedBillsDialog frm = new GenerateRaisedBillsDialog(this, true);
233 frm.setVisible(true);
234
235 }//GEN-LAST:event_menuGenerateRaisedBillsActionPerformed
236
237 private void menuAwaitingPaymentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAwaitingPaymentActionPerformed
238 // TODO add your handling code here:
239 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
240 String [] cols = {"Reference Number", "Description", "Bill Date", "Bill Amount", "Client"};
241 int rep = 0;
242 ArrayList<Object> data = Utility.getReportData(rep, -1);
243 if (data == null) {
244 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
245 return;
246 }
247 frm.setupReportTable(rep, REPORT_TITLE_BILLS_AWAITING_PAYMENT, cols, data);
248 frm.setVisible(true);
249 }//GEN-LAST:event_menuAwaitingPaymentActionPerformed
250
251 private void menuNoticesSentNotYetDeliveredActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesSentNotYetDeliveredActionPerformed
252 // TODO add your handling code here:
253 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
254 String[] cols = {"Reference Number", "Description", "Sent Date", "RPAD Reference", "Client"};
255 int rep = 1;
256 ArrayList<Object> data = Utility.getReportData (rep, -1);
257 if (data == null) {
258 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
259 return;
260 }
261 frm.setupReportTable(rep, REPORT_TITLE_NOTICES_SENT_NOT_DELIVERED, cols, data);
262 frm.setVisible (true);
263 }//GEN-LAST:event_menuNoticesSentNotYetDeliveredActionPerformed
264
265 private void menuNoticeDraftAwaitingApprovalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticeDraftAwaitingApprovalActionPerformed
266 // TODO add your handling code here:
267 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
268 String cols[] = {"Reference Number", "Description", "Entrustment Date", "Client"};
269 int rep = 2;
270 ArrayList<Object> data = Utility.getReportData(rep, -1);
271 if (data == null) {
272 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
273 return;
274 }
275 frm.setupReportTable(rep, REPORT_TITLE_DRAFTS_AWAITING_APPROVAL, cols, data);
276 frm.setVisible(true);
277 }//GEN-LAST:event_menuNoticeDraftAwaitingApprovalActionPerformed
278
279 private void menuNoticesClarificationPendingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesClarificationPendingActionPerformed
280 // TODO add your handling code here:
281 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
282 String cols[] = {"Reference Number", "Description", "Entrustment Date",
283 "Clarification Remarks", "Client" };
284 int rep = 3;
285 ArrayList<Object> data = Utility.getReportData(rep, -1);
286 if (data == null) {
287 JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
288 return;
289 }
290 frm.setupReportTable(rep, REPORT_TITLE_CLARIFICATIONS_PENDING, cols, data);
291 frm.setVisible(true);
292 }//GEN-LAST:event_menuNoticesClarificationPendingActionPerformed
293
294 private void menuNoticesToBeDraftedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesToBeDraftedActionPerformed
295 // TODO add your handling code here:
296 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
297 String cols[] = {"Reference Number", "Description", "Entrustment Date",
298 "Clarification Remarks", "Client" };
299 int rep = 4;
300 ArrayList<Object> data = Utility.getReportData(rep, -1);
301 if (data == null) {
302 JOptionPane.showMessageDialog(this , ERROR_DISPLAYING_REPORT);
303 return;
304 }
305 frm.setupReportTable(rep, REPORT_TITLE_TO_BE_DRAFTED, cols, data);
306 frm.setVisible(true);
307
308 }//GEN-LAST:event_menuNoticesToBeDraftedActionPerformed
309
310 private void menuNoticeDraftsApprovedToBeSentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticeDraftsApprovedToBeSentActionPerformed
311 // TODO add your handling code here:
312 NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
313 String cols[] = {"Reference Number", "Description", "Entrustment Date",
314 "Client" };
315 int rep = 5;
316 ArrayList<Object> data = Utility.getReportData(rep, -1);
317 if (data == null) {
318 JOptionPane.showMessageDialog(this , ERROR_DISPLAYING_REPORT);
319 return;
320 }
321 frm.setupReportTable(rep, REPORT_TITLE_APPROVED_NOT_YET_SENT, cols, data);
322 frm.setVisible(true);
323
324 }//GEN-LAST:event_menuNoticeDraftsApprovedToBeSentActionPerformed
325 private static final String REPORT_TITLE_TO_BE_DRAFTED = "To Be Drafted";
326 private static final String REPORT_TITLE_CLARIFICATIONS_PENDING = "Clarifications Pending";
327 private static final String REPORT_TITLE_DRAFTS_AWAITING_APPROVAL = "Drafts To Be Approved";
328 public static final String REPORT_TITLE_NOTICES_SENT_NOT_DELIVERED = "Notices Sent Not Yet Delivered";
329 public static final String ERROR_DISPLAYING_REPORT = "Error displaying report";
330 public static final String REPORT_TITLE_BILLS_AWAITING_PAYMENT = "Bills Awaiting Payment";
331 public static final String REPORT_TITLE_APPROVED_NOT_YET_SENT = "Drafts Approved Not Yet Sent";
332 /**
333 * @param args the command line arguments
334 */
335 public static void main(String args[]) {
336 /* Set the Nimbus look and feel */
337 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
338 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
339 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
340 */
341 try {
342 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
343 if ("Nimbus".equals(info.getName())) {
344 javax.swing.UIManager.setLookAndFeel(info.getClassName());
345 break;
346 }
347 }
348 } catch (ClassNotFoundException ex) {
349 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
350 } catch (InstantiationException ex) {
351 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
352 } catch (IllegalAccessException ex) {
353 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
354 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
355 java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
356 }
357 //</editor-fold>
358
359 /* Create and display the form */
360 java.awt.EventQueue.invokeLater(new Runnable() {
361 public void run() {
362 new MainFrame().setVisible(true);
363 }
364 });
365 }
366
367 // Variables declaration - do not modify//GEN-BEGIN:variables
368 private javax.swing.JMenuBar jMenuBar1;
369 private javax.swing.JPopupMenu.Separator jSeparator1;
370 private javax.swing.JMenuItem menuAwaitingPayment;
371 private javax.swing.JMenuItem menuClientMaster;
372 private javax.swing.JMenuItem menuCreateNotice;
373 private javax.swing.JMenuItem menuDatabaseSettings;
374 private javax.swing.JMenuItem menuGenerateRaisedBills;
375 private javax.swing.JMenu menuLawyerNotices;
376 private javax.swing.JMenuItem menuManageNotices;
377 private javax.swing.JMenu menuMaster;
378 private javax.swing.JMenuItem menuNoticeDraftAwaitingApproval;
379 private javax.swing.JMenuItem menuNoticeDraftsApprovedToBeSent;
380 private javax.swing.JMenuItem menuNoticesClarificationPending;
381 private javax.swing.JMenu menuNoticesReports;
382 private javax.swing.JMenuItem menuNoticesSentNotYetDelivered;
383 private javax.swing.JMenuItem menuNoticesToBeDrafted;
384 private javax.swing.JMenu menuSettings;
385 private javax.swing.JMenuItem menuStationery;
386 // End of variables declaration//GEN-END:variables
387 }