function buildChart(&$rows) { $graphRows = array(); $count = 0; $display = array(); $current_year = $this->_params['yid_value']; $previous_year = $current_year - 1; $interval[$previous_year] = $previous_year; $interval['life_time'] = 'life_time'; foreach ($rows as $key => $row) { $display['life_time'] = CRM_Utils_Array::value('life_time', $display) + $row['civicrm_life_time_total']; $display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year]; } $graphRows['value'] = $display; $chartInfo = array('legend' => ts('Lybunt Report'), 'xname' => ts('Amount'), 'yname' => ts('Year')); if ($this->_params['charts']) { $graphs = CRM_Utils_PChart::reportChart($graphRows, $this->_params['charts'], $interval, $chartInfo); $this->assign('graphFilePath', $graphs['0']['file_name']); $this->_graphPath = $graphs['0']['file_name']; } }
function buildChart(&$rows) { $graphRows = array(); $count = 0; $membershipTypeValues = CRM_Member_PseudoConstant::membershipType(); $isMembershipType = CRM_Utils_Array::value('membership_type_id', $this->_params['group_bys']); $isJoiningDate = CRM_Utils_Array::value('join_date', $this->_params['group_bys']); if (CRM_Utils_Array::value('charts', $this->_params)) { foreach ($rows as $key => $row) { if ($isMembershipType) { $join_date = CRM_Utils_Array::value('civicrm_membership_join_date_start', $row); $displayInterval = CRM_Utils_Array::value('civicrm_membership_join_date_interval', $row); if ($join_date) { list($year, $month) = explode('-', $join_date); } if (CRM_Utils_Array::value('civicrm_membership_join_date_subtotal', $row)) { switch ($this->_interval) { case 'Month': $displayRange = $displayInterval . ' ' . $year; break; case 'Quarter': $displayRange = 'Quarter ' . $displayInterval . ' of ' . $year; break; case 'Week': $displayRange = 'Week ' . $displayInterval . ' of ' . $year; break; case 'Year': $displayRange = $year; break; } $membershipType = $displayRange . "-" . $membershipTypeValues[$row['civicrm_membership_membership_type_id']]; } else { $membershipType = $membershipTypeValues[$row['civicrm_membership_membership_type_id']]; } $interval[$membershipType] = $membershipType; $display[$membershipType] = $row['civicrm_contribution_total_amount_sum']; } else { $graphRows['receive_date'][] = CRM_Utils_Array::value('civicrm_membership_join_date_start', $row); $graphRows[$this->_interval][] = CRM_Utils_Array::value('civicrm_membership_join_date_interval', $row); $graphRows['value'][] = $row['civicrm_contribution_total_amount_sum']; $count++; } } if ($isMembershipType) { $graphRows['value'] = $display; $chartInfo = array('legend' => 'MemberShip Summary', 'xname' => 'Amount', 'yname' => 'Year'); $graphs = CRM_Utils_PChart::reportChart($graphRows, $this->_params['charts'], $interval, $chartInfo); } else { $graphs = CRM_Utils_PChart::chart($graphRows, $this->_params['charts'], $this->_interval); } $this->assign('graphFilePath', $graphs['0']['file_name']); $this->_graphPath = $graphs['0']['file_name']; } }
function buildChart(&$rows) { $graphRows = array(); $count = 0; $current_year = $this->_params['yid_value']; $previous_year = $current_year - 1; $previous_two_year = $current_year - 2; $previous_three_year = $current_year - 3; $upto = $current_year - 4; $interval[$previous_year] = $previous_year; $interval[$previous_two_year] = $previous_two_year; $interval[$previous_three_year] = $previous_three_year; $interval["upto_{$upto}"] = "upto_{$upto}"; foreach ($rows as $key => $row) { $display["upto_{$upto}"] = CRM_Utils_Array::value("upto_{$upto}", $display) + CRM_Utils_Array::value("civicrm_upto_{$upto}", $row); $display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + CRM_Utils_Array::value($previous_year, $row); $display[$previous_two_year] = CRM_Utils_Array::value($previous_two_year, $display) + CRM_Utils_Array::value($previous_two_year, $row); $display[$previous_three_year] = CRM_Utils_Array::value($previous_three_year, $display) + CRM_Utils_Array::value($previous_three_year, $row); } $graphRows['value'] = $display; $chartInfo = array('legend' => 'Sybunt Report', 'xname' => 'Amount', 'yname' => 'Year'); if ($this->_params['charts']) { $graphs = CRM_Utils_PChart::reportChart($graphRows, $this->_params['charts'], $interval, $chartInfo); $this->assign('graphFilePath', $graphs['0']['file_name']); $this->_graphPath = $graphs['0']['file_name']; } }