forked from CiviWare/org.agbu.annualgrantbudgets
rewrite budget screen to be multifund-aware
This commit is contained in:
@ -50,7 +50,7 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
||||
}
|
||||
$grantBudgetTableName = CRM_Grant_DAO_GrantBudget::getTableName();
|
||||
$sql = "SELECT cgb.id, cft.name, IFNULL(cgb.budget, 0) AS budget,
|
||||
SUM(IFNULL(cg." . GRANT_AMOUNT_CHECK_FIELD . ", 0)) as total_amount_granted,
|
||||
SUM(IFNULL(trxn." . GRANT_AMOUNT_CHECK_FIELD . ", 0)) as total_amount_granted,
|
||||
cft.id AS financial_type_id
|
||||
FROM civicrm_financial_type cft
|
||||
INNER JOIN " . GRANT_SCHOLARSHIP_CUSTOM_TABLE_NAME . " gs
|
||||
@ -62,6 +62,9 @@ class CRM_Grant_BAO_GrantBudget extends CRM_Grant_DAO_GrantBudget {
|
||||
ON cg.financial_type_id = cft.id AND cg.status_id IN (%4)
|
||||
AND cg." . GRANT_DATE_CHECK_FIELD . " >= %2
|
||||
AND cg." . GRANT_DATE_CHECK_FIELD . " < %3
|
||||
LEFT JOIN civicrm_entity_financial_account cefa
|
||||
ON cefa.entity_table = 'civicrm_financial_type' AND cft.id = cefa.entity_id AND account_relationship = 14
|
||||
LEFT JOIN civicrm_financial_trxn trxn ON trxn.from_financial_account_id = cefa.financial_account_id
|
||||
{$where}
|
||||
GROUP BY cft.id
|
||||
ORDER BY cft.name";
|
||||
|
Reference in New Issue
Block a user