Reporting Functionality - Filter by Client
[habeas.git] / src / habeas / MainFrame.java
index 30458d6..ec3ce33 100644 (file)
@@ -5,6 +5,12 @@
  */
 package habeas;
 
+import java.util.ArrayList;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
+
 /**
  *
  * @author hari
@@ -33,8 +39,13 @@ public class MainFrame extends javax.swing.JFrame {
         menuLawyerNotices = new javax.swing.JMenu();
         menuCreateNotice = new javax.swing.JMenuItem();
         menuManageNotices = new javax.swing.JMenuItem();
+        jSeparator1 = new javax.swing.JPopupMenu.Separator();
+        menuGenerateRaisedBills = new javax.swing.JMenuItem();
+        menuNoticesReports = new javax.swing.JMenu();
+        menuAwaitingPayment = new javax.swing.JMenuItem();
         menuSettings = new javax.swing.JMenu();
         menuDatabaseSettings = new javax.swing.JMenuItem();
+        menuStationery = new javax.swing.JMenuItem();
 
         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
         setTitle("Habeas - Law Office Manager");
@@ -74,6 +85,30 @@ public class MainFrame extends javax.swing.JFrame {
             }
         });
         menuLawyerNotices.add(menuManageNotices);
+        menuLawyerNotices.add(jSeparator1);
+
+        menuGenerateRaisedBills.setMnemonic('G');
+        menuGenerateRaisedBills.setText("Generate Raised Bills...");
+        menuGenerateRaisedBills.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                menuGenerateRaisedBillsActionPerformed(evt);
+            }
+        });
+        menuLawyerNotices.add(menuGenerateRaisedBills);
+
+        menuNoticesReports.setMnemonic('r');
+        menuNoticesReports.setText("Reports");
+
+        menuAwaitingPayment.setMnemonic('a');
+        menuAwaitingPayment.setText("Bills awaiting payment...");
+        menuAwaitingPayment.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                menuAwaitingPaymentActionPerformed(evt);
+            }
+        });
+        menuNoticesReports.add(menuAwaitingPayment);
+
+        menuLawyerNotices.add(menuNoticesReports);
 
         jMenuBar1.add(menuLawyerNotices);
 
@@ -89,6 +124,15 @@ public class MainFrame extends javax.swing.JFrame {
         });
         menuSettings.add(menuDatabaseSettings);
 
+        menuStationery.setMnemonic('S');
+        menuStationery.setText("Stationery Settings...");
+        menuStationery.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                menuStationeryActionPerformed(evt);
+            }
+        });
+        menuSettings.add(menuStationery);
+
         jMenuBar1.add(menuSettings);
 
         setJMenuBar(jMenuBar1);
@@ -131,6 +175,34 @@ public class MainFrame extends javax.swing.JFrame {
         frm.setVisible(true);
     }//GEN-LAST:event_menuManageNoticesActionPerformed
 
+    private void menuStationeryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStationeryActionPerformed
+        // TODO add your handling code here:
+        StationerySettingsDialog frm = new StationerySettingsDialog(this, true);
+        frm.setVisible(true);
+    }//GEN-LAST:event_menuStationeryActionPerformed
+
+    private void menuGenerateRaisedBillsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuGenerateRaisedBillsActionPerformed
+        // TODO add your handling code here:
+        GenerateRaisedBillsDialog frm = new GenerateRaisedBillsDialog(this, true);
+        frm.setVisible(true);
+
+    }//GEN-LAST:event_menuGenerateRaisedBillsActionPerformed
+
+    private void menuAwaitingPaymentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAwaitingPaymentActionPerformed
+        // TODO add your handling code here:
+        NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
+        String [] cols = {"Reference Number", "Description", "Bill Date", "Bill Amount", "Client"};
+        ArrayList<Object> data = Utility.getPendingPaymentBills (-1);
+        if (data == null) {
+            JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
+            return;
+        }
+        frm.setupReportTable(REPORT_TITLE_BILLS_AWAITING_PAYMENT, cols, data);
+        frm.setVisible(true);
+    }//GEN-LAST:event_menuAwaitingPaymentActionPerformed
+    private static final String ERROR_DISPLAYING_REPORT = "Error displaying report";
+    private static final String REPORT_TITLE_BILLS_AWAITING_PAYMENT = "Bills Awaiting Payment";
+
     /**
      * @param args the command line arguments
      */
@@ -168,12 +240,17 @@ public class MainFrame extends javax.swing.JFrame {
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JMenuBar jMenuBar1;
+    private javax.swing.JPopupMenu.Separator jSeparator1;
+    private javax.swing.JMenuItem menuAwaitingPayment;
     private javax.swing.JMenuItem menuClientMaster;
     private javax.swing.JMenuItem menuCreateNotice;
     private javax.swing.JMenuItem menuDatabaseSettings;
+    private javax.swing.JMenuItem menuGenerateRaisedBills;
     private javax.swing.JMenu menuLawyerNotices;
     private javax.swing.JMenuItem menuManageNotices;
     private javax.swing.JMenu menuMaster;
+    private javax.swing.JMenu menuNoticesReports;
     private javax.swing.JMenu menuSettings;
+    private javax.swing.JMenuItem menuStationery;
     // End of variables declaration//GEN-END:variables
 }