Changes to code
This commit is contained in:
parent
0c4fe4ccd6
commit
b5c998846e
@ -37,17 +37,18 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
|||||||
LEFT JOIN civicrm_grant cg
|
LEFT JOIN civicrm_grant cg
|
||||||
ON cg.financial_type_id = cft.id AND cg.status_id IN (%4)
|
ON cg.financial_type_id = cft.id AND cg.status_id IN (%4)
|
||||||
AND cg.decision_date >= %2 AND cg.decision_date <= %3
|
AND cg.decision_date >= %2 AND cg.decision_date <= %3
|
||||||
$where
|
{$where}
|
||||||
GROUP BY cft.id
|
GROUP BY cft.id
|
||||||
ORDER BY cft.name";
|
ORDER BY cft.name";
|
||||||
$result = CRM_Core_DAO::executeQuery($sql, $qParams);
|
$result = CRM_Core_DAO::executeQuery($sql, $qParams);
|
||||||
|
|
||||||
while ($result->fetch()) {
|
while ($result->fetch()) {
|
||||||
$grantBudget[$result->id] = [
|
$grantBudget[$result->id] = [
|
||||||
|
'id' => $result->id,
|
||||||
'name' => $result->name,
|
'name' => $result->name,
|
||||||
'budget' => $result->budget,
|
'budget' => CRM_Utils_Money::format($result->budget),
|
||||||
'total_amount_granted' => $result->total_amount_granted,
|
'total_amount_granted' => CRM_Utils_Money::format($result->total_amount_granted),
|
||||||
'balance_amount' => ($result->budget - $result->total_amount_granted),
|
'balance_amount' => CRM_Utils_Money::format(($result->budget - $result->total_amount_granted)),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return $grantBudget;
|
return $grantBudget;
|
||||||
|
@ -43,6 +43,16 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic {
|
|||||||
return ts('Annual Grant Budget');
|
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.
|
* Get user context.
|
||||||
*
|
*
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function civicrm_api3_grant_budget_create($params) {
|
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');
|
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'GrantBudget');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
<div class="crm-content-block crm-block">
|
<div class="crm-content-block crm-block">
|
||||||
|
<table cellpadding="0" cellspacing="0" border="0" class="row-highlight">
|
||||||
|
<thead class="sticky">
|
||||||
|
<th>{ts}Endowement{/ts}</th>
|
||||||
|
<th>{ts}Annual Budget{/ts}</th>
|
||||||
|
<th>{ts}Amount Awarded{/ts}</th>
|
||||||
|
<th>{ts}Amound Remaining{/ts}</th>
|
||||||
|
</thead>
|
||||||
|
{crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=2018}
|
||||||
|
{foreach from=$result.values item=row}
|
||||||
|
<tr id="GrantBudget-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
|
||||||
|
<td>{$row.name}</td>
|
||||||
|
<td class="crm-editable" data-field="budget" data-type="text">{$row.budget}</td>
|
||||||
|
<td>{$row.total_amount_granted}</td>
|
||||||
|
<td>{$row.balance_amount}</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</table>
|
||||||
|
{crmButton p="civicrm" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<path>civicrm/grant/annual/budgets</path>
|
<path>civicrm/grant/annual/budgets</path>
|
||||||
<page_callback>CRM_Grant_Page_AnnualBudgets</page_callback>
|
<page_callback>CRM_Grant_Page_AnnualBudgets</page_callback>
|
||||||
<title>Grant Annual Budgets</title>
|
<title>Scholarship Annual Award Budgets</title>
|
||||||
<access_arguments>access CiviCRM</access_arguments>
|
<access_arguments>access CiviCRM</access_arguments>
|
||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
|
Loading…
Reference in New Issue
Block a user