Reporting Functionality - added few reports
authorHarishankar <v.harishankar@gmail.com>
Thu, 2 Apr 2020 10:15:08 +0000 (15:45 +0530)
committerHarishankar <v.harishankar@gmail.com>
Thu, 2 Apr 2020 10:15:08 +0000 (15:45 +0530)
Added a few reports to the reporting functionality from the menus.

src/habeas/MainFrame.form
src/habeas/MainFrame.java
src/habeas/NoticesReportViewDialog.form
src/habeas/NoticesReportViewDialog.java
src/habeas/Utility.java

index 3328dce..b91160d 100644 (file)
                 <Property name="text" type="java.lang.String" value="Reports"/>
               </Properties>
               <SubComponents>
-                <MenuItem class="javax.swing.JMenuItem" name="menuAwaitingPayment">
+                <MenuItem class="javax.swing.JMenuItem" name="menuNoticesClarificationPending">
                   <Properties>
-                    <Property name="mnemonic" type="int" value="97"/>
-                    <Property name="text" type="java.lang.String" value="Bills awaiting payment..."/>
+                    <Property name="mnemonic" type="int" value="99"/>
+                    <Property name="text" type="java.lang.String" value="Clarifications pending..."/>
                   </Properties>
                   <Events>
-                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuAwaitingPaymentActionPerformed"/>
+                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuNoticesClarificationPendingActionPerformed"/>
+                  </Events>
+                </MenuItem>
+                <MenuItem class="javax.swing.JMenuItem" name="menuNoticeDraftAwaitingApproval">
+                  <Properties>
+                    <Property name="mnemonic" type="int" value="100"/>
+                    <Property name="text" type="java.lang.String" value="Drafts to be approved..."/>
+                  </Properties>
+                  <Events>
+                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuNoticeDraftAwaitingApprovalActionPerformed"/>
                   </Events>
                 </MenuItem>
                 <MenuItem class="javax.swing.JMenuItem" name="menuNoticesSentNotYetDelivered">
                     <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuNoticesSentNotYetDeliveredActionPerformed"/>
                   </Events>
                 </MenuItem>
+                <MenuItem class="javax.swing.JMenuItem" name="menuAwaitingPayment">
+                  <Properties>
+                    <Property name="mnemonic" type="int" value="97"/>
+                    <Property name="text" type="java.lang.String" value="Bills awaiting payment..."/>
+                  </Properties>
+                  <Events>
+                    <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuAwaitingPaymentActionPerformed"/>
+                  </Events>
+                </MenuItem>
               </SubComponents>
             </Menu>
           </SubComponents>
index 3ff0418..3e84430 100644 (file)
@@ -39,8 +39,10 @@ public class MainFrame extends javax.swing.JFrame {
         jSeparator1 = new javax.swing.JPopupMenu.Separator();
         menuGenerateRaisedBills = new javax.swing.JMenuItem();
         menuNoticesReports = new javax.swing.JMenu();
-        menuAwaitingPayment = new javax.swing.JMenuItem();
+        menuNoticesClarificationPending = new javax.swing.JMenuItem();
+        menuNoticeDraftAwaitingApproval = new javax.swing.JMenuItem();
         menuNoticesSentNotYetDelivered = new javax.swing.JMenuItem();
+        menuAwaitingPayment = new javax.swing.JMenuItem();
         menuSettings = new javax.swing.JMenu();
         menuDatabaseSettings = new javax.swing.JMenuItem();
         menuStationery = new javax.swing.JMenuItem();
@@ -97,14 +99,23 @@ public class MainFrame extends javax.swing.JFrame {
         menuNoticesReports.setMnemonic('r');
         menuNoticesReports.setText("Reports");
 
-        menuAwaitingPayment.setMnemonic('a');
-        menuAwaitingPayment.setText("Bills awaiting payment...");
-        menuAwaitingPayment.addActionListener(new java.awt.event.ActionListener() {
+        menuNoticesClarificationPending.setMnemonic('c');
+        menuNoticesClarificationPending.setText("Clarifications pending...");
+        menuNoticesClarificationPending.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
-                menuAwaitingPaymentActionPerformed(evt);
+                menuNoticesClarificationPendingActionPerformed(evt);
             }
         });
-        menuNoticesReports.add(menuAwaitingPayment);
+        menuNoticesReports.add(menuNoticesClarificationPending);
+
+        menuNoticeDraftAwaitingApproval.setMnemonic('d');
+        menuNoticeDraftAwaitingApproval.setText("Drafts to be approved...");
+        menuNoticeDraftAwaitingApproval.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                menuNoticeDraftAwaitingApprovalActionPerformed(evt);
+            }
+        });
+        menuNoticesReports.add(menuNoticeDraftAwaitingApproval);
 
         menuNoticesSentNotYetDelivered.setMnemonic('s');
         menuNoticesSentNotYetDelivered.setText("Notices sent not yet delivered...");
@@ -115,6 +126,15 @@ public class MainFrame extends javax.swing.JFrame {
         });
         menuNoticesReports.add(menuNoticesSentNotYetDelivered);
 
+        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);
@@ -222,6 +242,37 @@ public class MainFrame extends javax.swing.JFrame {
         frm.setupReportTable(rep, REPORT_TITLE_NOTICES_SENT_NOT_DELIVERED, cols, data);
         frm.setVisible (true);
     }//GEN-LAST:event_menuNoticesSentNotYetDeliveredActionPerformed
+
+    private void menuNoticeDraftAwaitingApprovalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticeDraftAwaitingApprovalActionPerformed
+        // TODO add your handling code here:
+       NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
+       String cols[] = {"Reference Number", "Description", "Entrustment Date", "Client"};
+       int rep = 2;
+       ArrayList<Object> data = Utility.getReportData(rep, -1);
+       if (data == null) {
+           JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
+           return;
+       }
+       frm.setupReportTable(rep, REPORT_TITLE_DRAFTS_AWAITING_APPROVAL, cols, data);
+       frm.setVisible(true);
+    }//GEN-LAST:event_menuNoticeDraftAwaitingApprovalActionPerformed
+
+    private void menuNoticesClarificationPendingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNoticesClarificationPendingActionPerformed
+        // TODO add your handling code here:
+        NoticesReportViewDialog frm = new NoticesReportViewDialog(this, false);
+        String cols[] = {"Reference Number", "Description", "Entrustment Date",
+            "Clarification Remarks", "Client" };
+        int rep = 3;
+        ArrayList<Object> data = Utility.getReportData(rep, -1);
+        if (data == null) {
+            JOptionPane.showMessageDialog(this, ERROR_DISPLAYING_REPORT);
+            return;
+        }
+        frm.setupReportTable(rep, REPORT_TITLE_CLARIFICATIONS_PENDING, cols, data);
+        frm.setVisible(true);
+    }//GEN-LAST:event_menuNoticesClarificationPendingActionPerformed
+    private static final String REPORT_TITLE_CLARIFICATIONS_PENDING = "Clarifications Pending";
+    private static final String REPORT_TITLE_DRAFTS_AWAITING_APPROVAL = "Drafts To Be Approved";
     public static final String REPORT_TITLE_NOTICES_SENT_NOT_DELIVERED = "Notices Sent Not Yet Delivered";
     public static final String ERROR_DISPLAYING_REPORT = "Error displaying report";
     public static final String REPORT_TITLE_BILLS_AWAITING_PAYMENT = "Bills Awaiting Payment";
@@ -272,6 +323,8 @@ public class MainFrame extends javax.swing.JFrame {
     private javax.swing.JMenu menuLawyerNotices;
     private javax.swing.JMenuItem menuManageNotices;
     private javax.swing.JMenu menuMaster;
+    private javax.swing.JMenuItem menuNoticeDraftAwaitingApproval;
+    private javax.swing.JMenuItem menuNoticesClarificationPending;
     private javax.swing.JMenu menuNoticesReports;
     private javax.swing.JMenuItem menuNoticesSentNotYetDelivered;
     private javax.swing.JMenu menuSettings;
index 2a58dd0..0cb16bc 100644 (file)
             <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
               <Table columnCount="0" rowCount="0"/>
             </Property>
+            <Property name="cellSelectionEnabled" type="boolean" value="true"/>
             <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
               <TableColumnModel selectionModel="0"/>
             </Property>
index f9d7a8f..2636cbc 100644 (file)
@@ -77,6 +77,7 @@ public class NoticesReportViewDialog extends javax.swing.JDialog {
 
             }
         ));
+        tableReport.setCellSelectionEnabled(true);
         jScrollPane2.setViewportView(tableReport);
 
         checkFilterByClient.setText("Filter by Client");
index 8795204..d54ace3 100644 (file)
@@ -30,7 +30,16 @@ public class Utility {
     
             "SELECT ReferenceNumber, Description, SentDate, RPADReference, "
             + "ClientName FROM legalnotices INNER JOIN clients ON ClientId=clients.id"
-            + " WHERE NoticeSent=1 AND NoticeDelivered=0;"
+            + " WHERE NoticeSent=1 AND NoticeDelivered=0;",
+            
+            "SELECT ReferenceNumber, Description, EntrustmentDate, ClientName FROM legalnotices"
+            + " INNER JOIN clients ON ClientId=clients.id"
+            + " WHERE DraftCreated=1 AND DraftApproved=0;",
+            
+            "SELECT ReferenceNumber, Description, EntrustmentDate, "
+            + "ClarificationRemarks, ClientName FROM legalnotices INNER JOIN clients ON"
+            + " ClientId=clients.id WHERE ClarificationPending=1;"
+            
     } ;
 
     private static final String[] REPORTS_FILTERED = { "SELECT ReferenceNumber, Description"
@@ -40,7 +49,15 @@ public class Utility {
     
             "SELECT ReferenceNumber, Description, SentDate, RPADReference, "
             + "ClientName FROM legalnotices INNER JOIN clients ON ClientId=clients.id"
-            + " WHERE NoticeSent=1 AND NoticeDelivered=0 AND ClientId=?;"
+            + " WHERE NoticeSent=1 AND NoticeDelivered=0 AND ClientId=?;",
+            
+            "SELECT ReferenceNumber, Description, EntrustmentDate, ClientName FROM legalnotices"
+            + " INNER JOIN clients ON ClientId=clients.id"
+            + " WHERE DraftCreated=1 AND DraftApproved=0 AND ClientId=?;",
+
+            "SELECT ReferenceNumber, Description, EntrustmentDate, "
+            + "ClarificationRemarks, ClientName FROM legalnotices INNER JOIN clients ON"
+            + " ClientId=clients.id WHERE ClarificationPending=1 AND ClientId=?;"            
     } ;    
     
     static void saveStationerySettings (String left_header,