From 8968c71bdff5a8f342740dc8b463eafe63a5305d Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 14 Dec 2017 16:31:17 -0500 Subject: [PATCH] Adding to the billing dashboard. Setup count of pending (not overdue) Setup count of over due. --- models/admin/billing/index.php | 26 ++++++++++++++++----- models/admin/settings/notificationTypes.php | 2 +- views/admin/billing/index.html | 7 +++--- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/models/admin/billing/index.php b/models/admin/billing/index.php index 9869c30..e00e1d0 100644 --- a/models/admin/billing/index.php +++ b/models/admin/billing/index.php @@ -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 '
$pendingInvoices: ' . print_r( $pendingInvoices, true ) . '
'; - $numberPending = $this->getStats( $where ); - // echo '
$stats: ' . print_r( $stats, true ) . '
'; + // 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 '
$pending: ' . print_r( $pending, true ) . '
'; + $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, diff --git a/models/admin/settings/notificationTypes.php b/models/admin/settings/notificationTypes.php index a5103bd..6dc403d 100644 --- a/models/admin/settings/notificationTypes.php +++ b/models/admin/settings/notificationTypes.php @@ -142,7 +142,7 @@ class GlmMembersAdmin_settings_notificationTypes extends GlmDataNotificationType $option = $_REQUEST['option']; } - switch($_REQUEST['option']) { + switch( $option ) { case 'test': echo '
$_REQUEST: ' . print_r( $_REQUEST, true ) . '
'; require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/notifications.php'; diff --git a/views/admin/billing/index.html b/views/admin/billing/index.html index e6d81ee..efdb229 100644 --- a/views/admin/billing/index.html +++ b/views/admin/billing/index.html @@ -6,14 +6,15 @@ {/if} + -
Number of Over Due Invoices Listed: {if !$numberOverdue}0{else}{$numberOverdue}{/if}
+ +
- - +
Number of Pending Invoices Listed: {$numberPending}
Number of Pending Invoices Listed: {if !$numberPending}0{else}{$numberPending}{/if}
{include file='admin/footer.html'} -- 2.17.1