Adding to the billing dashboard.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 14 Dec 2017 21:31:17 +0000 (16:31 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 14 Dec 2017 21:31:17 +0000 (16:31 -0500)
Setup count of pending (not overdue)
Setup count of over due.

models/admin/billing/index.php
models/admin/settings/notificationTypes.php
views/admin/billing/index.html

index 9869c30..e00e1d0 100644 (file)
@@ -106,6 +106,10 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices
         $accountUpdateError = false;
         $accountAdded       = false;
         $accountInsertError = false;
+        $limit              = 20;
+        $overdue            = false;
+        $numberOverdue      = 0;
+        $pending            = false;
 
         // For lockedToMember
         $lockedToMember = false;
@@ -212,12 +216,21 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices
             $view = 'editAccount';
             break;
         case 'list':
-            // Get list of pending invoices
-            $where = 'T.paid <> true';
-            $pendingInvoices = $this->getList( $where );
-            // echo '<pre>$pendingInvoices: ' . print_r( $pendingInvoices, true ) . '</pre>';
-            $numberPending = $this->getStats( $where );
-            // echo '<pre>$stats: ' . print_r( $stats, true ) . '</pre>';
+            // Get list of pending invoices ( not overdue )
+            $pendingWhere = 'T.paid <> true AND due_date > NOW()';
+            $start        = 1;
+            $pending      = $this->getList( $pendingWhere, 'transaction_time', true, 'id', $start, $limit );
+            /**
+             * $pending = array( start, limit, returned, last, list = array...)
+             */
+            // echo '<pre>$pending: ' . print_r( $pending, true ) . '</pre>';
+            $numberPending = $pending['returned'];
+
+            // Get the number of over due invoices
+            $overDueWhere  = 'T.paid <> true AND due_date > NOW()';
+            $start         = 1;
+            $overdue       = $this->getList( $overDueWhere, 'transaction_time', true, 'id', $start, $limit );
+            $numberOverDue = $overdue['returned'];
 
             break;
         }
@@ -229,6 +242,7 @@ class GlmMembersAdmin_billing_index extends GlmDataInvoices
             'fromMemberMenu'     => ( defined('GLM_MEMBERS_BILLING_MEMBER_MENU' ) ? true: false ),
             'lockedToMember'     => $lockedToMember,
             'numberPending'      => $numberPending,
+            'numberOverdue'      => $numberOverdue,
             'memberID'           => $this->memberID,
             'haveMember'         => $haveMember,
             'haveAccount'        => $haveAccount,
index a5103bd..6dc403d 100644 (file)
@@ -142,7 +142,7 @@ class GlmMembersAdmin_settings_notificationTypes extends GlmDataNotificationType
             $option = $_REQUEST['option'];
         }
 
-        switch($_REQUEST['option']) {
+        switch( $option ) {
         case 'test':
             echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
             require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH .  '/notifications.php';
index e6d81ee..efdb229 100644 (file)
@@ -6,14 +6,15 @@
 {/if}
 
     <table class="glm-admin-table">
+        <tr><th>Number of Over Due Invoices Listed: </th><td> {if !$numberOverdue}0{else}{$numberOverdue}{/if} </td></tr>
         <tr>
-            <td colspan="2" align="">
+            <td>
+
             </td>
         </tr>
     </table>
-
     <table class="glm-admin-table">
-        <tr><th>Number of Pending Invoices Listed: </th><td> {$numberPending} </td></tr>
+        <tr><th>Number of Pending Invoices Listed: </th><td> {if !$numberPending}0{else}{$numberPending}{/if} </td></tr>
     </table>
 
 {include file='admin/footer.html'}