From f0472f1733ec3f4818867f096ea4e9a6cf329711 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 22 Aug 2013 22:49:53 +1200 Subject: [PATCH] CRM-13275 fix stats to show total count by currency & grand total Conflicts: packages --- CRM/Report/Form/Pledge/Detail.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/CRM/Report/Form/Pledge/Detail.php b/CRM/Report/Form/Pledge/Detail.php index b3f7cc71d5..6df25dba72 100644 --- a/CRM/Report/Form/Pledge/Detail.php +++ b/CRM/Report/Form/Pledge/Detail.php @@ -313,12 +313,13 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form { $group = "GROUP BY {$this->_aliases['civicrm_pledge']}.currency"; $sql = "{$select} {$this->_from} {$this->_where} {$group}"; $dao = CRM_Core_DAO::executeQuery($sql); - $count = $index = 0; + $count = $index = $totalCount = 0; // this will run once per currency while($dao->fetch()) { $totalAmount = CRM_Utils_Money::format($dao->amount, $dao->currency); $average = CRM_Utils_Money::format($dao->avg, $dao->currency); $count = $dao->count; + $totalCount .= $count; $statistics['counts']['amount' . $index] = array( 'title' => ts('Total Amount Pledged (') . $dao->currency . ')', 'value' => $totalAmount, @@ -329,14 +330,20 @@ class CRM_Report_Form_Pledge_Detail extends CRM_Report_Form { 'value' => $average, 'type' => CRM_Utils_Type::T_STRING, ); + $statistics['counts']['count' . $index] = array( + 'title' => ts('Total No Pledges (') . $dao->currency . ')', + 'value' => $count, + 'type' => CRM_Utils_Type::T_INT, + ); $index ++; } - - $statistics['counts']['count'] = array( - 'title' => ts('Total No Pledges'), - 'value' => $count, - ); - + if($totalCount > $count) { + $statistics['counts']['count' . $index] = array( + 'title' => ts('Total No Pledges'), + 'value' => $totalCount, + 'type' => CRM_Utils_Type::T_INT, + ); + } } return $statistics; } -- 2.25.1