function __construct()
 {
     $this->reportFilters = array('civicrm_contribution' => array('filters' => array('receive_date' => array(), 'comparison_date' => array('title' => ts('Comparison Date Range'), 'pseudofield' => TRUE, 'type' => CRM_Report_Form::OP_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, 'required' => TRUE), 'report_date' => array('title' => ts('Report Date Range'), 'pseudofield' => TRUE, 'type' => CRM_Report_Form::OP_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, 'required' => TRUE), 'behaviour_type' => array('title' => ts('Donor Behavior'), 'pseudofield' => TRUE, 'type' => CRM_Report_Form::OP_STRING, 'operatorType' => CRM_Report_Form::OP_SELECT, 'required' => TRUE, 'options' => array('renewed' => ts('Renewed Donors'), 'new' => ts('New Donor (since comparison period'), 'lapsed' => ts('Lapsed Donors from Comparison Period'), 'prior' => ts('All Lapsed Donors'), 'recovered' => ts('Recovered Donors'), 'first' => ts('First Time Donor'), 'increased' => ts('Donors with increased giving'), 'decreased' => ts('Donor with decreased giving'), 'every' => ts('All donors in main period'))))));
     $this->_columns = array_merge_recursive($this->reportFilters, $this->getContributionColumns(array('fields' => FALSE, 'order_by' => FALSE))) + $this->getContactColumns() + $this->getContributionSummaryColumns(array('prefix' => 'main', 'prefix_label' => ts('Main Range '))) + $this->getContributionSummaryColumns(array('prefix' => 'comparison', 'prefix_label' => ts('Comparison Range ')));
     $this->_columns['civicrm_contact']['fields']['display_name']['default'] = TRUE;
     $this->_columns['civicrm_contact']['fields']['id']['default'] = TRUE;
     $this->_columns['civicrm_contribution']['filters']['receive_date']['pseudofield'] = TRUE;
     $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['default'] = array(array_search('Completed', $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['options']));
     $this->_aliases['civicrm_contact'] = 'civicrm_report_contact';
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     parent::__construct();
 }
 function __construct()
 {
     $this->_statuses = array('new', 'recovered', 'renewed');
     $this->_barChartLegend = ts('Contributors previous to the Period behaviour in period');
     $this->reportFilters = array('civicrm_contribution' => array('filters' => array('receive_date' => array(), 'contribution_baseline_interval' => array('title' => ts('Contribution Time Interval'), 'pseudofield' => TRUE, 'operatorType' => CRM_Report_Form::OP_SELECT, 'default' => 12, 'type' => CRM_Report_Form::OP_INT, 'required' => TRUE, 'options' => array('6' => '6 months', '12' => '12 months')), 'contribution_renewal_comparison' => array('title' => ts('Renewal timeframe'), 'pseudofield' => TRUE, 'operatorType' => CRM_Report_Form::OP_SELECT, 'default' => 12, 'type' => CRM_Report_Form::OP_INT, 'options' => array('12' => '12 months', '18' => '18 months')), 'contribution_timeframe' => array('title' => ts('Number of months to look back'), 'pseudofield' => TRUE, 'type' => CRM_Report_Form::OP_INT, 'default' => 60))));
     $this->_columns = array_merge_recursive($this->reportFilters, $this->getContributionColumns(array('fields' => FALSE, 'order_by' => FALSE)));
     $this->_columns['civicrm_contribution']['filters']['receive_date']['operatorType'] = parent::OP_SINGLEDATE;
     $this->_columns['civicrm_contribution']['filters']['receive_date']['title'] = 'Cut-off date';
     $this->_columns['civicrm_contribution']['filters']['receive_date']['operations'] = array('to' => 'Is equal to');
     $this->_columns['civicrm_contribution']['filters']['receive_date']['default'] = date('m/d/Y', strtotime('31 Dec last year'));
     // $this->_columns['civicrm_contribution']['filters'] ['receive_date']['pseudofield'] = TRUE;
     $this->_aliases['civicrm_contact'] = 'civicrm_report_contact';
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     parent::__construct();
 }
 function __construct()
 {
     $this->_statuses = array('renewed', 'lapsed');
     $this->barChartLegend = ts('Subsequent contributions for Contributors in Base Period');
     $this->reportFilters = array('civicrm_contribution' => array('filters' => array('receive_date' => array(), 'contribution_baseline_interval' => array('title' => ts('Contribution Time Interval'), 'pseudofield' => TRUE, 'operatorType' => CRM_Report_Form::OP_INT, 'default' => 12, 'type' => CRM_Report_Form::OP_INT, 'required' => TRUE, 'operations' => array('eq' => 'Is equal to')), 'contribution_renewal_comparison' => array('title' => ts('Renewal timeframe'), 'pseudofield' => TRUE, 'operations' => array('eq' => 'Is equal to'), 'default' => 12, 'type' => CRM_Report_Form::OP_INT), 'contribution_no_periods' => array('title' => ts('Number of periods to show'), 'pseudofield' => TRUE, 'operatorType' => CRM_Report_Form::OP_SELECT, 'default' => 4, 'operations' => array('eq' => 'Is equal to'), 'type' => CRM_Report_Form::OP_INT, 'options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6)))));
     $this->_columns = array_merge_recursive($this->reportFilters, $this->getContributionColumns(array('fields' => FALSE, 'order_by' => FALSE)));
     $this->_columns['civicrm_contribution']['filters']['receive_date']['operatorType'] = parent::OP_SINGLEDATE;
     $this->_columns['civicrm_contribution']['filters']['receive_date']['title'] = 'Cut-off date';
     $this->_columns['civicrm_contribution']['filters']['receive_date']['operations'] = array('to' => 'Is equal to');
     $this->_columns['civicrm_contribution']['filters']['receive_date']['default'] = date('m/d/Y', strtotime('31 Dec last year'));
     $this->_columns['civicrm_contribution']['filters']['receive_date']['pseudofield'] = TRUE;
     $this->_aliases['civicrm_contact'] = 'civicrm_report_contact';
     $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['default'] = array(array_search('Completed', $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['options']));
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     parent::__construct();
 }
 function __construct()
 {
     $this->_statuses = array('first');
     $this->_barChartLegend = ts('New Contributors');
     $this->reportFilters = array('civicrm_contribution' => array('filters' => array('receive_date' => array(), 'contribution_baseline_interval' => array('title' => ts('Contribution Time Interval'), 'pseudofield' => TRUE, 'default' => 3, 'operatorType' => CRM_Report_Form::OP_SELECT, 'required' => TRUE, 'options' => array('1' => 'Monthly', '3' => 'Quarterly', '6' => '6 monthly', '12' => 'Yearly')), 'contribution_no_periods' => array('title' => ts('Number of periods to show'), 'pseudofield' => TRUE, 'operatorType' => CRM_Report_Form::OP_SELECT, 'default' => 4, 'operations' => array('eq' => 'Is equal to'), 'type' => CRM_Report_Form::OP_INT, 'options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6)), 'contribution_timeframe' => array('title' => ts('Number of months to look back'), 'pseudofield' => TRUE, 'operations' => array('eq' => ts('Is equal to')), 'type' => CRM_Report_Form::OP_INT, 'default' => 120))));
     $this->_columns = array_merge_recursive($this->reportFilters, $this->getContributionColumns(array('fields' => FALSE, 'order_by' => FALSE)));
     $this->_columns['civicrm_contribution']['filters']['receive_date']['operatorType'] = parent::OP_SINGLEDATE;
     $this->_columns['civicrm_contribution']['filters']['receive_date']['title'] = 'End Date of Reporting Period';
     $this->_columns['civicrm_contribution']['filters']['receive_date']['operations'] = array('to' => 'Is equal to');
     $this->_columns['civicrm_contribution']['filters']['receive_date']['default'] = date('m/d/Y', strtotime($this->getLastDayOfQuarter()));
     $this->_columns['civicrm_contribution']['filters']['receive_date']['pseudofield'] = TRUE;
     $this->_aliases['civicrm_contact'] = 'civicrm_report_contact';
     $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['default'] = array(array_search('Completed', $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['options']));
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     parent::__construct();
 }
 function __construct()
 {
     $this->_kpiSpecs = array('donor_number' => array('type' => CRM_Utils_Type::T_INT, 'title' => ts('Total Number of Donors'), 'contact_type_title' => ts('Total Number of %1 Donors'), 'link_status' => 'every'), 'total_amount' => array('type' => CRM_Utils_Type::T_MONEY, 'title' => ts('Amount Raised'), 'contact_type_title' => ts('Amount Raised From %1s'), 'link_status' => 'every'), 'average_donation' => array('type' => CRM_Utils_Type::T_MONEY, 'title' => ts('Average Donation'), 'contact_type_title' => ts('Average Donation From %1s'), 'link_status' => 'every'), 'no_increased_donations' => array('type' => CRM_Utils_Type::T_INT, 'title' => ts('Donors who Increased their donation'), 'contact_type_title' => ts('%1 Donors who Increased their donation'), 'link_status' => 'increased'), 'current_pledge_count' => array('type' => CRM_Utils_Type::T_INT, 'title' => ts('Active Pledges'), 'contact_type_title' => ts('%1 Donors with active pledges'), 'link_status' => NULL), 'current_recur_count' => array('type' => CRM_Utils_Type::T_INT, 'title' => ts('Active Recurring Contributions'), 'contact_type_title' => ts('%1 Donors with active recurring contributions'), 'link_status' => NULL), 'current_sustainer_count' => array('type' => CRM_Utils_Type::T_INT, 'title' => ts('Sustaining Members'), 'contact_type_title' => ts('%1 Sustaining  Members'), 'link_status' => NULL), 'highest_donation' => array('type' => CRM_Utils_Type::T_MONEY, 'title' => ts('Largest Donation'), 'contact_type_title' => ts('Largest Donation From %1s'), 'link_status' => 'every'), 'lowest_donation' => array('type' => CRM_Utils_Type::T_MONEY, 'title' => ts('Smallest Donation'), 'contact_type_title' => ts('Smallest Donation From %1s'), 'link_status' => 'every'));
     $extraDefault = array();
     $this->setFinancialType();
     if ($this->financialTypeField == 'financial_type_id') {
         // we are dealing with a 4.3 + install so we will also get contact created data
         $this->_kpiSpecs['contact_count'] = array('type' => CRM_Utils_Type::T_INT, 'title' => ts('New Contacts in Database Matching Giving Criteria'), 'contact_type_title' => ts('New %1s in Database Matching Giving Criteria'), 'link_status' => NULL);
         $this->_kpiSpecs['contact_count_all'] = array('type' => CRM_Utils_Type::T_INT, 'title' => ts('All New Contacts in Database'), 'contact_type_title' => ts('New %1s in Database'), 'link_status' => NULL);
         $extraDefault = array('contact_count_all');
     }
     foreach ($this->_kpiSpecs as $specKey => $specs) {
         $contactTypes = $this->getContactTypeOptions();
         $this->_kpiDescriptors[$specKey] = ts($specs['title']);
         foreach ($contactTypes as $contactType => $contactTypeName) {
             $this->_kpiDescriptors[$specKey . '__' . strtolower($contactType)] = ts($specs['contact_type_title'], array($contactType, 'String'));
         }
     }
     $defaultFilters = array('donor_number', 'total_amount', 'total_amount__individual', 'average_donation__individual', 'no_increased_donations__individual', 'current_sustainer_count');
     if ($extraDefault) {
         $defaultFilters += $extraDefault;
     }
     $this->_columns = array('pseudotable' => array('name' => 'civicrm_report_instance', 'filters' => array('report_options' => array('pseudofield' => TRUE, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->_kpiDescriptors, 'title' => ts('Selected Performance Indicators'), 'default' => $defaultFilters)))) + $this->getContributionColumns(array('fields' => FALSE, 'order_by' => FALSE));
     //  unset($this->_columns['civicrm_contribution']['filters']['receive_date']);
     $this->_columns['civicrm_contribution']['filters']['receive_date']['default'] = array('from' => date('m/d/Y', strtotime('first day of January this year')), 'to' => date('m/d/Y'));
     $this->_columns['civicrm_contribution']['filters']['receive_date']['title'] = 'Report Main Date Range';
     $this->_columns['civicrm_contribution']['filters']['receive_date']['pseudofield'] = TRUE;
     $this->_aliases['civicrm_contact'] = 'civicrm_report_contact';
     $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['default'] = array(array_search('Completed', $this->_columns['civicrm_contribution']['filters']['contribution_status_id']['options']));
     $this->_tagFilter = TRUE;
     $this->_groupFilter = TRUE;
     parent::__construct();
 }