init
This commit is contained in:
553
modules/Charts/PredefinedChart.php
Executable file
553
modules/Charts/PredefinedChart.php
Executable file
@@ -0,0 +1,553 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
* $Id$
|
||||
* Description: Class defining queries of predefined charts.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
class PredefinedChart{
|
||||
var $params = array();
|
||||
|
||||
function PredefinedChart(){
|
||||
}
|
||||
|
||||
function predefinedChartQuery($chart, $params=array()){
|
||||
switch($chart){
|
||||
case 'pipeline_by_sales_stage':
|
||||
case 'pipeline_by_sales_stage_funnel':
|
||||
return $this->pipelineBySalesStageQuery();
|
||||
case 'lead_source_by_outcome':
|
||||
return $this->leadSourceByOutcomeQuery($params);
|
||||
case 'outcome_by_month':
|
||||
return $this->outcomeByMonthQuery();
|
||||
case 'pipeline_by_lead_source':
|
||||
return $this->pipelineByLeadSourceQuery($params);
|
||||
case 'my_modules_used_last_30_days':
|
||||
return $this->myModuleUsageLast30Days();
|
||||
|
||||
|
||||
|
||||
|
||||
default:
|
||||
return $this->customChartQuery($chart);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function pipelineBySalesStageQuery(){
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
|
||||
global $current_user;
|
||||
global $timedate;
|
||||
global $app_list_strings;
|
||||
|
||||
//get the dates to display
|
||||
$user_date_start = $current_user->getPreference('pbss_date_start');
|
||||
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['pbss_date_start'])) {
|
||||
$date_start = $timedate->to_display_date($user_date_start, false);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_date_start']) && $_REQUEST['pbss_date_start'] != '') {
|
||||
$date_start = $_REQUEST['pbss_date_start'];
|
||||
$ds = $timedate->to_db_date($date_start, false);
|
||||
$current_user->setPreference('pbss_date_start', $ds);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_date_start']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date($timedate->get_date_format(), time());
|
||||
}
|
||||
|
||||
$user_date_end = $current_user->getPreference('pbss_date_end');
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['pbss_date_end'])) {
|
||||
$date_end = $timedate->to_display_date($user_date_end, false);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($user_date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_date_end']) && $_REQUEST['pbss_date_end'] != '') {
|
||||
$date_end = $_REQUEST['pbss_date_end'];
|
||||
$de = $timedate->to_db_date($date_end, false);
|
||||
$current_user->setPreference('pbss_date_end', $de);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug( $current_user->getPreference('pbss_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date($timedate->get_date_format(), strtotime('2010-01-01'));
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] not found. Using: ".$date_end);
|
||||
}
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$datax_selected= array();
|
||||
$user_tempx = $current_user->getPreference('pbss_sales_stages');
|
||||
//get list of sales stage keys to display
|
||||
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbss_sales_stages'])) {
|
||||
$tempx = $user_tempx ;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($user_tempx );
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_sales_stages']) && count($_REQUEST['pbss_sales_stages']) > 0) {
|
||||
$tempx = $_REQUEST['pbss_sales_stages'];
|
||||
$current_user->setPreference('pbss_sales_stages', $_REQUEST['pbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_sales_stages'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
|
||||
array_push($datax_selected,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['sales_stage_dom'];
|
||||
$datax_selected = array_keys($app_list_strings['sales_stage_dom']);
|
||||
}
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbss_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbss_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_ids']) && count($_REQUEST['pbss_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbss_ids'];
|
||||
$current_user->setPreference('pbss_ids', $_REQUEST['pbss_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND opportunities.sales_stage IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
$date_start = $timedate->swap_formats($date_start, $timedate->get_date_format(), $timedate->dbDayFormat);
|
||||
$date_end = $timedate->swap_formats($date_end, $timedate->get_date_format(), $timedate->dbDayFormat);
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND opportunities.date_closed >= ". db_convert("'".$date_start."'",'date'). "
|
||||
AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date') ;
|
||||
$where .= " AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage";
|
||||
|
||||
$additional_params = array( 'date_start' => $date_start, 'date_closed' => $date_end, );
|
||||
|
||||
$this->params = $additional_params;
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function leadSourceByOutcomeQuery($filters){
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
|
||||
global $current_user;
|
||||
global $app_list_strings;
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
|
||||
$tempx = $filters['lsbo_lead_sources'];
|
||||
if (!empty($lsbo_lead_sources) && count($lsbo_lead_sources) > 0 && !isset($_REQUEST['lsbo_lead_sources'])) {
|
||||
$GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:");
|
||||
$GLOBALS['log']->fatal($tempx);
|
||||
}
|
||||
elseif (isset($_REQUEST['lsbo_lead_sources']) && count($_REQUEST['lsbo_lead_sources']) > 0) {
|
||||
$tempx = $_REQUEST['lsbo_lead_sources'];
|
||||
$current_user->setPreference('lsbo_lead_sources', $_REQUEST['lsbo_lead_sources']);
|
||||
$GLOBALS['log']->fatal("_REQUEST['lsbo_lead_sources'] is:");
|
||||
$GLOBALS['log']->fatal($_REQUEST['lsbo_lead_sources']);
|
||||
$GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:");
|
||||
$GLOBALS['log']->fatal($current_user->getPreference('lsbo_lead_sources'));
|
||||
}
|
||||
//set $datax using selected sales stage keys
|
||||
if (!empty($tempx) && sizeof($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['lead_source_dom'][$key];
|
||||
array_push($selected_datax,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['lead_source_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
}
|
||||
|
||||
$datay = $datax;
|
||||
|
||||
$ids = $filters['lsbo_ids'];
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($ids) && count($ids) != 0 && !isset($_REQUEST['lsbo_ids'])) {
|
||||
$GLOBALS['log']->debug("_SESSION['lsbo_ids'] is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['lsbo_ids']) && count($_REQUEST['lsbo_ids']) > 0) {
|
||||
$ids = $_REQUEST['lsbo_ids'];
|
||||
$current_user->setPreference('lsbo_ids', $_REQUEST['lsbo_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['lsbo_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['lsbo_ids']);
|
||||
$GLOBALS['log']->debug("user->getPreference('lsbo_ids') is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('lsbo_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
|
||||
$opp = new Opportunity();
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count>0) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datay
|
||||
$count = count($datay);
|
||||
$datayArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datay as $key=>$value) {
|
||||
$datayArr[] = "'".$key."'";
|
||||
}
|
||||
$datayArr = join(",",$datayArr);
|
||||
$where .= "AND opportunities.lead_source IN ($datayArr) ";
|
||||
}
|
||||
$query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where." AND opportunities.deleted=0 ";
|
||||
$query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function outcomeByMonthQuery(){
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
|
||||
global $current_user;
|
||||
global $timedate;
|
||||
|
||||
$user_date_start = $current_user->getPreference('obm_date_start');
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) {
|
||||
$date_start =$user_date_start;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
|
||||
$date_start = $_REQUEST['obm_year'].'-01-01';
|
||||
$current_user->setPreference('obm_date_start', $date_start);
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_date_start']);
|
||||
$GLOBALS['log']->debug("_SESSION['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date('Y').'-01-01';
|
||||
}
|
||||
$user_date_end = $current_user->getPreference('obm_date_end');
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) {
|
||||
$date_end =$user_date_end;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
|
||||
$date_end = $_REQUEST['obm_year'].'-12-31';
|
||||
$current_user->setPreference('obm_date_end', $date_end );
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date('Y').'-12-31';
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
//get list of user ids for which to display data
|
||||
$user_ids = $current_user->getPreference('obm_ids');
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) {
|
||||
$ids = $user_ids;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) {
|
||||
$ids = $_REQUEST['obm_ids'];
|
||||
$current_user->setPreference('obm_ids', $_REQUEST['obm_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFRENCES['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
|
||||
$where = "";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count>0) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
// cn: adding user-pref date handling
|
||||
$dateStartDisplay = date($timedate->get_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = date($timedate->get_date_format(), strtotime($date_end));
|
||||
|
||||
$opp = new Opportunity();
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= "AND opportunities.date_closed >= ".db_convert("'".$date_start."'",'date')." AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date')." AND opportunities.deleted=0";
|
||||
$query = "SELECT sales_stage,".db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))." as m, sum(amount_usdollar/1000) as total, count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE ".$where;
|
||||
$query .= " GROUP BY sales_stage,".db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))."ORDER BY m";
|
||||
return $query;
|
||||
}
|
||||
|
||||
function pipelineByLeadSourceQuery($filters){
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
|
||||
global $current_user;
|
||||
global $app_list_strings;
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
|
||||
//get list of sales stage keys to display
|
||||
$user_tempx = $filters['pbls_lead_sources'];
|
||||
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbls_lead_sources'])) {
|
||||
$tempx = $user_tempx;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($user_tempx);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbls_lead_sources']) && count($_REQUEST['pbls_lead_sources']) > 0) {
|
||||
$tempx = $_REQUEST['pbls_lead_sources'];
|
||||
$current_user->setPreference('pbls_lead_sources', $_REQUEST['pbls_lead_sources']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbls_lead_sources']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbls_lead_sources'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['lead_source_dom'][$key];
|
||||
array_push($selected_datax,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['lead_source_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
}
|
||||
|
||||
$legends = $datax;
|
||||
|
||||
$ids = array();
|
||||
$user_ids = $filters['pbls_ids'];
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) > 0){
|
||||
$ids = $user_ids;
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
$opp = new Opportunity;
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $legends and $user
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count > 0 && !empty($user_id)) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
if(!empty($where)) $where .= 'AND';
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($legends);
|
||||
$legendItem = array();
|
||||
if ($count > 0 && !empty($legends)) {
|
||||
|
||||
foreach ($legends as $key=>$value) {
|
||||
$legendItem[] = "'".$key."'";
|
||||
}
|
||||
$legendItems = join(",",$legendItem);
|
||||
$where .= " opportunities.lead_source IN ($legendItems) ";
|
||||
}
|
||||
$query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE ".$where." AND opportunities.deleted=0 ";
|
||||
$query .= "GROUP BY lead_source ORDER BY total DESC";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function myModuleUsageLast30Days() {
|
||||
global $current_user;
|
||||
$dateValue = db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime("- 30 days"))."'" ,"datetime");
|
||||
|
||||
$query = "SELECT tracker.module_name as module_name ";
|
||||
$query .= ",COUNT(*) count FROM tracker ";
|
||||
$query .= "WHERE tracker.user_id = '$current_user->id' AND tracker.module_name != 'UserPreferences' AND tracker.date_modified > $dateValue ";
|
||||
$query .= "GROUP BY tracker.module_name ORDER BY count DESC";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// This function will grab a query from the custom directory to be used for charting
|
||||
function customChartQuery($chart){
|
||||
if (file_exists('custom/Charts/' . $chart . '.php')){
|
||||
require_once('custom/Charts/' . $chart . '.php');
|
||||
return customChartQuery();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
70
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartConfigure.tpl
Executable file
70
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartConfigure.tpl
Executable file
@@ -0,0 +1,70 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_CAMPAIGN_NAME}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="campaign_id" size='5'>
|
||||
{$campaign_list}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='{$LBL_SUBMIT_BUTTON_LABEL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
47
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartDashlet.data.php
Executable file
47
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartDashlet.data.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$dashletData['CampaignROIChartDashlet']['searchFields'] = array(
|
||||
'campaign_id' => array(
|
||||
'name' => 'campaign_id',
|
||||
'vname' => 'LBL_CAMPAIGN_NAME',
|
||||
'type' => 'enum',
|
||||
)
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['CampaignROIChartDashlet'] = array('LBL_TITLE' => 'Campaign ROI',
|
||||
'LBL_DESCRIPTION' => 'ROI Chart',
|
||||
'LBL_REFRESH' => 'Refresh Chart');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['CampaignROIChartDashlet'] = array('LBL_TITLE' => 'Kampagnen ROI',
|
||||
'LBL_DESCRIPTION' => 'ROI Diagramm',
|
||||
'LBL_REFRESH' => 'Diagramm neu laden');
|
||||
?>
|
||||
|
||||
47
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartDashlet.meta.php
Executable file
47
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartDashlet.meta.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['CampaignROIChartDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'icon' => 'themes/default/images/icon_Charts_GroupBy_32.gif',
|
||||
'category' => 'Charts',
|
||||
'module' => 'Campaigns',);
|
||||
?>
|
||||
86
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartDashlet.php
Executable file
86
modules/Charts/a/CampaignROIChartDashlet/CampaignROIChartDashlet.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGenericChart.php');
|
||||
|
||||
class CampaignROIChartDashlet extends DashletGenericChart
|
||||
{
|
||||
public $campaign_id;
|
||||
|
||||
protected $_seedName = 'Campaigns';
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::displayOptions()
|
||||
*/
|
||||
public function displayOptions()
|
||||
{
|
||||
$this->getSeedBean()->disable_row_level_security = false;
|
||||
|
||||
$campaigns = $this->getSeedBean()->get_full_list("","");
|
||||
if ( $campaigns != null )
|
||||
foreach ($campaigns as $c)
|
||||
$this->_searchFields['campaign_id']['options'][$c->id] = $c->name;
|
||||
else
|
||||
$this->_searchFields['campaign_id']['options'] = array();
|
||||
|
||||
return parent::displayOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
require_once('modules/Campaigns/Charts.php');
|
||||
|
||||
$roi_chart = new campaign_charts();
|
||||
$chartStr = $roi_chart->campaign_response_roi(
|
||||
$GLOBALS['app_list_strings']['roi_type_dom'],
|
||||
$GLOBALS['app_list_strings']['roi_type_dom'],
|
||||
$this->campaign_id[0],'',true,true,true,$this->id);
|
||||
|
||||
$returnStr = '<script type="text/javascript" src="' . getJSPath('include/javascript/swfobject.js') . '"></script>' . $chartStr;
|
||||
|
||||
return $this->getTitle('<div align="center"></div>') . '<div align="center">' . $returnStr . '</div><br />';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['CampaignROIChartDashlet'] = array('LBL_TITLE' => 'Kampanie - Zwrot z Inwestycji',
|
||||
'LBL_DESCRIPTION' => 'Wykres Zwrotu z Inwestycji',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
145
modules/Charts/a/EcmCallsDashlet/EcmCallsConfigure.tpl
Executable file
145
modules/Charts/a/EcmCallsDashlet/EcmCallsConfigure.tpl
Executable file
@@ -0,0 +1,145 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="pbuts_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_ECMCALLS_DATE} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date" size='12' maxlength='10' id='pbuts_date' value='{$pbuts_date}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="pbuts_date_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_ECMCALLS_DATE_SELECT}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_date_select">
|
||||
{$pbuts_date_select_options}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_ECMCALLS_TIME_FROM}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_time_from">
|
||||
{$pbuts_time_from_options}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_ECMCALLS_TIME_TO}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_time_to">
|
||||
{$pbuts_time_to_options}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMCALLS_SHOW_NUMBERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="checkbox" name="pbuts_show_numbers" {$pbuts_show_numbers}/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMCALLS_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_users[]" multiple size='4'>
|
||||
{$selected_datax_users}
|
||||
</select><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMCALLS_TYPE}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_type">
|
||||
{$selected_datax_type}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMCALLS_WATCH}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_watch">
|
||||
{$pbuts_watch}
|
||||
</select>
|
||||
>
|
||||
<select name="pbuts_watch_seconds">
|
||||
{$pbuts_watch_seconds}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='Submit'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "pbuts_date", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "pbuts_date_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
47
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.en_us.lang.php
Executable file
47
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.en_us.lang.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['EcmCallsDashlet'] = array(
|
||||
'LBL_TITLE' => 'Calls',
|
||||
'LBL_DESCRIPTION' => 'Scatter Graph',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
?>
|
||||
40
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.ge_ge.lang.php
Executable file
40
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.ge_ge.lang.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Enterprise Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-enterprise-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['EcmCallsDashlet'] = array(
|
||||
'LBL_TITLE' => 'Calls',
|
||||
'LBL_DESCRIPTION' => 'Scatter Graph',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
47
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.meta.php
Executable file
47
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.meta.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['EcmCallsDashlet'] = array('title' => translate('LBL_ECMCALLS_TITLE','Home'),
|
||||
'description' => translate('LBL_ECMCALLS_TITLE','Home'),
|
||||
'module' => 'EcmCalls',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
586
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.php
Executable file
586
modules/Charts/a/EcmCallsDashlet/EcmCallsDashlet.php
Executable file
@@ -0,0 +1,586 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('modules/Dashboard/Forms.php');
|
||||
$GLOBALS['db'] = new MysqlManager();
|
||||
$GLOBALS['db']->connect();
|
||||
|
||||
class EcmCallsDashlet extends Dashlet {
|
||||
|
||||
var $pbuts_date;
|
||||
var $pbuts_users = null;
|
||||
var $pbuts_time_from;
|
||||
var $pbuts_time_to;
|
||||
var $pbuts_type;
|
||||
var $pbuts_date_select;
|
||||
var $pbuts_show_numbers;
|
||||
var $pbuts_watch;
|
||||
|
||||
|
||||
var $refresh = false;
|
||||
|
||||
function EcmCallsDashlet($id, $options) {
|
||||
|
||||
global $timedate,$current_user;
|
||||
|
||||
$_SESSION['EcmCallsChart'][$id][$current_user->id] = $options;
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
$this->isRefreshable = true;
|
||||
|
||||
if(empty($options['pbuts_date']))
|
||||
$this->pbuts_date = date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_date = $options['pbuts_date'];
|
||||
|
||||
if(empty($options['pbuts_time_from']))
|
||||
$this->pbuts_time_from = "07:00";//date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_time_from = $options['pbuts_time_from'];
|
||||
|
||||
if(empty($options['pbuts_time_to']))
|
||||
$this->pbuts_time_to = "18:00"; //date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_time_to = $options['pbuts_time_to'];
|
||||
|
||||
if(empty($options['pbuts_type']))
|
||||
$this->pbuts_type = "outgoing";
|
||||
else
|
||||
$this->pbuts_type = $options['pbuts_type'];
|
||||
|
||||
if(empty($options['pbuts_date_select']))
|
||||
$this->pbuts_date_select = "THIS_DAY";
|
||||
else
|
||||
$this->pbuts_date_select = $options['pbuts_date_select'];
|
||||
|
||||
if(empty($options['pbuts_show_numbers']))
|
||||
$this->pbuts_show_numbers = 0;
|
||||
else
|
||||
$this->pbuts_show_numbers = $options['pbuts_show_numbers'];
|
||||
|
||||
if(empty($options['pbuts_watch']))
|
||||
$this->pbuts_watch = 'duration';
|
||||
else
|
||||
$this->pbuts_watch = $options['pbuts_watch'];
|
||||
|
||||
if(empty($options['pbuts_watch_seconds']))
|
||||
$this->pbuts_watch_seconds = '60';
|
||||
else
|
||||
$this->pbuts_watch_seconds = $options['pbuts_watch_seconds'];
|
||||
|
||||
|
||||
if(empty($options['pbuts_users']) || count($options['pbuts_users']) == 0) {
|
||||
$query = "select id, user_name from users where deleted='0'";
|
||||
$dbm = new MysqlManager();
|
||||
$dbm->connect();
|
||||
$results = $dbm->query($query);
|
||||
$us = array();
|
||||
if(is_resource($results))
|
||||
while($row = $dbm->fetchByAssoc($results)) $us[] = $row['id'];
|
||||
$this->pbuts_users = $us;
|
||||
|
||||
}
|
||||
else
|
||||
$this->pbuts_users = $options['pbuts_users'];
|
||||
|
||||
if(empty($options['title']))
|
||||
$this->title = translate('LBL_ECMCALLS_TITLE', 'Home');
|
||||
else
|
||||
$this->title = $options['title'];
|
||||
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
|
||||
$options['title'] = $_REQUEST['pbuts_dashlet_title'];
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
|
||||
$options['pbuts_users'] = $_REQUEST['pbuts_users'];
|
||||
$options['pbuts_date'] = $timedate->swap_formats($_REQUEST['pbuts_date'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
$options['pbuts_time_from'] = $_REQUEST['pbuts_time_from'];
|
||||
$options['pbuts_time_to'] = $_REQUEST['pbuts_time_to'];
|
||||
$options['pbuts_type'] = $_REQUEST['pbuts_type'];
|
||||
$options['pbuts_date_select'] = $_REQUEST['pbuts_date_select'];
|
||||
$options['pbuts_watch'] = $_REQUEST['pbuts_watch'];
|
||||
$options['pbuts_watch_seconds'] = $_REQUEST['pbuts_watch_seconds'];
|
||||
|
||||
if(isset($_REQUEST['pbuts_show_numbers']) && $_REQUEST['pbuts_show_numbers'] != '') $options['pbuts_show_numbers'] = 1; else $options['pbuts_show_numbers'] = 0;
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
|
||||
global $timedate, $image_path, $app_strings, $current_user, $app_list_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
$ss->assign('dashletType', 'predefined_chart');
|
||||
|
||||
$ss->assign('LBL_TITLE', translate('LBL_ECMCALLS_TITLE', 'Charts'));
|
||||
$ss->assign('LBL_CHART_TYPE', translate('LBL_CHART_TYPE', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_DATE', translate('LBL_ECMCALLS_DATE', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_USERS', translate('LBL_ECMCALLS_USERS', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_TIME_TO', translate('LBL_ECMCALLS_TIME_TO', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_TIME_FROM', translate('LBL_ECMCALLS_TIME_FROM', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_TYPE', translate('LBL_ECMCALLS_TYPE', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_DATE_SELECT', translate('LBL_ECMCALLS_DATE_SELECT', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_SHOW_NUMBERS', translate('LBL_ECMCALLS_SHOW_NUMBERS', 'Charts'));
|
||||
$ss->assign('LBL_ECMCALLS_WATCH', translate('LBL_ECMCALLS_WATCH', 'EcmCalls'));
|
||||
|
||||
$ss->assign('LBL_SELECT_BUTTON_TITLE', $app_strings['LBL_SELECT_BUTTON_TITLE']);
|
||||
$ss->assign('image_path', $image_path);
|
||||
|
||||
//get the dates to display
|
||||
$pbuts_date = $this->pbuts_date;
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
$ss->assign('pbuts_date', $timedate->swap_formats($pbuts_date, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
|
||||
$time_tf = array();
|
||||
for($i=0; $i<=24*60; $i+=30) {
|
||||
$time_tmp = sprintf("%02d:%02d",$i/60,$i%60);
|
||||
$time_tf[$time_tmp] = $time_tmp;
|
||||
}
|
||||
|
||||
$ss->assign('pbuts_time_from_options', get_select_options_with_id($time_tf,$this->pbuts_time_from));
|
||||
$ss->assign('pbuts_time_to_options', get_select_options_with_id($time_tf,$this->pbuts_time_to));
|
||||
|
||||
$query = "select id, first_name,last_name from users where deleted='0'";
|
||||
$dbm = new MysqlManager();
|
||||
$dbm->connect();
|
||||
$results = $dbm->query($query);
|
||||
$us = array();
|
||||
if(is_resource($results))
|
||||
while($row = $dbm->fetchByAssoc($results)) $us[$row['id']] = $row['first_name']." ".$row['last_name'];
|
||||
|
||||
$ss->assign('dashlet_title', $this->title);
|
||||
|
||||
if(is_array($this->pbuts_users) && count($this->pbuts_users) > 0)
|
||||
$selected_datax_users = $this->pbuts_users;
|
||||
else
|
||||
$selected_datax_users = $us;
|
||||
$ss->assign('selected_datax_users', get_select_options_with_id($us, $selected_datax_users));
|
||||
|
||||
|
||||
if(isset($this->pbuts_type) && $this->pbuts_type != '')
|
||||
$selected_datax_type = $this->pbuts_type;
|
||||
else
|
||||
$selected_datax_type = 'outgoing';
|
||||
$ss->assign('selected_datax_type', get_select_options_with_id($app_list_strings['ecmcalls_chart_call_type_dom'], $selected_datax_type));
|
||||
|
||||
if(isset($this->pbuts_date_select) && $this->pbuts_date_select != '')
|
||||
$selected_datax_date_select = $this->pbuts_date_select;
|
||||
else
|
||||
$selected_datax_date_select = 'THIS_DAY';
|
||||
$ss->assign('pbuts_date_select_options', get_select_options_with_id($app_list_strings['ecmcalls_chart_date_select_dom'], $selected_datax_date_select));
|
||||
|
||||
$ss->assign('pbuts_show_numbers', ($this->pbuts_show_numbers == 1 ? 'CHECKED' : ''));
|
||||
|
||||
$arr = array(
|
||||
'duration' => translate('LBL_DURATION', 'EcmCalls'),
|
||||
'billsec' => translate('LBL_BILLSEC', 'EcmCalls'),
|
||||
);
|
||||
$ss->assign('pbuts_watch', get_select_options_with_id($arr, $this->pbuts_watch));
|
||||
|
||||
$arr = array();
|
||||
for($i=1;$i<=180;$i++) $arr[$i] = strval($i).'s';
|
||||
$ss->assign('pbuts_watch_seconds', get_select_options_with_id($arr, $this->pbuts_watch_seconds));
|
||||
|
||||
$ss->assign('user_date_format', $timedate->get_user_date_format());
|
||||
$ss->assign('cal_dateformat', $timedate->get_cal_date_format());
|
||||
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Charts/Dashlets/EcmCallsDashlet/EcmCallsConfigure.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
global $sugar_config, $current_user, $current_language;
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
$chartStringsXML = 'cache/xml/chart_strings.' . $current_language .'.lang.xml';
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', chartStyle());
|
||||
$ss->assign('chartColorsXML', chartColors());
|
||||
$ss->assign('chartStringsXML', $chartStringsXML);
|
||||
|
||||
$str = '<script type="text/javascript">refreshMyEcmCallsChartDashlet("'.$this->id.'");</script>';
|
||||
|
||||
//$ss->fetch('modules/EcmCalls/chart/PredefinedChartDashletScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getTitle($text) {
|
||||
global $image_path, $app_strings, $sugar_config;
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="#" onclick="SUGAR.mySugar.configureDashlet(\''
|
||||
. $this->id . '\'); return false;" class="chartToolsLink">'
|
||||
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right">';
|
||||
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="refreshMyEcmCallsChartDashlet(\''.$this->id.'\');return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. $image_path . 'refresh.gif"/></a> ';
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.deleteDashlet(\''
|
||||
. $this->id . '\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_DELETE', 'Home') . '" alt="' . translate('LBL_DASHLET_DELETE', 'Home') . '" src="'
|
||||
. $image_path . 'close_dashboard.gif"/></a></div></td></tr></table>';
|
||||
|
||||
if(!function_exists('get_form_header')) {
|
||||
global $theme;
|
||||
require_once('themes/'.$theme.'/layout_utils.php');
|
||||
}
|
||||
|
||||
$str = '<div ';
|
||||
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= ' onmouseover="this.style.cursor = \'move\';"';
|
||||
$str .= 'id="dashlet_header_' . $this->id . '">' . get_form_header($this->title, $additionalTitle, false) . '</div>';
|
||||
|
||||
//$str .= $this->createAutoRefreshCode("refreshMyEcmCallsChartDashlet('".$this->id."');", true);
|
||||
return $str;
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $current_user, $theme, $timedate, $image_path;
|
||||
|
||||
$this->loadLanguage('EcmCallsDashlet', 'modules/Charts/Dashlets/');
|
||||
$returnStr = '';
|
||||
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
if(isset($_REQUEST['pbuts_refresh'])) {
|
||||
$refresh = $_REQUEST['pbuts_refresh'];
|
||||
}
|
||||
else {
|
||||
$refresh = false;
|
||||
}
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $date_start;
|
||||
$dateXml[1] = $date_end;
|
||||
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_bug_status = $this->pbuts_ecmcall_status;
|
||||
$tempx = $user_bug_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['bug_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['bug_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['bug_status_dom']);
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbuts_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbuts_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbuts_ids']) && count($_REQUEST['pbuts_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbuts_ids'];
|
||||
$current_user->setPreference('pbuts_ids', $_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbuts_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('modules/EcmCalls/chart/EcmCallsChart.php');
|
||||
|
||||
$sugar_smarty = new Sugar_Smarty();
|
||||
|
||||
$charts = array();
|
||||
|
||||
$sugarChart = new EcmCallsChart();
|
||||
|
||||
$sugarChart->base_url = array( 'module' => 'Bugs',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array();
|
||||
|
||||
|
||||
$ids = $this->pbuts_ecmcall_users;
|
||||
|
||||
global $app_list_strings;
|
||||
$sugarChart->enum_for_labels = array( 'status' => $app_list_strings['bug_status_dom'] );
|
||||
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
$query = $this->constructQuery($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarS',$current_module_strings);
|
||||
|
||||
$sugarChart->setData($this->getChartData($query));
|
||||
|
||||
|
||||
$total = $sugarChart->getTotal();
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
$sugarChart->is_currency = false;
|
||||
$sugarChart->currency_symbol = '';
|
||||
$sugarChart->thousands_symbol = '';//translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$subtitle = translate('LBL_BUG_SIZE', 'Charts');
|
||||
|
||||
$pipeline_total_string = translate('LBL_BUGS_TOTAL', 'Charts') . $total;
|
||||
|
||||
|
||||
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
|
||||
//$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
$returnStr .= $sugarChart->display($this->id, $xmlFile, '100%', '480', false);
|
||||
|
||||
return $this->getTitle('') . '<div align="center">' .$returnStr. '</div><br />';
|
||||
}
|
||||
|
||||
|
||||
// awu: Bug 16794 - this function is a hack to get the correct sales stage order until i can clean it up later
|
||||
function getChartData($query){
|
||||
/*
|
||||
global $app_list_strings, $current_user, $sugar_config;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_bug_status = $this->pbuts_ecmcall_status;
|
||||
$tempx = $user_bug_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['bug_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['bug_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['bug_status_dom']);
|
||||
}
|
||||
|
||||
$db = &PearDatabase::getInstance();
|
||||
|
||||
$result = $db->query($query);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
while($row != null){
|
||||
array_push($temp_data, $row);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
}
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $bug_status){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['status'] == $bug_status){
|
||||
//$value['total'] = $symbol . $value['total'];
|
||||
//$value['status'] = $app_list_strings['bug_status_dom'][$value['status']];
|
||||
array_push($data, $value);
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//echo '<br><br>'; var_dump($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function constructQuery($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
/*
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
global $timedate;
|
||||
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= " bugs.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND bugs.status IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND bugs.date_entered >= ". db_convert("'".$date_start."'",'datetime'). "
|
||||
AND bugs.date_entered <= ".db_convert("'".$date_end."'",'datetime') ;
|
||||
$where .= " AND bugs.assigned_user_id = users.id AND bugs.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
|
||||
$query = " SELECT bugs.status as status,
|
||||
users.user_name,
|
||||
bugs.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
count( bugs.assigned_user_id ) AS total
|
||||
FROM users, bugs ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY bugs.status";
|
||||
$query .= ", users.user_name, bugs.assigned_user_id";
|
||||
|
||||
//var_dump($query);
|
||||
//$res = $GLOBALS['db']->query($query);
|
||||
//var_dump($res);
|
||||
//var_dump($query);
|
||||
*/
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['MyForecastingChartDashlet'] = array('LBL_TITLE' => 'Moje Prognozy',
|
||||
'LBL_DESCRIPTION' => 'Udział Założony/Aktualny',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['MyOpportunitiesGaugeDashlet'] = array('LBL_TITLE' => 'Moje zamknięte Tematy',
|
||||
'LBL_DESCRIPTION' => 'Wskaźnik Tematów',
|
||||
'LBL_REFRESH' => 'Odswierz Wykres');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="mypbss_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="mypbss_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="mypbss_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_SALES_STAGES}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="mypbss_sales_stages[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='{$LBL_SUBMIT_BUTTON_LABEL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$dashletData['MyPipelineBySalesStageDashlet']['searchFields'] = array(
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'mypbss_date_start' => array(
|
||||
'name' => 'mypbss_date_start',
|
||||
'vname' => 'LBL_DATE_START',
|
||||
'type' => 'datepicker',
|
||||
),
|
||||
'mypbss_date_end' => array(
|
||||
'name' => 'mypbss_date_end',
|
||||
'vname' => 'LBL_DATE_END',
|
||||
'type' => 'datepicker',
|
||||
),
|
||||
'mypbss_sales_stages' => array(
|
||||
'name' => 'mypbss_sales_stages',
|
||||
'vname' => 'LBL_SALES_STAGES',
|
||||
'type' => 'enum',
|
||||
),
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['MyPipelineBySalesStageDashlet'] = array('LBL_TITLE' => 'My Pipeline By Sales Stage',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of My Sales Stage Pipeline',
|
||||
'LBL_REFRESH' => 'Refresh Chart');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['MyPipelineBySalesStageDashlet'] = array('LBL_TITLE' => 'Meine Pipeline nach Verkaufsphasen',
|
||||
'LBL_DESCRIPTION' => 'Vertikales Balkendiagramm der Pipeline nach Verkaufsphasen',
|
||||
'LBL_REFRESH' => 'Diagramm neu laden');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['MyPipelineBySalesStageDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'module' => 'Opportunities',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
282
modules/Charts/a/MyPipelineBySalesStageDashlet/MyPipelineBySalesStageDashlet.php
Executable file
282
modules/Charts/a/MyPipelineBySalesStageDashlet/MyPipelineBySalesStageDashlet.php
Executable file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGenericChart.php');
|
||||
|
||||
class MyPipelineBySalesStageDashlet extends DashletGenericChart
|
||||
{
|
||||
public $mypbss_date_start;
|
||||
public $mypbss_date_end;
|
||||
public $mypbss_sales_stages = array();
|
||||
|
||||
|
||||
|
||||
|
||||
protected $_seedName = 'Opportunities';
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::__construct()
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
array $options = null
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
if(empty($options['mypbss_date_start']))
|
||||
$options['mypbss_date_start'] = date($timedate->get_db_date_time_format(), time());
|
||||
if(empty($options['mypbss_date_end']))
|
||||
$options['mypbss_date_end'] = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
if(empty($options['title']))
|
||||
$options['title'] = translate('LBL_MY_PIPELINE_FORM_TITLE', 'Home');
|
||||
|
||||
parent::__construct($id,$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::displayOptions()
|
||||
*/
|
||||
public function displayOptions()
|
||||
{
|
||||
global $app_list_strings;
|
||||
|
||||
$selected_datax = array();
|
||||
if (count($this->mypbss_sales_stages) > 0)
|
||||
foreach ($this->mypbss_sales_stages as $key)
|
||||
$selected_datax[] = $key;
|
||||
else
|
||||
$selected_datax = array_keys($app_list_strings['sales_stage_dom']);
|
||||
|
||||
$this->_searchFields['mypbss_sales_stages']['options'] = $app_list_strings['sales_stage_dom'];
|
||||
$this->_searchFields['mypbss_sales_stages']['input_name0'] = $selected_datax;
|
||||
|
||||
|
||||
|
||||
|
||||
return parent::displayOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $sugar_config, $current_user;
|
||||
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
$sugarChart = new SugarChart();
|
||||
$sugarChart->base_url = array( 'module' => 'Opportunities',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array( 'assigned_user_id' => $current_user->id );
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
$sugarChart->is_currency = true;
|
||||
$sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$query = $this->constructQuery();
|
||||
|
||||
|
||||
|
||||
$dataset = $this->constructCEChartData($this->getChartData($query));
|
||||
$sugarChart->setData($dataset);
|
||||
$total = format_number($this->getHorizBarTotal($dataset), 0, 0);
|
||||
$pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . $total . $sugarChart->thousands_symbol;
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal bar chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugarChart->getXMLFileName($this->id);
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
|
||||
return $this->getTitle('') .
|
||||
'<div align="center">' .$sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />';
|
||||
}
|
||||
|
||||
/**
|
||||
* awu: Bug 16794 - this function is a hack to get the correct sales stage order
|
||||
* until i can clean it up later
|
||||
*
|
||||
* @param $query string
|
||||
* @return array
|
||||
*/
|
||||
private function getChartData(
|
||||
$query
|
||||
)
|
||||
{
|
||||
global $app_list_strings, $db;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_sales_stage = $this->mypbss_sales_stages;
|
||||
$tempx = $user_sales_stage;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['sales_stage_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['sales_stage_dom']);
|
||||
}
|
||||
|
||||
$result = $db->query($query);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
|
||||
while($row != null){
|
||||
$temp_data[] = $row;
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
}
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $sales_stage){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['sales_stage'] == $sales_stage){
|
||||
$value['sales_stage'] = $app_list_strings['sales_stage_dom'][$value['sales_stage']];
|
||||
$value['key'] = $sales_stage;
|
||||
$value['value'] = $value['sales_stage'];
|
||||
$data[] = $value;
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dataset array
|
||||
* @return int
|
||||
*/
|
||||
private function getHorizBarTotal(
|
||||
$dataset
|
||||
)
|
||||
{
|
||||
$total = 0;
|
||||
foreach($dataset as $value){
|
||||
$total += $value;
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dataset array
|
||||
* @return array
|
||||
*/
|
||||
private function constructCEChartData(
|
||||
$dataset
|
||||
)
|
||||
{
|
||||
$newData = array();
|
||||
foreach($dataset as $key=>$value){
|
||||
$newData[$value['sales_stage']] = $value['total'];
|
||||
}
|
||||
return $newData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::constructQuery()
|
||||
*/
|
||||
protected function constructQuery()
|
||||
{
|
||||
$query = "SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= " WHERE opportunities.assigned_user_id IN ('{$GLOBALS['current_user']->id}') " .
|
||||
" AND opportunities.date_closed >= ". db_convert("'".$this->mypbss_date_start."'",'datetime').
|
||||
" AND opportunities.date_closed <= ".db_convert("'".$this->mypbss_date_end."'",'datetime') .
|
||||
" AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
if ( count($this->mypbss_sales_stages) > 0 )
|
||||
$query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->mypbss_sales_stages) . "') ";
|
||||
$query .= " GROUP BY opportunities.sales_stage ,users.user_name,opportunities.assigned_user_id";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::constructGroupBy()
|
||||
*/
|
||||
protected function constructGroupBy()
|
||||
{
|
||||
$groupBy = array('sales_stage');
|
||||
|
||||
|
||||
|
||||
|
||||
array_push($groupBy, 'user_name');
|
||||
|
||||
|
||||
|
||||
return $groupBy;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version
|
||||
* 1.1.3 ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
|
||||
/*********************************************************************************
|
||||
* pl_pl.lang.ext.php,v for SugarCRM 4.5-->>
|
||||
* Translator: Krzysztof Morawski
|
||||
* All Rights Reserved.
|
||||
* Any bugs report welcome: krzysiek<at>mojsklepik<dot>net
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
|
||||
// $Id: MyPipelineBySalesStageDashlet.en_us.lang.php,v 1.3 2006/08/22 20:14:45 wayne Exp $
|
||||
|
||||
|
||||
$dashletStrings['MyPipelineBySalesStageDashlet'] = array('LBL_TITLE' => 'Lejek Etapów Sprzedaży',
|
||||
'LBL_DESCRIPTION' => 'Pionowa Belka Wykresu Lejka Etapów Sprzedaży',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);' />
|
||||
<input type='hidden' name='id' value='{$id}' />
|
||||
<input type='hidden' name='module' value='{$module}' />
|
||||
<input type='hidden' name='action' value='DynamicAction' />
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet' />
|
||||
<input type='hidden' name='to_pdf' value='true' />
|
||||
<input type='hidden' name='configure' value='true' />
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
|
||||
<table width="400" cellpadding="10" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_LEAD_SOURCES}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="lsbo_lead_sources[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="lsbo_ids[]" multiple size='3'>
|
||||
{$lsbo_ids}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='{$LBL_SUBMIT_BUTTON_LABEL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$dashletData['OpportunitiesByLeadSourceByOutcomeDashlet']['searchFields'] = array(
|
||||
'lsbo_lead_sources' => array(
|
||||
'name' => 'lsbo_lead_sources',
|
||||
'vname' => 'LBL_LEAD_SOURCES',
|
||||
'type' => 'enum',
|
||||
),
|
||||
'lsbo_ids' => array(
|
||||
'name' => 'lsbo_ids',
|
||||
'vname' => 'LBL_USERS',
|
||||
'type' => 'user_name',
|
||||
),
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OpportunitiesByLeadSourceByOutcomeDashlet'] = array('LBL_TITLE' => 'All Opportunities By Lead Source By Outcome',
|
||||
'LBL_DESCRIPTION' => 'Horizontal stacked chart of Opportunities By Lead Source By Outcome',
|
||||
'LBL_REFRESH' => 'Refresh Chart');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OpportunitiesByLeadSourceByOutcomeDashlet'] = array('LBL_TITLE' => 'Alle Verkaufschancen nach Quelle und Ergebnis',
|
||||
'LBL_DESCRIPTION' => 'Horizontal geschichtetes Diagramm der Verkaufschancen nach Quelle und Ergebnis',
|
||||
'LBL_REFRESH' => 'Diagramm neu laden');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['OpportunitiesByLeadSourceByOutcomeDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'icon' => 'themes/default/images/icon_Charts_Horizontal_32.gif',
|
||||
'module' => 'Opportunities',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGenericChart.php');
|
||||
|
||||
class OpportunitiesByLeadSourceByOutcomeDashlet extends DashletGenericChart
|
||||
{
|
||||
public $lsbo_lead_sources = array();
|
||||
public $lsbo_ids = array();
|
||||
|
||||
protected $_seedName = 'Opportunities';
|
||||
|
||||
public function displayOptions()
|
||||
{
|
||||
global $app_list_strings;
|
||||
|
||||
$selected_datax = array();
|
||||
if (!empty($this->lsbo_lead_sources) && sizeof($this->lsbo_lead_sources) > 0)
|
||||
foreach ($this->lsbo_lead_sources as $key)
|
||||
$selected_datax[] = $key;
|
||||
else
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
|
||||
$this->_searchFields['lsbo_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']);
|
||||
$this->_searchFields['lsbo_lead_sources']['input_name0'] = $selected_datax;
|
||||
|
||||
if (!isset($this->lsbo_ids) || count($this->lsbo_ids) == 0)
|
||||
$this->_searchFields['lsbo_ids']['input_name0'] = array_keys(get_user_array(false));
|
||||
|
||||
return parent::displayOptions();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $current_user, $sugar_config;
|
||||
require("modules/Charts/chartdefs.php");
|
||||
$chartDef = $chartDefs['lead_source_by_outcome'];
|
||||
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
$sugarChart = new SugarChart();
|
||||
$sugarChart->is_currency = true;
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
$sugarChart->setProperties('', $subtitle, $chartDef['chartType']);
|
||||
$sugarChart->base_url = $chartDef['base_url'];
|
||||
$sugarChart->group_by = $chartDef['groupBy'];
|
||||
$sugarChart->url_params = array();
|
||||
if ( count($this->lsbo_ids) > 0 )
|
||||
$sugarChart->url_params['assigned_user_id'] = array_values($this->lsbo_ids);
|
||||
$sugarChart->getData($this->constuctQuery());
|
||||
$sugarChart->data_set = $sugarChart->sortData($sugarChart->data_set, 'lead_source', true, 'sales_stage', true, true);
|
||||
$xmlFile = $sugarChart->getXMLFileName($this->id);
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
|
||||
return $this->getTitle('<div align="center"></div>') .
|
||||
'<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />';
|
||||
}
|
||||
|
||||
protected function constuctQuery()
|
||||
{
|
||||
$query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total, ".
|
||||
"count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= " WHERE opportunities.deleted=0 ";
|
||||
if ( count($this->lsbo_ids) > 0 )
|
||||
$query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->lsbo_ids)."') ";
|
||||
if ( count($this->lsbo_lead_sources) > 0 )
|
||||
$query .= "AND opportunities.lead_source IN ('".implode("','",$this->lsbo_lead_sources)."') ";
|
||||
else
|
||||
$query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
|
||||
$query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage";
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OpportunitiesByLeadSourceByOutcomeDashlet'] = array('LBL_TITLE' => 'Wszystkie Tematy przez Źródła Wizytówek przez Wynik',
|
||||
'LBL_DESCRIPTION' => 'Poziome przedstawienie wykresów Tematówprzez Źródła Wizytówek przez Wynik',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);' />
|
||||
<input type='hidden' name='id' value='{$id}' />
|
||||
<input type='hidden' name='module' value='{$module}' />
|
||||
<input type='hidden' name='action' value='DynamicAction' />
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet' />
|
||||
<input type='hidden' name='to_pdf' value='true' />
|
||||
<input type='hidden' name='configure' value='true' />
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
|
||||
<table width="400" cellpadding="10" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_LEAD_SOURCES}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbls_lead_sources[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbls_ids[]" multiple size='3'>
|
||||
{$pbls_ids}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='{$LBL_SUBMIT_BUTTON_LABEL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$dashletData['OpportunitiesByLeadSourceDashlet']['searchFields'] = array(
|
||||
'pbls_lead_sources' => array(
|
||||
'name' => 'pbls_lead_sources',
|
||||
'vname' => 'LBL_LEAD_SOURCES',
|
||||
'type' => 'enum',
|
||||
),
|
||||
'pbls_ids' => array(
|
||||
'name' => 'pbls_ids',
|
||||
'vname' => 'LBL_USERS',
|
||||
'type' => 'user_name',
|
||||
),
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OpportunitiesByLeadSourceDashlet'] = array('LBL_TITLE' => 'All Opportunities by Lead Source',
|
||||
'LBL_DESCRIPTION' => 'Pie Chart of Opportunities by Lead Source',
|
||||
'LBL_REFRESH' => 'Refresh Chart');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OpportunitiesByLeadSourceDashlet'] = array('LBL_TITLE' => 'Alle Verkaufschancen nach Quelle',
|
||||
'LBL_DESCRIPTION' => 'Tortendiagramm der Verkaufschancen nach Quelle',
|
||||
'LBL_REFRESH' => 'Diagramm neu laden');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['OpportunitiesByLeadSourceDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'icon' => 'themes/default/images/icon_Charts_Pie_32.gif',
|
||||
'module' => 'Opportunities',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGenericChart.php');
|
||||
|
||||
class OpportunitiesByLeadSourceDashlet extends DashletGenericChart
|
||||
{
|
||||
public $pbls_lead_sources = array();
|
||||
public $pbls_ids = array();
|
||||
|
||||
protected $_seedName = 'Opportunities';
|
||||
|
||||
public function displayOptions()
|
||||
{
|
||||
global $app_list_strings;
|
||||
|
||||
$selected_datax = array();
|
||||
if (!empty($this->pbls_lead_sources) && sizeof($this->pbls_lead_sources) > 0)
|
||||
foreach ($this->pbls_lead_sources as $key)
|
||||
$selected_datax[] = $key;
|
||||
else
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
|
||||
$this->_searchFields['pbls_lead_sources']['options'] = array_filter($app_list_strings['lead_source_dom']);
|
||||
$this->_searchFields['pbls_lead_sources']['input_name0'] = $selected_datax;
|
||||
|
||||
if (!isset($this->pbls_ids) || count($this->pbls_ids) == 0)
|
||||
$this->_searchFields['pbls_ids']['input_name0'] = array_keys(get_user_array(false));
|
||||
|
||||
return parent::displayOptions();
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
global $current_user, $sugar_config;
|
||||
require("modules/Charts/chartdefs.php");
|
||||
$chartDef = $chartDefs['pipeline_by_lead_source'];
|
||||
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
$sugarChart = new SugarChart();
|
||||
$sugarChart->is_currency = true;
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
$sugarChart->setProperties('', $subtitle, $chartDef['chartType']);
|
||||
$sugarChart->base_url = $chartDef['base_url'];
|
||||
$sugarChart->group_by = $chartDef['groupBy'];
|
||||
$sugarChart->url_params = array();
|
||||
if ( count($this->pbls_ids) > 0 )
|
||||
$sugarChart->url_params['assigned_user_id'] = array_values($this->pbls_ids);
|
||||
$sugarChart->getData($this->constructQuery());
|
||||
$sugarChart->data_set = $sugarChart->sortData($sugarChart->data_set, 'lead_source', true);
|
||||
$xmlFile = $sugarChart->getXMLFileName($this->id);
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
|
||||
return $this->getTitle('<div align="center"></div>') .
|
||||
'<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />';
|
||||
}
|
||||
|
||||
protected function constructQuery()
|
||||
{
|
||||
$query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count ".
|
||||
"FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE opportunities.deleted=0 ";
|
||||
if ( count($this->pbls_ids) > 0 )
|
||||
$query .= "AND opportunities.assigned_user_id IN ('".implode("','",$this->pbls_ids)."') ";
|
||||
if ( count($this->pbls_lead_sources) > 0 )
|
||||
$query .= "AND opportunities.lead_source IN ('".implode("','",$this->pbls_lead_sources)."') ";
|
||||
else
|
||||
$query .= "AND opportunities.lead_source IN ('".implode("','",array_keys($GLOBALS['app_list_strings']['lead_source_dom']))."') ";
|
||||
$query .= "GROUP BY lead_source ORDER BY total DESC";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OpportunitiesByLeadSourceDashlet'] = array('LBL_TITLE' => 'Wszystkie Tematy przez Źródła Wizytówek',
|
||||
'LBL_DESCRIPTION' => 'Wykres Okrągły Tematy przez Źródła Wizytówek',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
99
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthConfigure.tpl
Executable file
99
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthConfigure.tpl
Executable file
@@ -0,0 +1,99 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="obm_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="obm_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="obm_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="obm_ids[]" multiple size='3'>
|
||||
{$obm_ids}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='{$LBL_SUBMIT_BUTTON_LABEL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
57
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.data.php
Executable file
57
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.data.php
Executable file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$dashletData['OutcomeByMonthDashlet']['searchFields'] = array(
|
||||
'obm_date_start' => array(
|
||||
'name' => 'obm_date_start',
|
||||
'vname' => 'LBL_DATE_START',
|
||||
'type' => 'datepicker',
|
||||
),
|
||||
'obm_date_end' => array(
|
||||
'name' => 'obm_date_end',
|
||||
'vname' => 'LBL_DATE_END',
|
||||
'type' => 'datepicker',
|
||||
),
|
||||
'obm_ids' => array(
|
||||
'name' => 'obm_ids',
|
||||
'vname' => 'LBL_USERS',
|
||||
'type' => 'user_name',
|
||||
),
|
||||
);
|
||||
?>
|
||||
45
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.en_us.lang.php
Executable file
45
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.en_us.lang.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OutcomeByMonthDashlet'] = array('LBL_TITLE' => 'Outcome by Month',
|
||||
'LBL_DESCRIPTION' => 'Chart of the Monthly Outcomes',
|
||||
'LBL_REFRESH' => 'Refresh Chart');
|
||||
?>
|
||||
|
||||
45
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.ge_ge.lang.php
Executable file
45
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.ge_ge.lang.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OutcomeByMonthDashlet'] = array('LBL_TITLE' => 'Resultat nach Monat',
|
||||
'LBL_DESCRIPTION' => 'Diagramm der monatlichen Ergebnisse',
|
||||
'LBL_REFRESH' => 'Diagramm neu laden');
|
||||
?>
|
||||
|
||||
47
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.meta.php
Executable file
47
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.meta.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['OutcomeByMonthDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'icon' => 'themes/default/images/icon_Charts_Vertical_32.gif',
|
||||
'module' => 'Opportunities',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
139
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.php
Executable file
139
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.php
Executable file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGenericChart.php');
|
||||
|
||||
class OutcomeByMonthDashlet extends DashletGenericChart
|
||||
{
|
||||
public $obm_ids = array();
|
||||
public $obm_date_start;
|
||||
public $obm_date_end;
|
||||
|
||||
protected $_seedName = 'Opportunities';
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::__construct()
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
array $options = null
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
if(empty($options['obm_date_start']))
|
||||
$options['obm_date_start'] = date($timedate->get_db_date_time_format(), time());
|
||||
|
||||
if(empty($options['obm_date_end']))
|
||||
$options['obm_date_end'] = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
|
||||
parent::__construct($id,$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::displayOptions()
|
||||
*/
|
||||
public function displayOptions()
|
||||
{
|
||||
if (!isset($this->obm_ids) || count($this->obm_ids) == 0)
|
||||
$this->_searchFields['obm_ids']['input_name0'] = array_keys(get_user_array(false));
|
||||
|
||||
return parent::displayOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
$currency_symbol = $GLOBALS['sugar_config']['default_currency_symbol'];
|
||||
if ($GLOBALS['current_user']->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($GLOBALS['current_user']->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
require("modules/Charts/chartdefs.php");
|
||||
$chartDef = $chartDefs['outcome_by_month'];
|
||||
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
$sugarChart = new SugarChart();
|
||||
$sugarChart->setProperties('',
|
||||
translate('LBL_OPP_SIZE', 'Charts') . ' ' . $currency_symbol . '1' .translate('LBL_OPP_THOUSANDS', 'Charts'),
|
||||
$chartDef['chartType']);
|
||||
$sugarChart->base_url = $chartDef['base_url'];
|
||||
$sugarChart->group_by = $chartDef['groupBy'];
|
||||
$sugarChart->url_params = array();
|
||||
$sugarChart->getData($this->constructQuery());
|
||||
$sugarChart->is_currency = true;
|
||||
$sugarChart->data_set = $sugarChart->sortData($sugarChart->data_set, 'm', false, 'sales_stage', true, true);
|
||||
$xmlFile = $sugarChart->getXMLFileName($this->id);
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
|
||||
return $this->getTitle('<div align="center"></div>') .
|
||||
'<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />';
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::constructQuery()
|
||||
*/
|
||||
protected function constructQuery()
|
||||
{
|
||||
$query = "SELECT sales_stage,".
|
||||
db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))." as m, ".
|
||||
"sum(amount_usdollar/1000) as total, count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= " WHERE opportunities.date_closed >= ".db_convert("'".$this->obm_date_start."'",'datetime') .
|
||||
" AND opportunities.date_closed <= ".db_convert("'".$this->obm_date_end."'",'datetime') .
|
||||
" AND opportunities.deleted=0";
|
||||
if (count($this->obm_ids) > 0)
|
||||
$query .= " AND opportunities.assigned_user_id IN ('" . implode("','",$this->obm_ids) . "')";
|
||||
$query .= " GROUP BY sales_stage,".
|
||||
db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'")) .
|
||||
" ORDER BY m";
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
37
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.pl_pl.lang.php
Executable file
37
modules/Charts/a/OutcomeByMonthDashlet/OutcomeByMonthDashlet.pl_pl.lang.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['OutcomeByMonthDashlet'] = array('LBL_TITLE' => 'Wyniki na Miesiąc',
|
||||
'LBL_DESCRIPTION' => 'Wykres Miesięcznych Wyników',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="pbuts_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMINVOICEOUT_STATUS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_ecminvoiceout_status[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select><br /><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMINVOICEOUT_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_ecminvoiceout_users[]" multiple size='4'>
|
||||
{$selected_datax_users}
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='Submit'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByInvoiceOutsStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By Invoices Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of Invoices Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Enterprise Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-enterprise-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByInvoiceOutsStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By Invoices Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of Invoices Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['PipelineByInvoiceOutsStatusDashlet'] = array('title' => translate('LBL_PIPELINE_BY_ECMINVOICEOUTS_TITLE', 'Home'),
|
||||
'description' => translate('LBL_PIPELINE_BY_ECMINVOICEOUTS_TITLE', 'Home'),
|
||||
'module' => 'EcmInvoiceOuts',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,554 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('modules/Dashboard/Forms.php');
|
||||
|
||||
class PipelineByInvoiceOutsStatusDashlet extends Dashlet {
|
||||
var $pbuts_date_start;
|
||||
var $pbuts_date_end;
|
||||
var $pbuts_ecminvoiceout_status = null;
|
||||
var $pbuts_ecminvoiceout_users = null;
|
||||
|
||||
|
||||
|
||||
var $refresh = false;
|
||||
|
||||
function PipelineByInvoiceOutsStatusDashlet($id, $options) {
|
||||
global $timedate;
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
$this->isRefreshable = true;
|
||||
|
||||
if(empty($options['pbuts_date_start']))
|
||||
$this->pbuts_date_start = date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_date_start = $options['pbuts_date_start'];
|
||||
|
||||
if(empty($options['pbuts_date_end']))
|
||||
$this->pbuts_date_end = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
else
|
||||
$this->pbuts_date_end = $options['pbuts_date_end'];
|
||||
|
||||
if(empty($options['pbuts_ecminvoiceout_status']))
|
||||
$this->pbuts_ecminvoiceout_status = array();
|
||||
else
|
||||
$this->pbuts_ecminvoiceout_status = $options['pbuts_ecminvoiceout_status'];
|
||||
|
||||
if(empty($options['pbuts_ecminvoiceout_users']))
|
||||
$this->pbuts_ecminvoiceout_users = array();
|
||||
else
|
||||
$this->pbuts_ecminvoiceout_users = $options['pbuts_ecminvoiceout_users'];
|
||||
|
||||
|
||||
if(empty($options['title']))
|
||||
$this->title = translate('LBL_PIPELINE_BY_ECMINVOICEOUTS_TITLE', 'Home');
|
||||
else
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
if(is_file($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml"))
|
||||
unlink($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml");
|
||||
|
||||
$options['title'] = $_REQUEST['pbuts_dashlet_title'];
|
||||
$options['pbuts_ecminvoiceout_status'] = $_REQUEST['pbuts_ecminvoiceout_status'];
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
|
||||
$options['pbuts_ecminvoiceout_users'] = $_REQUEST['pbuts_ecminvoiceout_users'];
|
||||
$options['pbuts_date_start'] = $timedate->swap_formats($_REQUEST['pbuts_date_start'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
$options['pbuts_date_end'] = $timedate->swap_formats($_REQUEST['pbuts_date_end'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $timedate, $image_path, $app_strings, $current_user, $app_list_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
$ss->assign('dashletType', 'predefined_chart');
|
||||
$ss->assign('LBL_TITLE', translate('LBL_TITLE', 'Charts'));
|
||||
$ss->assign('LBL_CHART_TYPE', translate('LBL_CHART_TYPE', 'Charts'));
|
||||
$ss->assign('LBL_DATE_START', translate('LBL_DATE_START', 'Charts'));
|
||||
$ss->assign('LBL_DATE_END', translate('LBL_DATE_END', 'Charts'));
|
||||
$ss->assign('LBL_ECMINVOICEOUT_STATUS', translate('LBL_ECMINVOICEOUT_STATUS', 'Charts'));
|
||||
$ss->assign('LBL_ENTER_DATE', translate('LBL_ENTER_DATE', 'Charts'));
|
||||
$ss->assign('LBL_ECMINVOICEOUT_USERS', translate('LBL_ECMINVOICEOUT_USERS', 'Charts'));
|
||||
$ss->assign('LBL_SELECT_BUTTON_TITLE', $app_strings['LBL_SELECT_BUTTON_TITLE']);
|
||||
$ss->assign('image_path', $image_path);
|
||||
|
||||
//get the dates to display
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
$ss->assign('date_start', $timedate->swap_formats($date_start, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
$ss->assign('date_end', $timedate->swap_formats($date_end, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_ecminvoiceout_status = $this->pbuts_ecminvoiceout_status;
|
||||
$tempx = $user_ecminvoiceout_status;
|
||||
|
||||
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['ecminvoiceouts_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['ecminvoiceouts_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['ecminvoiceouts_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
$query = "select id, user_name from users where deleted='0'";
|
||||
$dbm = new MysqlManager();
|
||||
$dbm->connect();
|
||||
$results = $dbm->query($query);
|
||||
$us = array();
|
||||
if(is_resource($results))
|
||||
while($row = $dbm->fetchByAssoc($results)) $us[$row['id']] = $row['user_name'];
|
||||
|
||||
|
||||
|
||||
$ss->assign('dashlet_title', $this->title);
|
||||
|
||||
|
||||
|
||||
$ss->assign('selected_datax', get_select_options_with_id($app_list_strings['ecminvoiceouts_status_dom'], $selected_datax));
|
||||
|
||||
|
||||
if(is_array($this->pbuts_ecminvoiceout_users) && count($this->pbuts_ecminvoiceout_users) > 0)
|
||||
$selected_datax_users = $this->pbuts_ecminvoiceout_users;
|
||||
else
|
||||
$selected_datax_users = $us;
|
||||
|
||||
$ss->assign('selected_datax_users', get_select_options_with_id($us, $selected_datax_users));
|
||||
|
||||
$ss->assign('user_date_format', $timedate->get_user_date_format());
|
||||
$ss->assign('cal_dateformat', $timedate->get_cal_date_format());
|
||||
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Charts/Dashlets/PipelineByInvoiceOutsStatusDashlet/PipelineByInvoiceOutsStatusConfigure.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
global $sugar_config, $current_user, $current_language;
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
$chartStringsXML = 'cache/xml/chart_strings.' . $current_language .'.lang.xml';
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', chartStyle());
|
||||
$ss->assign('chartColorsXML', chartColors());
|
||||
$ss->assign('chartStringsXML', $chartStringsXML);
|
||||
|
||||
$str = $ss->fetch('modules/Charts/Dashlets/PredefinedChartDashletScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getTitle($text) {
|
||||
global $image_path, $app_strings, $sugar_config;
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="#" onclick="SUGAR.mySugar.configureDashlet(\''
|
||||
. $this->id . '\'); return false;" class="chartToolsLink">'
|
||||
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right">';
|
||||
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\',\'predefined_chart\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. $image_path . 'refresh.gif"/></a> ';
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.deleteDashlet(\''
|
||||
. $this->id . '\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_DELETE', 'Home') . '" alt="' . translate('LBL_DASHLET_DELETE', 'Home') . '" src="'
|
||||
. $image_path . 'close_dashboard.gif"/></a></div></td></tr></table>';
|
||||
|
||||
if(!function_exists('get_form_header')) {
|
||||
global $theme;
|
||||
require_once('themes/'.$theme.'/layout_utils.php');
|
||||
}
|
||||
|
||||
$str = '<div ';
|
||||
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= ' onmouseover="this.style.cursor = \'move\';"';
|
||||
$str .= 'id="dashlet_header_' . $this->id . '">' . get_form_header($this->title, $additionalTitle, false) . '</div>';
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $current_user, $theme, $timedate, $image_path;
|
||||
|
||||
$this->loadLanguage('PipelineByInvoiceOutsStatusDashlet', 'modules/Charts/Dashlets/');
|
||||
$returnStr = '';
|
||||
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
if(isset($_REQUEST['pbuts_refresh'])) {
|
||||
$refresh = $_REQUEST['pbuts_refresh'];
|
||||
}
|
||||
else {
|
||||
$refresh = false;
|
||||
}
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $date_start;
|
||||
$dateXml[1] = $date_end;
|
||||
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_ecminvoiceout_status = $this->pbuts_ecminvoiceout_status;
|
||||
$tempx = $user_ecminvoiceout_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['ecminvoiceouts_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['ecminvoiceouts_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['ecminvoiceouts_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbuts_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbuts_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbuts_ids']) && count($_REQUEST['pbuts_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbuts_ids'];
|
||||
$current_user->setPreference('pbuts_ids', $_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbuts_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
|
||||
$sugar_smarty = new Sugar_Smarty();
|
||||
|
||||
$charts = array();
|
||||
|
||||
$sugarChart = new SugarChart();
|
||||
|
||||
$sugarChart->base_url = array( 'module' => 'EcmInvoiceOuts',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array();
|
||||
|
||||
|
||||
$ids = $this->pbuts_ecminvoiceout_users;
|
||||
|
||||
global $app_list_strings;
|
||||
$sugarChart->enum_for_labels = array( 'status' => $app_list_strings['ecminvoiceouts_status_dom'] );
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
$query = $this->constructQuery($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarS',$current_module_strings);
|
||||
|
||||
$sugarChart->setData($this->getChartData($query));
|
||||
|
||||
|
||||
$total = $sugarChart->getTotal();
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
$sugarChart->is_currency = true;
|
||||
//$sugarChart->currency_symbol = '';
|
||||
$sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$subtitle = translate('LBL_ECMINVOICEOUTS_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_ECMINVOICEOUTS_THOUSANDS', 'Charts');
|
||||
|
||||
$pipeline_total_string = translate('LBL_ECMINVOICEOUTS_TOTAL', 'Charts') . ' '. $sugarChart->currency_symbol . format_number($total) . $sugarChart->thousands_symbol;
|
||||
|
||||
|
||||
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
$returnStr .= $sugarChart->display($this->id, $xmlFile, '100%', '480', false);
|
||||
|
||||
return $this->getTitle('') . '<div align="center">' .$returnStr . '</div><br />';
|
||||
}
|
||||
|
||||
|
||||
// awu: Bug 16794 - this function is a hack to get the correct sales stage order until i can clean it up later
|
||||
function getChartData($query){
|
||||
global $app_list_strings, $current_user, $sugar_config;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_ecminvoiceout_status = $this->pbuts_ecminvoiceout_status;
|
||||
$tempx = $user_ecminvoiceout_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['ecminvoiceouts_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['ecminvoiceouts_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['ecminvoiceouts_status_dom']);
|
||||
}
|
||||
|
||||
$db = &PearDatabase::getInstance();
|
||||
|
||||
$result = $db->query($query);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
while($row != null){
|
||||
array_push($temp_data, $row);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $ecminvoiceout_status){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['status'] == $ecminvoiceout_status){
|
||||
//$value['total'] = $symbol . $value['total'];
|
||||
//$value['status'] = $app_list_strings['ecminvoiceouts_status_dom'][$value['status']];
|
||||
array_push($data, $value);
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo '<br><br>'; var_dump($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function constructQuery($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
global $timedate;
|
||||
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= " ecminvoiceouts.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND ecminvoiceouts.status IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND ecminvoiceouts.date_entered >= ". db_convert("'".$date_start."'",'datetime'). "
|
||||
AND ecminvoiceouts.date_entered <= ".db_convert("'".$date_end."'",'datetime') ;
|
||||
$where .= " AND ecminvoiceouts.assigned_user_id = users.id AND ecminvoiceouts.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
/*
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage";
|
||||
$query .= ",users.user_name,opportunities.assigned_user_id";
|
||||
*/
|
||||
$query = " SELECT ecminvoiceouts.status as status,
|
||||
users.user_name,
|
||||
ecminvoiceouts.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(total/1000) AS total
|
||||
FROM users, ecminvoiceouts ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY ecminvoiceouts.status";
|
||||
$query .= ", users.user_name, ecminvoiceouts.assigned_user_id";
|
||||
|
||||
//var_dump($query);
|
||||
//$res = $GLOBALS['db']->query($query);
|
||||
//var_dump($res);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array(
|
||||
'status',
|
||||
'user_name',
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,115 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="pbuts_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMQUOTE_STATUS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_ecmquote_status[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select><br /><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_ECMQUOTE_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_ecmquote_users[]" multiple size='4'>
|
||||
{$selected_datax_users}
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='Submit'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByQuotesStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By Quotes Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of Quotes Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Enterprise Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-enterprise-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByQuotesStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By Quotes Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of Quotes Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['PipelineByQuotesStatusDashlet'] = array('title' => translate('LBL_PIPELINE_BY_ECMQUOTES_TITLE', 'Home'),
|
||||
'description' => translate('LBL_PIPELINE_BY_ECMQUOTES_TITLE', 'Home'),
|
||||
'module' => 'EcmQuotes',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
558
modules/Charts/a/PipelineByQuotesStatusDashlet/PipelineByQuotesStatusDashlet.php
Executable file
558
modules/Charts/a/PipelineByQuotesStatusDashlet/PipelineByQuotesStatusDashlet.php
Executable file
@@ -0,0 +1,558 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('modules/Dashboard/Forms.php');
|
||||
|
||||
class PipelineByQuotesStatusDashlet extends Dashlet {
|
||||
var $pbuts_date_start;
|
||||
var $pbuts_date_end;
|
||||
var $pbuts_ecmquote_status = null;
|
||||
var $pbuts_ecmquote_users = null;
|
||||
|
||||
|
||||
|
||||
var $refresh = false;
|
||||
|
||||
function PipelineByQuotesStatusDashlet($id, $options) {
|
||||
global $timedate;
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
$this->isRefreshable = true;
|
||||
|
||||
if(empty($options['pbuts_date_start']))
|
||||
$this->pbuts_date_start = date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_date_start = $options['pbuts_date_start'];
|
||||
|
||||
if(empty($options['pbuts_date_end']))
|
||||
$this->pbuts_date_end = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
else
|
||||
$this->pbuts_date_end = $options['pbuts_date_end'];
|
||||
|
||||
if(empty($options['pbuts_ecmquote_status']))
|
||||
$this->pbuts_ecmquote_status = array();
|
||||
else
|
||||
$this->pbuts_ecmquote_status = $options['pbuts_ecmquote_status'];
|
||||
|
||||
if(empty($options['pbuts_ecmquote_users']))
|
||||
$this->pbuts_ecmquote_users = array();
|
||||
else
|
||||
$this->pbuts_ecmquote_users = $options['pbuts_ecmquote_users'];
|
||||
|
||||
|
||||
if(empty($options['title']))
|
||||
$this->title = translate('LBL_PIPELINE_BY_ECMQUOTES_TITLE', 'Home');
|
||||
else
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
if(is_file($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml"))
|
||||
unlink($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml");
|
||||
|
||||
$options['title'] = $_REQUEST['pbuts_dashlet_title'];
|
||||
$options['pbuts_ecmquote_status'] = $_REQUEST['pbuts_ecmquote_status'];
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
|
||||
$options['pbuts_ecmquote_users'] = $_REQUEST['pbuts_ecmquote_users'];
|
||||
$options['pbuts_date_start'] = $timedate->swap_formats($_REQUEST['pbuts_date_start'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
$options['pbuts_date_end'] = $timedate->swap_formats($_REQUEST['pbuts_date_end'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $timedate, $image_path, $app_strings, $current_user, $app_list_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
$ss->assign('dashletType', 'predefined_chart');
|
||||
$ss->assign('LBL_TITLE', translate('LBL_TITLE', 'Charts'));
|
||||
$ss->assign('LBL_CHART_TYPE', translate('LBL_CHART_TYPE', 'Charts'));
|
||||
$ss->assign('LBL_DATE_START', translate('LBL_DATE_START', 'Charts'));
|
||||
$ss->assign('LBL_DATE_END', translate('LBL_DATE_END', 'Charts'));
|
||||
$ss->assign('LBL_ECMQUOTE_STATUS', translate('LBL_ECMQUOTE_STATUS', 'Charts'));
|
||||
$ss->assign('LBL_ENTER_DATE', translate('LBL_ENTER_DATE', 'Charts'));
|
||||
$ss->assign('LBL_ECMQUOTE_USERS', translate('LBL_ECMQUOTE_USERS', 'Charts'));
|
||||
$ss->assign('LBL_SELECT_BUTTON_TITLE', $app_strings['LBL_SELECT_BUTTON_TITLE']);
|
||||
$ss->assign('image_path', $image_path);
|
||||
|
||||
//get the dates to display
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
$ss->assign('date_start', $timedate->swap_formats($date_start, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
$ss->assign('date_end', $timedate->swap_formats($date_end, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_ecmquote_status = $this->pbuts_ecmquote_status;
|
||||
$tempx = $user_ecmquote_status;
|
||||
|
||||
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['ecmquotes_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['ecmquotes_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['ecmquotes_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
$query = "select id, first_name, last_name from users where deleted='0' and status='Active'";
|
||||
$dbm = new MysqlManager();
|
||||
$dbm->connect();
|
||||
$results = $dbm->query($query);
|
||||
$us = array();
|
||||
if(is_resource($results))
|
||||
while($row = $dbm->fetchByAssoc($results)) $us[$row['id']] = $row['first_name'].' '.$row['last_name'];
|
||||
|
||||
|
||||
|
||||
$ss->assign('dashlet_title', $this->title);
|
||||
|
||||
|
||||
|
||||
$ss->assign('selected_datax', get_select_options_with_id($app_list_strings['ecmquotes_status_dom'], $selected_datax));
|
||||
|
||||
|
||||
if(is_array($this->pbuts_ecmquote_users) && count($this->pbuts_ecmquote_users) > 0)
|
||||
$selected_datax_users = $this->pbuts_ecmquote_users;
|
||||
else
|
||||
$selected_datax_users = $us;
|
||||
|
||||
$ss->assign('selected_datax_users', get_select_options_with_id($us, $selected_datax_users));
|
||||
|
||||
$ss->assign('user_date_format', $timedate->get_user_date_format());
|
||||
$ss->assign('cal_dateformat', $timedate->get_cal_date_format());
|
||||
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Charts/Dashlets/PipelineByQuotesStatusDashlet/PipelineByQuotesStatusConfigure.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
global $sugar_config, $current_user, $current_language;
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
$chartStringsXML = 'cache/xml/chart_strings.' . $current_language .'.lang.xml';
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', chartStyle());
|
||||
$ss->assign('chartColorsXML', chartColors());
|
||||
$ss->assign('chartStringsXML', $chartStringsXML);
|
||||
|
||||
$str = $ss->fetch('modules/Charts/Dashlets/PredefinedChartDashletScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getTitle($text) {
|
||||
global $image_path, $app_strings, $sugar_config;
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="#" onclick="SUGAR.mySugar.configureDashlet(\''
|
||||
. $this->id . '\'); return false;" class="chartToolsLink">'
|
||||
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right">';
|
||||
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\',\'predefined_chart\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. $image_path . 'refresh.gif"/></a> ';
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.deleteDashlet(\''
|
||||
. $this->id . '\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_DELETE', 'Home') . '" alt="' . translate('LBL_DASHLET_DELETE', 'Home') . '" src="'
|
||||
. $image_path . 'close_dashboard.gif"/></a></div></td></tr></table>';
|
||||
|
||||
if(!function_exists('get_form_header')) {
|
||||
global $theme;
|
||||
require_once('themes/'.$theme.'/layout_utils.php');
|
||||
}
|
||||
|
||||
$str = '<div ';
|
||||
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= ' onmouseover="this.style.cursor = \'move\';"';
|
||||
$str .= 'id="dashlet_header_' . $this->id . '">' . get_form_header($this->title, $additionalTitle, false) . '</div>';
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $current_user, $theme, $timedate, $image_path;
|
||||
|
||||
$this->loadLanguage('PipelineByQuotesStatusDashlet', 'modules/Charts/Dashlets/');
|
||||
$returnStr = '';
|
||||
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
if(isset($_REQUEST['pbuts_refresh'])) {
|
||||
$refresh = $_REQUEST['pbuts_refresh'];
|
||||
}
|
||||
else {
|
||||
$refresh = false;
|
||||
}
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $date_start;
|
||||
$dateXml[1] = $date_end;
|
||||
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_ecmquote_status = $this->pbuts_ecmquote_status;
|
||||
$tempx = $user_ecmquote_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['ecmquotes_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['ecmquotes_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['ecmquotes_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbuts_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbuts_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbuts_ids']) && count($_REQUEST['pbuts_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbuts_ids'];
|
||||
$current_user->setPreference('pbuts_ids', $_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbuts_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
|
||||
$sugar_smarty = new Sugar_Smarty();
|
||||
|
||||
$charts = array();
|
||||
|
||||
$sugarChart = new SugarChart();
|
||||
|
||||
$sugarChart->base_url = array( 'module' => 'EcmQuotes',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array();
|
||||
|
||||
|
||||
$ids = $this->pbuts_ecmquote_users;
|
||||
|
||||
global $app_list_strings;
|
||||
$sugarChart->enum_for_labels = array( 'status' => $app_list_strings['ecmquotes_status_dom'] );
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
$query = $this->constructQuery($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarS',$current_module_strings);
|
||||
//echo '<pre>';print_r($this->getChartData($query));echo '</pre>';
|
||||
$sugarChart->setData($this->getChartData($query));
|
||||
|
||||
|
||||
$total = $sugarChart->getTotal();
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
$sugarChart->is_currency = true;
|
||||
//$sugarChart->currency_symbol = '';
|
||||
$sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$subtitle = translate('LBL_ECMQUOTES_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_ECMQUOTES_THOUSANDS', 'Charts');
|
||||
|
||||
$pipeline_total_string = translate('LBL_ECMQUOTES_TOTAL', 'Charts') . ' '. $sugarChart->currency_symbol . format_number($total) . $sugarChart->thousands_symbol;
|
||||
|
||||
|
||||
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
$returnStr .= $sugarChart->display($this->id, $xmlFile, '100%', '480', false);
|
||||
|
||||
return $this->getTitle('') . '<div align="center">' .$returnStr . '</div><br />';
|
||||
}
|
||||
|
||||
|
||||
// awu: Bug 16794 - this function is a hack to get the correct sales stage order until i can clean it up later
|
||||
function getChartData($query){
|
||||
global $app_list_strings, $current_user, $sugar_config;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_ecmquote_status = $this->pbuts_ecmquote_status;
|
||||
$tempx = $user_ecmquote_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['ecmquotes_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['ecmquotes_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['ecmquotes_status_dom']);
|
||||
}
|
||||
|
||||
$db = &PearDatabase::getInstance();
|
||||
|
||||
$result = $db->query($query);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
while($row != null){
|
||||
array_push($temp_data, $row);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $ecmquote_status){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['status'] == $ecmquote_status){
|
||||
//$value['total'] = $symbol . $value['total'];
|
||||
$value['status'] = $app_list_strings['ecmquotes_status_dom'][$value['status']];
|
||||
array_push($data, $value);
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo '<br><br>'; var_dump($data);
|
||||
//echo '<pre>';print_r($data);echo '</pre>';
|
||||
return $data;
|
||||
}
|
||||
|
||||
function constructQuery($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
global $timedate;
|
||||
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= " ecmquotes.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND ecmquotes.status IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND ecmquotes.date_entered >= ". db_convert("'".$date_start."'",'datetime'). "
|
||||
AND ecmquotes.date_entered <= ".db_convert("'".$date_end."'",'datetime') ;
|
||||
$where .= " AND ecmquotes.assigned_user_id = users.id AND ecmquotes.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
/*
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage";
|
||||
$query .= ",users.user_name,opportunities.assigned_user_id";
|
||||
*/
|
||||
$query = " SELECT
|
||||
concat(users.first_name, ' ', users.last_name) as user_name,
|
||||
|
||||
ecmquotes.status,
|
||||
|
||||
ecmquotes.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(total/1000) AS total
|
||||
FROM users, ecmquotes ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY concat(users.first_name, ' ', users.last_name)";
|
||||
$query .= ", ecmquotes.status, ecmquotes.assigned_user_id";
|
||||
|
||||
//var_dump($query);
|
||||
//$res = $GLOBALS['db']->query($query);
|
||||
//var_dump($res);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array( 'user_name',
|
||||
'status',
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
109
modules/Charts/a/PipelineBySalesStageDashlet/PipelineBySalesStageConfigure.tpl
Executable file
109
modules/Charts/a/PipelineBySalesStageDashlet/PipelineBySalesStageConfigure.tpl
Executable file
@@ -0,0 +1,109 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="pbss_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbss_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbss_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_SALES_STAGES}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbss_sales_stages[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='{$LBL_SUBMIT_BUTTON_LABEL}'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$dashletData['PipelineBySalesStageDashlet']['searchFields'] = array(
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'pbss_date_start' => array(
|
||||
'name' => 'pbss_date_start',
|
||||
'vname' => 'LBL_DATE_START',
|
||||
'type' => 'datepicker',
|
||||
),
|
||||
'pbss_date_end' => array(
|
||||
'name' => 'pbss_date_end',
|
||||
'vname' => 'LBL_DATE_END',
|
||||
'type' => 'datepicker',
|
||||
),
|
||||
'pbss_sales_stages' => array(
|
||||
'name' => 'pbss_sales_stages',
|
||||
'vname' => 'LBL_SALES_STAGES',
|
||||
'type' => 'enum',
|
||||
),
|
||||
);
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineBySalesStageDashlet'] = array('LBL_TITLE' => 'Pipeline By Sales Stage',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of Sales Stage Pipeline',
|
||||
'LBL_REFRESH' => 'Refresh Chart');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineBySalesStageDashlet'] = array('LBL_TITLE' => 'Pipeline nach Verkaufsphasen',
|
||||
'LBL_DESCRIPTION' => 'Vertikales Balkendiagramm der Pipeline nach Verkaufsphasen',
|
||||
'LBL_REFRESH' => 'Diagramm neu laden');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['PipelineBySalesStageDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'module' => 'Opportunities',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
231
modules/Charts/a/PipelineBySalesStageDashlet/PipelineBySalesStageDashlet.php
Executable file
231
modules/Charts/a/PipelineBySalesStageDashlet/PipelineBySalesStageDashlet.php
Executable file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/DashletGenericChart.php');
|
||||
|
||||
class PipelineBySalesStageDashlet extends DashletGenericChart
|
||||
{
|
||||
public $pbss_date_start;
|
||||
public $pbss_date_end;
|
||||
public $pbss_sales_stages = array();
|
||||
|
||||
|
||||
|
||||
|
||||
protected $_seedName = 'Opportunities';
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::__construct()
|
||||
*/
|
||||
public function __construct(
|
||||
$id,
|
||||
array $options = null
|
||||
)
|
||||
{
|
||||
global $timedate;
|
||||
|
||||
if(empty($options['pbss_date_start']))
|
||||
$options['pbss_date_start'] = date($timedate->get_db_date_time_format(), time());
|
||||
|
||||
if(empty($options['pbss_date_end']))
|
||||
$options['pbss_date_end'] = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
|
||||
if(empty($options['title']))
|
||||
$options['title'] = translate('LBL_PIPELINE_FORM_TITLE', 'Home');
|
||||
|
||||
parent::__construct($id,$options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::displayOptions()
|
||||
*/
|
||||
public function displayOptions()
|
||||
{
|
||||
global $app_list_strings;
|
||||
|
||||
if (!empty($this->pbss_sales_stages) && count($this->pbss_sales_stages) > 0)
|
||||
foreach ($this->pbss_sales_stages as $key)
|
||||
$selected_datax[] = $key;
|
||||
else
|
||||
$selected_datax = array_keys($app_list_strings['sales_stage_dom']);
|
||||
|
||||
$this->_searchFields['pbss_sales_stages']['options'] = $app_list_strings['sales_stage_dom'];
|
||||
$this->_searchFields['pbss_sales_stages']['input_name0'] = $selected_datax;
|
||||
|
||||
|
||||
|
||||
|
||||
return parent::displayOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::display()
|
||||
*/
|
||||
public function display()
|
||||
{
|
||||
global $current_user, $sugar_config;
|
||||
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
$sugarChart = new SugarChart();
|
||||
$sugarChart->base_url = array(
|
||||
'module' => 'Opportunities',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array( );
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
$sugarChart->setData($this->getChartData($this->constructQuery()));
|
||||
$sugarChart->is_currency = true;
|
||||
$sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
$subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . format_number($sugarChart->getTotal(), 0, 0, array('convert'=>true)) . $sugarChart->thousands_symbol;
|
||||
|
||||
|
||||
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugarChart->getXMLFileName($this->id);
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
|
||||
return $this->getTitle('') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div><br />';
|
||||
}
|
||||
|
||||
/**
|
||||
* awu: Bug 16794 - this function is a hack to get the correct sales stage order until
|
||||
* i can clean it up later
|
||||
*
|
||||
* @param $query string
|
||||
* @return array
|
||||
*/
|
||||
private function getChartData(
|
||||
$query
|
||||
)
|
||||
{
|
||||
global $app_list_strings, $db;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_sales_stage = $this->pbss_sales_stages;
|
||||
$tempx = $user_sales_stage;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
|
||||
$selected_datax[] = $key;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['sales_stage_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['sales_stage_dom']);
|
||||
}
|
||||
|
||||
$result = $db->query($query);
|
||||
while($row = $db->fetchByAssoc($result, -1, false))
|
||||
$temp_data[] = $row;
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $sales_stage){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['sales_stage'] == $sales_stage){
|
||||
$value['sales_stage'] = $app_list_strings['sales_stage_dom'][$value['sales_stage']];
|
||||
$value['key'] = $sales_stage;
|
||||
$value['value'] = $value['sales_stage'];
|
||||
$data[] = $value;
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::constructQuery()
|
||||
*/
|
||||
protected function constructQuery()
|
||||
{
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= " WHERE opportunities.date_closed >= ". db_convert("'".$this->pbss_date_start."'",'datetime').
|
||||
" AND opportunities.date_closed <= ".db_convert("'".$this->pbss_date_end."'",'datetime') .
|
||||
" AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
if ( count($this->pbss_sales_stages) > 0 )
|
||||
$query .= " AND opportunities.sales_stage IN ('" . implode("','",$this->pbss_sales_stages) . "') ";
|
||||
$query .= " GROUP BY opportunities.sales_stage ,users.user_name,opportunities.assigned_user_id";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DashletGenericChart::constructGroupBy()
|
||||
*/
|
||||
protected function constructGroupBy()
|
||||
{
|
||||
return array(
|
||||
'sales_stage',
|
||||
'user_name',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Professional Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineBySalesStageDashlet'] = array('LBL_TITLE' => 'Lejek Etapów Sprzedaży',
|
||||
'LBL_DESCRIPTION' => 'Wykres Lejka Poziomych Belek Etapów Sprzedaży',
|
||||
'LBL_REFRESH' => 'Odświerz Wykres');
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="pbuts_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_BUG_STATUS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_bug_status[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select><br /><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_BUG_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_bug_users[]" multiple size='4'>
|
||||
{$selected_datax_users}
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='Submit'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByUserBugsStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By User Bugs Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of User Bugs Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Enterprise Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-enterprise-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByUserBugsStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By User Bugs Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of User Bugs Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['PipelineByUserBugsStatusDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'module' => 'Bugs',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,553 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('modules/Dashboard/Forms.php');
|
||||
|
||||
class PipelineByUserBugsStatusDashlet extends Dashlet {
|
||||
var $pbuts_date_start;
|
||||
var $pbuts_date_end;
|
||||
var $pbuts_bug_status = null;
|
||||
var $pbuts_bug_users = null;
|
||||
|
||||
|
||||
|
||||
var $refresh = false;
|
||||
|
||||
function PipelineByUserBugsStatusDashlet($id, $options) {
|
||||
global $timedate;
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
$this->isRefreshable = true;
|
||||
|
||||
if(empty($options['pbuts_date_start']))
|
||||
$this->pbuts_date_start = date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_date_start = $options['pbuts_date_start'];
|
||||
|
||||
if(empty($options['pbuts_date_end']))
|
||||
$this->pbuts_date_end = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
else
|
||||
$this->pbuts_date_end = $options['pbuts_date_end'];
|
||||
|
||||
if(empty($options['pbuts_bug_status']))
|
||||
$this->pbuts_bug_status = array();
|
||||
else
|
||||
$this->pbuts_bug_status = $options['pbuts_bug_status'];
|
||||
|
||||
if(empty($options['pbuts_bug_users']))
|
||||
$this->pbuts_bug_users = array();
|
||||
else
|
||||
$this->pbuts_bug_users = $options['pbuts_bug_users'];
|
||||
|
||||
|
||||
if(empty($options['title']))
|
||||
$this->title = translate('LBL_PIPELINE_BY_USER_BUGS_STATUS_FORM_TITLE', 'Home');
|
||||
else
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
if(is_file($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml"))
|
||||
unlink($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml");
|
||||
|
||||
$options['title'] = $_REQUEST['pbuts_dashlet_title'];
|
||||
$options['pbuts_bug_status'] = $_REQUEST['pbuts_bug_status'];
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
|
||||
$options['pbuts_bug_users'] = $_REQUEST['pbuts_bug_users'];
|
||||
$options['pbuts_date_start'] = $timedate->swap_formats($_REQUEST['pbuts_date_start'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
$options['pbuts_date_end'] = $timedate->swap_formats($_REQUEST['pbuts_date_end'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $timedate, $image_path, $app_strings, $current_user, $app_list_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
$ss->assign('dashletType', 'predefined_chart');
|
||||
$ss->assign('LBL_TITLE', translate('LBL_TITLE', 'Charts'));
|
||||
$ss->assign('LBL_CHART_TYPE', translate('LBL_CHART_TYPE', 'Charts'));
|
||||
$ss->assign('LBL_DATE_START', translate('LBL_DATE_START', 'Charts'));
|
||||
$ss->assign('LBL_DATE_END', translate('LBL_DATE_END', 'Charts'));
|
||||
$ss->assign('LBL_BUG_STATUS', translate('LBL_BUG_STATUS', 'Charts'));
|
||||
$ss->assign('LBL_ENTER_DATE', translate('LBL_ENTER_DATE', 'Charts'));
|
||||
$ss->assign('LBL_BUG_USERS', translate('LBL_BUG_USERS', 'Charts'));
|
||||
$ss->assign('LBL_SELECT_BUTTON_TITLE', $app_strings['LBL_SELECT_BUTTON_TITLE']);
|
||||
$ss->assign('image_path', $image_path);
|
||||
|
||||
//get the dates to display
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
$ss->assign('date_start', $timedate->swap_formats($date_start, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
$ss->assign('date_end', $timedate->swap_formats($date_end, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_bug_status = $this->pbuts_bug_status;
|
||||
$tempx = $user_bug_status;
|
||||
|
||||
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['bug_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['bug_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['bug_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
$query = "select id, user_name from users where deleted='0'";
|
||||
$dbm = new MysqlManager();
|
||||
$dbm->connect();
|
||||
$results = $dbm->query($query);
|
||||
$us = array();
|
||||
if(is_resource($results))
|
||||
while($row = $dbm->fetchByAssoc($results)) $us[$row['id']] = $row['user_name'];
|
||||
|
||||
|
||||
|
||||
$ss->assign('dashlet_title', $this->title);
|
||||
|
||||
|
||||
|
||||
$ss->assign('selected_datax', get_select_options_with_id($app_list_strings['bug_status_dom'], $selected_datax));
|
||||
|
||||
|
||||
if(is_array($this->pbuts_bug_users) && count($this->pbuts_bug_users) > 0)
|
||||
$selected_datax_users = $this->pbuts_bug_users;
|
||||
else
|
||||
$selected_datax_users = $us;
|
||||
|
||||
$ss->assign('selected_datax_users', get_select_options_with_id($us, $selected_datax_users));
|
||||
|
||||
$ss->assign('user_date_format', $timedate->get_user_date_format());
|
||||
$ss->assign('cal_dateformat', $timedate->get_cal_date_format());
|
||||
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Charts/Dashlets/PipelineByUserBugsStatusDashlet/PipelineByUserBugsStatusConfigure.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
global $sugar_config, $current_user, $current_language;
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
$chartStringsXML = 'cache/xml/chart_strings.' . $current_language .'.lang.xml';
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', chartStyle());
|
||||
$ss->assign('chartColorsXML', chartColors());
|
||||
$ss->assign('chartStringsXML', $chartStringsXML);
|
||||
|
||||
$str = $ss->fetch('modules/Charts/Dashlets/PredefinedChartDashletScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getTitle($text) {
|
||||
global $image_path, $app_strings, $sugar_config;
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="#" onclick="SUGAR.mySugar.configureDashlet(\''
|
||||
. $this->id . '\'); return false;" class="chartToolsLink">'
|
||||
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right">';
|
||||
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\',\'predefined_chart\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. $image_path . 'refresh.gif"/></a> ';
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.deleteDashlet(\''
|
||||
. $this->id . '\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_DELETE', 'Home') . '" alt="' . translate('LBL_DASHLET_DELETE', 'Home') . '" src="'
|
||||
. $image_path . 'close_dashboard.gif"/></a></div></td></tr></table>';
|
||||
|
||||
if(!function_exists('get_form_header')) {
|
||||
global $theme;
|
||||
require_once('themes/'.$theme.'/layout_utils.php');
|
||||
}
|
||||
|
||||
$str = '<div ';
|
||||
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= ' onmouseover="this.style.cursor = \'move\';"';
|
||||
$str .= 'id="dashlet_header_' . $this->id . '">' . get_form_header($this->title, $additionalTitle, false) . '</div>';
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $current_user, $theme, $timedate, $image_path;
|
||||
|
||||
$this->loadLanguage('PipelineByUserBugsStatusDashlet', 'modules/Charts/Dashlets/');
|
||||
$returnStr = '';
|
||||
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
if(isset($_REQUEST['pbuts_refresh'])) {
|
||||
$refresh = $_REQUEST['pbuts_refresh'];
|
||||
}
|
||||
else {
|
||||
$refresh = false;
|
||||
}
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $date_start;
|
||||
$dateXml[1] = $date_end;
|
||||
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_bug_status = $this->pbuts_bug_status;
|
||||
$tempx = $user_bug_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['bug_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['bug_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['bug_status_dom']);
|
||||
}
|
||||
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbuts_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbuts_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbuts_ids']) && count($_REQUEST['pbuts_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbuts_ids'];
|
||||
$current_user->setPreference('pbuts_ids', $_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbuts_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
|
||||
$sugar_smarty = new Sugar_Smarty();
|
||||
|
||||
$charts = array();
|
||||
|
||||
$sugarChart = new SugarChart();
|
||||
|
||||
$sugarChart->base_url = array( 'module' => 'Bugs',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array();
|
||||
|
||||
|
||||
$ids = $this->pbuts_bug_users;
|
||||
|
||||
global $app_list_strings;
|
||||
$sugarChart->enum_for_labels = array( 'status' => $app_list_strings['bug_status_dom'] );
|
||||
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
$query = $this->constructQuery($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarS',$current_module_strings);
|
||||
|
||||
$sugarChart->setData($this->getChartData($query));
|
||||
|
||||
|
||||
$total = $sugarChart->getTotal();
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
$sugarChart->is_currency = false;
|
||||
$sugarChart->currency_symbol = '';
|
||||
$sugarChart->thousands_symbol = '';//translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$subtitle = translate('LBL_BUG_SIZE', 'Charts');
|
||||
|
||||
$pipeline_total_string = translate('LBL_BUGS_TOTAL', 'Charts') . $total;
|
||||
|
||||
|
||||
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
$returnStr .= $sugarChart->display($this->id, $xmlFile, '100%', '480', false);
|
||||
|
||||
return $this->getTitle('') . '<div align="center">' .$returnStr . '</div><br />';
|
||||
}
|
||||
|
||||
|
||||
// awu: Bug 16794 - this function is a hack to get the correct sales stage order until i can clean it up later
|
||||
function getChartData($query){
|
||||
global $app_list_strings, $current_user, $sugar_config;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_bug_status = $this->pbuts_bug_status;
|
||||
$tempx = $user_bug_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['bug_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['bug_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['bug_status_dom']);
|
||||
}
|
||||
|
||||
$db = &PearDatabase::getInstance();
|
||||
|
||||
$result = $db->query($query);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
while($row != null){
|
||||
array_push($temp_data, $row);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $bug_status){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['status'] == $bug_status){
|
||||
//$value['total'] = $symbol . $value['total'];
|
||||
//$value['status'] = $app_list_strings['bug_status_dom'][$value['status']];
|
||||
array_push($data, $value);
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo '<br><br>'; var_dump($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function constructQuery($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
global $timedate;
|
||||
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= " bugs.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND bugs.status IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND bugs.date_entered >= ". db_convert("'".$date_start."'",'datetime'). "
|
||||
AND bugs.date_entered <= ".db_convert("'".$date_end."'",'datetime') ;
|
||||
$where .= " AND bugs.assigned_user_id = users.id AND bugs.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
/*
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage";
|
||||
$query .= ",users.user_name,opportunities.assigned_user_id";
|
||||
*/
|
||||
$query = " SELECT bugs.status as status,
|
||||
users.user_name,
|
||||
bugs.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
count( bugs.assigned_user_id ) AS total
|
||||
FROM users, bugs ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY bugs.status";
|
||||
$query .= ", users.user_name, bugs.assigned_user_id";
|
||||
|
||||
//var_dump($query);
|
||||
//$res = $GLOBALS['db']->query($query);
|
||||
//var_dump($res);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array(
|
||||
'status',
|
||||
'user_name',
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,115 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<div style='width: 400px'>
|
||||
<form name='configure_{$id}' action="index.php" method="post" onSubmit='return SUGAR.dashlets.postForm("configure_{$id}", SUGAR.mySugar.uncoverPage);'>
|
||||
<input type='hidden' name='id' value='{$id}'>
|
||||
<input type='hidden' name='module' value='{$module}'>
|
||||
<input type='hidden' name='action' value='DynamicAction'>
|
||||
<input type='hidden' name='DynamicAction' value='configureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<input type='hidden' id='dashletType' name='dashletType' value='{$dashletType}' />
|
||||
<table width="400" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TITLE} <br /></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input type="text" value="{$dashlet_title}" size="30" name="pbuts_dashlet_title"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_START} <br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_start" size='12' maxlength='10' id='date_start' value='{$date_start}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_start_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap class='dataLabel'>{$LBL_DATE_END}<br><i>{$user_date_format}</i></td>
|
||||
<td valign='top' class='dataField'>
|
||||
<input onblur="parseDate(this, '{$cal_dateformat}');" class="text" name="pbuts_date_end" size='12' maxlength='10' id='date_end' value='{$date_end}'>
|
||||
<img src="themes/default/images/jscalendar.gif" alt="{$LBL_ENTER_DATE}" id="date_end_trigger" align="absmiddle">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TASK_STATUS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_task_status[]" multiple size='3'>
|
||||
{$selected_datax}
|
||||
</select><br /><br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' class='dataLabel' nowrap>{$LBL_TASK_USERS}</td>
|
||||
<td valign='top' class='dataField'>
|
||||
<select name="pbuts_task_users[]" multiple size='4'>
|
||||
{$selected_datax_users}
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" colspan="2">
|
||||
<input type='submit' onclick="" class='button' value='Submit'>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "{/literal}{$cal_dateformat}{literal}", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByUserTasksStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By User Tasks Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of User Tasks Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* The contents of this file are subject to the SugarCRM Enterprise Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-enterprise-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$dashletStrings['PipelineByUserTasksStatusDashlet'] = array(
|
||||
'LBL_TITLE' => 'Pipeline By User Tasks Status',
|
||||
'LBL_DESCRIPTION' => 'Vertical Bar Chart of User Tasks Status',
|
||||
'LBL_REFRESH' => 'Refresh Chart'
|
||||
);
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
global $app_strings, $current_language;
|
||||
|
||||
$dashletMeta['PipelineByUserTasksStatusDashlet'] = array('title' => 'LBL_TITLE',
|
||||
'description' => 'LBL_TITLE',
|
||||
'module' => 'Tasks',
|
||||
'icon' => 'themes/default/images/icon_Charts_Funnel_32.gif',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,557 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('modules/Dashboard/Forms.php');
|
||||
|
||||
class PipelineByUserTasksStatusDashlet extends Dashlet {
|
||||
var $pbuts_date_start;
|
||||
var $pbuts_date_end;
|
||||
var $pbuts_task_status = null;
|
||||
var $pbuts_task_users = null;
|
||||
|
||||
|
||||
|
||||
var $refresh = false;
|
||||
|
||||
function PipelineByUserTasksStatusDashlet($id, $options) {
|
||||
global $timedate;
|
||||
parent::Dashlet($id);
|
||||
$this->isConfigurable = true;
|
||||
$this->isRefreshable = true;
|
||||
|
||||
if(empty($options['pbuts_date_start']))
|
||||
$this->pbuts_date_start = date($timedate->get_db_date_time_format(), time());
|
||||
else
|
||||
$this->pbuts_date_start = $options['pbuts_date_start'];
|
||||
|
||||
if(empty($options['pbuts_date_end']))
|
||||
$this->pbuts_date_end = date($timedate->get_db_date_time_format(), strtotime('2010-01-01'));
|
||||
else
|
||||
$this->pbuts_date_end = $options['pbuts_date_end'];
|
||||
|
||||
if(empty($options['pbuts_task_status']))
|
||||
$this->pbuts_task_status = array();
|
||||
else
|
||||
$this->pbuts_task_status = $options['pbuts_task_status'];
|
||||
|
||||
if(empty($options['pbuts_task_users']))
|
||||
$this->pbuts_task_users = array();
|
||||
else
|
||||
$this->pbuts_task_users = $options['pbuts_task_users'];
|
||||
|
||||
|
||||
if(empty($options['title']))
|
||||
$this->title = translate('LBL_PIPELINE_BY_USER_TASKS_STATUS_FORM_TITLE', 'Home');
|
||||
else
|
||||
$this->title = $options['title'];
|
||||
}
|
||||
|
||||
function saveOptions($req) {
|
||||
global $sugar_config, $timedate, $current_user, $theme;
|
||||
$options = array();
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
if(is_file($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml"))
|
||||
unlink($sugar_config['tmp_dir'] . $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml");
|
||||
|
||||
$options['title'] = $_REQUEST['pbuts_dashlet_title'];
|
||||
$options['pbuts_task_status'] = $_REQUEST['pbuts_task_status'];
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
|
||||
$options['pbuts_task_users'] = $_REQUEST['pbuts_task_users'];
|
||||
$options['pbuts_date_start'] = $timedate->swap_formats($_REQUEST['pbuts_date_start'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
$options['pbuts_date_end'] = $timedate->swap_formats($_REQUEST['pbuts_date_end'], $timeFormat['date'], $timedate->dbDayFormat);
|
||||
|
||||
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $timedate, $image_path, $app_strings, $current_user, $app_list_strings;
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('id', $this->id);
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
$ss->assign('dashletType', 'predefined_chart');
|
||||
$ss->assign('LBL_TITLE', translate('LBL_TITLE', 'Charts'));
|
||||
$ss->assign('LBL_CHART_TYPE', translate('LBL_CHART_TYPE', 'Charts'));
|
||||
$ss->assign('LBL_DATE_START', translate('LBL_DATE_START', 'Charts'));
|
||||
$ss->assign('LBL_DATE_END', translate('LBL_DATE_END', 'Charts'));
|
||||
$ss->assign('LBL_TASK_STATUS', translate('LBL_TASK_STATUS', 'Charts'));
|
||||
$ss->assign('LBL_ENTER_DATE', translate('LBL_ENTER_DATE', 'Charts'));
|
||||
$ss->assign('LBL_TASK_USERS', translate('LBL_TASK_USERS', 'Charts'));
|
||||
$ss->assign('LBL_SELECT_BUTTON_TITLE', $app_strings['LBL_SELECT_BUTTON_TITLE']);
|
||||
$ss->assign('image_path', $image_path);
|
||||
|
||||
//get the dates to display
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
$timeFormat = $current_user->getUserDateTimePreferences();
|
||||
$ss->assign('date_start', $timedate->swap_formats($date_start, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
$ss->assign('date_end', $timedate->swap_formats($date_end, $timedate->dbDayFormat, $timeFormat['date']));
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_task_status = $this->pbuts_task_status;
|
||||
$tempx = $user_task_status;
|
||||
|
||||
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['task_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['task_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['task_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
$query = "select id, user_name from users where deleted='0'";
|
||||
$dbm = new MysqlManager();
|
||||
$dbm->connect();
|
||||
$results = $dbm->query($query);
|
||||
$us = array();
|
||||
if(is_resource($results))
|
||||
while($row = $dbm->fetchByAssoc($results)) $us[$row['id']] = $row['user_name'];
|
||||
|
||||
|
||||
|
||||
$ss->assign('dashlet_title', $this->title);
|
||||
|
||||
|
||||
|
||||
$ss->assign('selected_datax', get_select_options_with_id($app_list_strings['task_status_dom'], $selected_datax));
|
||||
|
||||
|
||||
if(is_array($this->pbuts_task_users) && count($this->pbuts_task_users) > 0)
|
||||
$selected_datax_users = $this->pbuts_task_users;
|
||||
else
|
||||
$selected_datax_users = $us;
|
||||
|
||||
$ss->assign('selected_datax_users', get_select_options_with_id($us, $selected_datax_users));
|
||||
|
||||
$ss->assign('user_date_format', $timedate->get_user_date_format());
|
||||
$ss->assign('cal_dateformat', $timedate->get_cal_date_format());
|
||||
|
||||
$ss->assign('module', $_REQUEST['module']);
|
||||
|
||||
return parent::displayOptions() . $ss->fetch('modules/Charts/Dashlets/PipelineByUserTasksStatusDashlet/PipelineByUserTasksStatusConfigure.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the javascript for the dashlet
|
||||
*
|
||||
* @return string javascript to use with this dashlet
|
||||
*/
|
||||
function displayScript() {
|
||||
global $sugar_config, $current_user, $current_language;
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
$chartStringsXML = 'cache/xml/chart_strings.' . $current_language .'.lang.xml';
|
||||
|
||||
$ss = new Sugar_Smarty();
|
||||
$ss->assign('chartName', $this->id);
|
||||
$ss->assign('chartXMLFile', $xmlFile);
|
||||
|
||||
$ss->assign('chartStyleCSS', chartStyle());
|
||||
$ss->assign('chartColorsXML', chartColors());
|
||||
$ss->assign('chartStringsXML', $chartStringsXML);
|
||||
|
||||
$str = $ss->fetch('modules/Charts/Dashlets/PredefinedChartDashletScript.tpl');
|
||||
return $str;
|
||||
}
|
||||
|
||||
function getTitle($text) {
|
||||
global $image_path, $app_strings, $sugar_config;
|
||||
|
||||
if($this->isConfigurable)
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right"><a href="#" onclick="SUGAR.mySugar.configureDashlet(\''
|
||||
. $this->id . '\'); return false;" class="chartToolsLink">'
|
||||
. get_image($image_path.'edit','title="' . translate('LBL_DASHLET_EDIT', 'Home') . '" alt="' . translate('LBL_DASHLET_EDIT', 'Home') . '" border="0" align="absmiddle"').'</a> '
|
||||
. '';
|
||||
else
|
||||
$additionalTitle = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td width="99%">' . $text
|
||||
. '</td><td nowrap width="1%"><div style="width: 100%;text-align:right">';
|
||||
|
||||
if($this->isRefreshable)
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
|
||||
. $this->id . '\',\'predefined_chart\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" alt="' . translate('LBL_DASHLET_REFRESH', 'Home') . '" src="'
|
||||
. $image_path . 'refresh.gif"/></a> ';
|
||||
$additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.deleteDashlet(\''
|
||||
. $this->id . '\'); return false;"><img width="13" height="13" border="0" align="absmiddle" title="' . translate('LBL_DASHLET_DELETE', 'Home') . '" alt="' . translate('LBL_DASHLET_DELETE', 'Home') . '" src="'
|
||||
. $image_path . 'close_dashboard.gif"/></a></div></td></tr></table>';
|
||||
|
||||
if(!function_exists('get_form_header')) {
|
||||
global $theme;
|
||||
require_once('themes/'.$theme.'/layout_utils.php');
|
||||
}
|
||||
|
||||
$str = '<div ';
|
||||
if(empty($sugar_config['lock_homepage']) || $sugar_config['lock_homepage'] == false) $str .= ' onmouseover="this.style.cursor = \'move\';"';
|
||||
$str .= 'id="dashlet_header_' . $this->id . '">' . get_form_header($this->title, $additionalTitle, false) . '</div>';
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $current_user, $theme, $timedate, $image_path;
|
||||
|
||||
$this->loadLanguage('PipelineByUserTasksStatusDashlet', 'modules/Charts/Dashlets/');
|
||||
$returnStr = '';
|
||||
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
if(isset($_REQUEST['pbuts_refresh'])) {
|
||||
$refresh = $_REQUEST['pbuts_refresh'];
|
||||
}
|
||||
else {
|
||||
$refresh = false;
|
||||
}
|
||||
|
||||
$date_start = $this->pbuts_date_start;
|
||||
$date_end = $this->pbuts_date_end;
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $date_start;
|
||||
$dateXml[1] = $date_end;
|
||||
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_task_status = $this->pbuts_task_status;
|
||||
$tempx = $user_task_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['task_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['task_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['task_status_dom']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbuts_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbuts_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbuts_ids']) && count($_REQUEST['pbuts_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbuts_ids'];
|
||||
$current_user->setPreference('pbuts_ids', $_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbuts_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbuts_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbuts_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('include/SugarCharts/SugarChart.php');
|
||||
|
||||
$sugar_smarty = new Sugar_Smarty();
|
||||
|
||||
$charts = array();
|
||||
|
||||
$sugarChart = new SugarChart();
|
||||
|
||||
$sugarChart->base_url = array( 'module' => 'Tasks',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
);
|
||||
$sugarChart->url_params = array();
|
||||
|
||||
|
||||
$ids = $this->pbuts_task_users;
|
||||
|
||||
global $app_list_strings;
|
||||
$sugarChart->enum_for_labels = array( 'status' => $app_list_strings['task_status_dom'] );
|
||||
$sugarChart->group_by = $this->constructGroupBy();
|
||||
$query = $this->constructQuery($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarS',$current_module_strings);
|
||||
|
||||
//$ddd = $this->getChartData($query);
|
||||
|
||||
$sugarChart->setData($this->getChartData($query));
|
||||
//print_r($sugarChart->data_set); echo '<br><br>';
|
||||
|
||||
|
||||
$total = $sugarChart->getTotal();
|
||||
|
||||
$currency_symbol = $sugar_config['default_currency_symbol'];
|
||||
|
||||
if ($current_user->getPreference('currency')){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$currency_symbol = $currency->symbol;
|
||||
}
|
||||
|
||||
$sugarChart->is_currency = false;
|
||||
$sugarChart->currency_symbol = '';
|
||||
$sugarChart->thousands_symbol = '';//translate('LBL_OPP_THOUSANDS', 'Charts');
|
||||
|
||||
$subtitle = translate('LBL_TASK_SIZE', 'Charts');
|
||||
|
||||
$pipeline_total_string = translate('LBL_TASKS_TOTAL', 'Charts') . $total;
|
||||
|
||||
|
||||
|
||||
$sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xmlFile = $sugar_config['tmp_dir']. $current_user->id . '_' . $this->id . '.xml';
|
||||
|
||||
$sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
|
||||
$returnStr .= $sugarChart->display($this->id, $xmlFile, '100%', '480', false);
|
||||
|
||||
return $this->getTitle('') . '<div align="center">' .$returnStr . '</div><br />';
|
||||
}
|
||||
|
||||
|
||||
// awu: Bug 16794 - this function is a hack to get the correct sales stage order until i can clean it up later
|
||||
function getChartData($query){
|
||||
global $app_list_strings, $current_user, $sugar_config;
|
||||
|
||||
$data = array();
|
||||
$temp_data = array();
|
||||
$selected_datax = array();
|
||||
|
||||
$user_task_status = $this->pbuts_task_status;
|
||||
$tempx = $user_task_status;
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['task_status_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['task_status_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['task_status_dom']);
|
||||
}
|
||||
|
||||
$db = &PearDatabase::getInstance();
|
||||
|
||||
$result = $db->query($query);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
while($row != null){
|
||||
array_push($temp_data, $row);
|
||||
$row = $db->fetchByAssoc($result, -1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// reorder and set the array based on the order of selected_datax
|
||||
foreach($selected_datax as $task_status){
|
||||
foreach($temp_data as $key => $value){
|
||||
if ($value['status'] == $task_status){
|
||||
//$value['total'] = $symbol . $value['total'];
|
||||
//$value['status'] = $app_list_strings['task_status_dom'][$value['status']];
|
||||
array_push($data, $value);
|
||||
unset($temp_data[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//echo '<br><br>'; var_dump($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
function constructQuery($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
global $timedate;
|
||||
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= " tasks.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND tasks.status IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND tasks.date_entered >= ". db_convert("'".$date_start."'",'datetime'). "
|
||||
AND tasks.date_entered <= ".db_convert("'".$date_end."'",'datetime') ;
|
||||
$where .= " AND tasks.assigned_user_id = users.id AND tasks.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
/*
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage";
|
||||
$query .= ",users.user_name,opportunities.assigned_user_id";
|
||||
*/
|
||||
$query = " SELECT tasks.status as status,
|
||||
users.user_name,
|
||||
tasks.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
count( tasks.assigned_user_id ) AS total
|
||||
FROM users, tasks ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY tasks.status";
|
||||
$query .= ", users.user_name, tasks.assigned_user_id";
|
||||
|
||||
//var_dump($query);
|
||||
//$res = $GLOBALS['db']->query($query);
|
||||
//var_dump($res);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array(
|
||||
'status',
|
||||
'user_name',
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
44
modules/Charts/a/PredefinedChartDashletScript.tpl
Executable file
44
modules/Charts/a/PredefinedChartDashletScript.tpl
Executable file
@@ -0,0 +1,44 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
*}
|
||||
|
||||
<script>
|
||||
SUGAR.mySugar.addToChartsArray('{$chartName}', '{$chartXMLFile}', '100%', '480', '{$chartStyleCSS}', '{$chartColorsXML}', '{$chartStringsXML}');
|
||||
</script>
|
||||
187
modules/Charts/chartdefs.php
Executable file
187
modules/Charts/chartdefs.php
Executable file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
$chartDefs = array(
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'pipeline_by_sales_stage'=>
|
||||
array( 'type' => 'code',
|
||||
'id' => 'Chart_pipeline_by_sales_stage',
|
||||
'label' => 'Pipeline by Sales Stage',
|
||||
'chartUnits' => 'Opportunity Size in $1K',
|
||||
'chartType' => 'horizontal group by chart',
|
||||
'groupBy' => array( 'sales_stage', 'user_name' ),
|
||||
'base_url'=>
|
||||
array( 'module' => 'Opportunities',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
),
|
||||
'url_params' => array( 'assigned_user_id', 'sales_stage', 'date_start', 'date_closed' ),
|
||||
),
|
||||
'lead_source_by_outcome'=>
|
||||
array( 'type' => 'code',
|
||||
'id' => 'Chart_lead_source_by_outcome',
|
||||
'label' => 'Lead Source By Outcome',
|
||||
'chartUnits' => '',
|
||||
'chartType' => 'horizontal group by chart',
|
||||
'groupBy' => array( 'lead_source', 'sales_stage' ),
|
||||
'base_url'=>
|
||||
array( 'module' => 'Opportunities',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
),
|
||||
'url_params' => array( 'lead_source', 'sales_stage', 'date_start', 'date_closed' ),
|
||||
),
|
||||
'outcome_by_month'=>
|
||||
array( 'type' => 'code',
|
||||
'id' => 'Chart_outcome_by_month',
|
||||
'label' => 'Outcome by Month',
|
||||
'chartUnits' => 'Opportunity Size in $1K',
|
||||
'chartType' => 'stacked group by chart',
|
||||
'groupBy' => array( 'm', 'sales_stage', ),
|
||||
'base_url'=>
|
||||
array( 'module' => 'Opportunities',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
),
|
||||
'url_params' => array( 'sales_stage', 'date_closed' ),
|
||||
),
|
||||
'pipeline_by_lead_source'=>
|
||||
array( 'type' => 'code',
|
||||
'id' => 'Chart_pipeline_by_lead_source',
|
||||
'label' => 'Pipeline By Lead Source',
|
||||
'chartUnits' => 'Opportunity Size in $1K',
|
||||
'chartType' => 'pie chart',
|
||||
'groupBy' => array( 'lead_source', ),
|
||||
'base_url'=>
|
||||
array( 'module' => 'Opportunities',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
),
|
||||
'url_params' => array( 'lead_source', ),
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'my_modules_used_last_30_days' =>
|
||||
array( 'type' => 'code',
|
||||
'id' => 'my_modules_used_last_30_days',
|
||||
'label' => 'My Modules Used (Last 30 Days)',
|
||||
'chartType' => 'horizontal bar chart',
|
||||
'chartUnits' => 'Access Count',
|
||||
'groupBy' => array( 'module_name'),
|
||||
'base_url'=>
|
||||
array( 'module' => 'Trackers',
|
||||
'action' => 'index',
|
||||
'query' => 'true',
|
||||
'searchFormTab' => 'advanced_search',
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
if(file_exists('custom/Charts/chartDefs.ext.php')){
|
||||
include_once('custom/Charts/chartDefs.ext.php');
|
||||
}
|
||||
?>
|
||||
454
modules/Charts/code/Chart_lead_source_by_outcome.php
Executable file
454
modules/Charts/code/Chart_lead_source_by_outcome.php
Executable file
@@ -0,0 +1,454 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: returns HTML for client-side image map.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('include/utils.php');
|
||||
|
||||
|
||||
class Chart_lead_source_by_outcome
|
||||
{
|
||||
var $modules = array('Opportunities');
|
||||
var $order = 0;
|
||||
function Chart_lead_source_by_outcome()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function draw($extra_tools)
|
||||
{
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action,$theme;
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
|
||||
if (isset($_REQUEST['lsbo_refresh'])) { $refresh = $_REQUEST['lsbo_refresh']; }
|
||||
else { $refresh = false; }
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
|
||||
global $current_user;
|
||||
$tempx = $current_user->getPreference('lsbo_lead_sources');
|
||||
if (!empty($lsbo_lead_sources) && count($lsbo_lead_sources) > 0 && !isset($_REQUEST['lsbo_lead_sources'])) {
|
||||
$GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:");
|
||||
$GLOBALS['log']->fatal($tempx);
|
||||
}
|
||||
elseif (isset($_REQUEST['lsbo_lead_sources']) && count($_REQUEST['lsbo_lead_sources']) > 0) {
|
||||
$tempx = $_REQUEST['lsbo_lead_sources'];
|
||||
$current_user->setPreference('lsbo_lead_sources', $_REQUEST['lsbo_lead_sources']);
|
||||
$GLOBALS['log']->fatal("_REQUEST['lsbo_lead_sources'] is:");
|
||||
$GLOBALS['log']->fatal($_REQUEST['lsbo_lead_sources']);
|
||||
$GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:");
|
||||
$GLOBALS['log']->fatal($current_user->getPreference('lsbo_lead_sources'));
|
||||
}
|
||||
//set $datax using selected sales stage keys
|
||||
if (!empty($tempx) && sizeof($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['lead_source_dom'][$key];
|
||||
array_push($selected_datax,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['lead_source_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
}
|
||||
|
||||
$ids =$current_user->getPreference('lsbo_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($ids) && count($ids) != 0 && !isset($_REQUEST['lsbo_ids'])) {
|
||||
$GLOBALS['log']->debug("_SESSION['lsbo_ids'] is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['lsbo_ids']) && count($_REQUEST['lsbo_ids']) > 0) {
|
||||
$ids = $_REQUEST['lsbo_ids'];
|
||||
$current_user->setPreference('lsbo_ids', $_REQUEST['lsbo_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['lsbo_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['lsbo_ids']);
|
||||
$GLOBALS['log']->debug("user->getPreference('lsbo_ids') is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('lsbo_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
|
||||
|
||||
$seps = array("-", "/");
|
||||
$dates = array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_lead_source_by_outcome_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
global $image_path;
|
||||
$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&lsbo_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh" border="0" align="absmiddle"').' '.$current_module_strings['LBL_REFRESH'].'</a> <a href="javascript: toggleDisplay(\'lsbo_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a> '.$extra_tools.'</div>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_LEAD_SOURCE_BY_OUTCOME'],$tools,false) . '</span>';
|
||||
|
||||
if (empty($_SESSION['lsbo_ids'])) $_SESSION['lsbo_ids'] = "";
|
||||
?>
|
||||
|
||||
<p>
|
||||
<div id='lsbo_edit' style='display: none;'>
|
||||
<form action="index.php" method="post" >
|
||||
<input type="hidden" name="module" value="<?php echo $currentModule;?>">
|
||||
<input type="hidden" name="action" value="<?php echo $action;?>">
|
||||
<input type="hidden" name="lsbo_refresh" value="true">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_LEAD_SOURCES'];?></b></td>
|
||||
<td valign='top'><select name="lsbo_lead_sources[]" multiple size='3'><?php echo get_select_options_with_id($app_list_strings['lead_source_dom'],$selected_datax); ?></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_USERS'];?></b></td>
|
||||
<td valign='top'><select name="lsbo_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$ids); ?></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php
|
||||
global $app_strings;
|
||||
?>
|
||||
<td align="right" colspan="2"> <input class="button" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /><input class="button" onClick="javascript: toggleDisplay('lsbo_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY'];?>" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']?>"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</p>
|
||||
<?php
|
||||
|
||||
echo "<p align='center'>".$this->gen_xml($datax, $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,$current_module_strings)."</p>";
|
||||
echo "<P align='center'><span class='chartFootnote'>".$current_module_strings['LBL_LEAD_SOURCE_BY_OUTCOME_DESC']."</span></P>";
|
||||
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
global $timedate;
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
?>
|
||||
<span class='chartFootnote'>
|
||||
<p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?></i></p>
|
||||
</span>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates lead_source_by_outcome pipeline image as a HORIZONAL accumlated bar graph for multiple users.
|
||||
* param $datay- the lead source data to display in the x-axis
|
||||
* param $ids - list of assigned users of opps to find
|
||||
* param $cache_file_name - file name to write image to
|
||||
* param $refresh - boolean whether to rebuild image if exists
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function gen_xml($datay=array('foo','bar'), $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors,$app_list_strings, $current_user;
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
if (!file_exists($cache_file_name) || $refresh == true) {
|
||||
$GLOBALS['log']->debug("datay is:");
|
||||
$GLOBALS['log']->debug($datay);
|
||||
$GLOBALS['log']->debug("user_id is: ");
|
||||
$GLOBALS['log']->debug($user_id);
|
||||
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
|
||||
$opp = new Opportunity();
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count>0) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datay
|
||||
$count = count($datay);
|
||||
$datayArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datay as $key=>$value) {
|
||||
$datayArr[] = "'".$key."'";
|
||||
}
|
||||
$datayArr = join(",",$datayArr);
|
||||
$where .= "AND opportunities.lead_source IN ($datayArr) ";
|
||||
}
|
||||
$query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where." AND opportunities.deleted=0 ";
|
||||
$query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage";
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datay and $user
|
||||
|
||||
$result = $opp->db->query($query)
|
||||
or sugar_die("Error selecting sugarbean: ".mysql_error());
|
||||
//build pipeline by sales stage data
|
||||
$total = 0;
|
||||
$div = 1;
|
||||
global $sugar_config;
|
||||
$symbol = $sugar_config['default_currency_symbol'];
|
||||
$other = $current_module_strings['LBL_LEAD_SOURCE_OTHER'];
|
||||
$rowTotalArr = array();
|
||||
$rowTotalArr[] = 0;
|
||||
global $current_user;
|
||||
$salesStages = array("Closed Lost"=>$app_list_strings['sales_stage_dom']["Closed Lost"],"Closed Won"=>$app_list_strings['sales_stage_dom']["Closed Won"],"Other"=>$other);
|
||||
if($current_user->getPreference('currency') ){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$div = $currency->conversion_rate;
|
||||
$symbol = $currency->symbol;
|
||||
}
|
||||
$fileContents = ' <yData defaultAltText="'.$current_module_strings['LBL_ROLLOVER_DETAILS'].'">'."\n";
|
||||
$leadSourceArr = array();
|
||||
while($row = $opp->db->fetchByAssoc($result, -1, false))
|
||||
{
|
||||
if($row['total']*$div<=100){
|
||||
$sum = round($row['total']*$div, 2);
|
||||
} else {
|
||||
$sum = round($row['total']*$div);
|
||||
}
|
||||
if($row['lead_source'] == ''){
|
||||
$row['lead_source'] = $current_module_strings['NTC_NO_LEGENDS'];
|
||||
}
|
||||
if($row['sales_stage'] == 'Closed Won' || $row['sales_stage'] == 'Closed Lost'){
|
||||
$salesStage = $row['sales_stage'];
|
||||
$salesStageT = $app_list_strings['sales_stage_dom'][$row['sales_stage']];
|
||||
} else {
|
||||
$salesStage = "Other";
|
||||
$salesStageT = $other;
|
||||
}
|
||||
if(!isset($leadSourceArr[$row['lead_source']]['row_total'])) {$leadSourceArr[$row['lead_source']]['row_total']=0;}
|
||||
$leadSourceArr[$row['lead_source']][$salesStage]['opp_count'][] = $row['opp_count'];
|
||||
$leadSourceArr[$row['lead_source']][$salesStage]['total'][] = $sum;
|
||||
$leadSourceArr[$row['lead_source']]['outcome'][$salesStage]=$salesStageT;
|
||||
$leadSourceArr[$row['lead_source']]['row_total'] += $sum;
|
||||
|
||||
$total += $sum;
|
||||
}
|
||||
foreach ($datay as $key=>$translation) {
|
||||
if ($key == '') {
|
||||
$key = $current_module_strings['NTC_NO_LEGENDS'];
|
||||
$translation = $current_module_strings['NTC_NO_LEGENDS'];
|
||||
}
|
||||
if(!isset($leadSourceArr[$key])){
|
||||
$leadSourceArr[$key] = $key;
|
||||
}
|
||||
if(isset($leadSourceArr[$key]['row_total'])){$rowTotalArr[]=$leadSourceArr[$key]['row_total'];}
|
||||
if(isset($leadSourceArr[$key]['row_total']) && $leadSourceArr[$key]['row_total']>100){
|
||||
$leadSourceArr[$key]['row_total'] = round($leadSourceArr[$key]['row_total']);
|
||||
}
|
||||
$fileContents .= ' <dataRow title="'.$translation.'" endLabel="'.currency_format_number($leadSourceArr[$key]['row_total'], array('currency_symbol' => true)) . '">'."\n";
|
||||
if(is_array($leadSourceArr[$key]['outcome'])){
|
||||
foreach ($leadSourceArr[$key]['outcome'] as $outcome=>$outcome_translation){
|
||||
$fileContents .= ' <bar id="'.$outcome.'" totalSize="'.array_sum($leadSourceArr[$key][$outcome]['total']).'" altText="'.format_number(array_sum($leadSourceArr[$key][$outcome]['opp_count']),0,0).' '.$current_module_strings['LBL_OPPS_WORTH'].' '.currency_format_number(array_sum($leadSourceArr[$key][$outcome]['total']),array('currency_symbol' => true)).$current_module_strings['LBL_OPP_THOUSANDS'].' '.$current_module_strings['LBL_OPPS_OUTCOME'].' '.$outcome_translation.'" url="index.php?module=Opportunities&action=index&lead_source='.$key.'&sales_stage='.urlencode($outcome).'&query=true&searchFormTab=advanced_search"/>'."\n";
|
||||
}
|
||||
}
|
||||
$fileContents .= ' </dataRow>'."\n";
|
||||
}
|
||||
$fileContents .= ' </yData>'."\n";
|
||||
$max = get_max($rowTotalArr);
|
||||
$fileContents .= ' <xData min="0" max="'.$max.'" length="10" kDelim="'.$kDelim.'" prefix="'.$symbol.'" suffix=""/>' . "\n";
|
||||
$fileContents .= ' <colorLegend status="on">'."\n";
|
||||
$i=0;
|
||||
|
||||
foreach ($salesStages as $outcome=>$outcome_translation) {
|
||||
$color = generate_graphcolor($outcome,$i);
|
||||
$fileContents .= ' <mapping id="'.$outcome.'" name="'.$outcome_translation.'" color="'.$color.'"/>'."\n";
|
||||
$i++;
|
||||
}
|
||||
$fileContents .= ' </colorLegend>'."\n";
|
||||
$fileContents .= ' <graphInfo>'."\n";
|
||||
$fileContents .= ' <![CDATA['.$current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'].']]>'."\n";
|
||||
$fileContents .= ' </graphInfo>'."\n";
|
||||
$fileContents .= ' <chartColors ';
|
||||
foreach ($barChartColors as $key => $value) {
|
||||
$fileContents .= ' '.$key.'='.'"'.$value.'" ';
|
||||
}
|
||||
$fileContents .= ' />'."\n";
|
||||
$fileContents .= '</graphData>'."\n";
|
||||
$total = round($total, 2);
|
||||
$title = '<graphData title="'.$current_module_strings['LBL_ALL_OPPORTUNITIES'].currency_format_number($total, array('currency_symbol' => true)).$app_strings['LBL_THOUSANDS_SYMBOL'].'">'."\n";
|
||||
$fileContents = $title.$fileContents;
|
||||
|
||||
save_xml_file($cache_file_name, $fileContents);
|
||||
}
|
||||
$return = create_chart('hBarF',$cache_file_name);
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
function constructQuery(){
|
||||
global $current_user;
|
||||
global $app_list_strings;
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
|
||||
$tempx = $current_user->getPreference('lsbo_lead_sources');
|
||||
if (!empty($lsbo_lead_sources) && count($lsbo_lead_sources) > 0 && !isset($_REQUEST['lsbo_lead_sources'])) {
|
||||
$GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:");
|
||||
$GLOBALS['log']->fatal($tempx);
|
||||
}
|
||||
elseif (isset($_REQUEST['lsbo_lead_sources']) && count($_REQUEST['lsbo_lead_sources']) > 0) {
|
||||
$tempx = $_REQUEST['lsbo_lead_sources'];
|
||||
$current_user->setPreference('lsbo_lead_sources', $_REQUEST['lsbo_lead_sources']);
|
||||
$GLOBALS['log']->fatal("_REQUEST['lsbo_lead_sources'] is:");
|
||||
$GLOBALS['log']->fatal($_REQUEST['lsbo_lead_sources']);
|
||||
$GLOBALS['log']->fatal("user->getPreference('lsbo_lead_sources') is:");
|
||||
$GLOBALS['log']->fatal($current_user->getPreference('lsbo_lead_sources'));
|
||||
}
|
||||
//set $datax using selected sales stage keys
|
||||
if (!empty($tempx) && sizeof($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['lead_source_dom'][$key];
|
||||
array_push($selected_datax,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['lead_source_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
}
|
||||
|
||||
$datay = $datax;
|
||||
|
||||
$ids =$current_user->getPreference('lsbo_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($ids) && count($ids) != 0 && !isset($_REQUEST['lsbo_ids'])) {
|
||||
$GLOBALS['log']->debug("_SESSION['lsbo_ids'] is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['lsbo_ids']) && count($_REQUEST['lsbo_ids']) > 0) {
|
||||
$ids = $_REQUEST['lsbo_ids'];
|
||||
$current_user->setPreference('lsbo_ids', $_REQUEST['lsbo_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['lsbo_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['lsbo_ids']);
|
||||
$GLOBALS['log']->debug("user->getPreference('lsbo_ids') is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('lsbo_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
|
||||
$opp = new Opportunity();
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count>0) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $datay
|
||||
$count = count($datay);
|
||||
$datayArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datay as $key=>$value) {
|
||||
$datayArr[] = "'".$key."'";
|
||||
}
|
||||
$datayArr = join(",",$datayArr);
|
||||
$where .= "AND opportunities.lead_source IN ($datayArr) ";
|
||||
}
|
||||
$query = "SELECT lead_source,sales_stage,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where." AND opportunities.deleted=0 ";
|
||||
$query .= " GROUP BY sales_stage,lead_source ORDER BY lead_source,sales_stage";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array( 'lead_source', 'sales_stage' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
501
modules/Charts/code/Chart_my_pipeline_by_sales_stage.php
Executable file
501
modules/Charts/code/Chart_my_pipeline_by_sales_stage.php
Executable file
@@ -0,0 +1,501 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: returns HTML for client-side image map.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
require_once("include/charts/Charts.php");
|
||||
require_once("modules/Charts/code/Chart_pipeline_by_sales_stage.php");
|
||||
//require_once("modules/Dashboard/Forms.php");
|
||||
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $current_user, $theme, $timedate;
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
global $timedate;
|
||||
|
||||
if (isset($_REQUEST['mypbss_refresh'])) { $refresh = $_REQUEST['mypbss_refresh']; }
|
||||
else { $refresh = false; }
|
||||
|
||||
//get the dates to display
|
||||
$user_date_start = $current_user->getPreference('mypbss_date_start');
|
||||
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['mypbss_date_start'])) {
|
||||
$date_start = $user_date_start;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['mypbss_date_start']) && $_REQUEST['mypbss_date_start'] != '') {
|
||||
$date_start = $_REQUEST['mypbss_date_start'];
|
||||
$current_user->setPreference('mypbss_date_start', $_REQUEST['mypbss_date_start']);
|
||||
$GLOBALS['log']->debug("_REQUEST['mypbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['mypbss_date_start']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('mypbss_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date($timedate->get_date_format(), time());
|
||||
}
|
||||
$user_date_end = $current_user->getPreference('mypbss_date_end');
|
||||
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['mypbss_date_end'])) {
|
||||
$date_end = $user_date_end;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($user_date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['mypbss_date_end']) && $_REQUEST['mypbss_date_end'] != '') {
|
||||
$date_end = $_REQUEST['mypbss_date_end'];
|
||||
$current_user->setPreference('mypbss_date_end', $_REQUEST['mypbss_date_end']);
|
||||
$GLOBALS['log']->debug("_REQUEST['mypbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['mypbss_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug( $current_user->getPreference('mypbss_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date($timedate->get_date_format(), strtotime('2010-01-01'));
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_end'] not found. Using: ".$date_end);
|
||||
}
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateStartDisplay = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $timedate->swap_formats($date_start, $user_dateFormat, $timedate->dbDayFormat);
|
||||
$dateXml[1] = $timedate->swap_formats($date_end, $user_dateFormat, $timedate->dbDayFormat);
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
$user_sales_stage = $current_user->getPreference('mypbss_sales_stages');
|
||||
if (!empty($user_sales_stage) && count($user_sales_stage) > 0 && !isset($_REQUEST['mypbss_sales_stages'])) {
|
||||
$tempx = $user_sales_stage;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($user_sales_stage);
|
||||
}
|
||||
elseif (isset($_REQUEST['mypbss_sales_stages']) && count($_REQUEST['mypbss_sales_stages']) > 0) {
|
||||
$tempx = $_REQUEST['mypbss_sales_stages'];
|
||||
$current_user->setPreference('mypbss_sales_stages', $_REQUEST['mypbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("_REQUEST['mypbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['mypbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("USER PREFRENCES['mypbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('mypbss_sales_stages'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
|
||||
array_push($selected_datax, $key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['sales_stage_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['sales_stage_dom']);
|
||||
}
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
$ids = array($current_user->id);
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
$seps = array("-", "/");
|
||||
$dates = array($dateStartDisplay, $dateEndDisplay);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_".$theme."_my_pipeline_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
|
||||
$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&mypbss_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh" border="0" align="absmiddle"').' '.$current_module_strings['LBL_REFRESH'].'</a> <a href="javascript: toggleDisplay(\'my_pipeline_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a></div>';
|
||||
|
||||
?>
|
||||
<?php echo get_form_header($mod_strings['LBL_PIPELINE_FORM_TITLE'], $tools , false);?>
|
||||
|
||||
<?php
|
||||
global $timedate;
|
||||
$cal_lang = "en";
|
||||
$cal_dateformat = $timedate->get_cal_date_format();
|
||||
?>
|
||||
<p>
|
||||
<div id='my_pipeline_edit' style='display: none;'>
|
||||
<form name='my_pipeline' action="index.php" method="post" >
|
||||
<input type="hidden" name="module" value="<?php echo $currentModule;?>">
|
||||
<input type="hidden" name="action" value="<?php echo $action;?>">
|
||||
<input type="hidden" name="mypbss_refresh" value="true">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_DATE_START']?> </b><br><i><?php echo $timedate->get_user_date_format();?></i></td>
|
||||
<td valign='top' ><input onblur="parseDate(this, '<?php echo $cal_dateformat ?>');" class="text" name="mypbss_date_start" size='12' maxlength='10' id='date_start' value='<?php echo $date_start; ?>'> <img src="themes/default/images/jscalendar.gif" alt="<?php echo $app_strings['LBL_ENTER_DATE']; ?>" id="date_start_trigger" align="absmiddle"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_DATE_END'];?></b><br><i><?php echo $timedate->get_user_date_format();?></i></td>
|
||||
<td valign='top' ><input onblur="parseDate(this, '<?php echo $cal_dateformat ?>');" class="text" name="mypbss_date_end" size='12' maxlength='10' id='date_end' value='<?php echo $date_end; ?>'> <img src="themes/default/images/jscalendar.gif" alt="<?php echo $app_strings['LBL_ENTER_DATE']; ?>" id="date_end_trigger" align="absmiddle"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_SALES_STAGES'];?></b></td>
|
||||
<td valign='top' ><select name="mypbss_sales_stages[]" multiple size='3'><?php echo get_select_options_with_id($app_list_strings['sales_stage_dom'],$selected_datax); ?></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right" colspan="2"><input class="button" onclick="return verify_chart_data(my_pipeline);" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /><input class="button" onClick="javascript: toggleDisplay('my_pipeline_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY'];?>" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']?>"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "<?php echo $cal_dateformat ?>", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "<?php echo $cal_dateformat ?>", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
|
||||
echo "<p align='center'>".gen_xml_pipeline_by_sales_stage($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarS',$current_module_strings)."</p>";
|
||||
echo "<P align='center'><span class='chartFootnote'>".$current_module_strings['LBL_PIPELINE_FORM_TITLE_DESC']."</span></P>";
|
||||
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<span class='chartFootnote'>
|
||||
<p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?></i></p>
|
||||
</span>
|
||||
|
||||
<?php
|
||||
echo get_validate_chart_js();
|
||||
|
||||
/**
|
||||
* Creates opportunity pipeline image as a HORIZONTAL accumlated BAR GRAPH for multiple users.
|
||||
* param $datax- the sales stage data to display in the x-axis
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function gen_xml_pipeline_by_sales_stage($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
global $timedate;
|
||||
|
||||
if (!file_exists($cache_file_name) || $refresh == true) {
|
||||
|
||||
$GLOBALS['log']->debug("starting pipeline chart");
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
$GLOBALS['log']->debug("user_id is: ");
|
||||
$GLOBALS['log']->debug($user_id);
|
||||
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND opportunities.sales_stage IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND opportunities.date_closed >= ". db_convert("'".$date_start."'",'date'). "
|
||||
AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date') ;
|
||||
$where .= " AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage,users.user_name,opportunities.assigned_user_id";
|
||||
|
||||
$result = $opp->db->query($query)
|
||||
or sugar_die("Error selecting sugarbean: ".mysql_error());
|
||||
//build pipeline by sales stage data
|
||||
$total = 0;
|
||||
$div = 1;
|
||||
global $sugar_config;
|
||||
$symbol = $sugar_config['default_currency_symbol'];
|
||||
global $current_user;
|
||||
if($current_user->getPreference('currency') ){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$div = $currency->conversion_rate;
|
||||
$symbol = $currency->symbol;
|
||||
}
|
||||
// cn: adding user-pref date handling
|
||||
$dateStartDisplay = date($timedate->get_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = date($timedate->get_date_format(), strtotime($date_end));
|
||||
|
||||
$fileContents = ' <yData defaultAltText="'.$current_module_strings['LBL_ROLLOVER_DETAILS'].'">'."\n";
|
||||
$stageArr = array();
|
||||
$usernameArr = array();
|
||||
$rowTotalArr = array();
|
||||
$rowTotalArr[] = 0;
|
||||
while($row = $opp->db->fetchByAssoc($result, -1, false))
|
||||
{
|
||||
if($row['total']*$div<=100){
|
||||
$sum = round($row['total']*$div, 2);
|
||||
} else {
|
||||
$sum = round($row['total']*$div);
|
||||
}
|
||||
if(!isset($stageArr[$row['sales_stage']]['row_total'])) {$stageArr[$row['sales_stage']]['row_total']=0;}
|
||||
$stageArr[$row['sales_stage']][$row['assigned_user_id']]['opp_count'] = $row['opp_count'];
|
||||
$stageArr[$row['sales_stage']][$row['assigned_user_id']]['total'] = $sum;
|
||||
$stageArr[$row['sales_stage']]['people'][$row['assigned_user_id']] = $row['user_name'];
|
||||
$stageArr[$row['sales_stage']]['row_total'] += $sum;
|
||||
|
||||
$usernameArr[$row['assigned_user_id']] = $row['user_name'];
|
||||
$total += $sum;
|
||||
}
|
||||
foreach ($datax as $key=>$translation) {
|
||||
if(isset($stageArr[$key]['row_total'])){$rowTotalArr[]=$stageArr[$key]['row_total'];}
|
||||
if(isset($stageArr[$key]['row_total']) && $stageArr[$key]['row_total']>100) {
|
||||
$stageArr[$key]['row_total'] = round($stageArr[$key]['row_total']);
|
||||
}
|
||||
$fileContents .= ' <dataRow title="'.$translation.'" endLabel="';
|
||||
if(isset($stageArr[$key]['row_total'])){$fileContents .= $stageArr[$key]['row_total'];}
|
||||
$fileContents .= '">'."\n";
|
||||
if(isset($stageArr[$key]['people'])){
|
||||
asort($stageArr[$key]['people']);
|
||||
reset($stageArr[$key]['people']);
|
||||
foreach ($stageArr[$key]['people'] as $nameKey=>$nameValue) {
|
||||
$fileContents .= ' <bar id="'.$nameKey.'" totalSize="'.$stageArr[$key][$nameKey]['total'].'" altText="'.$nameValue.': '.$stageArr[$key][$nameKey]['opp_count'].' '.$current_module_strings['LBL_OPPS_WORTH'].' '.currency_format_number($stageArr[$key][$nameKey]['total'], array('currency_symbol'=>true)).$current_module_strings['LBL_OPP_THOUSANDS'].' '.$current_module_strings['LBL_OPPS_IN_STAGE'].' '.$translation.'" url="index.php?module=Opportunities&action=index&assigned_user_id[]='.$nameKey.'&sales_stage='.urlencode($key).'&date_start='.$date_start.'&date_closed='.$date_end.'&query=true&searchFormTab=advanced_search"/>'."\n";
|
||||
}
|
||||
}
|
||||
$fileContents .= ' </dataRow>'."\n";
|
||||
}
|
||||
$fileContents .= ' </yData>'."\n";
|
||||
$max = get_max($rowTotalArr);
|
||||
if($chart_size=='hBarF'){
|
||||
$length = "10";
|
||||
}else{
|
||||
$length = "4";
|
||||
}
|
||||
$fileContents .= ' <xData min="0" max="'.$max.'" length="'.$length.'" kDelim="'.$kDelim.'" prefix="'.$symbol.'" suffix=""/>'."\n";
|
||||
$fileContents .= ' <colorLegend status="on">'."\n";
|
||||
$i=0;
|
||||
asort($new_ids);
|
||||
foreach ($new_ids as $key=>$value) {
|
||||
$color = generate_graphcolor($key,$i);
|
||||
$fileContents .= ' <mapping id="'.$key.'" name="'.$value.'" color="'.$color.'"/>'."\n";
|
||||
$i++;
|
||||
}
|
||||
$fileContents .= ' </colorLegend>'."\n";
|
||||
$fileContents .= ' <graphInfo>'."\n";
|
||||
$fileContents .= ' <![CDATA['.$current_module_strings['LBL_DATE_RANGE'].' '.$dateStartDisplay.' '.$current_module_strings['LBL_DATE_RANGE_TO'].' '.$dateEndDisplay.'<BR/>'.$current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'].']]>'."\n";
|
||||
$fileContents .= ' </graphInfo>'."\n";
|
||||
$fileContents .= ' <chartColors ';
|
||||
foreach ($barChartColors as $key => $value) {
|
||||
$fileContents .= ' '.$key.'='.'"'.$value.'" ';
|
||||
}
|
||||
$fileContents .= ' />'."\n";
|
||||
$fileContents .= '</graphData>'."\n";
|
||||
$total = $total;
|
||||
$title = '<graphData title="'.$current_module_strings['LBL_TOTAL_PIPELINE'].currency_format_number($total, array('currency_symbol' => true)).$app_strings['LBL_THOUSANDS_SYMBOL'].'">'."\n";
|
||||
$fileContents = $title.$fileContents;
|
||||
|
||||
save_xml_file($cache_file_name, $fileContents);
|
||||
}
|
||||
|
||||
if($chart_size=='hBarF'){
|
||||
$width = "800";
|
||||
$height = "400";
|
||||
} else {
|
||||
$width = "350";
|
||||
$height = "400";
|
||||
}
|
||||
$return = create_chart($chart_size,$cache_file_name,$width,$height);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function constructQuery(){
|
||||
global $current_user;
|
||||
global $time_date;
|
||||
|
||||
//get the dates to display
|
||||
$user_date_start = $current_user->getPreference('mypbss_date_start');
|
||||
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['mypbss_date_start'])) {
|
||||
$date_start = $user_date_start;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['mypbss_date_start']) && $_REQUEST['mypbss_date_start'] != '') {
|
||||
$date_start = $_REQUEST['mypbss_date_start'];
|
||||
$current_user->setPreference('mypbss_date_start', $_REQUEST['mypbss_date_start']);
|
||||
$GLOBALS['log']->debug("_REQUEST['mypbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['mypbss_date_start']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('mypbss_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date($timedate->get_date_format(), time());
|
||||
}
|
||||
$user_date_end = $current_user->getPreference('mypbss_date_end');
|
||||
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['mypbss_date_end'])) {
|
||||
$date_end = $user_date_end;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($user_date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['mypbss_date_end']) && $_REQUEST['mypbss_date_end'] != '') {
|
||||
$date_end = $_REQUEST['mypbss_date_end'];
|
||||
$current_user->setPreference('mypbss_date_end', $_REQUEST['mypbss_date_end']);
|
||||
$GLOBALS['log']->debug("_REQUEST['mypbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['mypbss_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug( $current_user->getPreference('mypbss_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date($timedate->get_date_format(), strtotime('2010-01-01'));
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['mypbss_date_end'] not found. Using: ".$date_end);
|
||||
}
|
||||
|
||||
$user_id = array($current_user->id);
|
||||
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
}
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND opportunities.sales_stage IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND opportunities.date_closed >= ". db_convert("'".$date_start."'",'date'). "
|
||||
AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date') ;
|
||||
$where .= " AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage,users.user_name,opportunities.assigned_user_id";
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array('sales_stage');
|
||||
}
|
||||
|
||||
?>
|
||||
466
modules/Charts/code/Chart_outcome_by_month.php
Executable file
466
modules/Charts/code/Chart_outcome_by_month.php
Executable file
@@ -0,0 +1,466 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: returns HTML for client-side image map.
|
||||
********************************************************************************/
|
||||
require_once('config.php');
|
||||
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('include/utils.php');
|
||||
|
||||
|
||||
class Chart_outcome_by_month
|
||||
{
|
||||
var $modules = array('Opportunities');
|
||||
var $order = 0;
|
||||
function Chart_outcome_by_month()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function draw($extra_tools)
|
||||
{
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
require_once("modules/Dashboard/Forms.php");
|
||||
global $app_list_strings, $current_language, $sugar_config, $currentModule, $action, $theme;
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
|
||||
if (isset($_REQUEST['obm_refresh'])) { $refresh = $_REQUEST['obm_refresh']; }
|
||||
else { $refresh = false; }
|
||||
|
||||
$date_start = array();
|
||||
$datax = array();
|
||||
//get the dates to display
|
||||
global $current_user;
|
||||
$user_date_start = $current_user->getPreference('obm_date_start');
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) {
|
||||
$date_start =$user_date_start;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
|
||||
$date_start = $_REQUEST['obm_year'].'-01-01';
|
||||
$current_user->setPreference('obm_date_start', $date_start);
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_date_start']);
|
||||
$GLOBALS['log']->debug("_SESSION['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date('Y').'-01-01';
|
||||
}
|
||||
$user_date_end = $current_user->getPreference('obm_date_end');
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) {
|
||||
$date_end =$user_date_end;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
|
||||
$date_end = $_REQUEST['obm_year'].'-12-31';
|
||||
$current_user->setPreference('obm_date_end', $date_end );
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date('Y').'-12-31';
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
//get list of user ids for which to display data
|
||||
$user_ids = $current_user->getPreference('obm_ids');
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) {
|
||||
$ids = $user_ids;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) {
|
||||
$ids = $_REQUEST['obm_ids'];
|
||||
$current_user->setPreference('obm_ids', $_REQUEST['obm_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFRENCES['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
global $timedate;
|
||||
$dateDisplayStart = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateDisplayEnd = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_outcome_by_month_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
|
||||
global $image_path,$app_strings;
|
||||
$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&obm_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh" border="0" align="absmiddle"').' '.$current_module_strings['LBL_REFRESH'].'</a> <a href="javascript: toggleDisplay(\'outcome_by_month_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a> '.$extra_tools.'</div>';
|
||||
?>
|
||||
<?php echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_YEAR_BY_OUTCOME'],$tools,false) . '</span>';?>
|
||||
|
||||
<?php
|
||||
$cal_lang = "en";
|
||||
$cal_dateformat = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
|
||||
|
||||
if (empty($_SESSION['obm_ids'])) $_SESSION['obm_ids'] = "";
|
||||
?>
|
||||
<p>
|
||||
<div id='outcome_by_month_edit' style='display: none;'>
|
||||
<form name="outcome_by_month" action="index.php" method="post" >
|
||||
<input type="hidden" name="module" value="<?php echo $currentModule;?>">
|
||||
<input type="hidden" name="action" value="<?php echo $action;?>">
|
||||
<input type="hidden" name="obm_refresh" value="true">
|
||||
<input type="hidden" name="obm_date_start" value="<?php if (isset($_SESSION['obm_date_start'])) echo $_SESSION['obm_date_start']?>">
|
||||
<input type="hidden" name="obm_date_end" value="<?php if (isset($_SESSION['obm_date_end'])) echo $_SESSION['obm_date_end']?>">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap ><b><?php echo $current_module_strings['LBL_YEAR']?></b><br><span class="dateFormat"><?php echo $app_strings['NTC_YEAR_FORMAT']?></span></td>
|
||||
<td valign='top' ><input class="text" name="obm_year" size='12' maxlength='10' id='obm_year' value='<?php if (isset($date_start)) echo substr($date_start,0,4)?>'> </td>
|
||||
<td valign='top'><b><?php echo $current_module_strings['LBL_USERS'];?></b></td>
|
||||
<td valign='top'><select name="obm_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$ids); ?></select></td>
|
||||
<td align="right" valign="top"><input class="button" onclick="return verify_chart_data_outcome_by_month();" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /><input class="button" onClick="javascript: toggleDisplay('outcome_by_month_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY'];?>" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']?>"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</p>
|
||||
<?php
|
||||
// draw chart
|
||||
echo "<p align='center'>".$this->gen_xml($date_start, $date_end, $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,$current_module_strings)."</p>";
|
||||
echo "<P align='center'><span class='chartFootnote'>".$current_module_strings['LBL_MONTH_BY_OUTCOME_DESC']."</span></P>";
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
?>
|
||||
|
||||
<span class='chartFootnote'>
|
||||
<p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?></i></p>
|
||||
</span>
|
||||
<?php
|
||||
echo get_validate_chart_js();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates opportunity pipeline image as a VERTICAL accumlated bar graph for multiple users.
|
||||
* param $datax- the month data to display in the x-axis
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function gen_xml($date_start='1971-10-15', $date_end='2010-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$current_module_strings) {
|
||||
global $app_strings, $app_list_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
global $timedate;
|
||||
|
||||
if (!file_exists($cache_file_name) || $refresh == true) {
|
||||
$GLOBALS['log']->debug("date_start is: $date_start");
|
||||
$GLOBALS['log']->debug("date_end is: $date_end");
|
||||
$GLOBALS['log']->debug("user_id is: ");
|
||||
$GLOBALS['log']->debug($user_id);
|
||||
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
|
||||
|
||||
$where = "";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count>0) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
// cn: adding user-pref date handling
|
||||
$dateStartDisplay = date($timedate->get_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = date($timedate->get_date_format(), strtotime($date_end));
|
||||
|
||||
$opp = new Opportunity();
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= "AND opportunities.date_closed >= ".db_convert("'".$date_start."'",'date')." AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date')." AND opportunities.deleted=0";
|
||||
$query = "SELECT sales_stage,".db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))." as m, sum(amount_usdollar/1000) as total, count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE ".$where;
|
||||
$query .= " GROUP BY sales_stage,".db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))."ORDER BY m";
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datay and $user
|
||||
//_pp($query);
|
||||
|
||||
$result = $opp->db->query($query)
|
||||
or sugar_die("Error selecting sugarbean: ".mysql_error());
|
||||
//build pipeline by sales stage data
|
||||
$total = 0;
|
||||
$div = 1;
|
||||
global $sugar_config;
|
||||
$symbol = $sugar_config['default_currency_symbol'];
|
||||
$other = $current_module_strings['LBL_LEAD_SOURCE_OTHER'];
|
||||
$rowTotalArr = array();
|
||||
$rowTotalArr[] = 0;
|
||||
global $current_user;
|
||||
$salesStages = array("Closed Lost"=>$app_list_strings['sales_stage_dom']["Closed Lost"],"Closed Won"=>$app_list_strings['sales_stage_dom']["Closed Won"],"Other"=>$other);
|
||||
if($current_user->getPreference('currency') ){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$div = $currency->conversion_rate;
|
||||
$symbol = $currency->symbol;
|
||||
}
|
||||
$months = array();
|
||||
$monthArr = array();
|
||||
while($row = $opp->db->fetchByAssoc($result, -1, false))
|
||||
{
|
||||
if($row['total']*$div<=100){
|
||||
$sum = round($row['total']*$div, 2);
|
||||
} else {
|
||||
$sum = round($row['total']*$div);
|
||||
}
|
||||
if($row['sales_stage'] == 'Closed Won' || $row['sales_stage'] == 'Closed Lost'){
|
||||
$salesStage = $row['sales_stage'];
|
||||
$salesStageT = $app_list_strings['sales_stage_dom'][$row['sales_stage']];
|
||||
} else {
|
||||
$salesStage = "Other";
|
||||
$salesStageT = $other;
|
||||
}
|
||||
|
||||
$months[$row['m']] = $row['m'];
|
||||
if(!isset($monthArr[$row['m']]['row_total'])) {$monthArr[$row['m']]['row_total']=0;}
|
||||
$monthArr[$row['m']][$salesStage]['opp_count'][] = $row['opp_count'];
|
||||
$monthArr[$row['m']][$salesStage]['total'][] = $sum;
|
||||
$monthArr[$row['m']]['outcome'][$salesStage]=$salesStageT;
|
||||
$monthArr[$row['m']]['row_total'] += $sum;
|
||||
|
||||
$total += $sum;
|
||||
}
|
||||
|
||||
$fileContents = ' <xData length="20">'."\n";
|
||||
if (!empty($months)) {
|
||||
foreach ($months as $month){
|
||||
$rowTotalArr[]=$monthArr[$month]['row_total'];
|
||||
if($monthArr[$month]['row_total']>100)
|
||||
{
|
||||
$monthArr[$month]['row_total']=round($monthArr[$month]['row_total']);
|
||||
}
|
||||
$fileContents .= ' <dataRow title="'.$month.'" endLabel="'.currency_format_number($monthArr[$month]['row_total'], array('currency_symbol' => true)).'">'."\n";
|
||||
arsort($salesStages);
|
||||
foreach ($salesStages as $outcome=>$outcome_translation){
|
||||
if(isset($monthArr[$month][$outcome])) {
|
||||
$fileContents .= ' <bar id="'.$outcome.'" totalSize="'.array_sum($monthArr[$month][$outcome]['total']).'" altText="'.$month.': '.format_number(array_sum($monthArr[$month][$outcome]['opp_count']), 0, 0).' '.$current_module_strings['LBL_OPPS_WORTH'].' '.currency_format_number(array_sum($monthArr[$month][$outcome]['total']),array('currency_symbol' => true)).$current_module_strings['LBL_OPP_THOUSANDS'].' '.$current_module_strings['LBL_OPPS_OUTCOME'].' '.$outcome_translation.'" url="index.php?module=Opportunities&action=index&date_closed='.$month.'&sales_stage='.urlencode($outcome).'&query=true&searchFormTab=advanced_search"/>'."\n";
|
||||
}
|
||||
}
|
||||
$fileContents .= ' </dataRow>'."\n";
|
||||
}
|
||||
} else {
|
||||
$fileContents .= ' <dataRow title="" endLabel="">'."\n";
|
||||
$fileContents .= ' <bar id="" totalSize="0" altText="" url=""/>'."\n";
|
||||
$fileContents .= ' </dataRow>'."\n";
|
||||
$rowTotalArr[] = 1000;
|
||||
}
|
||||
$fileContents .= ' </xData>'."\n";
|
||||
$max = get_max($rowTotalArr);
|
||||
$fileContents .= ' <yData min="0" max="'.$max.'" length="10" prefix="'.$symbol.'" suffix="" kDelim="'.$kDelim.'" defaultAltText="'.$current_module_strings['LBL_ROLLOVER_DETAILS'].'"/>'."\n";
|
||||
$fileContents .= ' <colorLegend status="on">'."\n";
|
||||
$i=0;
|
||||
asort($salesStages);
|
||||
foreach ($salesStages as $outcome=>$outcome_translation) {
|
||||
$color = generate_graphcolor($outcome,$i);
|
||||
$fileContents .= ' <mapping id="'.$outcome.'" name="'.$outcome_translation.'" color="'.$color.'"/>'."\n";
|
||||
$i++;
|
||||
}
|
||||
$fileContents .= ' </colorLegend>'."\n";
|
||||
$fileContents .= ' <graphInfo>'."\n";
|
||||
$fileContents .= ' <![CDATA['.$current_module_strings['LBL_DATE_RANGE']." ".$dateStartDisplay." ".$current_module_strings['LBL_DATE_RANGE_TO']." ".$dateEndDisplay."<br/>".$current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'].']]>'."\n";
|
||||
$fileContents .= ' </graphInfo>'."\n";
|
||||
$fileContents .= ' <chartColors ';
|
||||
foreach ($barChartColors as $key => $value) {
|
||||
$fileContents .= ' '.$key.'='.'"'.$value.'" ';
|
||||
}
|
||||
$fileContents .= ' />'."\n";
|
||||
$fileContents .= '</graphData>'."\n";
|
||||
$total = round($total, 2);
|
||||
$title = '<graphData title="'.$current_module_strings['LBL_TOTAL_PIPELINE'].currency_format_number($total, array('currency_symbol' => true)).$app_strings['LBL_THOUSANDS_SYMBOL'].'">'."\n";
|
||||
$fileContents = $title.$fileContents;
|
||||
|
||||
//echo $fileContents;
|
||||
save_xml_file($cache_file_name, $fileContents);
|
||||
}
|
||||
$return = create_chart('vBarF',$cache_file_name);
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
function constructQuery(){
|
||||
global $current_user;
|
||||
global $timedate;
|
||||
|
||||
$user_date_start = $current_user->getPreference('obm_date_start');
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['obm_date_start'])) {
|
||||
$date_start =$user_date_start;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
|
||||
$date_start = $_REQUEST['obm_year'].'-01-01';
|
||||
$current_user->setPreference('obm_date_start', $date_start);
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_date_start']);
|
||||
$GLOBALS['log']->debug("_SESSION['obm_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date('Y').'-01-01';
|
||||
}
|
||||
$user_date_end = $current_user->getPreference('obm_date_end');
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['obm_date_end'])) {
|
||||
$date_end =$user_date_end;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_year']) && $_REQUEST['obm_year'] != '') {
|
||||
$date_end = $_REQUEST['obm_year'].'-12-31';
|
||||
$current_user->setPreference('obm_date_end', $date_end );
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_date_end'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date('Y').'-12-31';
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
//get list of user ids for which to display data
|
||||
$user_ids = $current_user->getPreference('obm_ids');
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['obm_ids'])) {
|
||||
$ids = $user_ids;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['obm_ids']) && count($_REQUEST['obm_ids']) > 0) {
|
||||
$ids = $_REQUEST['obm_ids'];
|
||||
$current_user->setPreference('obm_ids', $_REQUEST['obm_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['obm_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFRENCES['obm_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('obm_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
|
||||
$where = "";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count>0) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
|
||||
// cn: adding user-pref date handling
|
||||
$dateStartDisplay = date($timedate->get_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = date($timedate->get_date_format(), strtotime($date_end));
|
||||
|
||||
$opp = new Opportunity();
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= "AND opportunities.date_closed >= ".db_convert("'".$date_start."'",'date')." AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date')." AND opportunities.deleted=0";
|
||||
$query = "SELECT sales_stage,".db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))." as m, sum(amount_usdollar/1000) as total, count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE ".$where;
|
||||
$query .= " GROUP BY sales_stage,".db_convert('opportunities.date_closed','date_format',array("'%Y-%m'"),array("'YYYY-MM'"))."ORDER BY m";
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array( 'm', 'sales_stage', );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
436
modules/Charts/code/Chart_pipeline_by_lead_source.php
Executable file
436
modules/Charts/code/Chart_pipeline_by_lead_source.php
Executable file
@@ -0,0 +1,436 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: returns HTML for client-side image map.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
require_once('config.php');
|
||||
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('include/utils.php');
|
||||
|
||||
|
||||
class Chart_pipeline_by_lead_source
|
||||
{
|
||||
var $order = 0;
|
||||
var $modules = array('Opportunities');
|
||||
|
||||
function Chart_pipeline_by_lead_source()
|
||||
{
|
||||
}
|
||||
|
||||
function draw($extra_tools)
|
||||
{
|
||||
require_once('include/utils.php');
|
||||
|
||||
global $app_list_strings, $current_language, $ids, $sugar_config ,$theme;
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
|
||||
if (isset($_REQUEST['pbls_refresh'])) { $refresh = $_REQUEST['pbls_refresh']; }
|
||||
else { $refresh = false; }
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
global $current_user;
|
||||
$user_tempx = $current_user->getPreference('pbls_lead_sources');
|
||||
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbls_lead_sources'])) {
|
||||
$tempx = $user_tempx;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($user_tempx);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbls_lead_sources']) && count($_REQUEST['pbls_lead_sources']) > 0) {
|
||||
$tempx = $_REQUEST['pbls_lead_sources'];
|
||||
$current_user->setPreference('pbls_lead_sources', $_REQUEST['pbls_lead_sources']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbls_lead_sources']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbls_lead_sources'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['lead_source_dom'][$key];
|
||||
array_push($selected_datax,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['lead_source_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
}
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
$ids = array();
|
||||
$user_ids = $current_user->getPreference('pbls_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbls_ids'])) {
|
||||
if(isset($_SESSION['pbls_ids'])) {$ids = $_SESSION['pbls_ids'];}
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbls_ids']) && count($_REQUEST['pbls_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbls_ids'];
|
||||
$current_user->setPreference('pbls_ids', $ids);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbls_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbls_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbls_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids) && is_array($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
$id_md5 = substr(md5($current_user->id),0,9);
|
||||
|
||||
|
||||
$seps = array("-", "/");
|
||||
$dates = array(date($GLOBALS['timedate']->dbDayFormat), $GLOBALS['timedate']->dbDayFormat);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_pipeline_by_lead_source_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
global $currentModule,$action,$image_path;
|
||||
$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&pbls_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh" border="0" align="absmiddle"').' '.$current_module_strings['LBL_REFRESH'].'</a> <a href="javascript: toggleDisplay(\'pbls_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a> '.$extra_tools.'</div>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_LEAD_SOURCE_FORM_TITLE'],$tools,false) . '</span>';
|
||||
if (empty($_SESSION['pbls_lead_sources'])) $_SESSION['pbls_lead_sources'] = "";
|
||||
if (empty($_SESSION['pbls_ids'])) $_SESSION['pbls_ids'] = "";
|
||||
?>
|
||||
|
||||
<p>
|
||||
<div id='pbls_edit' style='display: none;'>
|
||||
<form action="index.php" method="post" >
|
||||
<input type="hidden" name="module" value="<?php echo $currentModule;?>">
|
||||
<input type="hidden" name="action" value="<?php echo $action;?>">
|
||||
<input type="hidden" name="pbls_refresh" value="true">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_LEAD_SOURCES'];?></b></td>
|
||||
<td valign='top'><select name="pbls_lead_sources[]" multiple size='3'><?php echo get_select_options_with_id($app_list_strings['lead_source_dom'],$selected_datax); ?></select></td>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_USERS'];?></b></td>
|
||||
<td valign='top'><select name="pbls_ids[]" multiple size='3'><?php $allUsers = get_user_array(false); echo get_select_options_with_id($allUsers,$ids); ?></select></td>
|
||||
<?php
|
||||
global $app_strings;
|
||||
?>
|
||||
<td align="right" valign="top"><input class="button" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /><input class="button" onClick="javascript: toggleDisplay('pbls_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY'];?>" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']?>"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</p>
|
||||
<?php
|
||||
// draw table
|
||||
echo "<p align='center'>".$this->gen_xml($datax, $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,$current_module_strings)."</p>";
|
||||
echo "<P align='center'><span class='chartFootnote'>".$current_module_strings['LBL_LEAD_SOURCE_FORM_DESC']."</span></P>";
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
global $timedate;
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
?>
|
||||
<span class='chartFootnote'>
|
||||
<p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?></i></p>
|
||||
</span>
|
||||
<?Php
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates PIE CHART image of opportunities by lead_source.
|
||||
* param $datax- the sales stage data to display in the x-axis
|
||||
* param $datay- the sum of opportunity amounts for each opportunity in each sales stage
|
||||
* to display in the y-axis
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function gen_xml($legends=array('foo','bar'), $user_id=array('1'), $cache_file_name='a_file', $refresh=true,$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $pieChartColors, $current_user;
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
if (!file_exists($cache_file_name) || $refresh == true) {
|
||||
;
|
||||
$GLOBALS['log']->debug("starting pipeline chart");
|
||||
$GLOBALS['log']->debug("legends is:");
|
||||
$GLOBALS['log']->debug($legends);
|
||||
$GLOBALS['log']->debug("user_id is: ");
|
||||
$GLOBALS['log']->debug($user_id);
|
||||
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
|
||||
|
||||
$opp = new Opportunity;
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $legends and $user
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count > 0 && !empty($user_id)) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
if(!empty($where)) $where .= 'AND';
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($legends);
|
||||
$legendItem = array();
|
||||
if ($count > 0 && !empty($legends)) {
|
||||
|
||||
foreach ($legends as $key=>$value) {
|
||||
$legendItem[] = "'".$key."'";
|
||||
}
|
||||
$legendItems = join(",",$legendItem);
|
||||
$where .= " opportunities.lead_source IN ($legendItems) ";
|
||||
}
|
||||
$query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE ".$where." AND opportunities.deleted=0 ";
|
||||
$query .= "GROUP BY lead_source ORDER BY total DESC";
|
||||
|
||||
//build pipeline by lead source data
|
||||
$total = 0;
|
||||
$div = 1;
|
||||
global $sugar_config;
|
||||
$symbol = $sugar_config['default_currency_symbol'];
|
||||
global $current_user;
|
||||
if($current_user->getPreference('currency') ) {
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$div = $currency->conversion_rate;
|
||||
$symbol = $currency->symbol;
|
||||
}
|
||||
$subtitle = $current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'];
|
||||
$fileContents = '';
|
||||
$fileContents .= ' <pie defaultAltText="'.$current_module_strings['LBL_ROLLOVER_WEDGE_DETAILS'].'" legendStatus="on">'."\n";
|
||||
$result = $opp->db->query($query)
|
||||
or sugar_die("Error selecting sugarbean: ".mysql_error());
|
||||
$leadSourceArr = array();
|
||||
while($row = $opp->db->fetchByAssoc($result, -1, false))
|
||||
{
|
||||
if($row['lead_source'] == ''){
|
||||
$leadSource = $current_module_strings['NTC_NO_LEGENDS'];
|
||||
} else {
|
||||
$leadSource = $row['lead_source'];
|
||||
}
|
||||
if($row['total']*$div<=100){
|
||||
$sum = round($row['total']*$div, 2);
|
||||
} else {
|
||||
$sum = round($row['total']*$div);
|
||||
}
|
||||
|
||||
$leadSourceArr[$leadSource]['opp_count'] = $row['opp_count'];
|
||||
$leadSourceArr[$leadSource]['sum'] = $sum;
|
||||
}
|
||||
$i=0;
|
||||
foreach ($legends as $lead_source_key=>$translation) {
|
||||
if ($lead_source_key == '') {
|
||||
$lead_source_key = $current_module_strings['NTC_NO_LEGENDS'];
|
||||
$translation = $current_module_strings['NTC_NO_LEGENDS'];
|
||||
}
|
||||
if(!isset($leadSourceArr[$lead_source_key])) {
|
||||
$leadSourceArr[$lead_source_key] = $lead_source_key;
|
||||
$leadSourceArr[$lead_source_key]['sum'] = 0;
|
||||
}
|
||||
$color = generate_graphcolor($lead_source_key,$i);
|
||||
$fileContents .= ' <wedge title="'.$translation.'" kDelim="'.$kDelim.'" value="'.$leadSourceArr[$lead_source_key]['sum'].'" color="'.$color.'" labelText="'.currency_format_number($leadSourceArr[$lead_source_key]['sum'], array('currency_symbol' => true)).'" url="index.php?module=Opportunities&action=index&lead_source='.urlencode($lead_source_key).'&query=true&searchFormTab=advanced_search" altText="'.format_number($leadSourceArr[$lead_source_key]['opp_count'], 0, 0).' '.$current_module_strings['LBL_OPPS_IN_LEAD_SOURCE'].' '.$translation.'"/>'."\n";
|
||||
if(isset($leadSourceArr[$lead_source_key])){$total += $leadSourceArr[$lead_source_key]['sum'];}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$fileContents .= ' </pie>'."\n";
|
||||
$fileContents .= ' <graphInfo>'."\n";
|
||||
$fileContents .= ' <![CDATA[]]>'."\n";
|
||||
$fileContents .= ' </graphInfo>'."\n";
|
||||
$fileContents .= ' <chartColors ';
|
||||
foreach ($pieChartColors as $key => $value) {
|
||||
$fileContents .= ' '.$key.'='.'"'.$value.'" ';
|
||||
}
|
||||
$fileContents .= ' />'."\n";
|
||||
$fileContents .= '</graphData>'."\n";
|
||||
$total = round($total, 2);
|
||||
$title = $current_module_strings['LBL_TOTAL_PIPELINE'].currency_format_number($total, array('currency_symbol' => true)).$app_strings['LBL_THOUSANDS_SYMBOL'];
|
||||
$fileContents = '<graphData title="'.$title.'" subtitle="'.$subtitle.'">'."\n" . $fileContents;
|
||||
$GLOBALS['log']->debug("total is: $total");
|
||||
if ($total == 0) {
|
||||
return ($current_module_strings['ERR_NO_OPPS']);
|
||||
}
|
||||
|
||||
save_xml_file($cache_file_name, $fileContents);
|
||||
}
|
||||
|
||||
$return = create_chart('pieF',$cache_file_name);
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
function constructQuery(){
|
||||
global $current_user;
|
||||
global $app_list_strings;
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$selected_datax = array();
|
||||
//get list of sales stage keys to display
|
||||
global $current_user;
|
||||
$user_tempx = $current_user->getPreference('pbls_lead_sources');
|
||||
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbls_lead_sources'])) {
|
||||
$tempx = $user_tempx;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($user_tempx);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbls_lead_sources']) && count($_REQUEST['pbls_lead_sources']) > 0) {
|
||||
$tempx = $_REQUEST['pbls_lead_sources'];
|
||||
$current_user->setPreference('pbls_lead_sources', $_REQUEST['pbls_lead_sources']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbls_lead_sources']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_lead_sources'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbls_lead_sources'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['lead_source_dom'][$key];
|
||||
array_push($selected_datax,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['lead_source_dom'];
|
||||
$selected_datax = array_keys($app_list_strings['lead_source_dom']);
|
||||
}
|
||||
|
||||
$legends = $datax;
|
||||
|
||||
$ids = array();
|
||||
$user_ids = $current_user->getPreference('pbls_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbls_ids'])) {
|
||||
if(isset($_SESSION['pbls_ids'])) {$ids = $_SESSION['pbls_ids'];}
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbls_ids']) && count($_REQUEST['pbls_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbls_ids'];
|
||||
$current_user->setPreference('pbls_ids', $ids);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbls_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbls_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbls_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbls_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
|
||||
$opp = new Opportunity;
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $legends and $user
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
if ($count > 0 && !empty($user_id)) {
|
||||
foreach ($user_id as $the_id) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
if(!empty($where)) $where .= 'AND';
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($legends);
|
||||
$legendItem = array();
|
||||
if ($count > 0 && !empty($legends)) {
|
||||
|
||||
foreach ($legends as $key=>$value) {
|
||||
$legendItem[] = "'".$key."'";
|
||||
}
|
||||
$legendItems = join(",",$legendItem);
|
||||
$where .= " opportunities.lead_source IN ($legendItems) ";
|
||||
}
|
||||
$query = "SELECT lead_source,sum(amount_usdollar/1000) as total,count(*) as opp_count FROM opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE ".$where." AND opportunities.deleted=0 ";
|
||||
$query .= "GROUP BY lead_source ORDER BY total DESC";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array( 'lead_source', );
|
||||
}
|
||||
}
|
||||
?>
|
||||
623
modules/Charts/code/Chart_pipeline_by_sales_stage.php
Executable file
623
modules/Charts/code/Chart_pipeline_by_sales_stage.php
Executable file
@@ -0,0 +1,623 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: returns HTML for client-side image map.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('config.php');
|
||||
|
||||
require_once('modules/Opportunities/Opportunity.php');
|
||||
require_once('include/charts/Charts.php');
|
||||
require_once('include/utils.php');
|
||||
|
||||
|
||||
class Chart_pipeline_by_sales_stage
|
||||
{
|
||||
var $modules = array('Opportunities');
|
||||
var $order = 0;
|
||||
function Chart_pipeline_by_sales_stage()
|
||||
{
|
||||
}
|
||||
|
||||
function draw($extra_tools)
|
||||
{
|
||||
|
||||
require_once('include/utils.php');
|
||||
|
||||
global $action;
|
||||
global $app_list_strings;
|
||||
global $app_strings;
|
||||
global $current_language;
|
||||
global $current_user;
|
||||
global $image_path;
|
||||
global $currentModule;
|
||||
global $sugar_config;
|
||||
global $theme;
|
||||
global $timedate;
|
||||
|
||||
$user_dateFormat = $timedate->get_date_format();
|
||||
$current_module_strings = return_module_language($current_language, 'Charts');
|
||||
|
||||
|
||||
if (isset($_REQUEST['pbss_refresh'])) { $refresh = $_REQUEST['pbss_refresh']; }
|
||||
else { $refresh = false; }
|
||||
|
||||
//get the dates to display
|
||||
$user_date_start = $current_user->getPreference('pbss_date_start');
|
||||
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['pbss_date_start'])) {
|
||||
$date_start = $timedate->to_display_date($user_date_start, false);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_date_start']) && $_REQUEST['pbss_date_start'] != '') {
|
||||
$date_start = $_REQUEST['pbss_date_start'];
|
||||
$ds = $timedate->to_db_date($date_start, false);
|
||||
$current_user->setPreference('pbss_date_start', $ds);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_date_start']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date($timedate->get_date_format(), time());
|
||||
}
|
||||
|
||||
$user_date_end = $current_user->getPreference('pbss_date_end');
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['pbss_date_end'])) {
|
||||
$date_end = $timedate->to_display_date($user_date_end, false);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($user_date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_date_end']) && $_REQUEST['pbss_date_end'] != '') {
|
||||
$date_end = $_REQUEST['pbss_date_end'];
|
||||
$de = $timedate->to_db_date($date_end, false);
|
||||
$current_user->setPreference('pbss_date_end', $de);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug( $current_user->getPreference('pbss_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date($timedate->get_date_format(), strtotime('2010-01-01'));
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] not found. Using: ".$date_end);
|
||||
}
|
||||
|
||||
// cn: format date_start|end to user's preferred
|
||||
$dateDisplayStart = strftime($timedate->get_user_date_format(), strtotime($date_start));
|
||||
$dateDisplayEnd = strftime($timedate->get_user_date_format(), strtotime($date_end));
|
||||
$seps = array("-", "/");
|
||||
$dates = array($date_start, $date_end);
|
||||
$dateFileNameSafe = str_replace($seps, "_", $dates);
|
||||
$dateXml[0] = $timedate->swap_formats($date_start, $user_dateFormat, $timedate->dbDayFormat);
|
||||
$dateXml[1] = $timedate->swap_formats($date_end, $user_dateFormat, $timedate->dbDayFormat);
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$datax_selected= array();
|
||||
$user_tempx = $current_user->getPreference('pbss_sales_stages');
|
||||
//get list of sales stage keys to display
|
||||
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbss_sales_stages'])) {
|
||||
$tempx = $user_tempx ;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($user_tempx );
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_sales_stages']) && count($_REQUEST['pbss_sales_stages']) > 0) {
|
||||
$tempx = $_REQUEST['pbss_sales_stages'];
|
||||
$current_user->setPreference('pbss_sales_stages', $_REQUEST['pbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_sales_stages'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
|
||||
array_push($datax_selected,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['sales_stage_dom'];
|
||||
$datax_selected = array_keys($app_list_strings['sales_stage_dom']);
|
||||
}
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbss_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbss_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_ids']) && count($_REQUEST['pbss_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbss_ids'];
|
||||
$current_user->setPreference('pbss_ids', $_REQUEST['pbss_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
|
||||
//create unique prefix based on selected users for image files
|
||||
$id_hash = '1';
|
||||
if (isset($ids)) {
|
||||
sort($ids);
|
||||
$id_hash = crc32(implode('',$ids));
|
||||
if($id_hash < 0)
|
||||
{
|
||||
$id_hash = $id_hash * -1;
|
||||
}
|
||||
}
|
||||
$GLOBALS['log']->debug("ids is:");
|
||||
$GLOBALS['log']->debug($ids);
|
||||
|
||||
$cache_file_name = $current_user->getUserPrivGuid()."_lead_source_by_outcome_".$dateFileNameSafe[0]."_".$dateFileNameSafe[1].".xml";
|
||||
|
||||
$GLOBALS['log']->debug("cache file name is: $cache_file_name");
|
||||
|
||||
$tools='<div align="right"><a href="index.php?module='.$currentModule.'&action='. $action .'&pbss_refresh=true" class="chartToolsLink">'.get_image($image_path.'refresh','alt="Refresh" border="0" align="absmiddle"').' '.$current_module_strings['LBL_REFRESH'].'</a> <a href="javascript: toggleDisplay(\'pipeline_by_sales_stage_edit\');" class="chartToolsLink">'.get_image($image_path.'edit','alt="Edit" border="0" align="absmiddle"').' '. $current_module_strings['LBL_EDIT'].'</a> '.$extra_tools.'</div>';
|
||||
|
||||
echo '<span onmouseover="this.style.cursor=\'move\'" id="chart_handle_' . $this->order . '">' . get_form_header($current_module_strings['LBL_SALES_STAGE_FORM_TITLE'], $tools , false) . '</span>'; ?>
|
||||
|
||||
<?php
|
||||
$cal_lang = "en";
|
||||
$cal_dateformat = $timedate->get_cal_date_format();
|
||||
if (empty($_SESSION['pbss_sales_stages'])) $_SESSION['pbss_sales_stages'] = "";
|
||||
if (empty($_SESSION['pbss_ids'])) $_SESSION['pbss_ids'] = "";
|
||||
|
||||
|
||||
// set populate values
|
||||
$puser_date_start = $current_user->getPreference('user_date_start');
|
||||
|
||||
?>
|
||||
<p>
|
||||
<div id='pipeline_by_sales_stage_edit' style='display: none;'>
|
||||
<form name='pipeline_by_sales_stage' action="index.php" method="post" >
|
||||
<input type="hidden" name="module" value="<?php echo $currentModule;?>">
|
||||
<input type="hidden" name="action" value="<?php echo $action;?>">
|
||||
<input type="hidden" name="pbss_refresh" value="true">
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="chartForm" align="center">
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_DATE_START']?></b> <br><span class="dateFormat"><?php echo "(".$timedate->get_user_date_format().")"; ?></span></td>
|
||||
<td valign='top' ><input class="text" name="pbss_date_start" size='12' maxlength='10' id='date_start' value='<?php if (isset($date_start)) echo $date_start; ?>'> <img src="themes/default/images/jscalendar.gif" alt="<?php echo $app_strings['LBL_ENTER_DATE']; ?>" id="date_start_trigger" align="absmiddle"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_DATE_END'];?></b><br><span class="dateFormat"><?php echo "(".$timedate->get_user_date_format().")"; ?></span></td>
|
||||
<td valign='top' ><input class="text" name="pbss_date_end" size='12' maxlength='10' id='date_end' value='<?php if (isset($date_end)) echo $date_end; ?>'> <img src="themes/default/images/jscalendar.gif" alt="<?php echo $app_strings['LBL_ENTER_DATE']; ?>" id="date_end_trigger" align="absmiddle"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_SALES_STAGES'];?></b></td>
|
||||
<td valign='top' ><select name="pbss_sales_stages[]" multiple size='3'><?php echo get_select_options_with_id($app_list_strings['sales_stage_dom'],$datax_selected); ?></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top' nowrap><b><?php echo $current_module_strings['LBL_USERS'];?></b></td>
|
||||
<td valign='top' ><select name="pbss_ids[]" multiple size='3'><?php echo get_select_options_with_id(get_user_array(false),$ids); ?></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
global $app_strings;
|
||||
?>
|
||||
<td align="right" colspan="2"><input class="button" onclick="return verify_chart_data(pipeline_by_sales_stage);" type="submit" title="<?php echo $app_strings['LBL_SELECT_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_SELECT_BUTTON_KEY']; ?>" value="<?php echo $app_strings['LBL_SELECT_BUTTON_LABEL']?>" /><input class="button" onClick="javascript: toggleDisplay('pipeline_by_sales_stage_edit');" type="button" title="<?php echo $app_strings['LBL_CANCEL_BUTTON_TITLE']; ?>" accessKey="<?php echo $app_strings['LBL_CANCEL_BUTTON_KEY'];?>" value="<?php echo $app_strings['LBL_CANCEL_BUTTON_LABEL']?>"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
Calendar.setup ({
|
||||
inputField : "date_start", ifFormat : "<?php echo $cal_dateformat ?>", showsTime : false, button : "date_start_trigger", singleClick : true, step : 1
|
||||
});
|
||||
Calendar.setup ({
|
||||
inputField : "date_end", ifFormat : "<?php echo $cal_dateformat ?>", showsTime : false, button : "date_end_trigger", singleClick : true, step : 1
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</p>
|
||||
<?php
|
||||
|
||||
// draw table
|
||||
echo "<P align='center'>".$this->gen_xml($datax, $dateXml[0], $dateXml[1], $ids, $sugar_config['tmp_dir'].$cache_file_name, $refresh,'hBarF',$current_module_strings)."</P>";
|
||||
echo "<P align='center'><span class='chartFootnote'>".$current_module_strings['LBL_SALES_STAGE_FORM_DESC']."</span></P>";
|
||||
|
||||
if (file_exists($sugar_config['tmp_dir'].$cache_file_name)) {
|
||||
$file_date = date($timedate->get_date_format()." ".$timedate->get_time_format(), filemtime($sugar_config['tmp_dir'].$cache_file_name));
|
||||
}
|
||||
else {
|
||||
$file_date = '';
|
||||
}
|
||||
?>
|
||||
|
||||
<span class='chartFootnote'>
|
||||
<p align="right"><i><?php echo $current_module_strings['LBL_CREATED_ON'].' '.$file_date; ?></i></p>
|
||||
</span>
|
||||
<?php
|
||||
echo get_validate_chart_js();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates opportunity pipeline image as a HORIZONTAL accumlated BAR GRAPH for multiple users.
|
||||
* param $datax- the sales stage data to display in the x-axis
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
|
||||
* All Rights Reserved..
|
||||
* Contributor(s): ______________________________________..
|
||||
*/
|
||||
function gen_xml($datax=array('foo','bar'), $date_start='2071-10-15', $date_end='2071-10-15', $user_id=array('1'), $cache_file_name='a_file', $refresh=false,$chart_size='hBarF',$current_module_strings) {
|
||||
global $app_strings, $charset, $lang, $barChartColors, $current_user;
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$kDelim = $current_user->getPreference('num_grp_sep');
|
||||
|
||||
global $timedate;
|
||||
|
||||
if (!file_exists($cache_file_name) || $refresh == true) {
|
||||
|
||||
$GLOBALS['log']->debug("starting pipeline chart");
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
$GLOBALS['log']->debug("user_id is: ");
|
||||
$GLOBALS['log']->debug($user_id);
|
||||
$GLOBALS['log']->debug("cache_file_name is: $cache_file_name");
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND opportunities.sales_stage IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND opportunities.date_closed >= ". db_convert("'".$date_start."'",'date'). "
|
||||
AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date') ;
|
||||
$where .= " AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage,users.user_name,opportunities.assigned_user_id";
|
||||
|
||||
|
||||
|
||||
$result = $opp->db->query($query)
|
||||
or sugar_die("Error selecting sugarbean: ".mysql_error());
|
||||
//build pipeline by sales stage data
|
||||
$total = 0;
|
||||
$div = 1;
|
||||
global $sugar_config;
|
||||
$symbol = $sugar_config['default_currency_symbol'];
|
||||
global $current_user;
|
||||
if($current_user->getPreference('currency') ){
|
||||
require_once('modules/Currencies/Currency.php');
|
||||
$currency = new Currency();
|
||||
$currency->retrieve($current_user->getPreference('currency'));
|
||||
$div = $currency->conversion_rate;
|
||||
$symbol = $currency->symbol;
|
||||
}
|
||||
// cn: adding user-pref date handling
|
||||
$dateStartDisplay = date($timedate->get_date_format(), strtotime($date_start));
|
||||
$dateEndDisplay = date($timedate->get_date_format(), strtotime($date_end));
|
||||
|
||||
$fileContents = ' <yData defaultAltText="'.$current_module_strings['LBL_ROLLOVER_DETAILS'].'">'."\n";
|
||||
$stageArr = array();
|
||||
$usernameArr = array();
|
||||
$rowTotalArr = array();
|
||||
$rowTotalArr[] = 0;
|
||||
while($row = $opp->db->fetchByAssoc($result, -1, false))
|
||||
{
|
||||
if($row['total']*$div<=100){
|
||||
$sum = round($row['total']*$div, 2);
|
||||
} else {
|
||||
$sum = round($row['total']*$div);
|
||||
}
|
||||
if(!isset($stageArr[$row['sales_stage']]['row_total'])) {$stageArr[$row['sales_stage']]['row_total']=0;}
|
||||
$stageArr[$row['sales_stage']][$row['assigned_user_id']]['opp_count'] = $row['opp_count'];
|
||||
$stageArr[$row['sales_stage']][$row['assigned_user_id']]['total'] = $sum;
|
||||
$stageArr[$row['sales_stage']]['people'][$row['assigned_user_id']] = $row['user_name'];
|
||||
$stageArr[$row['sales_stage']]['row_total'] += $sum;
|
||||
|
||||
$usernameArr[$row['assigned_user_id']] = $row['user_name'];
|
||||
$total += $sum;
|
||||
}
|
||||
foreach ($datax as $key=>$translation) {
|
||||
if(isset($stageArr[$key]['row_total'])){$rowTotalArr[]=$stageArr[$key]['row_total'];}
|
||||
if(isset($stageArr[$key]['row_total']) && $stageArr[$key]['row_total']>100) {
|
||||
$stageArr[$key]['row_total'] = round($stageArr[$key]['row_total']);
|
||||
}
|
||||
$fileContents .= ' <dataRow title="'.$translation.'" endLabel="';
|
||||
if(isset($stageArr[$key]['row_total'])){$fileContents .= currency_format_number($stageArr[$key]['row_total'], array('currency_symbol' => true));}
|
||||
$fileContents .= '">'."\n";
|
||||
if(isset($stageArr[$key]['people'])){
|
||||
asort($stageArr[$key]['people']);
|
||||
reset($stageArr[$key]['people']);
|
||||
foreach ($stageArr[$key]['people'] as $nameKey=>$nameValue) {
|
||||
$fileContents .= ' <bar id="'.$nameKey.'" totalSize="'.$stageArr[$key][$nameKey]['total'].'" altText="'.$nameValue.': '.format_number($stageArr[$key][$nameKey]['opp_count'], 0, 0).' '.$current_module_strings['LBL_OPPS_WORTH'].' '.format_number($stageArr[$key][$nameKey]['total'], 2, 2).$current_module_strings['LBL_OPP_THOUSANDS'].' '.$current_module_strings['LBL_OPPS_IN_STAGE'].' '.$translation.'" url="index.php?module=Opportunities&action=index&assigned_user_id[]='.$nameKey.'&sales_stage='.urlencode($key).'&date_start='.$date_start.'&date_closed='.$date_end.'&query=true&searchFormTab=advanced_search"/>'."\n";
|
||||
}
|
||||
}
|
||||
$fileContents .= ' </dataRow>'."\n";
|
||||
}
|
||||
$fileContents .= ' </yData>'."\n";
|
||||
$max = get_max($rowTotalArr);
|
||||
if($chart_size=='hBarF'){
|
||||
$length = "10";
|
||||
}else{
|
||||
$length = "4";
|
||||
}
|
||||
$fileContents .= ' <xData min="0" max="'.$max.'" length="'.$length.'" prefix="'.$symbol.'" suffix="" kDelim="'.$kDelim.'" />'."\n";
|
||||
$fileContents .= ' <colorLegend status="on">'."\n";
|
||||
$i=0;
|
||||
asort($new_ids);
|
||||
foreach ($new_ids as $key=>$value) {
|
||||
$color = generate_graphcolor($key,$i);
|
||||
$fileContents .= ' <mapping id="'.$key.'" name="'.$value.'" color="'.$color.'"/>'."\n";
|
||||
$i++;
|
||||
}
|
||||
$fileContents .= ' </colorLegend>'."\n";
|
||||
$fileContents .= ' <graphInfo>'."\n";
|
||||
$fileContents .= ' <![CDATA['.$current_module_strings['LBL_DATE_RANGE'].' '.$dateStartDisplay.' '.$current_module_strings['LBL_DATE_RANGE_TO'].' '.$dateEndDisplay.'<BR/>'.$current_module_strings['LBL_OPP_SIZE'].' '.$symbol.'1'.$current_module_strings['LBL_OPP_THOUSANDS'].']]>'."\n";
|
||||
$fileContents .= ' </graphInfo>'."\n";
|
||||
$fileContents .= ' <chartColors ';
|
||||
foreach ($barChartColors as $key => $value) {
|
||||
$fileContents .= ' '.$key.'='.'"'.$value.'" ';
|
||||
}
|
||||
$fileContents .= ' />'."\n";
|
||||
$fileContents .= '</graphData>'."\n";
|
||||
$total = $total;
|
||||
$title = '<graphData title="'.$current_module_strings['LBL_TOTAL_PIPELINE'].currency_format_number($total, array('currency_symbol' => true)).$app_strings['LBL_THOUSANDS_SYMBOL'].'">'."\n";
|
||||
$fileContents = $title.$fileContents;
|
||||
|
||||
save_xml_file($cache_file_name, $fileContents);
|
||||
}
|
||||
|
||||
if($chart_size=='hBarF'){
|
||||
$width = "800";
|
||||
$height = "400";
|
||||
} else {
|
||||
$width = "350";
|
||||
$height = "400";
|
||||
}
|
||||
$return = create_chart($chart_size,$cache_file_name,$width,$height);
|
||||
return $return;
|
||||
}
|
||||
|
||||
function constructQuery(){
|
||||
global $current_user;
|
||||
global $timedate;
|
||||
global $app_list_strings;
|
||||
|
||||
//get the dates to display
|
||||
$user_date_start = $current_user->getPreference('pbss_date_start');
|
||||
|
||||
if (!empty($user_date_start) && !isset($_REQUEST['pbss_date_start'])) {
|
||||
$date_start = $timedate->to_display_date($user_date_start, false);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($user_date_start);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_date_start']) && $_REQUEST['pbss_date_start'] != '') {
|
||||
$date_start = $_REQUEST['pbss_date_start'];
|
||||
$ds = $timedate->to_db_date($date_start, false);
|
||||
$current_user->setPreference('pbss_date_start', $ds);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_date_start']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_start'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_date_start'));
|
||||
}
|
||||
else {
|
||||
$date_start = date($timedate->get_date_format(), time());
|
||||
}
|
||||
|
||||
$user_date_end = $current_user->getPreference('pbss_date_end');
|
||||
if (!empty($user_date_end) && !isset($_REQUEST['pbss_date_end'])) {
|
||||
$date_end = $timedate->to_display_date($user_date_end, false);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($user_date_end);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_date_end']) && $_REQUEST['pbss_date_end'] != '') {
|
||||
$date_end = $_REQUEST['pbss_date_end'];
|
||||
$de = $timedate->to_db_date($date_end, false);
|
||||
$current_user->setPreference('pbss_date_end', $de);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_date_end']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] is:");
|
||||
$GLOBALS['log']->debug( $current_user->getPreference('pbss_date_end'));
|
||||
}
|
||||
else {
|
||||
$date_end = date($timedate->get_date_format(), strtotime('2010-01-01'));
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_date_end'] not found. Using: ".$date_end);
|
||||
}
|
||||
|
||||
$tempx = array();
|
||||
$datax = array();
|
||||
$datax_selected= array();
|
||||
$user_tempx = $current_user->getPreference('pbss_sales_stages');
|
||||
//get list of sales stage keys to display
|
||||
if (!empty($user_tempx) && count($user_tempx) > 0 && !isset($_REQUEST['pbss_sales_stages'])) {
|
||||
$tempx = $user_tempx ;
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($user_tempx );
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_sales_stages']) && count($_REQUEST['pbss_sales_stages']) > 0) {
|
||||
$tempx = $_REQUEST['pbss_sales_stages'];
|
||||
$current_user->setPreference('pbss_sales_stages', $_REQUEST['pbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_sales_stages']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_sales_stages'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_sales_stages'));
|
||||
}
|
||||
|
||||
//set $datax using selected sales stage keys
|
||||
if (count($tempx) > 0) {
|
||||
foreach ($tempx as $key) {
|
||||
$datax[$key] = $app_list_strings['sales_stage_dom'][$key];
|
||||
array_push($datax_selected,$key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$datax = $app_list_strings['sales_stage_dom'];
|
||||
$datax_selected = array_keys($app_list_strings['sales_stage_dom']);
|
||||
}
|
||||
$GLOBALS['log']->debug("datax is:");
|
||||
$GLOBALS['log']->debug($datax);
|
||||
|
||||
|
||||
|
||||
$ids = array();
|
||||
$new_ids = array();
|
||||
$user_ids = $current_user->getPreference('pbss_ids');
|
||||
//get list of user ids for which to display data
|
||||
if (!empty($user_ids) && count($user_ids) != 0 && !isset($_REQUEST['pbss_ids'])) {
|
||||
$ids = $user_ids;
|
||||
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($user_ids);
|
||||
}
|
||||
elseif (isset($_REQUEST['pbss_ids']) && count($_REQUEST['pbss_ids']) > 0) {
|
||||
$ids = $_REQUEST['pbss_ids'];
|
||||
$current_user->setPreference('pbss_ids', $_REQUEST['pbss_ids']);
|
||||
$GLOBALS['log']->debug("_REQUEST['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($_REQUEST['pbss_ids']);
|
||||
$GLOBALS['log']->debug("USER PREFERENCES['pbss_ids'] is:");
|
||||
$GLOBALS['log']->debug($current_user->getPreference('pbss_ids'));
|
||||
}
|
||||
else {
|
||||
$ids = get_user_array(false);
|
||||
$ids = array_keys($ids);
|
||||
|
||||
}
|
||||
|
||||
$user_id = $ids;
|
||||
$opp = new Opportunity;
|
||||
$where="";
|
||||
//build the where clause for the query that matches $user
|
||||
$count = count($user_id);
|
||||
$id = array();
|
||||
$user_list = get_user_array(false);
|
||||
foreach ($user_id as $key) {
|
||||
$new_ids[$key] = $user_list[$key];
|
||||
}
|
||||
if ($count>0) {
|
||||
foreach ($new_ids as $the_id=>$the_name) {
|
||||
$id[] = "'".$the_id."'";
|
||||
}
|
||||
$ids = join(",",$id);
|
||||
$where .= "opportunities.assigned_user_id IN ($ids) ";
|
||||
|
||||
}
|
||||
//build the where clause for the query that matches $datax
|
||||
$count = count($datax);
|
||||
$dataxArr = array();
|
||||
if ($count>0) {
|
||||
|
||||
foreach ($datax as $key=>$value) {
|
||||
$dataxArr[] = "'".$key."'";
|
||||
}
|
||||
$dataxArr = join(",",$dataxArr);
|
||||
$where .= "AND opportunities.sales_stage IN ($dataxArr) ";
|
||||
}
|
||||
|
||||
//build the where clause for the query that matches $date_start and $date_end
|
||||
$where .= " AND opportunities.date_closed >= ". db_convert("'".$date_start."'",'date'). "
|
||||
AND opportunities.date_closed <= ".db_convert("'".$date_end."'",'date') ;
|
||||
$where .= " AND opportunities.assigned_user_id = users.id AND opportunities.deleted=0 ";
|
||||
|
||||
//Now do the db queries
|
||||
//query for opportunity data that matches $datax and $user
|
||||
$query = " SELECT opportunities.sales_stage,
|
||||
users.user_name,
|
||||
opportunities.assigned_user_id,
|
||||
count( * ) AS opp_count,
|
||||
sum(amount_usdollar/1000) AS total
|
||||
FROM users,opportunities ";
|
||||
|
||||
|
||||
|
||||
$query .= "WHERE " .$where;
|
||||
$query .= " GROUP BY opportunities.sales_stage,users.user_name,opportunities.assigned_user_id";
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function constructGroupBy(){
|
||||
return array( 'sales_stage', 'user_name' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
48
modules/Charts/code/predefined_charts.php
Executable file
48
modules/Charts/code/predefined_charts.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2009 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
$predefined_charts = array(
|
||||
'Chart_pipeline_by_sales_stage'=>
|
||||
array('type'=>'code','id'=>'Chart_pipeline_by_sales_stage','label'=>'Pipeline by Sales Stage','chartType'=>'horizontal group by chart',),
|
||||
'Chart_lead_source_by_outcome'=>
|
||||
array('type'=>'code','id'=>'Chart_lead_source_by_outcome','label'=>'Lead Source By Outcome','chartType'=>'horizontal group by chart',),
|
||||
'Chart_outcome_by_month'=>
|
||||
array('type'=>'code','id'=>'Chart_outcome_by_month','label'=>'Outcome by Month','chartType'=>'stacked group by chart',),
|
||||
'Chart_pipeline_by_lead_source'=>
|
||||
array('type'=>'code','id'=>'Chart_pipeline_by_lead_source','label'=>'Pipeline By Lead Source','chartType'=>'pie chart',),
|
||||
'Chart_my_pipeline_by_sales_stage'=>
|
||||
array('type'=>'code','id'=>'Chart_pipeline_by_sales_stage','label'=>'My Pipeline by Sales Stage','chartType'=>'funnel chart',),
|
||||
);
|
||||
140
modules/Charts/language/en_us.lang.php
Executable file
140
modules/Charts/language/en_us.lang.php
Executable file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004 - 2008 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = array (
|
||||
'ERR_NO_OPPS' => 'Please create some Opportunities to see Opportunity graphs.',
|
||||
'LBL_ALL_OPPORTUNITIES' => 'Total amount of all opportunities is ',
|
||||
'LBL_CHART_TYPE' => 'Chart Type:',
|
||||
'LBL_CREATED_ON' => 'Last run on ',
|
||||
'LBL_DATE_END' => 'End Date:',
|
||||
'LBL_DATE_RANGE_TO' => 'to',
|
||||
'LBL_DATE_RANGE' => 'Date range is',
|
||||
'LBL_DATE_START' => 'Begin Date:',
|
||||
'LBL_EDIT' => 'Edit',
|
||||
'LBL_LEAD_SOURCE_BY_OUTCOME_DESC' => 'Shows cumulative opportunity amounts by selected lead source by outcome for selected users. Outcome is based on whether the sales stage is Closed Won, Closed Lost, or any other value.',
|
||||
'LBL_LEAD_SOURCE_BY_OUTCOME' => 'All Opportunities By Lead Source By Outcome',
|
||||
'LBL_LEAD_SOURCE_FORM_DESC' => 'Shows cumulative opportunity amounts by selected lead source for selected users.',
|
||||
'LBL_LEAD_SOURCE_FORM_TITLE' => 'All Opportunities By Lead Source',
|
||||
'LBL_LEAD_SOURCE_OTHER' => 'Other',
|
||||
'LBL_LEAD_SOURCES' => 'Lead Sources:',
|
||||
'LBL_MODULE_NAME' => 'Dashboard',
|
||||
'LBL_MODULE_TITLE' => 'Dashboard: Home',
|
||||
'LBL_MONTH_BY_OUTCOME_DESC' => 'Shows cumulative opportunity amounts by month by outcome for selected users where the expected closed date is within the specified date range. Outcome is based on whether the sales stage is Closed Won, Closed Lost, or any other value.',
|
||||
'LBL_NUMBER_OF_OPPS' => 'Number of Opportunities',
|
||||
'LBL_OPP_SIZE' => 'Opportunity size in',
|
||||
'LBL_OPP_THOUSANDS'=> 'K',
|
||||
'LBL_OPPS_IN_LEAD_SOURCE' => 'opportunities where lead source is',
|
||||
'LBL_OPPS_IN_STAGE' => ' where sales stage is',
|
||||
'LBL_OPPS_OUTCOME' => ' where outcome is',
|
||||
'LBL_OPPS_WORTH' => 'opportunities worth',
|
||||
'LBL_PIPELINE_FORM_TITLE_DESC' => 'Shows cumulative amounts by selected sales stages for your opportunities where the expected closed date is within the specified date range.',
|
||||
'LBL_CAMPAIGN_ROI_TITLE_DESC' => 'Shows campaign response by return on investment.',
|
||||
'LBL_REFRESH' => 'Refresh',
|
||||
'LBL_ROLLOVER_DETAILS' => 'Rollover a bar for details.',
|
||||
'LBL_ROLLOVER_WEDGE_DETAILS' => 'Rollover a wedge for details.',
|
||||
'LBL_SALES_STAGE_FORM_DESC' => 'Shows cumulative opportunity amounts by selected sales stages for selected users where the expected closed date is within the specified date range.',
|
||||
'LBL_SALES_STAGE_FORM_TITLE' => 'Pipeline By Sales Stage',
|
||||
'LBL_SALES_STAGES' => 'Sales Stages:',
|
||||
'LBL_TOTAL_PIPELINE' => 'Pipeline total is ',
|
||||
'LBL_USERS' => 'Users:',
|
||||
'LBL_YEAR_BY_OUTCOME' => 'Pipeline By Month By Outcome',
|
||||
'LBL_YEAR' => 'Year:',
|
||||
'LNK_NEW_ACCOUNT' => 'Create Account',
|
||||
'LNK_NEW_CALL' => 'Schedule Call',
|
||||
'LNK_NEW_CASE' => 'Create Case',
|
||||
'LNK_NEW_CONTACT' => 'Create Contact',
|
||||
'LNK_NEW_ISSUE' => 'Report Bug',
|
||||
'LNK_NEW_LEAD' => 'Create Lead',
|
||||
'LNK_NEW_MEETING' => 'Schedule Meeting',
|
||||
'LNK_NEW_NOTE' => 'Create Note or Attachment',
|
||||
'LNK_NEW_OPPORTUNITY' => 'Create Opportunity',
|
||||
'LNK_NEW_QUOTE' => 'Create Quote',
|
||||
'LNK_NEW_TASK' => 'Create Task',
|
||||
'NTC_NO_LEGENDS' => 'None',
|
||||
|
||||
'LBL_TITLE' => 'Title: ',
|
||||
'LBL_MY_MODULES_USED_SIZE' => 'Access Count',
|
||||
'LBL_TASK_STATUS' => 'Task Status:',
|
||||
'LBL_TASKS_TOTAL' => 'Tasks count is: ',
|
||||
'LBL_TASK_SIZE' => 'Task size is in 1 unit.',
|
||||
'LBL_TASK_USERS' => 'Users:',
|
||||
|
||||
'LBL_BUG_STATUS' => 'Bug Status:',
|
||||
'LBL_BUGS_TOTAL' => 'Bugs count is: ',
|
||||
'LBL_BUG_SIZE' => 'Bug size is in 1 unit.',
|
||||
'LBL_BUG_USERS' => 'Users:',
|
||||
|
||||
'LBL_ECMCALLS_TITLE' => 'Users Calls:',
|
||||
'LBL_ECMCALLS_USERS' => 'Users:',
|
||||
'LBL_ECMCALLS_DATE' => 'Date:',
|
||||
'LBL_ECMCALLS_TIME_FROM' => 'Time From:',
|
||||
'LBL_ECMCALLS_TIME_TO' => 'Time To:',
|
||||
'LBL_ECMCALLS_NO_DATA' => 'No Data',
|
||||
'LBL_ECMCALLS_TYPE' => 'Type:',
|
||||
'LBL_ECMCALLS_DATE_SELECT' => 'Or Date:',
|
||||
'LBL_ECMCALLS_SHOW_NUMBERS' => 'Show Numbers:',
|
||||
|
||||
'LBL_INCOMING_LESS_THAN_60S' => 'Incoming, duration <= 60s',
|
||||
'LBL_INCOMING_MORE_THAN_60S' => 'Incoming, duration > 60s',
|
||||
'LBL_OUTGOING_LESS_THAN_60S' => 'Outgoing, duration <= 60s',
|
||||
'LBL_OUTGOING_MORE_THAN_60S' => 'Outgoing, duration > 60s',
|
||||
|
||||
'LBL_ECMQUOTES_TITLE' => 'Quotes',
|
||||
'LBL_ECMQUOTES_SIZE' => 'Quote size in',
|
||||
'LBL_ECMQUOTES_THOUSANDS'=> 'K',
|
||||
'LBL_ECMQUOTES_TOTAL' => 'Total is:',
|
||||
'LBL_ECMQUOTE_STATUS' => 'Quote Status:',
|
||||
'LBL_ECMQUOTE_USERS' => 'Users:',
|
||||
|
||||
|
||||
'LBL_ECMINVOICEOUTS_TITLE' => 'Quotes',
|
||||
'LBL_ECMINVOICEOUTS_SIZE' => 'Quote size in',
|
||||
'LBL_ECMINVOICEOUTS_THOUSANDS'=> 'K',
|
||||
'LBL_ECMINVOICEOUTS_TOTAL' => 'Total is:',
|
||||
'LBL_ECMINVOICEOUT_STATUS' => 'Quote Status:',
|
||||
'LBL_ECMINVOICEOUT_USERS' => 'Users:',
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
122
modules/Charts/language/ge_ge.lang.php
Executable file
122
modules/Charts/language/ge_ge.lang.php
Executable file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Enterprise Subscription
|
||||
* Agreement ("License") which can be viewed at
|
||||
* http://www.sugarcrm.com/crm/products/sugar-enterprise-eula.html
|
||||
* By installing or using this file, You have unconditionally agreed to the
|
||||
* terms and conditions of the License, and You may not use this file except in
|
||||
* compliance with the License. Under the terms of the license, You shall not,
|
||||
* among other things: 1) sublicense, resell, rent, lease, redistribute, assign
|
||||
* or otherwise transfer Your rights to the Software, and 2) use the Software
|
||||
* for timesharing or service bureau purposes such as hosting the Software for
|
||||
* commercial gain and/or for the benefit of a third party. Use of the Software
|
||||
* may be subject to applicable fees and any use of the Software without first
|
||||
* paying applicable fees is strictly prohibited. You do not have the right to
|
||||
* remove SugarCRM copyrights from the source code or user interface.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* Your Warranty, Limitations of liability and Indemnity are expressly stated
|
||||
* in the License. Please refer to the License for the specific language
|
||||
* governing these rights and limitations under the License. Portions created
|
||||
* by SugarCRM are Copyright (C) 2004-2007 SugarCRM, Inc.; All Rights Reserved.
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: Defines the English language pack for the base application.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributors: Genius4U Ltd., simplicity GmbH, iscongroup kft.
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = array (
|
||||
'ERR_NO_OPPS' => 'Sie müssen Verkaufschancen erstellt haben, um eine entsprechende Grafik anzeigen zu können.',
|
||||
'LBL_ALL_OPPORTUNITIES' => 'Die Summe aller Verkaufschancen ist',
|
||||
'LBL_CHART_TYPE' => 'Diagrammtyp:',
|
||||
'LBL_CREATED_ON' => 'Zum letzten Mal durchgeführt am ',
|
||||
'LBL_DATE_END' => 'Enddatum:',
|
||||
'LBL_DATE_RANGE_TO' => 'bis',
|
||||
'LBL_DATE_RANGE' => 'Datumsbereich ist',
|
||||
'LBL_DATE_START' => 'Anfangsdatum:',
|
||||
'LBL_EDIT' => 'Bearbeiten',
|
||||
'LBL_LEAD_SOURCE_BY_OUTCOME_DESC' => 'Zeigt die aufsummierten Beträge der Verkaufschancen nach ausgewählter Quelle und Ergebnis für die selektierten Benutzer. Die Ergebnisse basieren auf den Verkaufsphasen.',
|
||||
'LBL_LEAD_SOURCE_BY_OUTCOME' => 'Alle Verkaufschancen nach Quelle und Ergebnis',
|
||||
'LBL_LEAD_SOURCE_FORM_DESC' => 'Zeigt die aufsummierten Beträge der Verkaufschancen nach selektierter Quelle für bestimmte Benutzer an.',
|
||||
'LBL_LEAD_SOURCE_FORM_TITLE' => 'Alle Verkaufschancen nach Quelle',
|
||||
'LBL_LEAD_SOURCE_OTHER' => 'Andere',
|
||||
'LBL_LEAD_SOURCES' => 'Quellen:',
|
||||
'LBL_MODULE_NAME' => 'Übersicht',
|
||||
'LBL_MODULE_TITLE' => 'Übersicht: Home',
|
||||
'LBL_MONTH_BY_OUTCOME_DESC' => 'Zeigt die aufsummierten Beträge der Verkaufschancen nach Monat und Ergebnis für bestimmte Benutzer an. Das erwartete Enddatum der Verkaufschancen ist innerhalb des angegebenen Datumbereichs. Die Ergebnisse basieren auf den Verkaufsphasen.',
|
||||
'LBL_OPP_SIZE' => 'Verkaufschance Größe in ',
|
||||
'LBL_OPP_THOUSANDS'=> 'K',
|
||||
'LBL_OPPS_IN_LEAD_SOURCE' => 'Verkaufschancen mit Quelle',
|
||||
'LBL_OPPS_IN_STAGE' => ' wo Verkaufsphase ist',
|
||||
'LBL_OPPS_OUTCOME' => ' wo das Ergebnis ist',
|
||||
'LBL_OPPS_WORTH' => 'Verkaufschancen Wert',
|
||||
'LBL_PIPELINE_FORM_TITLE_DESC' => 'Zeigt die aufsummierten Beträge der Verkaufschancen, deren erwartetes Enddatum innerhalb des angegebenen Datumbereichs liegt, nach ausgewählten Verkaufsphasen an.',
|
||||
'LBL_CAMPAIGN_ROI_TITLE_DESC' => 'Zeigt Kampagnen Resonanz nach Return On Investment.',
|
||||
'LBL_REFRESH' => 'Aktualisieren',
|
||||
'LBL_ROLLOVER_DETAILS' => 'Für Details gehen Sie auf den Balken.',
|
||||
'LBL_ROLLOVER_WEDGE_DETAILS' => 'Für Details gehen Sie auf einen Ausschnitt.',
|
||||
'LBL_SALES_STAGE_FORM_DESC' => 'Zeigt die aufsummierten Beträge der Verkaufschancen, deren erwartetes Enddatum innerhalb des angegebenen Datumbereichs liegt, an.Guppiert nach ausgewählten Verkaufsphasen für bestimmte Benutzer.',
|
||||
'LBL_SALES_STAGE_FORM_TITLE' => 'Meine Pipeline nach Verkaufsphasen',
|
||||
'LBL_SALES_STAGES' => 'Verkaufsphasen:',
|
||||
'LBL_TOTAL_PIPELINE' => 'Pipeline gesamt ist ',
|
||||
'LBL_USERS' => 'Benutzer:',
|
||||
'LBL_YEAR_BY_OUTCOME' => 'Pipeline nach Monat und Ergebnis',
|
||||
'LBL_YEAR' => 'Jahr:',
|
||||
'LNK_NEW_ACCOUNT' => 'Neue Firma',
|
||||
'LNK_NEW_CALL' => 'Neuer Anruf',
|
||||
'LNK_NEW_CASE' => 'Neuer Fall',
|
||||
'LNK_NEW_CONTACT' => 'Neuer Kontakt',
|
||||
'LNK_NEW_ISSUE' => 'Neuer Fehler',
|
||||
'LNK_NEW_LEAD' => 'Neuer Interessent',
|
||||
'LNK_NEW_MEETING' => 'Neues Meeting',
|
||||
'LNK_NEW_NOTE' => 'Neue Notiz oder Anlage',
|
||||
'LNK_NEW_OPPORTUNITY' => 'Neue Verkaufschance',
|
||||
'LNK_NEW_QUOTE' => 'Neues Angebot',
|
||||
'LNK_NEW_TASK' => 'Neue Aufgabe',
|
||||
'NTC_NO_LEGENDS' => 'Kein(e)',
|
||||
|
||||
'LBL_TITLE' => 'Titel:',
|
||||
|
||||
'LBL_ECMCALLS_TITLE' => 'Users Calls:',
|
||||
'LBL_ECMCALLS_USERS' => 'Users:',
|
||||
'LBL_ECMCALLS_DATE' => 'Date:',
|
||||
'LBL_ECMCALLS_TIME_FROM' => 'Time From:',
|
||||
'LBL_ECMCALLS_TIME_TO' => 'Time To:',
|
||||
'LBL_ECMCALLS_NO_DATA' => 'No Data',
|
||||
'LBL_ECMCALLS_TYPE' => 'Type:',
|
||||
'LBL_ECMCALLS_DATE_SELECT' => 'Or Date:',
|
||||
'LBL_ECMCALLS_SHOW_NUMBERS' => 'Show Numbers:',
|
||||
|
||||
'LBL_INCOMING_LESS_THAN_60S' => 'Incoming, duration <= 60s',
|
||||
'LBL_INCOMING_MORE_THAN_60S' => 'Incoming, duration > 60s',
|
||||
'LBL_OUTGOING_LESS_THAN_60S' => 'Outgoing, duration <= 60s',
|
||||
'LBL_OUTGOING_MORE_THAN_60S' => 'Outgoing, duration > 60s',
|
||||
|
||||
'LBL_ECMQUOTES_TITLE' => 'Quotes',
|
||||
'LBL_ECMQUOTES_SIZE' => 'Quote size in',
|
||||
'LBL_ECMQUOTES_THOUSANDS'=> 'K',
|
||||
'LBL_ECMQUOTES_TOTAL' => 'Total is:',
|
||||
'LBL_ECMQUOTE_STATUS' => 'Quote Status:',
|
||||
'LBL_ECMQUOTE_USERS' => 'Users:',
|
||||
|
||||
|
||||
'LBL_ECMINVOICEOUTS_TITLE' => 'Quotes',
|
||||
'LBL_ECMINVOICEOUTS_SIZE' => 'Quote size in',
|
||||
'LBL_ECMINVOICEOUTS_THOUSANDS'=> 'K',
|
||||
'LBL_ECMINVOICEOUTS_TOTAL' => 'Total is:',
|
||||
'LBL_ECMINVOICEOUT_STATUS' => 'Quote Status:',
|
||||
'LBL_ECMINVOICEOUT_USERS' => 'Users:',
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
125
modules/Charts/language/pl_pl.lang.php
Executable file
125
modules/Charts/language/pl_pl.lang.php
Executable file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/*********************************************************************************
|
||||
* The contents of this file are subject to the SugarCRM Public License Version
|
||||
* 1.1.3 ("License"); You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* All copies of the Covered Code must include on each user interface screen:
|
||||
* (i) the "Powered by SugarCRM" logo and
|
||||
* (ii) the SugarCRM copyright notice
|
||||
* in the same form as they appear in the distribution. See full license for
|
||||
* requirements.
|
||||
*
|
||||
* The Original Code is: SugarCRM Open Source
|
||||
* The Initial Developer of the Original Code is SugarCRM, Inc.
|
||||
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
********************************************************************************/
|
||||
|
||||
/*********************************************************************************
|
||||
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
|
||||
* Translator: Krzysztof Morawski
|
||||
* All Rights Reserved.
|
||||
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
$mod_strings = array (
|
||||
'ERR_NO_OPPS' => 'Żeby zobaczyć zestawienia wartości przychodów z projektów, musisz utworzyć co najmniej jeden z nich.',
|
||||
'LBL_ALL_OPPORTUNITIES' => 'Całkowite przychody z proj. ',
|
||||
'LBL_CHART_TYPE' => 'Typ Wykresu:',
|
||||
'LBL_CREATED_ON' => 'Ostatnia aktual.: ',
|
||||
'LBL_DATE_START' => 'Data rozp.:',
|
||||
'LBL_DATE_RANGE' => 'Przedział czasowy od:',
|
||||
'LBL_DATE_RANGE_TO' => 'do:',
|
||||
'LBL_DATE_END' => 'Data zak.:',
|
||||
'LBL_EDIT' => 'Popraw',
|
||||
'LBL_LEAD_SOURCE_BY_OUTCOME_DESC' => 'Globalne, skumulowane wyniki dla wybranych źródeł pozyskania klienta, wybranych użytkowników, w wybranym przedziale czasowym, dla wszystkich statusów procesu sprzedaży.',
|
||||
'LBL_LEAD_SOURCE_BY_OUTCOME' => 'Wszyskie proj. źródła wg. wyników',
|
||||
'LBL_LEAD_SOURCE_FORM_DESC' => 'Pokazuje skumulowaną liczbę Tematów na wybranego Żródło Pozyskania na wybranego Użytkownika.',
|
||||
'LBL_LEAD_SOURCE_FORM_TITLE' => 'Wszystkie Tematy przez Źródła Pozyskania',
|
||||
'LBL_LEAD_SOURCE_OTHER' => 'Inne',
|
||||
'LBL_LEAD_SOURCES' => 'Źródła Pozyskania Klientów:',
|
||||
'LBL_MODULE_NAME' => 'Zestawienia',
|
||||
'LBL_MODULE_TITLE' => 'Zestawienia: Strona Główna',
|
||||
'LBL_MONTH_BY_OUTCOME_DESC' => 'Globalne, skumulowane wartości przychodów miesięcznie, wg. projektów (dla wybranych użytkowników), dla których spodziewana data zakończenia mieści się w wybranym przedziale czasowym. Wynik liczony jest dla projektów posiadający status Zakończony sukcesem, zakończony porażką i pozostałych.',
|
||||
'LBL_OPP_SIZE' => 'Wartość projektu w tys. zł.',
|
||||
'LBL_OPP_THOUSANDS'=> 'Tyś.',
|
||||
'LBL_OPPS_IN_LEAD_SOURCE' => 'Zadania w których źródłem pozyskania klienta jest',
|
||||
'LBL_OPPS_IN_STAGE' => 'Zadania w których etapem sprzedaży jest',
|
||||
'LBL_OPPS_OUTCOME' => 'Zadania w których wynik jest',
|
||||
'LBL_OPPS_WORTH' => 'wartość zadań',
|
||||
'LBL_PIPELINE_FORM_TITLE_DESC' => 'Skumulowane wyniki wg. etapów sprzedaży moich projektów których zakończenie mieści się w wybranym przedziale czasowym.',
|
||||
'LBL_CAMPAIGN_ROI_TITLE_DESC' => 'Pokaż Wyniki Zwrotu z Inwestycji z Kampanii.',
|
||||
'LBL_REFRESH' => 'Odśwież',
|
||||
'LBL_ROLLOVER_DETAILS' => 'Rozwiń etykietę, aby zobaczyć szczegóły.',
|
||||
'LBL_ROLLOVER_WEDGE_DETAILS' => 'Rozwiń klin, aby zobaczyć szczegóły.',
|
||||
'LBL_SALES_STAGE_FORM_TITLE' => 'Wykres wg. etapów sprzedaży',
|
||||
'LBL_SALES_STAGE_FORM_DESC' => 'Wartość skumulowana projektów według etapów sprzedaży dla wybranych użytkowników w określonym przedziale czasowym. ',
|
||||
'LBL_SALES_STAGES' => 'Etapy sprzedaży:',
|
||||
'LBL_TOTAL_PIPELINE' => 'Wartość całkowita: ',
|
||||
'LBL_USERS' => 'Użytkownicy:',
|
||||
'LBL_YEAR_BY_OUTCOME' => 'Wykres wg. Miesięcy i przychodów',
|
||||
'LBL_YEAR' => 'Rok:',
|
||||
'LNK_NEW_ACCOUNT' => 'Utwórz Klienta',
|
||||
'LNK_NEW_CALL' => 'Zaplanowane Rozmowy Tel.',
|
||||
'LNK_NEW_CASE' => 'Utwórz Sprawę',
|
||||
'LNK_NEW_CONTACT' => 'Utwórz Kontakt',
|
||||
'LNK_NEW_ISSUE' => 'Zgłoś Błąd',
|
||||
'LNK_NEW_LEAD' => 'Utwórz Wizytówkę',
|
||||
'LNK_NEW_MEETING' => 'Harmonogram Spotkań',
|
||||
'LNK_NEW_NOTE' => 'Utwórz Notatkę, lub Załącznik',
|
||||
'LNK_NEW_OPPORTUNITY' => 'Utrzórz Temat',
|
||||
'LNK_NEW_QUOTE' => 'Utwórz Wycenę',
|
||||
'LNK_NEW_TASK' => 'Utwórz Zadanie',
|
||||
'NTC_NO_LEGENDS' => 'Brak',
|
||||
|
||||
'LBL_TITLE' => 'Tytuł: ',
|
||||
'LBL_TASK_STATUS' => 'Task Status:',
|
||||
'LBL_TASKS_TOTAL' => 'Tasks count is: ',
|
||||
'LBL_TASK_SIZE' => 'Task size is in 1 unit.',
|
||||
'LBL_TASK_USERS' => 'Users:',
|
||||
|
||||
'LBL_BUG_STATUS' => 'Bug Status:',
|
||||
'LBL_BUGS_TOTAL' => 'Bugs count is: ',
|
||||
'LBL_BUG_SIZE' => 'Bug size is in 1 unit.',
|
||||
'LBL_BUG_USERS' => 'Users:',
|
||||
|
||||
'LBL_ECMCALLS_TITLE' => 'Users Calls:',
|
||||
'LBL_ECMCALLS_USERS' => 'Users:',
|
||||
'LBL_ECMCALLS_DATE' => 'Date:',
|
||||
'LBL_ECMCALLS_TIME_FROM' => 'Time From:',
|
||||
'LBL_ECMCALLS_TIME_TO' => 'Time To:',
|
||||
'LBL_ECMCALLS_NO_DATA' => 'Brak Danych',
|
||||
'LBL_ECMCALLS_TYPE' => 'Type:',
|
||||
'LBL_ECMCALLS_DATE_SELECT' => 'Or Date:',
|
||||
'LBL_ECMCALLS_SHOW_NUMBERS' => 'Show Numbers:',
|
||||
|
||||
'LBL_INCOMING_LESS_THAN_60S' => 'Incoming, duration <= 60s',
|
||||
'LBL_INCOMING_MORE_THAN_60S' => 'Incoming, duration > 60s',
|
||||
'LBL_OUTGOING_LESS_THAN_60S' => 'Outgoing, duration <= 60s',
|
||||
'LBL_OUTGOING_MORE_THAN_60S' => 'Outgoing, duration > 60s',
|
||||
|
||||
'LBL_ECMQUOTES_TITLE' => 'Oferty',
|
||||
'LBL_ECMQUOTES_SIZE' => 'Quote size',
|
||||
'LBL_ECMQUOTES_THOUSANDS'=> 'tys.',
|
||||
'LBL_ECMQUOTES_TOTAL' => 'Suma:',
|
||||
'LBL_ECMQUOTE_STATUS' => 'Status oferty:',
|
||||
'LBL_ECMQUOTE_USERS' => 'Użytkownicy:',
|
||||
|
||||
'LBL_ECMINVOICEOUTS_TITLE' => 'Quotes',
|
||||
'LBL_ECMINVOICEOUTS_SIZE' => 'Quote size in',
|
||||
'LBL_ECMINVOICEOUTS_THOUSANDS'=> 'K',
|
||||
'LBL_ECMINVOICEOUTS_TOTAL' => 'Total is:',
|
||||
'LBL_ECMINVOICEOUT_STATUS' => 'Quote Status:',
|
||||
'LBL_ECMINVOICEOUT_USERS' => 'Users:',
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user