diff --git a/CRM/Grant/BAO/GrantBudget.php b/CRM/Grant/BAO/GrantBudget.php index a641fac..027acb8 100644 --- a/CRM/Grant/BAO/GrantBudget.php +++ b/CRM/Grant/BAO/GrantBudget.php @@ -37,17 +37,18 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget { LEFT JOIN civicrm_grant cg ON cg.financial_type_id = cft.id AND cg.status_id IN (%4) AND cg.decision_date >= %2 AND cg.decision_date <= %3 - $where + {$where} GROUP BY cft.id ORDER BY cft.name"; $result = CRM_Core_DAO::executeQuery($sql, $qParams); while ($result->fetch()) { $grantBudget[$result->id] = [ + 'id' => $result->id, 'name' => $result->name, - 'budget' => $result->budget, - 'total_amount_granted' => $result->total_amount_granted, - 'balance_amount' => ($result->budget - $result->total_amount_granted), + 'budget' => CRM_Utils_Money::format($result->budget), + 'total_amount_granted' => CRM_Utils_Money::format($result->total_amount_granted), + 'balance_amount' => CRM_Utils_Money::format(($result->budget - $result->total_amount_granted)), ]; } return $grantBudget; diff --git a/CRM/Grant/Page/AnnualBudgets.php b/CRM/Grant/Page/AnnualBudgets.php index 52788bc..810cf7e 100644 --- a/CRM/Grant/Page/AnnualBudgets.php +++ b/CRM/Grant/Page/AnnualBudgets.php @@ -43,6 +43,16 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic { return ts('Annual Grant Budget'); } + /** + * Get name of edit form. + * + * @return string + * Classname of edit form. + */ + public function editForm() { + return 'CRM_Grant_Page_AnnualBudgets'; + } + /** * Get user context. * diff --git a/api/v3/GrantBudget.php b/api/v3/GrantBudget.php index 43fd86c..fcac915 100644 --- a/api/v3/GrantBudget.php +++ b/api/v3/GrantBudget.php @@ -13,6 +13,9 @@ * @return array */ function civicrm_api3_grant_budget_create($params) { + if (!empty($params['budget'])) { + $params['budget'] = CRM_Utils_Rule::cleanMoney($params['budget']); + } return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'GrantBudget'); } diff --git a/templates/CRM/Grant/Page/AnnualBudgets.tpl b/templates/CRM/Grant/Page/AnnualBudgets.tpl index a49c7ff..80ba8a1 100644 --- a/templates/CRM/Grant/Page/AnnualBudgets.tpl +++ b/templates/CRM/Grant/Page/AnnualBudgets.tpl @@ -1,3 +1,20 @@
{ts}Endowement{/ts} | +{ts}Annual Budget{/ts} | +{ts}Amount Awarded{/ts} | +{ts}Amound Remaining{/ts} | + + {crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=2018} + {foreach from=$result.values item=row} +
---|---|---|---|
{$row.name} | +{$row.budget} | +{$row.total_amount_granted} | +{$row.balance_amount} | +