added fiscal year select box

This commit is contained in:
CiviWare Solutions 2018-08-12 05:04:21 +05:30
parent f702e0d15a
commit 61ae4f80ea
2 changed files with 28 additions and 0 deletions

View File

@ -39,6 +39,15 @@ class CRM_Grant_Page_AnnualBudgets extends CRM_Core_Page_Basic {
if (empty($fiscalYear)) {
$fiscalYear = date('Y');
}
$fiscalYearOptions = '';
foreach (CRM_Grant_BAO_GrantBudget::getFiscalyear() as $key => $value) {
$extra = '';
if ($key == $fiscalYear) {
$extra = 'selected="selected"';
}
$fiscalYearOptions .= "<option value='{$key}' {$extra}>{$value}</option>";
}
$this->assign('fiscal_year_options', $fiscalYearOptions);
$this->assign('fiscalYear', $fiscalYear);
}

View File

@ -1,4 +1,9 @@
<div class="crm-content-block crm-block">
<label>{ts}Fiscal Year: {/ts}</label>
<select name="fiscal_year" type="text" id="fiscal_year" class="crm-form-select required crm-select2 six">
{$fiscal_year_options}
</select>
</br></br>
<table cellpadding="0" cellspacing="0" border="0" class="row-highlight">
<thead class="sticky">
<th>{ts}Endowement{/ts}</th>
@ -23,3 +28,17 @@
</table>
{crmButton p="civicrm" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#fiscal_year').change(loadPage);
function loadPage() {
window.location.href = CRM.url('civicrm/grant/annual/budgets', {
reset: '1',
fiscalYear: $('#fiscal_year').val()
});
}
});
</script>
{/literal}