init
This commit is contained in:
75
modules/EcmCharts/AnnualSalesChart.php
Normal file
75
modules/EcmCharts/AnnualSalesChart.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
|
||||
/*****************************************************/
|
||||
/*********************** PREPARE *********************/
|
||||
/*****************************************************/
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/ChartAnnualSalesHelper.php');
|
||||
global $mod_strings;
|
||||
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
$options = array();
|
||||
|
||||
// Data od
|
||||
if(!$_GET['year'])
|
||||
$options['year'] = date("Y");
|
||||
else
|
||||
$options['year'] = $_GET['year'];
|
||||
|
||||
if(!$_GET['type'])
|
||||
$options['type'] = "%";
|
||||
else
|
||||
$options['type'] = $_GET['type'];
|
||||
|
||||
if(!$_GET['comparativeData'])
|
||||
$options['comparativeData'] = "disabled";
|
||||
else
|
||||
$options['comparativeData'] = $_GET['comparativeData'];
|
||||
|
||||
if(!$_GET['chartType'])
|
||||
$options["chartType"] = "column";
|
||||
else
|
||||
$options["chartType"] = $_GET["chartType"];
|
||||
|
||||
$comparativeData = null;
|
||||
$options2 = null;
|
||||
$db_connection_handler = $GLOBALS["db"];
|
||||
|
||||
if( $options["comparativeData"] == 'enabled')
|
||||
{
|
||||
$options2 = $options;
|
||||
$options2["year"] -= 1;
|
||||
$helper2 = new ChartAnnualSalesHelper($db_connection_handler, $options2, $mod_strings);
|
||||
$helper2->getChartOptions();
|
||||
// Pobieram dane sprzed roku
|
||||
$comparativeData = $helper2->getMonthsArray();
|
||||
$helper = new ChartAnnualSalesHelper($db_connection_handler, $options, $mod_strings, $comparativeData);
|
||||
$data = $helper->getChartOptions();
|
||||
} else {
|
||||
$helper = new ChartAnnualSalesHelper($db_connection_handler, $options, $mod_strings);
|
||||
$data = $helper->getChartOptions();
|
||||
}
|
||||
|
||||
// Generowanie lat do selektora
|
||||
$y = range(2000, date("Y"));
|
||||
$years = array_reverse($y,true);
|
||||
|
||||
|
||||
/*
|
||||
* SMARTY
|
||||
*/
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign('chartOptions', $data);
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
$smarty->assign('year', $options["year"]);
|
||||
$smarty->assign('years', $years);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
$smarty->assign('chartType', $options["chartType"]);
|
||||
$smarty -> assign('LANG', $mod_strings);
|
||||
|
||||
// Pobieranie widoku
|
||||
echo $smarty->display ( 'modules/EcmCharts/tpls/AnnualSalesChart.tpl' );
|
||||
?>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
class ChartAnnualSalesHelper
|
||||
{
|
||||
private $outputOptions = null;
|
||||
private $options = null;
|
||||
private $db = null;
|
||||
private $monthName = null;
|
||||
private $comparativeData = null;
|
||||
private $months;
|
||||
|
||||
public function ChartAnnualSalesHelper($db, $options, $lang, $comparativeData = null)
|
||||
{
|
||||
$this->options = $options;
|
||||
$this->db = $db;
|
||||
$this->comparativeData = $comparativeData;
|
||||
$this->monthName = array($lang['LBL_JANUARY'],
|
||||
$lang['LBL_FEBRUARY'],
|
||||
$lang['LBL_MARCH'],
|
||||
$lang['LBL_APRIL'],
|
||||
$lang['LBL_MAY'],
|
||||
$lang['LBL_JUNE'],
|
||||
$lang['LBL_JULY'],
|
||||
$lang['LBL_AUGUST'],
|
||||
$lang['LBL_SEPTEMBER'],
|
||||
$lang['LBL_OCTOBER'],
|
||||
$lang['LBL_NOVEMBER'],
|
||||
$lang['LBL_DECEMBER']);
|
||||
}
|
||||
|
||||
// Zwraca ustawienia Google Charts
|
||||
public function getChartOptions()
|
||||
{
|
||||
$months = $this->getMonths();
|
||||
|
||||
$data = "";
|
||||
for( $i = 0; $i < count($months); $i++ )
|
||||
{
|
||||
if( $months[$i] != 0 && $months[$i] != null)
|
||||
{
|
||||
$value = sprintf("%.2f", (float)$months[$i]);
|
||||
$data .= "['".$this->monthName[$i]."', ". $value;
|
||||
|
||||
if( $this->options["comparativeData"] == "enabled" )
|
||||
$data .= ", ".$this->comparativeData[$i].'0';
|
||||
|
||||
$data .= "],";
|
||||
}
|
||||
}
|
||||
$data = rtrim($data, ",");
|
||||
return $data;
|
||||
}
|
||||
|
||||
// Pobiera tablice z wartościami sum netto dla każdego roku
|
||||
private function getMonths()
|
||||
{
|
||||
$months = array();
|
||||
$thisYear = date("Y");
|
||||
$thisMonth = date("m");
|
||||
|
||||
for( $i = 1; $i <= 12; $i++ )
|
||||
{
|
||||
$result = $this->getSubtotalByMonth(($i <= 9 ? '0'.$i : $i), $this->options['year']);
|
||||
|
||||
array_push($months, $result);
|
||||
}
|
||||
|
||||
$this->months = $months;
|
||||
return $months;
|
||||
|
||||
}
|
||||
|
||||
// Metoda zwraca cenę netto dla danego miesiąca w danym roku
|
||||
private function getSubtotalByMonth($month, $year)
|
||||
{
|
||||
$type = $this->options["type"];
|
||||
$query = "
|
||||
SELECT
|
||||
SUM(CASE WHEN e.currency_value = '0' OR e.currency_value = '' OR e.currency_value=0 OR e.currency_value is null
|
||||
THEN
|
||||
e.total_netto
|
||||
ELSE
|
||||
e.total_netto*e.currency_value
|
||||
END
|
||||
) as 'subtotal'
|
||||
FROM
|
||||
ecminvoiceouts e
|
||||
WHERE e.canceled = '0'
|
||||
AND e.deleted = '0'
|
||||
AND e.type LIKE '$type'
|
||||
AND e.register_date LIKE '$year-$month-%'
|
||||
";
|
||||
|
||||
//echo $query."<br><br>";
|
||||
|
||||
if( $this->options["contractor_id"] && $this->options["contractor_name"])
|
||||
{
|
||||
$query .= "AND e.parent_id = '".$this->options["contractor_id"]."'";
|
||||
}
|
||||
|
||||
$results = $this->db->query($query);
|
||||
$result = $this->db->fetchByAssoc( $results );
|
||||
return $result['subtotal'];
|
||||
}
|
||||
|
||||
public function getMonthsArray()
|
||||
{
|
||||
return $this->months;
|
||||
}
|
||||
|
||||
public function haveComparativeData()
|
||||
{
|
||||
if( $this->comparativeData != null )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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".
|
||||
*/
|
||||
|
||||
|
||||
global $mod_strings;
|
||||
|
||||
$dashletMeta['MyChartsAnnualSalesDashlet'] = array(
|
||||
'title' => 'Raport sprzedaży rocznej z podziałem na miesiące',
|
||||
'description' => 'Wykres słupkowy, w widoku poziomym przedstawiający sprzedaż w aktualnym roku z danymi porównawczymi sprzed roku i możliwością filtrowania',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('ChartAnnualSalesHelper.php');
|
||||
|
||||
|
||||
class MyChartsAnnualSalesDashlet extends Dashlet {
|
||||
|
||||
var $savedText; // users's saved text
|
||||
var $height = '300'; // height of the pad
|
||||
var $firstLoad = 'yes';
|
||||
function MyChartsAnnualSalesDashlet($id, $def = null) {
|
||||
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
require('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/MyChartsAnnualSalesDashlet.meta.php');
|
||||
require('modules/EcmCharts/language/pl_pl.lang.php');
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = false; // dashlet has java ipt attached to it
|
||||
$options = $this->loadOptions();
|
||||
|
||||
// if no custom title, use default
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Wykres sprzedaży rocznej z podziałem na miesiące";
|
||||
|
||||
$this->title = $options["title"];
|
||||
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
|
||||
$options = $this->loadOptions();
|
||||
$comparativeData = null;
|
||||
$options2 = null;
|
||||
$db_connection_handler = $GLOBALS["db"];
|
||||
$options = $this->loadOptions();
|
||||
// Data od
|
||||
if(!$options['year'])
|
||||
$options['year'] = date("Y");
|
||||
|
||||
if(!$options["comparativeData"])
|
||||
$options["comparativeData"] = 'disabled';
|
||||
|
||||
if(!$options["type"])
|
||||
$options["type"] = '%';
|
||||
|
||||
if(!$options["chartType"])
|
||||
$options["chartType"] = 'column';
|
||||
|
||||
if( $options["comparativeData"] == 'enabled')
|
||||
{
|
||||
$options2 = $this->loadOptions();
|
||||
$options2["year"] -= 1;
|
||||
$helper2 = new ChartAnnualSalesHelper($db_connection_handler, $options2, $mod_strings);
|
||||
$helper2->getChartOptions();
|
||||
// Pobieram dane sprzed roku
|
||||
$comparativeData = $helper2->getMonthsArray();
|
||||
$helper = new ChartAnnualSalesHelper($db_connection_handler, $options, $mod_strings, $comparativeData);
|
||||
$data = $helper->getChartOptions();
|
||||
} else {
|
||||
$helper = new ChartAnnualSalesHelper($db_connection_handler, $options, $mod_strings);
|
||||
$data = $helper->getChartOptions();
|
||||
}
|
||||
|
||||
/*
|
||||
* SMARTY
|
||||
*/
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign('chartOptions', $data);
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
$smarty->assign('year', $options["year"]);
|
||||
$smarty->assign('chartType', $options["chartType"]);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
if( $helper->haveComparativeData() )
|
||||
$smarty->assign('comparative_data_on', 'true');
|
||||
else
|
||||
$smarty->assign('comparative_data_on', 'false');
|
||||
// Pobieranie widoku
|
||||
$output = $smarty->fetch('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/MyChartsAnnualSalesDashlet.tpl');
|
||||
// return parent::display for title and smarty template
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $output;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $mod_strings,$current_user;
|
||||
// format daty
|
||||
$smarty = new Sugar_Smarty();
|
||||
// Pobieram ustawienia
|
||||
$options = $this->loadOptions();
|
||||
// Data od
|
||||
if(!$options['year'])
|
||||
$options['year'] = date("Y");
|
||||
|
||||
if(!$options["comparativeData"])
|
||||
$options["comparativeData"] = 'disabled';
|
||||
|
||||
if(!$options["type"])
|
||||
$options["type"] = '%';
|
||||
|
||||
if(!$options["chartType"])
|
||||
$options["chartType"] = 'column';
|
||||
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Raport sprzedaży w roku z podziałem na miesiące";
|
||||
|
||||
// Generowanie lat do selektora
|
||||
$y = range(2000, date("Y"));
|
||||
$years = array_reverse($y,true);
|
||||
|
||||
//The id must be assigned in all dashlet options pages
|
||||
$smarty->assign('id', $this->id);
|
||||
// Typ dokumentu: all, normal, correct
|
||||
$smarty->assign('type', $options['type']);
|
||||
$smarty->assign('year', $options['year']);
|
||||
$smarty->assign('contractor_id', $options["contractor_id"]);;
|
||||
$smarty->assign('contractor_name', $options["contractor_name"]);
|
||||
$smarty->assign('chartType', $options["chartType"]);
|
||||
$smarty->assign('years', $years);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
$smarty->assign('title', $options["title"]);
|
||||
// Pokazywać dane porównawcze? Tak: enabled, nie: disabled
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
|
||||
// Przekazuję widok opcji do metody displayOptions()
|
||||
return parent::displayOptions() . $smarty->fetch('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/MyChartsAnnualSalesDashletOptions.tpl');
|
||||
}
|
||||
|
||||
// Zapisywanie opcji dashletu
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
$options["year"] = $req["year"];
|
||||
$options["comparativeData"] = $req["comparativeData"];
|
||||
$options["type"] = $req["type"];
|
||||
$options["chartType"] = $req["chartType"];
|
||||
$options["title"] = $req["title"];
|
||||
|
||||
if( $req["account_name"] == '' )
|
||||
{
|
||||
$options["contractor_name"] = '';
|
||||
$options["contractor_id"] = '';
|
||||
} else {
|
||||
$options["contractor_name"] = $req['account_name'];
|
||||
$options["contractor_id"] = $req['account_id'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
.no-data {
|
||||
display: table;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.textCenter {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.textCenter span {
|
||||
font-size: 16px;
|
||||
border: 1px dashed #E03E3E;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 10px 10px 5px #AAAAAA;
|
||||
background-color: #FFDEDE;
|
||||
color: #E03E3E;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
<div id='jotpsadad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: 200px; border: 1px #ddd solid'>
|
||||
<div id="annual_sales_chart{$id}" style="width: 100%; height: 100%;">
|
||||
<div class="no-data">
|
||||
<div class="textCenter">
|
||||
<span>
|
||||
{$LANG.LBL_NO_DATA_CHANGE_FILTER}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div style='overflow: auto; width: 100%; height: 800px; border: 1px #ddd solid'>
|
||||
<div id="annual_sales_chart{$id}" style="width: 100%; height: 97%;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- GOOGLE CHARTS API -->
|
||||
{if $chartOptions != ''}
|
||||
{literal}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script type="text/javascript" src="modules/EcmCharts/Dashlets/MyChartsSalesDashlet/js/salesChart.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Load the Visualization API and the piechart package.
|
||||
google.load('visualization', '1', {'packages':['corechart','geochart','table']});
|
||||
|
||||
function drawChart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Rok', {/literal}'{$LANG.LBL_SALE}'
|
||||
{if $comparativeData == 'enabled'} , '{$LANG.LBL_SALE_IN_PAST_YEAR}'{/if}
|
||||
{literal}],
|
||||
|
||||
{/literal}
|
||||
{$chartOptions}
|
||||
{literal}
|
||||
]);
|
||||
|
||||
var formatter = new google.visualization.NumberFormat({
|
||||
suffix: 'zł'
|
||||
});
|
||||
|
||||
formatter.format(data, 1); // Apply formatter to second column.
|
||||
{/literal}
|
||||
{if $comparative_data_on == 'true' }
|
||||
formatter.format(data, 2); // Apply formatter to second column.
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
var options = {
|
||||
{/literal}
|
||||
title: '{ $LANG.LBL_SALES_CHART_IN }{$year}',
|
||||
{literal}
|
||||
legend: {position: 'bottom', textStyle: {fontSize: 10}},
|
||||
tooltip:{textStyle:{fontSize:'10'}},
|
||||
vAxis:{title: {/literal}'{$LANG.LBL_VALUEOFSALES}'{literal},textStyle:{color: '#000000',fontSize: '11', paddingRight: '100',marginRight: '100'}},
|
||||
hAxis:{title:'',textStyle:{color: '#000000',fontSize: '10', paddingRight: '100',marginRight: '100'}}
|
||||
};
|
||||
|
||||
{/literal}
|
||||
{if $chartType == 'column' or $chartType == ''}
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{elseif $chartType == 'pie'}
|
||||
var chart = new google.visualization.PieChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{elseif $chartType == 'line'}
|
||||
var chart = new google.visualization.LineChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{elseif $chartType == 'stepped'}
|
||||
var chart = new google.visualization.SteppedAreaChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{else}
|
||||
var chart = new google.visualization.AreaChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
chart.draw(data, options);
|
||||
}
|
||||
|
||||
// sekunda opóźnienia, żeby zdążył wczytać się moduł "visualization"
|
||||
setTimeout(drawChart, 1000);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
{*
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
<script type="text/javascript" src="modules/EcmCharts/javascript/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
function listenerFunction() {
|
||||
//location.reload();
|
||||
};
|
||||
|
||||
$("#chartTypeSelector").change(function() {
|
||||
if( $(this).val() == 'pie' )
|
||||
{
|
||||
$("#documentTypeSelector").val("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$("#documentTypeSelector").change(function(){
|
||||
if( $(this).val() == 'correct' && $("#chartTypeSelector").val() == 'pie' )
|
||||
{
|
||||
$("#chartTypeSelector").val("column");
|
||||
}
|
||||
});
|
||||
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
table tr td {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
table tr td select {
|
||||
width: 140px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
|
||||
|
||||
<div style='width: 600px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="600" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td>{$LANG.LBL_TITLE}: </td>
|
||||
<td>
|
||||
<input type="text" value="{$title}" name="title" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_SELECT_YEAR}: </td>
|
||||
<td>
|
||||
<select name="year">
|
||||
{foreach from=$years item=y}
|
||||
<option value="{$y}" { if $y == $year || $year == ""} selected="true" {/if}>{$y}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDED_DOCUMENT_TYPE}: </td>
|
||||
<td>
|
||||
<select id="documentTypeSelector" name="type">
|
||||
<option value="%" { if $type == "%" || $type == ""} selected="true" {/if}>{$LANG.LBL_NORMAL_AND_CORRECT}</option>
|
||||
<option value="normal" { if $type == "normal"} selected="true" {/if}>{$LANG.LBL_NORMAL_ONLY}</option>
|
||||
<option value="correct" { if $type == "correct"} selected="true" {/if}>{$LANG.LBL_CORRECT_ONLY}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
{* Search by contractor *}
|
||||
<td>{$LANG.LBL_CONTRACTOR}</td>
|
||||
<td>
|
||||
<input id="search_account_name" type="text" value="{$contractor_name}" name="account_name">
|
||||
<input id="search_account_id" type="hidden" value="{$contractor_id}" name="account_id">
|
||||
<input class="button" type="button" value="{$LANG.LBL_SELECT}" accesskey="T" title="Select [Alt+T]" value="" name="btn_account_name" onClick="getContractor()">
|
||||
|
||||
{* Open popup window to select contractor *}
|
||||
<script type="text/javascript">
|
||||
function getContractor()
|
||||
{ldelim}
|
||||
open_popup("Accounts", 600, 400, "", true, false,
|
||||
{ldelim}
|
||||
"call_back_function":"set_return","form_name":"configure_{$id}","field_to_name_array":
|
||||
{ldelim}"id":"search_account_id","name":"search_account_name"{rdelim}
|
||||
{rdelim}, "single", true);
|
||||
{rdelim};
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_CHARTTYPE}: </td>
|
||||
<td>
|
||||
<select id="chartTypeSelector" name="chartType">
|
||||
<option value="column" { if $chartType == "column" || $chartType == ""} selected="true" {/if}>{$LANG.LBL_CHARTTYPECOLUMN}</option>
|
||||
<option value="pie" { if $chartType == "pie"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEPIE}</option>
|
||||
<option value="line" { if $chartType == "line"} selected="true" {/if}>{$LANG.LBL_CHARTTYPELINE}</option>
|
||||
<option value="area" { if $chartType == "area"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEAREA}</option>
|
||||
<option value="stepped" { if $chartType == "stepped"} selected="true" {/if}>{$LANG.LBL_CHARTTYPESTEPPEDAREA}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_VIEW_COMPARATIVE_DATA}: </td>
|
||||
<td>
|
||||
<input type="radio" name="comparativeData" value="enabled" { if $comparativeData == "enabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
<input type="radio" name="comparativeData" style="margin-left: 20px" value="disabled" { if $comparativeData == "disabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_NO}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: center;">
|
||||
<input id="submitButton" type="submit" class="button" style="margin-top: 30px;" value="{$LANG.LBL_SAVECHANGES}" onclick="setTimeout(listenerFunction, 1000);">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
class ChartAnnualSalesHelper
|
||||
{
|
||||
private $outputOptions = null;
|
||||
private $options = null;
|
||||
private $db = null;
|
||||
private $monthName = null;
|
||||
private $comparativeData = null;
|
||||
private $months;
|
||||
|
||||
public function ChartAnnualSalesHelper($db, $options, $lang, $comparativeData = null)
|
||||
{
|
||||
$this->options = $options;
|
||||
$this->db = $db;
|
||||
$this->comparativeData = $comparativeData;
|
||||
$this->monthName = array($lang['LBL_JANUARY'],
|
||||
$lang['LBL_FEBRUARY'],
|
||||
$lang['LBL_MARCH'],
|
||||
$lang['LBL_APRIL'],
|
||||
$lang['LBL_MAY'],
|
||||
$lang['LBL_JUNE'],
|
||||
$lang['LBL_JULY'],
|
||||
$lang['LBL_AUGUST'],
|
||||
$lang['LBL_SEPTEMBER'],
|
||||
$lang['LBL_OCTOBER'],
|
||||
$lang['LBL_NOVEMBER'],
|
||||
$lang['LBL_DECEMBER']);
|
||||
}
|
||||
|
||||
// Zwraca ustawienia Google Charts
|
||||
public function getChartOptions()
|
||||
{
|
||||
$months = $this->getMonths();
|
||||
|
||||
$data = "";
|
||||
for( $i = 0; $i < count($months); $i++ )
|
||||
{
|
||||
if( $months[$i] != 0 && $months[$i] != null)
|
||||
{
|
||||
$value = sprintf("%.2f", (float)$months[$i]);
|
||||
$data .= "['".$this->monthName[$i]."', ". $value;
|
||||
|
||||
if( $this->options["comparativeData"] == "enabled" )
|
||||
$data .= ", ".$this->comparativeData[$i].'0';
|
||||
|
||||
$data .= "],";
|
||||
}
|
||||
}
|
||||
$data = rtrim($data, ",");
|
||||
return $data;
|
||||
}
|
||||
|
||||
// Pobiera tablice z wartościami sum netto dla każdego roku
|
||||
private function getMonths()
|
||||
{
|
||||
$months = array();
|
||||
$thisYear = date("Y");
|
||||
$thisMonth = date("m");
|
||||
|
||||
for( $i = 1; $i <= 12; $i++ )
|
||||
{
|
||||
$result = $this->getSubtotalByMonth(($i <= 9 ? '0'.$i : $i), $this->options['year']);
|
||||
|
||||
array_push($months, $result);
|
||||
}
|
||||
|
||||
$this->months = $months;
|
||||
return $months;
|
||||
|
||||
}
|
||||
|
||||
// Metoda zwraca cenę netto dla danego miesiąca w danym roku
|
||||
private function getSubtotalByMonth($month, $year)
|
||||
{
|
||||
$type = $this->options["type"];
|
||||
$query = "
|
||||
SELECT
|
||||
SUM(CASE WHEN e.currency_value = '0' OR e.currency_value = '' OR e.currency_value=0 OR e.currency_value is null
|
||||
THEN
|
||||
e.total_netto
|
||||
ELSE
|
||||
e.total_netto*e.currency_value
|
||||
END
|
||||
) as 'subtotal'
|
||||
FROM
|
||||
ecminvoiceouts e
|
||||
WHERE e.canceled = '0'
|
||||
AND e.deleted = '0'
|
||||
AND e.type LIKE '$type'
|
||||
AND e.register_date LIKE '$year-$month-%'
|
||||
";
|
||||
|
||||
//echo $query."<br><br>";
|
||||
|
||||
if( $this->options["contractor_id"] && $this->options["contractor_name"])
|
||||
{
|
||||
$query .= "AND e.parent_id = '".$this->options["contractor_id"]."'";
|
||||
}
|
||||
|
||||
$results = $this->db->query($query);
|
||||
$result = $this->db->fetchByAssoc( $results );
|
||||
return $result['subtotal'];
|
||||
}
|
||||
|
||||
public function getMonthsArray()
|
||||
{
|
||||
return $this->months;
|
||||
}
|
||||
|
||||
public function haveComparativeData()
|
||||
{
|
||||
if( $this->comparativeData != null )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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".
|
||||
*/
|
||||
|
||||
|
||||
global $mod_strings;
|
||||
|
||||
$dashletMeta['MyChartsAnnualSalesDashlet'] = array(
|
||||
'title' => 'Raport sprzedaży rocznej z podziałem na miesiące',
|
||||
'description' => 'Wykres słupkowy, w widoku poziomym przedstawiający sprzedaż w aktualnym roku z danymi porównawczymi sprzed roku i możliwością filtrowania',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('ChartAnnualSalesHelper.php');
|
||||
|
||||
|
||||
class MyChartsAnnualSalesDashlet extends Dashlet {
|
||||
|
||||
var $savedText; // users's saved text
|
||||
var $height = '300'; // height of the pad
|
||||
var $firstLoad = 'yes';
|
||||
function MyChartsAnnualSalesDashlet($id, $def = null) {
|
||||
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
require('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/MyChartsAnnualSalesDashlet.meta.php');
|
||||
require('modules/EcmCharts/language/pl_pl.lang.php');
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = false; // dashlet has java ipt attached to it
|
||||
$options = $this->loadOptions();
|
||||
|
||||
// if no custom title, use default
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Wykres sprzedaży rocznej z podziałem na miesiące";
|
||||
|
||||
$this->title = $options["title"];
|
||||
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
|
||||
$options = $this->loadOptions();
|
||||
$comparativeData = null;
|
||||
$options2 = null;
|
||||
$db_connection_handler = $GLOBALS["db"];
|
||||
$options = $this->loadOptions();
|
||||
// Data od
|
||||
if(!$options['year'])
|
||||
$options['year'] = date("Y");
|
||||
|
||||
if(!$options["comparativeData"])
|
||||
$options["comparativeData"] = 'disabled';
|
||||
|
||||
if(!$options["type"])
|
||||
$options["type"] = '%';
|
||||
|
||||
if(!$options["chartType"])
|
||||
$options["chartType"] = 'column';
|
||||
|
||||
if( $options["comparativeData"] == 'enabled')
|
||||
{
|
||||
$options2 = $this->loadOptions();
|
||||
$options2["year"] -= 1;
|
||||
$helper2 = new ChartAnnualSalesHelper($db_connection_handler, $options2, $mod_strings);
|
||||
$helper2->getChartOptions();
|
||||
// Pobieram dane sprzed roku
|
||||
$comparativeData = $helper2->getMonthsArray();
|
||||
$helper = new ChartAnnualSalesHelper($db_connection_handler, $options, $mod_strings, $comparativeData);
|
||||
$data = $helper->getChartOptions();
|
||||
} else {
|
||||
$helper = new ChartAnnualSalesHelper($db_connection_handler, $options, $mod_strings);
|
||||
$data = $helper->getChartOptions();
|
||||
}
|
||||
|
||||
/*
|
||||
* SMARTY
|
||||
*/
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty->assign('chartOptions', $data);
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
$smarty->assign('year', $options["year"]);
|
||||
$smarty->assign('chartType', $options["chartType"]);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
if( $helper->haveComparativeData() )
|
||||
$smarty->assign('comparative_data_on', 'true');
|
||||
else
|
||||
$smarty->assign('comparative_data_on', 'false');
|
||||
// Pobieranie widoku
|
||||
$output = $smarty->fetch('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/MyChartsAnnualSalesDashlet.tpl');
|
||||
// return parent::display for title and smarty template
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $output;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $mod_strings,$current_user;
|
||||
// format daty
|
||||
$smarty = new Sugar_Smarty();
|
||||
// Pobieram ustawienia
|
||||
$options = $this->loadOptions();
|
||||
// Data od
|
||||
if(!$options['year'])
|
||||
$options['year'] = date("Y");
|
||||
|
||||
if(!$options["comparativeData"])
|
||||
$options["comparativeData"] = 'disabled';
|
||||
|
||||
if(!$options["type"])
|
||||
$options["type"] = '%';
|
||||
|
||||
if(!$options["chartType"])
|
||||
$options["chartType"] = 'column';
|
||||
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Raport sprzedaży w roku z podziałem na miesiące";
|
||||
|
||||
// Generowanie lat do selektora
|
||||
$y = range(2000, date("Y"));
|
||||
$years = array_reverse($y,true);
|
||||
|
||||
//The id must be assigned in all dashlet options pages
|
||||
$smarty->assign('id', $this->id);
|
||||
// Typ dokumentu: all, normal, correct
|
||||
$smarty->assign('type', $options['type']);
|
||||
$smarty->assign('year', $options['year']);
|
||||
$smarty->assign('contractor_id', $options["contractor_id"]);;
|
||||
$smarty->assign('contractor_name', $options["contractor_name"]);
|
||||
$smarty->assign('chartType', $options["chartType"]);
|
||||
$smarty->assign('years', $years);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
$smarty->assign('title', $options["title"]);
|
||||
// Pokazywać dane porównawcze? Tak: enabled, nie: disabled
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
|
||||
// Przekazuję widok opcji do metody displayOptions()
|
||||
return parent::displayOptions() . $smarty->fetch('modules/EcmCharts/Dashlets/MyChartsAnnualSalesDashlet/MyChartsAnnualSalesDashletOptions.tpl');
|
||||
}
|
||||
|
||||
// Zapisywanie opcji dashletu
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
$options["year"] = $req["year"];
|
||||
$options["comparativeData"] = $req["comparativeData"];
|
||||
$options["type"] = $req["type"];
|
||||
$options["chartType"] = $req["chartType"];
|
||||
$options["title"] = $req["title"];
|
||||
|
||||
if( $req["account_name"] == '' )
|
||||
{
|
||||
$options["contractor_name"] = '';
|
||||
$options["contractor_id"] = '';
|
||||
} else {
|
||||
$options["contractor_name"] = $req['account_name'];
|
||||
$options["contractor_id"] = $req['account_id'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
.no-data {
|
||||
display: table;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.textCenter {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.textCenter span {
|
||||
font-size: 16px;
|
||||
border: 1px dashed #E03E3E;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 10px 10px 5px #AAAAAA;
|
||||
background-color: #FFDEDE;
|
||||
color: #E03E3E;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
<div id='jotpsadad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: 200px; border: 1px #ddd solid'>
|
||||
<div id="annual_sales_chart{$id}" style="width: 100%; height: 100%;">
|
||||
<div class="no-data">
|
||||
<div class="textCenter">
|
||||
<span>
|
||||
{$LANG.LBL_NO_DATA_CHANGE_FILTER}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div style='overflow: auto; width: 100%; height: 800px; border: 1px #ddd solid'>
|
||||
<div id="annual_sales_chart{$id}" style="width: 100%; height: 97%;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- GOOGLE CHARTS API -->
|
||||
{if $chartOptions != ''}
|
||||
{literal}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script type="text/javascript" src="modules/EcmCharts/Dashlets/MyChartsSalesDashlet/js/salesChart.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Load the Visualization API and the piechart package.
|
||||
google.load('visualization', '1', {'packages':['corechart','geochart','table']});
|
||||
|
||||
function drawChart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Rok', {/literal}'{$LANG.LBL_SALE}'
|
||||
{if $comparativeData == 'enabled'} , '{$LANG.LBL_SALE_IN_PAST_YEAR}'{/if}
|
||||
{literal}],
|
||||
|
||||
{/literal}
|
||||
{$chartOptions}
|
||||
{literal}
|
||||
]);
|
||||
|
||||
var formatter = new google.visualization.NumberFormat({
|
||||
suffix: 'zł'
|
||||
});
|
||||
|
||||
formatter.format(data, 1); // Apply formatter to second column.
|
||||
{/literal}
|
||||
{if $comparative_data_on == 'true' }
|
||||
formatter.format(data, 2); // Apply formatter to second column.
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
var options = {
|
||||
{/literal}
|
||||
title: '{ $LANG.LBL_SALES_CHART_IN }{$year}',
|
||||
{literal}
|
||||
legend: {position: 'bottom', textStyle: {fontSize: 10}},
|
||||
tooltip:{textStyle:{fontSize:'10'}},
|
||||
vAxis:{title: {/literal}'{$LANG.LBL_VALUEOFSALES}'{literal},textStyle:{color: '#000000',fontSize: '11', paddingRight: '100',marginRight: '100'}},
|
||||
hAxis:{title:'',textStyle:{color: '#000000',fontSize: '10', paddingRight: '100',marginRight: '100'}}
|
||||
};
|
||||
|
||||
{/literal}
|
||||
{if $chartType == 'column' or $chartType == ''}
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{elseif $chartType == 'pie'}
|
||||
var chart = new google.visualization.PieChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{elseif $chartType == 'line'}
|
||||
var chart = new google.visualization.LineChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{elseif $chartType == 'stepped'}
|
||||
var chart = new google.visualization.SteppedAreaChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{else}
|
||||
var chart = new google.visualization.AreaChart(document.getElementById('annual_sales_chart{$id}'));
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
chart.draw(data, options);
|
||||
}
|
||||
|
||||
// sekunda opóźnienia, żeby zdążył wczytać się moduł "visualization"
|
||||
setTimeout(drawChart, 1000);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
{*
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
<script type="text/javascript" src="modules/EcmCharts/javascript/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
function listenerFunction() {
|
||||
//location.reload();
|
||||
};
|
||||
|
||||
$("#chartTypeSelector").change(function() {
|
||||
if( $(this).val() == 'pie' )
|
||||
{
|
||||
$("#documentTypeSelector").val("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$("#documentTypeSelector").change(function(){
|
||||
if( $(this).val() == 'correct' && $("#chartTypeSelector").val() == 'pie' )
|
||||
{
|
||||
$("#chartTypeSelector").val("column");
|
||||
}
|
||||
});
|
||||
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
table tr td {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
table tr td select {
|
||||
width: 140px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
|
||||
|
||||
<div style='width: 600px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="600" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td>{$LANG.LBL_TITLE}: </td>
|
||||
<td>
|
||||
<input type="text" value="{$title}" name="title" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_SELECT_YEAR}: </td>
|
||||
<td>
|
||||
<select name="year">
|
||||
{foreach from=$years item=y}
|
||||
<option value="{$y}" { if $y == $year || $year == ""} selected="true" {/if}>{$y}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDED_DOCUMENT_TYPE}: </td>
|
||||
<td>
|
||||
<select id="documentTypeSelector" name="type">
|
||||
<option value="%" { if $type == "%" || $type == ""} selected="true" {/if}>{$LANG.LBL_NORMAL_AND_CORRECT}</option>
|
||||
<option value="normal" { if $type == "normal"} selected="true" {/if}>{$LANG.LBL_NORMAL_ONLY}</option>
|
||||
<option value="correct" { if $type == "correct"} selected="true" {/if}>{$LANG.LBL_CORRECT_ONLY}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
{* Search by contractor *}
|
||||
<td>{$LANG.LBL_CONTRACTOR}</td>
|
||||
<td>
|
||||
<input id="search_account_name" type="text" value="{$contractor_name}" name="account_name">
|
||||
<input id="search_account_id" type="hidden" value="{$contractor_id}" name="account_id">
|
||||
<input class="button" type="button" value="{$LANG.LBL_SELECT}" accesskey="T" title="Select [Alt+T]" value="" name="btn_account_name" onClick="getContractor()">
|
||||
|
||||
{* Open popup window to select contractor *}
|
||||
<script type="text/javascript">
|
||||
function getContractor()
|
||||
{ldelim}
|
||||
open_popup("Accounts", 600, 400, "", true, false,
|
||||
{ldelim}
|
||||
"call_back_function":"set_return","form_name":"configure_{$id}","field_to_name_array":
|
||||
{ldelim}"id":"search_account_id","name":"search_account_name"{rdelim}
|
||||
{rdelim}, "single", true);
|
||||
{rdelim};
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_CHARTTYPE}: </td>
|
||||
<td>
|
||||
<select id="chartTypeSelector" name="chartType">
|
||||
<option value="column" { if $chartType == "column" || $chartType == ""} selected="true" {/if}>{$LANG.LBL_CHARTTYPECOLUMN}</option>
|
||||
<option value="pie" { if $chartType == "pie"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEPIE}</option>
|
||||
<option value="line" { if $chartType == "line"} selected="true" {/if}>{$LANG.LBL_CHARTTYPELINE}</option>
|
||||
<option value="area" { if $chartType == "area"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEAREA}</option>
|
||||
<option value="stepped" { if $chartType == "stepped"} selected="true" {/if}>{$LANG.LBL_CHARTTYPESTEPPEDAREA}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_VIEW_COMPARATIVE_DATA}: </td>
|
||||
<td>
|
||||
<input type="radio" name="comparativeData" value="enabled" { if $comparativeData == "enabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
<input type="radio" name="comparativeData" style="margin-left: 20px" value="disabled" { if $comparativeData == "disabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_NO}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: center;">
|
||||
<input id="submitButton" type="submit" class="button" style="margin-top: 30px;" value="{$LANG.LBL_SAVECHANGES}" onclick="setTimeout(listenerFunction, 1000);">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,499 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Klasa reprezentująca produkt
|
||||
*/
|
||||
class Product {
|
||||
// Name
|
||||
var $name;
|
||||
// Total sum
|
||||
var $total;
|
||||
// Subtotal sum
|
||||
var $subtotal;
|
||||
// Quantity
|
||||
var $quantity;
|
||||
// Category
|
||||
var $category;
|
||||
// Subcategory
|
||||
var $subcategory;
|
||||
// Item is from correct
|
||||
var $fromCorrect;
|
||||
// Currency_value
|
||||
var $currency_value = 0;
|
||||
|
||||
public function __construct($name, $total, $subtotal, $subprice, $quantity, $currency_value, $old_quantity, $subtotal_corrected, $old_total, $type)
|
||||
{
|
||||
//echo "W konstruktorze Product: ".$name." ".$total." ".$subtotal." ".$subprice." ".$quantity."<br>";
|
||||
|
||||
$cv = $currency_value == 0 ? 1 : $currency_value;
|
||||
$oldSubtotal = ($old_subtotal == 0 || $old_subtotal == null) ? 0 : $old_subtotal;
|
||||
$oldTotal = ($old_total == 0 || $old_total == null) ? 0 : $old_total;
|
||||
$oldQuantity = ($old_quantity == 0 || $old_quantity == null) ? 0 : $old_quantity;
|
||||
$this->name = $name;
|
||||
if( $type == 'correct' )
|
||||
{
|
||||
$this->total = ($total-$oldTotal)*$cv;
|
||||
$this->subtotal = ($subtotal_corrected)*$cv;
|
||||
$this->quantity = $quantity-$oldQuantity;
|
||||
$this->subprice = $subprice*$cv;
|
||||
$this->currency_value = $currency_value;
|
||||
|
||||
$this->fromCorrect = true;
|
||||
} else {
|
||||
$this->total = $total*$cv;
|
||||
$this->subtotal = $subtotal*$cv;
|
||||
$this->subprice = $subprice*$cv;
|
||||
$this->quantity = $quantity;
|
||||
$this->currency_value = $cv;
|
||||
|
||||
$this->fromCorrect = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Klasa reprezentująca podkategorię produktową
|
||||
*/
|
||||
class Subcategory {
|
||||
// Subcategory id
|
||||
var $id;
|
||||
// Name
|
||||
var $name;
|
||||
// Total sum
|
||||
var $total;
|
||||
// Subtotal sum
|
||||
var $subtotal;
|
||||
// Cost sum in category
|
||||
var $cost;
|
||||
// Count all products in category
|
||||
var $quantity;
|
||||
// Products in category
|
||||
var $products = array();
|
||||
// IsEmpty
|
||||
var $isEmpty = true;
|
||||
|
||||
public function __construct($id, $name, $total = 0.00, $subtotal = 0.00, $cost = 0.00, array $products = NULL)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->total = $total;
|
||||
$this->subtotal = $subtotal;
|
||||
$this->cost = $cost;
|
||||
$this->products = $products;
|
||||
|
||||
if( $products != null )
|
||||
if( count($products) > 0 )
|
||||
$this->isEmpty = false;
|
||||
}
|
||||
|
||||
public function id()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function cost()
|
||||
{
|
||||
return $this->cost;
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->products;
|
||||
}
|
||||
|
||||
public function setProducts( array $products )
|
||||
{
|
||||
$this->products = $products;
|
||||
if( count($this->products) > 0 )
|
||||
$this->isEmpty = false;
|
||||
foreach( $this->products as $product )
|
||||
{
|
||||
$this->total += $product->total;
|
||||
$this->subtotal += $product->subtotal;
|
||||
$this->quantity += $product->quantity;
|
||||
}
|
||||
}
|
||||
|
||||
public function showProducts()
|
||||
{
|
||||
if( !$this->isEmpty )
|
||||
{
|
||||
echo "<br><br>";
|
||||
foreach( $this->products as $product) {
|
||||
echo $product->name.", ".$product->subtotal."<br>";
|
||||
}
|
||||
} else {
|
||||
echo "<br><br>";
|
||||
echo "Brak produktów w kategorii ".$this->name;
|
||||
}
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
|
||||
echo "<br>";
|
||||
echo $this->id." <br>";
|
||||
echo $this->name.": <br>";
|
||||
echo "Cena netto: ".$this->subtotal."<br>";
|
||||
echo "Cena brutto: ".$this->total."<br>";
|
||||
echo "Cena ilość produktów: ".$this->quantity."<br>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Klasa reprezentująca kategorię produktową
|
||||
*/
|
||||
class Category extends Subcategory {
|
||||
public function __construct($id, $name = '', $total = 0, $subtotal = 0, $cost = 0, $products = null)
|
||||
{
|
||||
parent::__construct($id, $name, $total, $subtotal, $cost, $products);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Klasa pomocnicza przy generowaniu wykresów dla MyChartsSalesDashlet
|
||||
*/
|
||||
class ChartSalesHelper {
|
||||
|
||||
// Global database connection instance
|
||||
var $db_connection;
|
||||
// Chart options
|
||||
var $options;
|
||||
// Product category array
|
||||
var $categories = array();
|
||||
// Product subcategory array
|
||||
var $subcategories = array();
|
||||
// Enable log function
|
||||
var $logEnabled = false;
|
||||
|
||||
// Constructor
|
||||
public function __construct($db_connection, $options, $comparativeData = null)
|
||||
{
|
||||
//$this->log("Parametry dashletu: ", $options );
|
||||
$this->db_connection = $db_connection;
|
||||
$this->options = $options;
|
||||
$this->compData = null;
|
||||
|
||||
$this->getCategories();
|
||||
|
||||
if( $this->options["detail"] == 'category')
|
||||
{
|
||||
if( $comparativeData != null )
|
||||
{
|
||||
$this->compData = $comparativeData;
|
||||
}
|
||||
} else {
|
||||
if( $comparativeData != null )
|
||||
{
|
||||
$this->compData = $comparativeData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function haveComparativeData()
|
||||
{
|
||||
if( $this->compData != null )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getAllCategories()
|
||||
{
|
||||
return $this->categories;
|
||||
}
|
||||
|
||||
public function getAllSubcategories()
|
||||
{
|
||||
return $this->subcategories;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Private methods
|
||||
//----------------------------------------
|
||||
|
||||
/**
|
||||
* Metoda pobiera wszystkie kategorie z bazy
|
||||
*/
|
||||
private function getCategories($getSubcategories = false)
|
||||
{
|
||||
// Pobieram kategorie, albo podkategorie
|
||||
// w zależności od podanej wartości parametru
|
||||
if( $this->options["detail"] == 'subcategory' )
|
||||
$depression = 1;
|
||||
else
|
||||
$depression = 0;
|
||||
|
||||
$query = "
|
||||
SELECT
|
||||
category.id,
|
||||
category.name
|
||||
FROM ecmproductcategories category
|
||||
JOIN
|
||||
ecmproductcategories_bean bean
|
||||
ON bean.ecmproductcategory_id = category.id
|
||||
WHERE
|
||||
category.deleted='0'
|
||||
AND bean.position='$depression'
|
||||
AND bean.deleted='0'
|
||||
GROUP BY
|
||||
category.id
|
||||
ORDER BY
|
||||
category.name
|
||||
";
|
||||
|
||||
|
||||
$results = $this->db_connection->query($query);
|
||||
$all = array();
|
||||
|
||||
if( $this->options["detail"] == 'subcategory' )
|
||||
{
|
||||
while( $result = $this->db_connection->fetchByAssoc( $results ) )
|
||||
{
|
||||
$subcategory = new Subcategory($result['id'], $result['name']);
|
||||
$all[] = $subcategory;
|
||||
}
|
||||
|
||||
$this->subcategories = $all;
|
||||
$this->log( "Ilość podkategorii: ".count($this->subcategories));
|
||||
|
||||
foreach( $this->subcategories as $subcategory )
|
||||
$this->getCategoryItems($subcategory);
|
||||
} else {
|
||||
while( $result = $this->db_connection->fetchByAssoc( $results ) )
|
||||
{
|
||||
$category = new Category($result['id'], $result['name']);
|
||||
$all[] = $category;
|
||||
}
|
||||
|
||||
$this->categories = $all;
|
||||
$this->log( "Ilość kategorii: ".count($this->categories));
|
||||
|
||||
foreach( $this->categories as $category )
|
||||
$this->getCategoryItems($category);
|
||||
}
|
||||
|
||||
// Sort categories
|
||||
usort( $this->categories, array($this, 'sortCategoriesAndSubcategoriesFunction') );
|
||||
|
||||
// Sort subcategories
|
||||
usort( $this->subcategories, array($this, 'sortCategoriesAndSubcategoriesFunction') );
|
||||
|
||||
}
|
||||
|
||||
private static function sortCategoriesAndSubcategoriesFunction( $a, $b )
|
||||
{
|
||||
if( $a->subtotal > $b->subtotal )
|
||||
return false;
|
||||
else if( $a->subtotal < $b->subtotal )
|
||||
return true;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Metoda pobiera wszystkie itemy danej kategorii w podanym przedziale czasowym
|
||||
*/
|
||||
private function getCategoryItems( $obj )
|
||||
{
|
||||
$date_from = $this->prepareDateToQuery( new DateTime($this->options["date_from"]) );
|
||||
$date_to = $this->prepareDateToQuery( new DateTime($this->options["date_to"]) );
|
||||
$type = $this->options["type"];
|
||||
$category_id = $obj->id();
|
||||
|
||||
if( $obj instanceof Category )
|
||||
$position = 0;
|
||||
else
|
||||
$position = 1;
|
||||
|
||||
$query = "
|
||||
SELECT
|
||||
item.ecmproduct_id AS 'id',
|
||||
item.name AS 'name',
|
||||
item.total_brutto AS 'total',
|
||||
item.total_netto AS 'subtotal',
|
||||
item.price_start AS 'subprice',
|
||||
item.quantity AS 'quantity',
|
||||
item.old_quantity AS 'old_quantity',
|
||||
item.total_netto_corrected AS 'subtotal_corrected',
|
||||
item.old_total_brutto AS 'old_total',
|
||||
item.old_ecminvoiceoutitem_id,
|
||||
faktura.currency_value,
|
||||
faktura.type AS 'type'
|
||||
FROM
|
||||
ecminvoiceoutitems item
|
||||
JOIN ecminvoiceouts faktura
|
||||
ON item.ecminvoiceout_id = faktura.id
|
||||
JOIN ecmproducts produkt
|
||||
ON item.ecmproduct_id = produkt.id
|
||||
JOIN ecmproductcategories_bean bean
|
||||
ON bean.bean_id = produkt.id
|
||||
JOIN ecmproductcategories kategoria
|
||||
ON bean.ecmproductcategory_id = kategoria.id
|
||||
WHERE
|
||||
faktura.register_date BETWEEN '$date_from' AND '$date_to'
|
||||
AND faktura.type LIKE '$type'
|
||||
AND kategoria.id = '$category_id'
|
||||
AND bean.position = '$position'
|
||||
AND bean.deleted = '0'
|
||||
AND kategoria.deleted = '0'
|
||||
AND faktura.canceled = '0'
|
||||
AND faktura.deleted = '0'
|
||||
AND item.deleted = '0'
|
||||
ORDER BY item.name
|
||||
|
||||
";
|
||||
|
||||
|
||||
$results = $this->db_connection->query( $query );
|
||||
$productArray = array();
|
||||
|
||||
while( $result = $this->db_connection->fetchByAssoc( $results ) )
|
||||
{
|
||||
if( $result["type"] == 'correct')
|
||||
{
|
||||
if( $result["old_ecminvoiceoutitem_id"] != '' ||
|
||||
$result["old_ecminvoiceoutitem_id"] != null ||
|
||||
$result["old_ecminvoiceoutitem_id"] != 0)
|
||||
{
|
||||
$product = new Product($result["name"],
|
||||
$result["total"],
|
||||
$result["subtotal"],
|
||||
$result["subprice"],
|
||||
$result["quantity"],
|
||||
$result["currency_value"],
|
||||
$result["old_quantity"],
|
||||
$result["subtotal_corrected"],
|
||||
$result["old_total"],
|
||||
$result["type"]);
|
||||
} else {
|
||||
$product = null;
|
||||
}
|
||||
} else if($result["type"] == 'normal') {
|
||||
$product = new Product($result["name"],
|
||||
$result["total"],
|
||||
$result["subtotal"],
|
||||
$result["subprice"],
|
||||
$result["quantity"],
|
||||
$result["currency_value"],
|
||||
$result["old_quantity"],
|
||||
$result["subtotal_corrected"],
|
||||
$result["old_total"],
|
||||
$result["type"]);
|
||||
}
|
||||
|
||||
|
||||
if( $product != null )
|
||||
$productArray[] = $product;
|
||||
}
|
||||
|
||||
$obj->setProducts( $productArray );
|
||||
/* if( $obj->name == 'Środki czystości' ){
|
||||
$obj->showProducts();
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Wyświetla kategorie w których są jakieś produkty
|
||||
*/
|
||||
public function showCategories()
|
||||
{
|
||||
echo "WYświetlam";
|
||||
foreach( $this->categories as $category )
|
||||
{
|
||||
if( !$category->isEmpty )
|
||||
{
|
||||
echo $category->id;
|
||||
echo "<br>";
|
||||
echo $category->name;
|
||||
echo "<br>";
|
||||
}
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Wyświetla podkategorie w których są jakieś produkty
|
||||
*/
|
||||
public function showSubcategories()
|
||||
{
|
||||
foreach( $this->subcategories as $subcategory )
|
||||
{
|
||||
if( !$subcategory->isEmpty )
|
||||
{
|
||||
echo $subcategory->id;
|
||||
echo "<br>";
|
||||
echo $subcategory->name;
|
||||
echo "<br>";
|
||||
}
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda przygotowuje datę do wstawienia w zapytanie SQL
|
||||
*/
|
||||
private function prepareDateToQuery( DateTime $d )
|
||||
{
|
||||
return $d->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render data to Google Charts options
|
||||
*/
|
||||
public function renderGoogleChartOptions( $fromCategories = true )
|
||||
{
|
||||
$data = "";
|
||||
|
||||
if( $this->options["detail"] == "category" ) {
|
||||
for( $i = 0; $i < count($this->categories); $i++)
|
||||
{
|
||||
if( !$this->categories[$i]->isEmpty ) {
|
||||
$data .= "['".$this->categories[$i]->name."', ".$this->categories[$i]->subtotal;
|
||||
if( $this->options["comparativeData"] == 'enabled' )
|
||||
$data .= ", ".$this->compData[$i]->subtotal."0],";
|
||||
else
|
||||
$data .= "],";
|
||||
//echo "['".$this->categories[$i]->name."', ".$this->categories[$i]->subtotal.", ".$this->compData[$i]->subtotal."],<br>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for( $i = 0; $i < count($this->subcategories); $i++)
|
||||
{
|
||||
if( !$this->subcategories[$i]->isEmpty ) {
|
||||
$data .= "['".$this->subcategories[$i]->name."', ".$this->subcategories[$i]->subtotal;
|
||||
if( $this->options["comparativeData"] == 'enabled' )
|
||||
$data .= ", ".$this->compData[$i]->subtotal."0],";
|
||||
else
|
||||
$data .= "],";
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = rtrim($data, ",");
|
||||
//echo $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log functions
|
||||
*/
|
||||
private function log( $msg , $arrayOrObject = '')
|
||||
{
|
||||
if( $this->logEnabled == true )
|
||||
{
|
||||
echo "<br>";
|
||||
echo $msg;
|
||||
if( $arrayOrObject )
|
||||
print_r( $arrayOrObject );
|
||||
echo "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
} // end class
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
|
||||
$dashletMeta['MyChartsSalesDashlet'] = array(
|
||||
'title' => 'Wykres sprzedaży z podziałem na kategorie/podkategorie',
|
||||
'description' => 'Wykres słupkowy, w widoku poziomym przedstawiający sprzedaż w zadanym okresie z podziałem na kategorie i podkategorie wraz z możliwością wyboru przedziału danych porównawczych',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('ChartSalesHelper.php');
|
||||
|
||||
|
||||
class MyChartsSalesDashlet extends Dashlet {
|
||||
|
||||
var $savedText; // users's saved text
|
||||
var $height = '300'; // height of the pad
|
||||
var $firstLoad = 'yes';
|
||||
function MyChartsSalesDashlet($id, $def) {
|
||||
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
require('modules/EcmCharts/Dashlets/MyChartsSalesDashlet/MyChartsSalesDashlet.meta.php');
|
||||
require('modules/EcmCharts/language/pl_pl.lang.php');
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = false; // dashlet has java ipt attached to it
|
||||
$options = $this->loadOptions();
|
||||
|
||||
if( !$options["title"] )
|
||||
$options["title"] = "Wykres sprzedaży z podziałem na kategorie/podkategorie";
|
||||
|
||||
// if no custom title, use default
|
||||
$this->title = $options["title"];
|
||||
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
|
||||
$options = $this->loadOptions();
|
||||
|
||||
// Data od
|
||||
if(!$options['date_from'])
|
||||
$options['date_from'] = date("01.m.Y");
|
||||
|
||||
// Data do
|
||||
if(!$options['date_to'])
|
||||
$options['date_to'] = date("d.m.Y");
|
||||
|
||||
if(!$options['type'])
|
||||
$options['type'] = "%";
|
||||
|
||||
if(!$options['comparativeData'])
|
||||
$options['comparativeData'] = "disabled";
|
||||
|
||||
if(!$options['detail'])
|
||||
$options['detail'] = "category";
|
||||
|
||||
if(!$options['chartType'])
|
||||
$options['chartType'] = "column";
|
||||
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Wykres sprzedaży z podziałem na kategorie/podkategorie";
|
||||
|
||||
$optionsForComparativeData = $options;
|
||||
$optionsForComparativeData["date_from"] = date("Y-m-d",strtotime(date("Y-m-d", strtotime($optionsForComparativeData["date_from"]))." -1 year"));
|
||||
$optionsForComparativeData["date_to"] = date("Y-m-d",strtotime(date("Y-m-d", strtotime($optionsForComparativeData["date_to"]))." -1 year"));
|
||||
|
||||
$db_connection_handler = $GLOBALS["db"];
|
||||
|
||||
/*
|
||||
* DATA
|
||||
*/
|
||||
$cd = null;
|
||||
|
||||
if( $options["comparativeData"] == "enabled")
|
||||
{
|
||||
$comparativeData = new ChartSalesHelper( $db_connection_handler, $optionsForComparativeData);
|
||||
if( $options["detail"] == 'category')
|
||||
{
|
||||
$cd = $comparativeData->getAllCategories();
|
||||
} else {
|
||||
$cd = $comparativeData->getAllSubcategories();
|
||||
}
|
||||
}
|
||||
|
||||
$helper = new ChartSalesHelper( $db_connection_handler, $options, $cd );
|
||||
$data = $helper->renderGoogleChartOptions();
|
||||
|
||||
/*
|
||||
* SMARTY
|
||||
*/
|
||||
$smarty = new Sugar_Smarty();
|
||||
//$ss->assign('account_id',$optionsArray['account_id']);
|
||||
$smarty->assign('id', $this->id);
|
||||
$smarty->assign('height', $this->height);
|
||||
$smarty->assign('date_from', $options["date_from"]);
|
||||
$smarty->assign('date_to', $options["date_to"]);
|
||||
$smarty->assign('chartOptions', $data);
|
||||
$smarty->assign('detail', $options["detail"]);
|
||||
$smarty->assign('firstLoad', $this->firstLoad);
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
if( $helper->haveComparativeData() )
|
||||
$smarty->assign('comparative_data_on', 'true');
|
||||
else
|
||||
$smarty->assign('comparative_data_on', 'false');
|
||||
$smarty->assign('chartType', $options['chartType']);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
|
||||
|
||||
// Pobieranie widoku
|
||||
$output = $smarty->fetch('modules/EcmCharts/Dashlets/MyChartsSalesDashlet/MyChartsSalesDashlet.tpl');
|
||||
// return parent::display for title and smarty template
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $output;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
// format daty
|
||||
$smarty = new Sugar_Smarty();
|
||||
// Pobieram ustawienia
|
||||
$options = $this->loadOptions();
|
||||
|
||||
// Data od
|
||||
if(!$options['date_from'])
|
||||
$options['date_from'] = date("01.m.Y");
|
||||
|
||||
// Data do
|
||||
if(!$options['date_to'])
|
||||
$options['date_to'] = date("d.m.Y");
|
||||
|
||||
if(!$options['type'])
|
||||
$options['type'] = "%";
|
||||
|
||||
if(!$options['comparativeData'])
|
||||
$options['comparativeData'] = "disabled";
|
||||
|
||||
if(!$options['detail'])
|
||||
$options['detail'] = "category";
|
||||
|
||||
if(!$options['chartType'])
|
||||
$options['chartType'] = "column";
|
||||
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Wykres sprzedaży z podziałem na kategorie/podkategorie";
|
||||
|
||||
// Format daty
|
||||
$Calendar_daFormat = str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));
|
||||
$smarty->assign("dateFormat", $Calendar_daFormat);
|
||||
//The id must be assigned in all dashlet options pages
|
||||
$smarty->assign('id', $this->id);
|
||||
$smarty->assign('date_from', $options['date_from']);
|
||||
$smarty->assign('date_to', $options['date_to']);
|
||||
// Sczegółowość wykresu: category, subcategory
|
||||
$smarty->assign('detail', $options['detail']);
|
||||
// Typ dokumentu: all, normal, correct
|
||||
$smarty->assign('type', $options['type']);
|
||||
// Pokazywać dane porównawcze? Tak: enabled, nie: disabled
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
// Typ wykresu
|
||||
$smarty->assign('chartType', $options['chartType']);
|
||||
// Tytuł
|
||||
$smarty->assign('title', $options['title']);
|
||||
// Lang
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
// Przekazuję widok opcji do metody displayOptions()
|
||||
return parent::displayOptions() . $smarty->fetch('modules/EcmCharts/Dashlets/MyChartsSalesDashlet/MyChartsSalesDashletOptions.tpl');
|
||||
|
||||
}
|
||||
|
||||
// Zapisywanie opcji dashletu
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
$options["date_from"] = $req["date_from"];
|
||||
$options["date_to"] = $req["date_to"];
|
||||
$options["detail"] = $req["detail"];
|
||||
$options["comparativeData"] = $req["comparativeData"];
|
||||
$options["type"] = $req["type"];
|
||||
$options["chartType"] = $req["chartType"];
|
||||
$options["title"] = $req["title"];
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,155 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
.no-data {
|
||||
display: table;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.textCenter {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.textCenter span {
|
||||
font-size: 16px;
|
||||
border: 1px dashed #E03E3E;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 10px 10px 5px #AAAAAA;
|
||||
background-color: #FFDEDE;
|
||||
color: #E03E3E;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
<div id='jotpsadad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: 200px; border: 1px #ddd solid'>
|
||||
<div id="sales_chart{$id}" style="width: 100%; height: 100%;">
|
||||
<div class="no-data">
|
||||
<div class="textCenter">
|
||||
<span>
|
||||
Brak danych od {$date_from} do {$date_to}, wybierz inny przedział dat.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div id='jotpsadad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: 800px; border: 1px #ddd solid'>
|
||||
<div id="sales_chart{$id}" style="width: 100%; height: 98%;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- GOOGLE CHARTS API -->
|
||||
{if $chartOptions != ''}
|
||||
{literal}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="modules/EcmCharts/Dashlets/MyChartsSalesDashlet/js/salesChart.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Load the Visualization API and the piechart package.
|
||||
google.load('visualization', '1', {'packages':['corechart','geochart','table']});
|
||||
|
||||
function drawChart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Kategoria', 'Sprzedaż w aktualnym roku'{/literal}
|
||||
{if $comparativeData == 'enabled'} , 'Sprzedaż z poprzedniego roku'{/if}
|
||||
{literal}],
|
||||
|
||||
{/literal}
|
||||
{$chartOptions}
|
||||
{literal}
|
||||
]);
|
||||
|
||||
var formatter = new google.visualization.NumberFormat({
|
||||
suffix: 'zł'
|
||||
});
|
||||
|
||||
formatter.format(data, 1); // Apply formatter to second column.
|
||||
{/literal}
|
||||
{if $comparative_data_on == 'true' }
|
||||
formatter.format(data, 2); // Apply formatter to second column.
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
var options = {
|
||||
{/literal}
|
||||
title: '{$LANG.LBL_CHARTSALES} {$LANG.LBL_FROM} {$date_from} {$LANG.LBL_TO} {$date_to}',
|
||||
{literal}
|
||||
legend: {position: 'bottom', textStyle: {fontSize: 10}},
|
||||
tooltip:{textStyle:{fontSize:'10'}},
|
||||
vAxis:{title: {/literal}'{$LANG.LBL_VALUEOFSALES}'{literal},textStyle:{color: '#000000',fontSize: '10', paddingRight: '100',marginRight: '100'}},
|
||||
hAxis:{title:{/literal}{if $detail == 'category'}'{$LANG_LBL_CATEGORY}'{else}'{$LANG_LBL_SUBCATEGORY}'{/if}{literal}, titleTextStyle: {color: 'red'},textStyle:{color: '#000000',fontSize: '11', paddingRight: '100',marginRight: '100'}}
|
||||
|
||||
};
|
||||
|
||||
{/literal}
|
||||
{if $chartType == 'column' or $chartType == ''}
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('sales_chart{$id}'));
|
||||
{elseif $chartType == 'pie'}
|
||||
var chart = new google.visualization.PieChart(document.getElementById('sales_chart{$id}'));
|
||||
{elseif $chartType == 'line'}
|
||||
var chart = new google.visualization.LineChart(document.getElementById('sales_chart{$id}'));
|
||||
{elseif $chartType == 'stepped'}
|
||||
var chart = new google.visualization.SteppedAreaChart(document.getElementById('sales_chart{$id}'));
|
||||
{else}
|
||||
var chart = new google.visualization.AreaChart(document.getElementById('sales_chart{$id}'));
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
chart.draw(data, options);
|
||||
|
||||
}
|
||||
|
||||
// sekunda opóźnienia, żeby zdążył wczytać się moduł "visualization"
|
||||
setTimeout(drawChart, 1000);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
{*
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
|
||||
<script type="text/javascript" src="modules/EcmCharts/javascript/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
function listenerFunction() {
|
||||
//location.reload();
|
||||
};
|
||||
|
||||
$("#chartTypeSelector").change(function() {
|
||||
if( $(this).val() == 'pie' )
|
||||
{
|
||||
$("#documentTypeSelector").val("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$("#documentTypeSelector").change(function(){
|
||||
if( $(this).val() != 'normal' && $("#chartTypeSelector").val() == 'pie' )
|
||||
{
|
||||
$("#chartTypeSelector").val("column");
|
||||
}
|
||||
});
|
||||
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
table tr td {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
table tr td select {
|
||||
width: 140px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
|
||||
|
||||
<div style='width: 600px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="600" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td>{$LANG.LBL_TITLE}: </td>
|
||||
<td>
|
||||
<input type="text" value="{$title}" name="title" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDEDATE} {$LANG.LBL_FROM}: </td>
|
||||
<td>
|
||||
{* Search by date_from *}
|
||||
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title="" value="{$date_from}" autocomplete="off">
|
||||
<img id="date_from_trigger" border="0" align="absmiddle" alt="Enter Date" src="themes/default/images/jscalendar.gif">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "date_from",
|
||||
daFormat : "{$dateFormat}",
|
||||
button : "date_from_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
<td> {$LANG.LBL_TO}: </td>
|
||||
<td>
|
||||
{* Search by date_to *}
|
||||
<input autocomplete="off" name="date_to" id="date_to" value="{$date_to}" title="" tabindex="" size="11" maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "date_to",
|
||||
daFormat : "{$dateFormat}",
|
||||
button : "date_to_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_SHOW}: </td>
|
||||
<td>
|
||||
<select name="detail">
|
||||
<option value="category" { if $detail == "category" || $detail == ""} selected="true" {/if} >Kategorii</option>
|
||||
<option value="subcategory" { if $detail=="subcategory"} selected {/if} >Podkategorii</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDED_DOCUMENT_TYPE}: </td>
|
||||
<td>
|
||||
<select id="documentTypeSelector" name="type">
|
||||
<option value="%" { if $type == "%" || $type == ""} selected="true" {/if}>{$LANG.LBL_NORMAL_AND_CORRECT}</option>
|
||||
<option value="normal" { if $type == "normal"} selected="true" {/if}>{$LANG.LBL_NORMAL_ONLY}</option>
|
||||
<option value="correct" { if $type == "correct"} selected="true" {/if}>{$LANG.LBL_CORRECT_ONLY}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_CHARTTYPE}: </td>
|
||||
<td>
|
||||
<select id="chartTypeSelector" name="chartType">
|
||||
<option value="column" { if $chartType == "column" || $chartType == ""} selected="true" {/if}>{$LANG.LBL_CHARTTYPECOLUMN}</option>
|
||||
<option value="pie" { if $chartType == "pie"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEPIE}</option>
|
||||
<option value="line" { if $chartType == "line"} selected="true" {/if}>{$LANG.LBL_CHARTTYPELINE}</option>
|
||||
<option value="area" { if $chartType == "area"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEAREA}</option>
|
||||
<option value="stepped" { if $chartType == "stepped"} selected="true" {/if}>{$LANG.LBL_CHARTTYPESTEPPEDAREA}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_VIEW_COMPARATIVE_DATA}: </td>
|
||||
<td>
|
||||
<input type="radio" name="comparativeData" value="enabled" { if $comparativeData == "enabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
<input type="radio" name="comparativeData" style="margin-left: 20px" value="disabled" { if $comparativeData == "disabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_NO}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: center;">
|
||||
<input id="submitButton" type="submit" class="button" style="margin-top: 30px;" value="{$LANG.LBL_SAVECHANGES}" onclick="setTimeout(listenerFunction, 1000);">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Klasa reprezentująca kontrahenta
|
||||
*/
|
||||
class Contractor {
|
||||
// Nazwa kontrahenta
|
||||
var $name;
|
||||
// Cena netto
|
||||
var $subtotal;
|
||||
// Koszty
|
||||
var $cost;
|
||||
|
||||
public function __construct($name, $subtotal, $cost)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->subtotal = $subtotal;
|
||||
$this->cost = $cost;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Klasa pomocnicza przy generowaniu wykresów dla MyContractorsChartsSalesDashlet
|
||||
*/
|
||||
class MyContractorChartSalesHelper {
|
||||
|
||||
// Global database connection instance
|
||||
var $db_connection;
|
||||
// Chart options
|
||||
var $options;
|
||||
// Tablica kontrahentów
|
||||
var $contractors = array();
|
||||
// Dane porównawcze
|
||||
var $compData = null;
|
||||
|
||||
// Constructor
|
||||
public function __construct($db_connection, $options, $comparativeData = null)
|
||||
{
|
||||
//$this->log("Parametry dashletu: ", $options );
|
||||
$this->db_connection = $db_connection;
|
||||
$this->options = $options;
|
||||
$this->compData = $comparativeData;
|
||||
|
||||
$this->getData();
|
||||
}
|
||||
|
||||
public function haveComparativeData()
|
||||
{
|
||||
if( $this->compData != null )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
// Private methods
|
||||
//----------------------------------------
|
||||
|
||||
/**
|
||||
* Metoda pobiera wszystkie dane o kontrahentach
|
||||
*/
|
||||
private function getData()
|
||||
{
|
||||
|
||||
$date_from = $this->prepareDateToQuery( new DateTime($this->options["date_from"]) );
|
||||
$date_to = $this->prepareDateToQuery( new DateTime($this->options["date_to"]) );
|
||||
$type = $this->options["type"];
|
||||
$count = $this->options["count"];
|
||||
|
||||
|
||||
$query = "
|
||||
SELECT
|
||||
acco.name as 'name',
|
||||
acco.parent_id as 'parent',
|
||||
sum(
|
||||
CASE WHEN faktura.type!='correct'
|
||||
THEN
|
||||
CASE WHEN faktura.currency_value is null or faktura.currency_value='' or faktura.currency_value=0
|
||||
THEN
|
||||
pozycja.total_netto
|
||||
ELSE
|
||||
pozycja.total_netto*faktura.currency_value
|
||||
END
|
||||
ELSE
|
||||
CASE WHEN faktura.currency_value is null or faktura.currency_value='' or faktura.currency_value=0
|
||||
THEN
|
||||
pozycja.total_netto-pozycja.old_total_netto
|
||||
ELSE
|
||||
(pozycja.total_netto-pozycja.old_total_netto)*faktura.currency_value
|
||||
END
|
||||
END
|
||||
) as netto,
|
||||
sum(
|
||||
CASE WHEN faktura.type!='correct'
|
||||
THEN
|
||||
pozycja.price_purchase*pozycja.quantity
|
||||
ELSE
|
||||
0
|
||||
END
|
||||
) as cost
|
||||
FROM
|
||||
ecminvoiceoutitems pozycja
|
||||
JOIN
|
||||
ecminvoiceouts faktura ON pozycja.ecminvoiceout_id = faktura.id
|
||||
JOIN
|
||||
accounts acco ON acco.id = faktura.parent_id
|
||||
WHERE
|
||||
faktura.register_date BETWEEN
|
||||
'$date_from' AND '$date_to'
|
||||
and faktura.type like '$type'
|
||||
and faktura.canceled = 0
|
||||
and faktura.deleted= 0
|
||||
and pozycja.deleted= 0";
|
||||
|
||||
if( $this->options["group_media_saturn_holding"] == 'enabled' )
|
||||
$query .= " GROUP BY IFNULL(acco.parent_id, acco.id) ";
|
||||
else
|
||||
$query .= " GROUP BY acco.id ";
|
||||
|
||||
$query .= "ORDER BY netto DESC
|
||||
LIMIT $count;
|
||||
";
|
||||
|
||||
$results = $this->db_connection->query( $query );
|
||||
$allContractors = array();
|
||||
|
||||
while( $result = $this->db_connection->fetchByAssoc( $results ) )
|
||||
{
|
||||
if( $result['parent'] == "1249" && $this->options["group_media_saturn_holding"] == 'enabled')
|
||||
$name = "Media Saturn Holding";
|
||||
else
|
||||
$name = $result["name"];
|
||||
|
||||
$contractor = new Contractor($name,
|
||||
$result["netto"],
|
||||
$result["cost"]);
|
||||
|
||||
|
||||
if( $contractor != null )
|
||||
$allContractors[] = $contractor;
|
||||
}
|
||||
|
||||
$this->contractors = $allContractors;
|
||||
}
|
||||
|
||||
public function showContractors()
|
||||
{
|
||||
print_r( $this->contractors );
|
||||
}
|
||||
|
||||
public function getContractors()
|
||||
{
|
||||
return $this->contractors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Metoda przygotowuje datę do wstawienia w zapytanie SQL
|
||||
*/
|
||||
private function prepareDateToQuery( DateTime $d )
|
||||
{
|
||||
return $d->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render data to Google Charts options
|
||||
*/
|
||||
public function renderGoogleChartOptions()
|
||||
{
|
||||
$data = "";
|
||||
|
||||
for( $i = 0; $i < count($this->contractors); $i++)
|
||||
{
|
||||
if( !$this->contractors[$i]->isEmpty ) {
|
||||
$data .= "['".$this->contractors[$i]->name."', ".$this->contractors[$i]->subtotal;
|
||||
if( $this->options["comparativeData"] == 'enabled' )
|
||||
$data .= ", ".$this->compData[$i]->subtotal."0],";
|
||||
else
|
||||
$data .= "],";
|
||||
//echo "['".$this->categories[$i]->name."', ".$this->categories[$i]->subtotal.", ".$this->compData[$i]->subtotal."],<br>";
|
||||
}
|
||||
}
|
||||
|
||||
$data = rtrim($data, ",");
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
} // end class
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
|
||||
$dashletMeta['MyContractorsChartsSalesDashlet'] = array(
|
||||
'title' => 'Wykres sprzedaży z podziałem na kontrahentów',
|
||||
'description' => 'Wykres słupkowy, w widoku poziomym przedstawiający sprzedaż w zadanym okresie z podziałem na kontrahentów wraz z możliwością wyboru przedziału danych porównawczych',
|
||||
'category' => 'Charts');
|
||||
?>
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('MyContractorChartSalesHelper.php');
|
||||
|
||||
|
||||
class MyContractorsChartsSalesDashlet extends Dashlet {
|
||||
|
||||
var $savedText; // users's saved text
|
||||
var $height = '300'; // height of the pad
|
||||
function MyContractorsChartsSalesDashlet($id, $def) {
|
||||
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
require('modules/EcmCharts/Dashlets/MyContractorsChartsSalesDashlet/MyContractorsChartsSalesDashlet.meta.php');
|
||||
require('modules/EcmCharts/language/pl_pl.lang.php');
|
||||
parent::Dashlet($id); // call parent constructor
|
||||
|
||||
$this->isConfigurable = true; // dashlet is configurable
|
||||
$this->hasScript = false; // dashlet has java ipt attached to it
|
||||
$options = $this->loadOptions();
|
||||
|
||||
if( !$options["title"] )
|
||||
$options["title"] = "Wykres z podziałem na kontrahentów";
|
||||
|
||||
// if no custom title, use default
|
||||
$this->title = $options["title"];
|
||||
|
||||
}
|
||||
|
||||
function display() {
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
|
||||
$options = $this->loadOptions();
|
||||
|
||||
// Data od
|
||||
if(!$options['date_from'])
|
||||
$options['date_from'] = date("01.m.Y");
|
||||
|
||||
// Data do
|
||||
if(!$options['date_to'])
|
||||
$options['date_to'] = date("d.m.Y");
|
||||
|
||||
if(!$options['type'])
|
||||
$options['type'] = "%";
|
||||
|
||||
if(!$options['comparativeData'])
|
||||
$options['comparativeData'] = "disabled";
|
||||
|
||||
if(!$options['chartType'])
|
||||
$options['chartType'] = "column";
|
||||
|
||||
if(!$options['count'])
|
||||
$options['count'] = "10";
|
||||
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Wykres sprzedaży z podziałem na kontrahentów";
|
||||
|
||||
$optionsForComparativeData = $options;
|
||||
$optionsForComparativeData["date_from"] = date("Y-m-d",strtotime(date("Y-m-d", strtotime($optionsForComparativeData["date_from"]))." -1 year"));
|
||||
$optionsForComparativeData["date_to"] = date("Y-m-d",strtotime(date("Y-m-d", strtotime($optionsForComparativeData["date_to"]))." -1 year"));
|
||||
|
||||
$db_connection_handler = $GLOBALS["db"];
|
||||
|
||||
/*
|
||||
* DATA
|
||||
*/
|
||||
$cd = null;
|
||||
|
||||
if( $options["comparativeData"] == "enabled" )
|
||||
{
|
||||
$comparativeData = new MyContractorChartSalesHelper( $db_connection_handler, $optionsForComparativeData);
|
||||
$cd = $comparativeData->getContractors();
|
||||
}
|
||||
|
||||
$helper = new MyContractorChartSalesHelper( $db_connection_handler, $options, $cd );
|
||||
|
||||
$data = $helper->renderGoogleChartOptions();
|
||||
|
||||
/*
|
||||
* SMARTY
|
||||
*/
|
||||
$smarty = new Sugar_Smarty();
|
||||
//$ss->assign('account_id',$optionsArray['account_id']);
|
||||
if( $helper->haveComparativeData() )
|
||||
$smarty->assign('comparative_data_on', 'true');
|
||||
else
|
||||
$smarty->assign('comparative_data_on', 'false');
|
||||
$smarty->assign('id', $this->id);
|
||||
$smarty->assign('height', $this->height);
|
||||
$smarty->assign('date_from', $options["date_from"]);
|
||||
$smarty->assign('date_to', $options["date_to"]);
|
||||
$smarty->assign('chartOptions', $data);
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
$smarty->assign('chartType', $options['chartType']);
|
||||
$smarty->assign('contractorsCount', $options['count']);
|
||||
$smarty->assign('group_media_saturn_holding', $options["group_media_saturn_holding"]);
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
|
||||
|
||||
// Pobieranie widoku
|
||||
$output = $smarty->fetch('modules/EcmCharts/Dashlets/MyContractorsChartsSalesDashlet/MyContractorsChartsSalesDashlet.tpl');
|
||||
// return parent::display for title and smarty template
|
||||
return parent::display($this->dashletStrings['LBL_DBLCLICK_HELP']) . $output;
|
||||
}
|
||||
|
||||
function displayOptions() {
|
||||
global $current_user, $mod_strings, $app_strings;
|
||||
// format daty
|
||||
$smarty = new Sugar_Smarty();
|
||||
// Pobieram ustawienia
|
||||
$options = $this->loadOptions();
|
||||
|
||||
// Data od
|
||||
if(!$options['date_from'])
|
||||
$options['date_from'] = date("01.m.Y");
|
||||
|
||||
// Data do
|
||||
if(!$options['date_to'])
|
||||
$options['date_to'] = date("d.m.Y");
|
||||
|
||||
if(!$options['type'])
|
||||
$options['type'] = "%";
|
||||
|
||||
if(!$options['comparativeData'])
|
||||
$options['comparativeData'] = "disabled";
|
||||
|
||||
if(!$options['chartType'])
|
||||
$options['chartType'] = "column";
|
||||
|
||||
if(!$options["title"])
|
||||
$options["title"] = "Wykres sprzedaży z podziałem na kategorie/podkategorie";
|
||||
|
||||
if(!$options["count"])
|
||||
$options["count"] = "10";
|
||||
|
||||
$numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
|
||||
// Format daty
|
||||
$Calendar_daFormat = str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));
|
||||
$smarty->assign("dateFormat", $Calendar_daFormat);
|
||||
//The id must be assigned in all dashlet options pages
|
||||
$smarty->assign('id', $this->id);
|
||||
$smarty->assign('date_from', $options['date_from']);
|
||||
$smarty->assign('date_to', $options['date_to']);
|
||||
// Typ dokumentu: all, normal, correct
|
||||
$smarty->assign('type', $options['type']);
|
||||
// Pokazywać dane porównawcze? Tak: enabled, nie: disabled
|
||||
$smarty->assign('comparativeData', $options['comparativeData']);
|
||||
// Typ wykresu
|
||||
$smarty->assign('chartType', $options['chartType']);
|
||||
// Tytuł
|
||||
$smarty->assign('title', $options['title']);
|
||||
// Ilość kontrahentów na wykresie
|
||||
$smarty->assign('contractorsCount', $options['count']);
|
||||
// Liczby do wyboru ilości kontrahentów
|
||||
$smarty->assign('numbers', $numbers);
|
||||
// Ilość kontrahentów
|
||||
$smarty->assign('count', $options['count']);
|
||||
// Grupowanie mediaków i saturnów
|
||||
$smarty->assign('group_media_saturn_holding', $options["group_media_saturn_holding"]);
|
||||
// Lang
|
||||
$smarty->assign('LANG', $mod_strings);
|
||||
|
||||
// Przekazuję widok opcji do metody displayOptions()
|
||||
return parent::displayOptions() . $smarty->fetch('modules/EcmCharts/Dashlets/MyContractorsChartsSalesDashlet/MyContractorsChartsSalesDashletOptions.tpl');
|
||||
|
||||
}
|
||||
|
||||
// Zapisywanie opcji dashletu
|
||||
function saveOptions($req) {
|
||||
$options = array();
|
||||
$options["date_from"] = $req["date_from"];
|
||||
$options["date_to"] = $req["date_to"];
|
||||
$options["comparativeData"] = $req["comparativeData"];
|
||||
$options["type"] = $req["type"];
|
||||
$options["chartType"] = $req["chartType"];
|
||||
$options["count"] = $req["contractorsCount"];
|
||||
$options["title"] = $req["title"];
|
||||
$options["group_media_saturn_holding"] = $req["group_media_saturn_holding"];
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,155 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
.no-data {
|
||||
display: table;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.textCenter {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.textCenter span {
|
||||
font-size: 16px;
|
||||
border: 1px dashed #E03E3E;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 10px 10px 5px #AAAAAA;
|
||||
background-color: #FFDEDE;
|
||||
color: #E03E3E;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
<div id='jotpsadad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: 200px; border: 1px #ddd solid'>
|
||||
<div id="contractors_sales_chart{$id}" style="width: 100%; height: 100%;">
|
||||
<div class="no-data">
|
||||
<div class="textCenter">
|
||||
<span>
|
||||
Brak danych od {$date_from} do {$date_to}, wybierz inny przedział dat.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div id='jotpsadad_{$id}' ondblclick='JotPad.edit(this, "{$id}")' style='overflow: auto; width: 100%; height: 800px; border: 1px #ddd solid'>
|
||||
<div id="contractors_sales_chart{$id}" style="width: 100%; height: 98%;"></div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- GOOGLE CHARTS API -->
|
||||
{if $chartOptions != ''}
|
||||
{literal}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="modules/EcmCharts/Dashlets/MyChartsSalesDashlet/js/salesChart.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Load the Visualization API and the piechart package.
|
||||
google.load('visualization', '1', {'packages':['corechart','geochart','table']});
|
||||
|
||||
function drawChart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Kategoria', 'Sprzedaż w aktualnym roku'{/literal}
|
||||
{if $comparativeData == 'enabled'} , 'Sprzedaż z poprzedniego roku'{/if}
|
||||
{literal}],
|
||||
|
||||
{/literal}
|
||||
{$chartOptions}
|
||||
{literal}
|
||||
]);
|
||||
|
||||
var formatter = new google.visualization.NumberFormat({
|
||||
suffix: 'zł'
|
||||
});
|
||||
|
||||
formatter.format(data, 1); // Apply formatter to second column.
|
||||
{/literal}
|
||||
{if $comparative_data_on == 'true' }
|
||||
formatter.format(data, 2); // Apply formatter to second column.
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
var options = {
|
||||
{/literal}
|
||||
title: '{$LANG.LBL_CHARTSALES} {$LANG.LBL_FROM} {$date_from} {$LANG.LBL_TO} {$date_to}',
|
||||
{literal}
|
||||
legend: {position: 'bottom', textStyle: {fontSize: 10}},
|
||||
tooltip:{textStyle:{fontSize:'10'}},
|
||||
vAxis:{title: {/literal}'{$LANG.LBL_VALUEOFSALES}'{literal},textStyle:{color: '#000000',fontSize: '10', paddingRight: '100',marginRight: '100'}},
|
||||
hAxis:{title:{/literal}{if $detail == 'category'}'{$LANG_LBL_CATEGORY}'{else}'{$LANG_LBL_SUBCATEGORY}'{/if}{literal}, titleTextStyle: {color: 'red'},textStyle:{color: '#000000',fontSize: '11', paddingRight: '100',marginRight: '100'}}
|
||||
|
||||
};
|
||||
|
||||
{/literal}
|
||||
{if $chartType == 'column' or $chartType == ''}
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('contractors_sales_chart{$id}'));
|
||||
{elseif $chartType == 'pie'}
|
||||
var chart = new google.visualization.PieChart(document.getElementById('contractors_sales_chart{$id}'));
|
||||
{elseif $chartType == 'line'}
|
||||
var chart = new google.visualization.LineChart(document.getElementById('contractors_sales_chart{$id}'));
|
||||
{elseif $chartType == 'stepped'}
|
||||
var chart = new google.visualization.SteppedAreaChart(document.getElementById('contractors_sales_chart{$id}'));
|
||||
{else}
|
||||
var chart = new google.visualization.AreaChart(document.getElementById('contractors_sales_chart{$id}'));
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
chart.draw(data, options);
|
||||
|
||||
}
|
||||
|
||||
// sekunda opóźnienia, żeby zdążył wczytać się moduł "visualization"
|
||||
setTimeout(drawChart, 1000);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
{*
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
*}
|
||||
|
||||
<script type="text/javascript" src="modules/EcmCharts/javascript/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
function listenerFunction() {
|
||||
//location.reload();
|
||||
};
|
||||
|
||||
$("#chartTypeSelector").change(function() {
|
||||
if( $(this).val() == 'pie' )
|
||||
{
|
||||
$("#documentTypeSelector").val("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$("#documentTypeSelector").change(function(){
|
||||
if( $(this).val() != 'normal' && $("#chartTypeSelector").val() == 'pie' )
|
||||
{
|
||||
$("#chartTypeSelector").val("column");
|
||||
}
|
||||
});
|
||||
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
table tr td {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
table tr td select {
|
||||
width: 140px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
|
||||
|
||||
<div style='width: 600px'>
|
||||
<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='Home'>
|
||||
<input type='hidden' name='action' value='ConfigureDashlet'>
|
||||
<input type='hidden' name='to_pdf' value='true'>
|
||||
<input type='hidden' name='configure' value='true'>
|
||||
<table width="600" cellpadding="0" cellspacing="0" border="0" class="tabForm" align="center">
|
||||
<tr>
|
||||
<td>{$LANG.LBL_TITLE}: </td>
|
||||
<td>
|
||||
<input type="text" value="{$title}" name="title" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDEDATE} {$LANG.LBL_FROM}: </td>
|
||||
<td>
|
||||
{* Search by date_from *}
|
||||
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title="" value="{$date_from}" autocomplete="off">
|
||||
<img id="date_from_trigger" border="0" align="absmiddle" alt="Enter Date" src="themes/default/images/jscalendar.gif">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "date_from",
|
||||
daFormat : "{$dateFormat}",
|
||||
button : "date_from_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
<td> {$LANG.LBL_TO}: </td>
|
||||
<td>
|
||||
{* Search by date_to *}
|
||||
<input autocomplete="off" name="date_to" id="date_to" value="{$date_to}" title="" tabindex="" size="11" maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "date_to",
|
||||
daFormat : "{$dateFormat}",
|
||||
button : "date_to_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDED_DOCUMENT_TYPE}: </td>
|
||||
<td>
|
||||
<select id="documentTypeSelector" name="type">
|
||||
<option value="%" { if $type == "%" || $type == ""} selected="true" {/if}>{$LANG.LBL_NORMAL_AND_CORRECT}</option>
|
||||
<option value="normal" { if $type == "normal"} selected="true" {/if}>{$LANG.LBL_NORMAL_ONLY}</option>
|
||||
<option value="correct" { if $type == "correct"} selected="true" {/if}>{$LANG.LBL_CORRECT_ONLY}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_CHARTTYPE}: </td>
|
||||
<td>
|
||||
<select id="chartTypeSelector" name="chartType">
|
||||
<option value="column" { if $chartType == "column"} selected="true" {/if}>{$LANG.LBL_CHARTTYPECOLUMN}</option>
|
||||
<option value="pie" { if $chartType == "pie"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEPIE}</option>
|
||||
<option value="line" { if $chartType == "line"} selected="true" {/if}>{$LANG.LBL_CHARTTYPELINE}</option>
|
||||
<option value="area" { if $chartType == "area"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEAREA}</option>
|
||||
<option value="stepped" { if $chartType == "stepped"} selected="true" {/if}>{$LANG.LBL_CHARTTYPESTEPPEDAREA}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_SELECT_CONTRACTORSCOUNT}: </td>
|
||||
<td>
|
||||
<select name="contractorsCount">
|
||||
{foreach from=$numbers item=n}
|
||||
<option value="{$n}" { if $n == $count || $count == ""} selected="true" {/if}>{$n}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{$LANG.LBL_VIEW_COMPARATIVE_DATA}: </td>
|
||||
<td>
|
||||
<input type="radio" name="comparativeData" value="enabled" { if $comparativeData == "enabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
<input type="radio" name="comparativeData" style="margin-left: 20px" value="disabled" { if $comparativeData == "disabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_NO}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> {$LANG.LBL_GROUP_MEDIASATURNHOLDING}</td>
|
||||
<td>
|
||||
<input type="checkbox" value="enabled" name="group_media_saturn_holding"
|
||||
{if $group_media_saturn_holding == 'enabled'}checked{/if}>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: center;">
|
||||
<input id="submitButton" type="submit" class="button" style="margin-top: 30px;" value="{$LANG.LBL_SAVECHANGES}" onclick="setTimeout(listenerFunction, 1000);">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
36
modules/EcmCharts/DetailView.php
Normal file
36
modules/EcmCharts/DetailView.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
|
||||
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
|
||||
|
||||
require_once('modules/EcmCharts/EcmChart.php');
|
||||
require_once('modules/EcmCharts/Forms.php');
|
||||
require_once ('include/time.php');
|
||||
require_once('include/json_config.php');
|
||||
|
||||
$json_config = new json_config();
|
||||
|
||||
$focus = new EcmChart();
|
||||
|
||||
if(isset($_REQUEST['record']))$focus->retrieve($_REQUEST['record']);
|
||||
|
||||
require_once('include/MVC/View/SugarView.php');
|
||||
|
||||
if(file_exists('modules/EcmCharts/views/view.detail.php')) {
|
||||
require_once('modules/EcmCharts/views/view.detail.php');
|
||||
$detail = new EcmChart();
|
||||
}
|
||||
else{
|
||||
require_once('include/MVC/View/views/view.detail.php');
|
||||
$detail = new ViewDetail();
|
||||
$detail->ss = new Sugar_Smarty();
|
||||
$detail->module = 'EcmCharts';
|
||||
}
|
||||
|
||||
global $app_list_strings;
|
||||
|
||||
$detail->bean = $focus;
|
||||
$detail->preDisplay();
|
||||
|
||||
echo $detail->display();
|
||||
?>
|
||||
161
modules/EcmCharts/EcmChart.php
Normal file
161
modules/EcmCharts/EcmChart.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO: To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
require_once('data/SugarBean.php');
|
||||
require_once('include/utils.php');
|
||||
|
||||
class EcmChart extends SugarBean {
|
||||
var $field_name_map = array();
|
||||
|
||||
var $id;
|
||||
var $date_entered;
|
||||
var $date_modified;
|
||||
var $modified_user_id;
|
||||
var $assigned_user_id;
|
||||
var $name;
|
||||
var $value;
|
||||
|
||||
var $module_dir = 'EcmCharts';
|
||||
var $table_name = "ecmcharts";
|
||||
var $object_name = "EcmChart";
|
||||
|
||||
var $new_schema = true;
|
||||
|
||||
var $additional_column_fields = array('assigned_user_name', 'assigned_user_id');
|
||||
|
||||
function EcmChart() {
|
||||
parent::SugarBean();
|
||||
$this->setupCustomFields('EcmCharts');
|
||||
foreach($this->field_defs as $field){
|
||||
$this->field_name_map[$field['name']] = $field;
|
||||
}
|
||||
}
|
||||
function get_summary_text(){
|
||||
return $this->name;
|
||||
}
|
||||
function create_list_query($order_by, $where, $show_deleted = 0){
|
||||
$custom_join = $this->custom_fields->getJOIN();
|
||||
$query ="SELECT ";
|
||||
$query.="ecmcharts.*,users.user_name as assigned_user_name";
|
||||
if($custom_join)$query.=$custom_join['select'];
|
||||
$query.=" FROM ecmcharts ";
|
||||
$query.="LEFT JOIN users ON ecmcharts.assigned_user_id=users.id";
|
||||
$query.=" ";
|
||||
if($custom_join)$query.=$custom_join['join'];
|
||||
$where_auto='1=1';
|
||||
if($show_deleted==0)$where_auto=" $this->table_name.deleted=0 ";
|
||||
elseif($show_deleted==1)$where_auto=" $this->table_name.deleted=1 ";
|
||||
if($where!="")$query.="where $where AND ".$where_auto;
|
||||
else $query.="where ".$where_auto;
|
||||
if(substr_count($order_by,'.')>0)$query .= " ORDER BY $order_by";
|
||||
elseif($order_by != "")$query .= " ORDER BY $order_by";
|
||||
else $query .= " ORDER BY ecmcharts.name";
|
||||
return $query;
|
||||
}
|
||||
function create_export_query($order_by,$where){
|
||||
$custom_join = $this->custom_fields->getJOIN();
|
||||
$query ="SELECT ";
|
||||
$query.="ecmcharts.*,users.user_name as assigned_user_name";
|
||||
if($custom_join)$query.=$custom_join['select'];
|
||||
$query.=" FROM ecmcharts ";
|
||||
$query.="LEFT JOIN users ON ecmcharts.assigned_user_id=users.id";
|
||||
$query.=" ";
|
||||
if($custom_join)$query.=$custom_join['join'];
|
||||
$where_auto='1=1';
|
||||
if($show_deleted==0)$where_auto=" $this->table_name.deleted=0 ";
|
||||
elseif($show_deleted==1)$where_auto=" $this->table_name.deleted=1 ";
|
||||
if($where!="")$query.="where $where AND ".$where_auto;
|
||||
else $query.="where ".$where_auto;
|
||||
if(substr_count($order_by,'.')>0)$query .= " ORDER BY $order_by";
|
||||
elseif($order_by != "")$query .= " ORDER BY $order_by";
|
||||
else $query .= " ORDER BY ecmcharts.name";
|
||||
return $query;
|
||||
}
|
||||
function fill_in_additional_list_fields(){
|
||||
}
|
||||
|
||||
function fill_in_additional_detail_fields(){
|
||||
parent::fill_in_additional_detail_fields();
|
||||
}
|
||||
function get_list_view_data(){
|
||||
global $current_language;
|
||||
$the_array=parent::get_list_view_data();
|
||||
$app_list_strings=return_app_list_strings_language($current_language);
|
||||
$mod_strings=return_module_language($current_language,'EcmCharts');
|
||||
|
||||
$the_array['NAME']=(($this->name == "") ? "<em>blank</em>" : $this->name);
|
||||
$the_array['ENCODED_NAME']=$this->name;
|
||||
return $the_array;
|
||||
}
|
||||
function build_generic_where_clause($the_query_string){
|
||||
$where_clauses=array();
|
||||
$the_query_string=PearDatabase::quote(from_html($the_query_string));
|
||||
array_push($where_clauses,"ecmcharts.name like '$the_query_string%'");
|
||||
|
||||
$the_where="";
|
||||
foreach($where_clauses as $clause){
|
||||
if($the_where!="")$the_where.=" or ";
|
||||
$the_where.=$clause;
|
||||
}
|
||||
return $the_where;
|
||||
}
|
||||
function set_notification_body($xtpl,$ecmchart)
|
||||
{
|
||||
global $mod_strings,$app_list_strings;
|
||||
$xtpl->assign("ECMCHART_SUBJECT",$ecmchart->name);
|
||||
return $xtpl;
|
||||
}
|
||||
|
||||
function bean_implements($interface){
|
||||
switch($interface){
|
||||
case 'ACL':return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function save($check_notify=FALSE){
|
||||
return parent::save($check_notify);
|
||||
}
|
||||
}
|
||||
?>
|
||||
73
modules/EcmCharts/EcmChartsQuickCreate.php
Normal file
73
modules/EcmCharts/EcmChartsQuickCreate.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?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/EditView/QuickCreate.php');
|
||||
require_once('modules/EcmCharts/EcmChart.php');
|
||||
require_once('include/javascript/javascript.php');
|
||||
|
||||
class EcmChartsQuickCreate extends QuickCreate {
|
||||
|
||||
var $javascript;
|
||||
|
||||
function process() {
|
||||
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
|
||||
$mod_strings = return_module_language($current_language, 'EcmCharts');
|
||||
|
||||
parent::process();
|
||||
|
||||
$this->ss->assign("PRIORITY_OPTIONS", get_select_options_with_id($app_list_strings['ecmchart_priority_dom'], $app_list_strings['ecmchart_priority_default_key']));
|
||||
$this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['ecmchart_status_dom'], $app_list_strings['ecmchart_status_default_key']));
|
||||
$this->ss->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['ecmchart_type_dom'],$app_list_strings['ecmchart_type_default_key']));
|
||||
|
||||
if($this->viaAJAX) { // override for ajax call
|
||||
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"ecmchartsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"ecmcharts\"); else return false;'");
|
||||
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_ecmcharts\")';");
|
||||
}
|
||||
|
||||
$this->ss->assign('viaAJAX', $this->viaAJAX);
|
||||
|
||||
$this->javascript = new javascript();
|
||||
$this->javascript->setFormName('ecmchartsQuickCreate');
|
||||
|
||||
$focus = new EcmChart();
|
||||
$this->javascript->setSugarBean($focus);
|
||||
$this->javascript->addAllFields('');
|
||||
|
||||
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
|
||||
}
|
||||
}
|
||||
?>
|
||||
37
modules/EcmCharts/Forms.php
Normal file
37
modules/EcmCharts/Forms.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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/EditView/SideQuickCreate.php');
|
||||
50
modules/EcmCharts/Menu.php
Normal file
50
modules/EcmCharts/Menu.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* Description: TODO To be written.
|
||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________..
|
||||
********************************************************************************/
|
||||
|
||||
global $mod_strings;
|
||||
$module_menu[]=array("index.php?module=EcmCharts&action=SalesChart","Wykres sprzedaży z podziałem na kategorie/podkategorie","EcmCharts7", 'EcmCharts');
|
||||
$module_menu[]=array("index.php?module=EcmCharts&action=AnnualSalesChart","Wykres sprzedaży z podziałem na miesiące","EcmCharts7", 'EcmCharts');
|
||||
$module_menu[]=array('#', '<span style="display: none">wp_shortcut_fill_0</span>', '');
|
||||
|
||||
?>
|
||||
87
modules/EcmCharts/SalesChart.php
Normal file
87
modules/EcmCharts/SalesChart.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'Not A Valid Entry Point' );
|
||||
|
||||
/*****************************************************/
|
||||
/*********************** PREPARE *********************/
|
||||
/*****************************************************/
|
||||
$db = $GLOBALS ['db'];
|
||||
|
||||
require_once('include/Dashlets/Dashlet.php');
|
||||
require_once('include/Sugar_Smarty.php');
|
||||
require_once('modules/EcmCharts/Dashlets/MyChartsSalesDashlet/ChartSalesHelper.php');
|
||||
global $mod_strings;
|
||||
|
||||
$options = array();
|
||||
|
||||
// Data od
|
||||
if(!$_GET['date_from'])
|
||||
$options['date_from'] = date("01.m.Y");
|
||||
else
|
||||
$options['date_from'] = $_GET['date_from'];
|
||||
|
||||
// Data do
|
||||
if(!$_GET['date_to'])
|
||||
$options['date_to'] = date("d.m.Y");
|
||||
else
|
||||
$options['date_to'] = $_GET['date_to'];
|
||||
|
||||
if(!$_GET['type'])
|
||||
$options['type'] = "%";
|
||||
else
|
||||
$options['type'] = $_GET['type'];
|
||||
|
||||
if(!$_GET['comparativeData'])
|
||||
$options['comparativeData'] = "disabled";
|
||||
else
|
||||
$options['comparativeData'] = $_GET['comparativeData'];
|
||||
|
||||
if(!$_GET['detail'])
|
||||
$options['detail'] = "category";
|
||||
else
|
||||
$options['detail'] = $_GET['detail'];
|
||||
|
||||
if(!$_GET['chartType']) {
|
||||
$options['chartType'] = "column";
|
||||
} else {
|
||||
$options['chartType'] = $_GET['chartType'];
|
||||
}
|
||||
|
||||
$optionsForComparativeData = $options;
|
||||
$optionsForComparativeData["date_from"] = date("Y-m-d",strtotime(date("Y-m-d", strtotime($optionsForComparativeData["date_from"]))." -1 year"));
|
||||
$optionsForComparativeData["date_to"] = date("Y-m-d",strtotime(date("Y-m-d", strtotime($optionsForComparativeData["date_to"]))." -1 year"));
|
||||
|
||||
$db_connection_handler = $GLOBALS["db"];
|
||||
|
||||
/*
|
||||
* DATA
|
||||
*/
|
||||
$cd = null;
|
||||
|
||||
if( $options["comparativeData"] == "enabled")
|
||||
{
|
||||
$comparativeData = new ChartSalesHelper( $db_connection_handler, $optionsForComparativeData);
|
||||
if( $options["detail"] == 'category')
|
||||
{
|
||||
$cd = $comparativeData->getAllCategories();
|
||||
} else {
|
||||
$cd = $comparativeData->getAllSubcategories();
|
||||
}
|
||||
}
|
||||
|
||||
$helper = new ChartSalesHelper( $db_connection_handler, $options, $cd );
|
||||
$data = $helper->renderGoogleChartOptions();
|
||||
|
||||
// create & execute smarty
|
||||
$Calendar_daFormat = str_replace("d","%d",str_replace("m","%m",str_replace("Y","%Y",$GLOBALS['timedate']->get_date_format())));
|
||||
$smarty = new Sugar_Smarty();
|
||||
$smarty -> assign( "dateFormat", $Calendar_daFormat);
|
||||
$smarty -> assign('date_from', $options["date_from"]);
|
||||
$smarty -> assign('date_to', $options["date_to"]);
|
||||
$smarty -> assign('chartOptions', $data);
|
||||
$smarty -> assign('detail', $options["detail"]);
|
||||
$smarty -> assign('comparativeData', $options['comparativeData']);
|
||||
$smarty -> assign('chartType', $options['chartType']);
|
||||
$smarty -> assign('LANG', $mod_strings);
|
||||
echo $smarty->display ( 'modules/EcmCharts/tpls/SalesChart.tpl' );
|
||||
?>
|
||||
3
modules/EcmCharts/index.php
Normal file
3
modules/EcmCharts/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
header("Location: index.php?module=EcmCharts&action=index1");
|
||||
?>
|
||||
4
modules/EcmCharts/javascript/jquery-2.1.1.min.js
vendored
Normal file
4
modules/EcmCharts/javascript/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
103
modules/EcmCharts/language/en_us.lang.php
Normal file
103
modules/EcmCharts/language/en_us.lang.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* 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 (
|
||||
|
||||
'LBL_SALE' => "Sales",
|
||||
'LBL_SALE_IN_PAST_YEAR' => "Sales in last year",
|
||||
'LBL_SALES_CHART_IN' => "Sales chart in year ",
|
||||
'LBL_MONTH' => "Month",
|
||||
|
||||
// AnnualSales
|
||||
'LBL_ANNUAL_CHART_NAME' => 'Chart of sales by month',
|
||||
'LBL_ANNUAL_CHART_DESCRIPTION' => 'The bar chart in landscape view showing sales in the current year with the prior year comparative data and the possibility of filtering',
|
||||
'LBL_NO_DATA_IN_YEAR' => "There is no data for the year ",
|
||||
'LBL_SELECT_ANOTHER_YEAR' => "select another year.",
|
||||
|
||||
'LBL_JANUARY' => 'January',
|
||||
'LBL_FEBRUARY' => 'February',
|
||||
'LBL_MARCH' => 'March',
|
||||
'LBL_APRIL' => 'April',
|
||||
'LBL_MAY' => 'May',
|
||||
'LBL_JUNE' => 'June',
|
||||
'LBL_JULY' => 'July',
|
||||
'LBL_AUGUST' => 'August',
|
||||
'LBL_SEPTEMBER' => 'September',
|
||||
'LBL_OCTOBER' => 'October',
|
||||
'LBL_NOVEMBER' => 'November',
|
||||
'LBL_DECEMBER' => 'December',
|
||||
|
||||
'LBL_SELECT_YEAR' => 'Select year',
|
||||
'LBL_CHARTTYPE' => 'Chart type',
|
||||
'LBL_CHARTTYPEPIE' => 'Pie',
|
||||
'LBL_CHARTTYPECOLUMN' => 'Column',
|
||||
'LBL_CHARTTYPEAREA' => 'Area',
|
||||
'LBL_INCLUDED_DOCUMENT_TYPE' => "Include document type",
|
||||
'LBL_AND_CONTRACTOR' => "and contractor",
|
||||
'LBL_NO_DATA_CHANGE_FILTER' => "No data to display, change filters.",
|
||||
'LBL_CONTRACTOR' => 'Contractor',
|
||||
'LBL_VIEW_COMPARATIVE_DATA' => 'Display comparative data',
|
||||
'LBL_NO' => 'No',
|
||||
'LBL_YES' => 'Yes',
|
||||
'LBL_CORRECT_ONLY' => "Corrects",
|
||||
'LBL_NORMAL_ONLY' => "Invoice",
|
||||
'LBL_NORMAL_AND_CORRECT' => "Invoice and corrects",
|
||||
'LBL_SELECT' => "Select",
|
||||
'LBL_INCLUDEDATE' => "Include date",
|
||||
'LBL_TO' => 'from',
|
||||
'LBL_FROM' => "to",
|
||||
'LBL_SELECTDATAFROM' => "Include date from",
|
||||
'LBL_TITLE' => "Title",
|
||||
'LBL_SAVECHANGES' => "Save changes",
|
||||
'LBL_SAVE' => "Save",
|
||||
'LBL_SHOW' => "Show",
|
||||
'LBL_GENERATECHART' => "Generate chart",
|
||||
'LBL_RESTOREDEFAULTPARAMETERS' => "Restore default parameters",
|
||||
'LBL_VALUEOFSALES' => "Sales value",
|
||||
'LBL_CHARTOPTIONS' => "Chart options",
|
||||
'LBL_CHARTSALES' => "Sales chart",
|
||||
'LBL_CATEGORY' => "Category",
|
||||
'LBL_SUBCATEGORY' => "Subcategory"
|
||||
|
||||
);
|
||||
?>
|
||||
79
modules/EcmCharts/language/ge_ge.lang.php
Normal file
79
modules/EcmCharts/language/ge_ge.lang.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* 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 (
|
||||
'LBL_ASSIGNED_TO_ID' => 'Assigned To',
|
||||
'LBL_VALUE' => 'Value',
|
||||
'LBL_MODULE_NAME' => 'Vat',
|
||||
'LBL_MODULE_TITLE' => 'Vat: Home',
|
||||
'LBL_MODULE_ID' => 'Vat',
|
||||
'LBL_SEARCH_FORM_TITLE' => 'Vat Search',
|
||||
'LBL_LIST_FORM_TITLE' => 'Vat List',
|
||||
'LBL_NEW_FORM_TITLE' => 'New Vat',
|
||||
'LBL_SUBJECT' => 'Subject:',
|
||||
'LBL_ECMCHART' => 'Vat:',
|
||||
'LBL_ECMCHART_SUBJECT' => 'Vat Subject:',
|
||||
'LBL_LIST_SUBJECT' => 'Name',
|
||||
'LBL_LIST_LAST_MODIFIED' => 'Last Modified',
|
||||
'LNK_NEW_ECMCHART' => 'Create Vat',
|
||||
'LNK_ECMCHART_LIST' => 'Vat',
|
||||
'ERR_DELETE_RECORD' => 'You must specify a record number in order to delete the vat.',
|
||||
'LBL_LIST_MY_ECMCHARTS' => 'My Assigned Vat',
|
||||
|
||||
'LBL_CREATED_BY' => 'Created by:',
|
||||
'LBL_DATE_CREATED' => 'Create Date:',
|
||||
'LBL_MODIFIED_BY' => 'Last Modified by:',
|
||||
'LBL_DATE_LAST_MODIFIED' => 'Modify Date:',
|
||||
|
||||
'LBL_DEFAULT_SUBPANEL_TITLE' => 'Vat',
|
||||
'LBL_SYSTEM_ID' => 'System ID',
|
||||
'LBL_LIST_ASSIGNED_TO_NAME' => 'Assigned User',
|
||||
'LBL_LIST_VALUE' => 'Value',
|
||||
'LBL_ASSIGNED_TO_NAME' => 'Assigned to',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
?>
|
||||
106
modules/EcmCharts/language/pl_pl.lang.php
Normal file
106
modules/EcmCharts/language/pl_pl.lang.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
/*********************************************************************************
|
||||
|
||||
* 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 (
|
||||
'LBL_SALE' => "Sprzedaż",
|
||||
'LBL_SALE_IN_PAST_YEAR' => "Sprzedaż z poprzedniego roku",
|
||||
'LBL_SALES_CHART_IN' => "Wykres sprzedaży w roku ",
|
||||
'LBL_MONTH' => "Miesiąc",
|
||||
|
||||
// AnnualSales
|
||||
'LBL_ANNUAL_CHART_NAME' => 'Wykres sprzedaży z podziałem na miesiące',
|
||||
'LBL_ANNUAL_CHART_DESCRIPTION' => 'Wykres słupkowy, w widoku poziomym przedstawiający sprzedaż w aktualnym roku z danymi porównawczymi sprzed roku i możliwością filtrowania',
|
||||
'LBL_NO_DATA_IN_YEAR' => "Brak danych w roku ",
|
||||
'LBL_SELECT_ANOTHER_YEAR' => "wybierz inny rok.",
|
||||
|
||||
'LBL_JANUARY' => 'Styczeń',
|
||||
'LBL_FEBRUARY' => 'Luty',
|
||||
'LBL_MARCH' => 'Marzec',
|
||||
'LBL_APRIL' => 'Kwiecień',
|
||||
'LBL_MAY' => 'Maj',
|
||||
'LBL_JUNE' => 'Czerwiec',
|
||||
'LBL_JULY' => 'Lipiec',
|
||||
'LBL_AUGUST' => 'Sierpień',
|
||||
'LBL_SEPTEMBER' => 'Wrzesień',
|
||||
'LBL_OCTOBER' => 'Październik',
|
||||
'LBL_NOVEMBER' => 'Listopad',
|
||||
'LBL_DECEMBER' => 'Grudzień',
|
||||
|
||||
'LBL_SELECT_YEAR' => 'Wybierz rok',
|
||||
'LBL_CHARTTYPE' => 'Typ wykresu',
|
||||
'LBL_CHARTTYPEPIE' => 'Kołowy',
|
||||
'LBL_CHARTTYPELINE' => 'Liniowy',
|
||||
'LBL_CHARTTYPECOLUMN' => 'Kolumnowy',
|
||||
'LBL_CHARTTYPEAREA' => 'Obszarowy',
|
||||
'LBL_CHARTTYPESTEPPEDAREA' => 'Obszarowy - stopniowy',
|
||||
'LBL_INCLUDED_DOCUMENT_TYPE' => "Uwzględniony typ dokumentu",
|
||||
'LBL_AND_CONTRACTOR' => "i kontrahenta",
|
||||
'LBL_NO_DATA_CHANGE_FILTER' => "Brak danych, zmień filtrowanie.",
|
||||
'LBL_CONTRACTOR' => 'Kontrahent',
|
||||
'LBL_VIEW_COMPARATIVE_DATA' => 'Wyświetl dane porównawcze',
|
||||
'LBL_NO' => 'Nie',
|
||||
'LBL_YES' => 'Tak',
|
||||
'LBL_CORRECT_ONLY' => "Korekty",
|
||||
'LBL_NORMAL_ONLY' => "Faktury",
|
||||
'LBL_NORMAL_AND_CORRECT' => "Faktury i korekty",
|
||||
'LBL_SELECT' => "Wybierz",
|
||||
'LBL_INCLUDEDATE' => "Uwzględnij datę",
|
||||
'LBL_TO' => 'do',
|
||||
'LBL_FROM' => "od",
|
||||
'LBL_SELECTDATAFROM' => "Uwzględnij dane od",
|
||||
'LBL_TITLE' => "Tytuł",
|
||||
'LBL_SAVECHANGES' => "Zapis ustawienia",
|
||||
'LBL_SAVE' => "Zapisz",
|
||||
'LBL_SHOW' => "Pokaż",
|
||||
'LBL_GENERATECHART' => "Generuj wykres",
|
||||
'LBL_RESTOREDEFAULTPARAMETERS' => "Przywróć parametry domyślne",
|
||||
'LBL_VALUEOFSALES' => "Wartość sprzedaży",
|
||||
'LBL_CHARTOPTIONS' => "Ustawienia wykresu",
|
||||
'LBL_CHARTSALES' => "Wykres sprzedaży",
|
||||
'LBL_CATEGORY' => "Kategoria",
|
||||
'LBL_SUBCATEGORY' => "Podkategoria",
|
||||
|
||||
'LBL_SELECT_CONTRACTORSCOUNT' => 'Ilość kontrahentów',
|
||||
'LBL_GROUP_MEDIASATURNHOLDING' => 'Grupuj "Media Saturn Holding"'
|
||||
);
|
||||
?>
|
||||
44
modules/EcmCharts/metadata/SearchFields.php
Normal file
44
modules/EcmCharts/metadata/SearchFields.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
$searchFields['EcmCharts'] =
|
||||
array (
|
||||
'name' => array( 'query_type'=>'default'),
|
||||
'value' => array( 'query_type'=>'default'),
|
||||
'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true),
|
||||
'assigned_user_id'=> array('query_type'=>'default'),
|
||||
);
|
||||
?>
|
||||
64
modules/EcmCharts/metadata/additionalDetails.php
Normal file
64
modules/EcmCharts/metadata/additionalDetails.php
Normal file
@@ -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 - 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/utils.php');
|
||||
|
||||
function additionalDetailsEcmChart($fields) {
|
||||
static $mod_strings;
|
||||
global $app_strings;
|
||||
if(empty($mod_strings)) {
|
||||
global $current_language;
|
||||
$mod_strings = return_module_language($current_language, 'EcmCharts');
|
||||
}
|
||||
|
||||
$overlib_string = '';
|
||||
|
||||
if(!empty($fields['DATE_ENTERED']))
|
||||
$overlib_string .= '<b>'. $app_strings['LBL_DATE_ENTERED'] . '</b> ' . $fields['DATE_ENTERED'] . '<br>';
|
||||
if(!empty($fields['NAME']))
|
||||
$overlib_string .= '<b>'. $mod_strings['LBL_NAME'] . '</b> ' . $fields['NAME'] . '<br>';
|
||||
|
||||
return array('fieldToAddTo' => 'NAME',
|
||||
'string' => $overlib_string,
|
||||
'editLink' => "index.php?action=EditView&module=EcmCharts&return_module=EcmCharts&record={$fields['ID']}",
|
||||
'viewLink' => "index.php?action=DetailView&module=EcmCharts&return_module=EcmCharts&record={$fields['ID']}");
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
67
modules/EcmCharts/metadata/detailviewdefs.php
Normal file
67
modules/EcmCharts/metadata/detailviewdefs.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
$viewdefs['EcmCharts']['DetailView'] = array(
|
||||
'templateMeta'=>array(
|
||||
'form'=>array(
|
||||
'buttons'=>array(
|
||||
'EDIT',
|
||||
'DUPLICATE',
|
||||
'DELETE',
|
||||
)
|
||||
),
|
||||
'maxColumns'=>'2',
|
||||
'widths'=>array(
|
||||
array(
|
||||
'label'=>'10',
|
||||
'field' =>'30'
|
||||
),
|
||||
array(
|
||||
'label'=>'10',
|
||||
'field'=>'30'
|
||||
)
|
||||
),
|
||||
),
|
||||
'panels'=>array(
|
||||
array(
|
||||
'name',
|
||||
'assigned_user_name',
|
||||
),
|
||||
array(
|
||||
'value',
|
||||
),
|
||||
)
|
||||
);
|
||||
?>
|
||||
52
modules/EcmCharts/metadata/editviewdefs.php
Normal file
52
modules/EcmCharts/metadata/editviewdefs.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
$viewdefs['EcmCharts']['EditView'] = array(
|
||||
'templateMeta'=>array(
|
||||
'form' => array('buttons'=>array('SAVE', 'CANCEL')),
|
||||
'maxColumns'=>'2',
|
||||
'widths'=>array(
|
||||
array('label'=>'10','field'=>'30'),
|
||||
array('label'=>'10','field'=>'30'),
|
||||
),
|
||||
),
|
||||
'panels'=>array(
|
||||
'default'=>array(
|
||||
array('name','assigned_user_name'),
|
||||
array('value'),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
56
modules/EcmCharts/metadata/listviewdefs.php
Normal file
56
modules/EcmCharts/metadata/listviewdefs.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$listViewDefs['EcmCharts'] = array(
|
||||
'NAME' => array(
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'default' => true,
|
||||
'link' => true),
|
||||
'VALUE' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_VALUE',
|
||||
'default' => true),
|
||||
'ASSIGNED_USER_NAME' => array(
|
||||
'width' => '9',
|
||||
'label' => 'LBL_LIST_ASSIGNED_USER',
|
||||
'default' => true)
|
||||
);
|
||||
?>
|
||||
51
modules/EcmCharts/metadata/metafiles.php
Normal file
51
modules/EcmCharts/metadata/metafiles.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on Jun 1, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
$metafiles['EcmCharts'] = array(
|
||||
'detailviewdefs' => 'modules/EcmCharts/metadata/detailviewdefs.php',
|
||||
'editviewdefs' => 'modules/EcmCharts/metadata/editviewdefs.php',
|
||||
'listviewdefs' => 'modules/EcmCharts/metadata/listviewdefs.php',
|
||||
'searchdefs' => 'modules/EcmCharts/metadata/searchdefs.php',
|
||||
'popupdefs' => 'modules/EcmCharts/metadata/popupdefs.php',
|
||||
'searchfields' => 'modules/EcmCharts/metadata/SearchFields.php',
|
||||
|
||||
);
|
||||
?>
|
||||
67
modules/EcmCharts/metadata/popupdefs.php
Normal file
67
modules/EcmCharts/metadata/popupdefs.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
|
||||
$popupMeta = array('moduleMain' => 'EcmChart',
|
||||
'varName' => 'ECMCHART',
|
||||
'orderBy' => 'ecmcharts.name',
|
||||
'whereClauses' =>
|
||||
array('name' => 'ecmcharts.name'),
|
||||
'listviewdefs' => array(
|
||||
'NAME' => array(
|
||||
'width' => '32',
|
||||
'label' => 'LBL_LIST_SUBJECT',
|
||||
'default' => true,
|
||||
'link' => true),
|
||||
'VALUE' => array(
|
||||
'width' => '10',
|
||||
'label' => 'LBL_LIST_VALUE',
|
||||
'default' => true),
|
||||
'ASSIGNED_USER_NAME' => array(
|
||||
'width' => '9',
|
||||
'label' => 'LBL_LIST_ASSIGNED_USER',
|
||||
'default' => true)
|
||||
|
||||
),
|
||||
'searchdefs' => array(
|
||||
'name',
|
||||
'value',
|
||||
array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
59
modules/EcmCharts/metadata/searchdefs.php
Normal file
59
modules/EcmCharts/metadata/searchdefs.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* 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".
|
||||
********************************************************************************/
|
||||
/*
|
||||
* Created on May 29, 2007
|
||||
*
|
||||
* To change the template for this generated file go to
|
||||
* Window - Preferences - PHPeclipse - PHP - Code Templates
|
||||
*/
|
||||
$searchdefs['EcmCharts'] = array(
|
||||
'templateMeta' => array(
|
||||
'maxColumns' => '3',
|
||||
'widths' => array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
'layout' => array(
|
||||
'basic_search' => array(
|
||||
'name',
|
||||
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
|
||||
),
|
||||
'advanced_search' => array(
|
||||
'name',
|
||||
'value',
|
||||
array('name' => 'assigned_user_id', 'type' => 'enum', 'label' => 'LBL_ASSIGNED_TO', 'function' => array('name' => 'get_user_array', 'params' => array(false))),
|
||||
),
|
||||
),
|
||||
);
|
||||
?>
|
||||
71
modules/EcmCharts/metadata/sidecreateviewdefs.php
Normal file
71
modules/EcmCharts/metadata/sidecreateviewdefs.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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".
|
||||
*********************************************************************************/
|
||||
$viewdefs['EcmCharts']['SideQuickCreate'] = array(
|
||||
'templateMeta' => array('form'=>array('buttons'=>array('SAVE'),
|
||||
'button_location'=>'bottom',
|
||||
'headerTpl'=>'include/EditView/header.tpl',
|
||||
'footerTpl'=>'include/EditView/footer.tpl',
|
||||
),
|
||||
'maxColumns' => '1',
|
||||
'panelClass'=>'none',
|
||||
|
||||
'labelsOnTop'=>true,
|
||||
'widths' => array(
|
||||
array('label' => '10', 'field' => '30'),
|
||||
),
|
||||
),
|
||||
'panels' =>array (
|
||||
'DEFAULT' =>
|
||||
array (
|
||||
array (
|
||||
array('name'=>'name', 'displayParams'=>array('size'=>20, 'required'=>true)),
|
||||
),
|
||||
array(
|
||||
array('name'=>'value', 'displayParams'=>array('size'=>20)),
|
||||
),
|
||||
array (
|
||||
array('name'=>'assigned_user_name', 'displayParams'=>array('required'=>true, 'size'=>11, 'selectOnly'=>true)),
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
65
modules/EcmCharts/metadata/studio.php
Normal file
65
modules/EcmCharts/metadata/studio.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$GLOBALS['studioDefs']['EcmCharts'] = array(
|
||||
'LBL_DETAILVIEW'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmCharts/DetailView.html',
|
||||
'php_file'=>'modules/EcmCharts/DetailView.php',
|
||||
'type'=>'DetailView',
|
||||
),
|
||||
'LBL_EDITVIEW'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmCharts/EditView.html',
|
||||
'php_file'=>'modules/EcmCharts/EditView.php',
|
||||
'type'=>'EditView',
|
||||
),
|
||||
'LBL_LISTVIEW'=>array(
|
||||
'template'=>'listview',
|
||||
'meta_file'=>'modules/EcmCharts/listviewdefs.php',
|
||||
'type'=>'ListView',
|
||||
),
|
||||
'LBL_SEARCHFORM'=>array(
|
||||
'template'=>'xtpl',
|
||||
'template_file'=>'modules/EcmCharts/SearchForm.html',
|
||||
'php_file'=>'modules/EcmCharts/ListView.php',
|
||||
'type'=>'SearchForm',
|
||||
),
|
||||
|
||||
);
|
||||
42
modules/EcmCharts/metadata/subpaneldefs.php
Normal file
42
modules/EcmCharts/metadata/subpaneldefs.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Layout definition for EcmCharts
|
||||
*
|
||||
* 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".
|
||||
*/
|
||||
|
||||
$layout_defs['EcmCharts']['subpanel_setup'] = array(
|
||||
);
|
||||
?>
|
||||
91
modules/EcmCharts/metadata/subpanels/default.php
Normal file
91
modules/EcmCharts/metadata/subpanels/default.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||
/**
|
||||
* Subpanel Layout definition for EcmCharts
|
||||
*
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
$subpanel_layout = array(
|
||||
'top_buttons' => array(
|
||||
array('widget_class' => 'SubPanelTopCreateButton'),
|
||||
array('widget_class' => 'SubPanelTopSelectButton', 'popup_module' => 'EcmCharts'),
|
||||
),
|
||||
|
||||
'where' => '',
|
||||
|
||||
|
||||
|
||||
'list_fields' => array(
|
||||
'ecmchart_number'=>array(
|
||||
'vname' => 'LBL_LIST_NUMBER',
|
||||
'width' => '5%',
|
||||
),
|
||||
|
||||
'name'=>array(
|
||||
'vname' => 'LBL_LIST_SUBJECT',
|
||||
'widget_class' => 'SubPanelDetailViewLink',
|
||||
'width' => '50%',
|
||||
),
|
||||
'status'=>array(
|
||||
'vname' => 'LBL_LIST_STATUS',
|
||||
'width' => '15%',
|
||||
),
|
||||
'type'=>array(
|
||||
'vname' => 'LBL_LIST_TYPE',
|
||||
'width' => '15%',
|
||||
),
|
||||
'priority'=>array(
|
||||
'vname' => 'LBL_LIST_PRIORITY',
|
||||
'width' => '11%',
|
||||
),
|
||||
'assigned_user_name' => array (
|
||||
'name' => 'assigned_user_name',
|
||||
'vname' => 'LBL_LIST_ASSIGNED_TO_NAME',
|
||||
),
|
||||
'edit_button'=>array(
|
||||
'widget_class' => 'SubPanelEditButton',
|
||||
'module' => 'EcmCharts',
|
||||
'width' => '4%',
|
||||
),
|
||||
'remove_button'=>array(
|
||||
'widget_class' => 'SubPanelRemoveButton',
|
||||
'module' => 'EcmCharts',
|
||||
'width' => '5%',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
214
modules/EcmCharts/tpls/AnnualSalesChart.tpl
Normal file
214
modules/EcmCharts/tpls/AnnualSalesChart.tpl
Normal file
@@ -0,0 +1,214 @@
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
.buttons {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
table tr td {
|
||||
padding: 5px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
<script type="text/javascript" src="modules/EcmCharts/javascript/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
$(document).ready(function(){
|
||||
function listenerFunction() {
|
||||
//location.reload();
|
||||
};
|
||||
|
||||
$("#chartTypeSelector").change(function() {
|
||||
if( $(this).val() == 'pie' )
|
||||
{
|
||||
$("#documentTypeSelector").val("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$("#documentTypeSelector").change(function(){
|
||||
if( $(this).val() == 'correct' && $("#chartTypeSelector").val() == 'pie' )
|
||||
{
|
||||
$("#chartTypeSelector").val("column");
|
||||
}
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<ul class="tablist" style="width:100%;">
|
||||
<li>
|
||||
<a class="current" href="#">{$LANG.LBL_CHARTOPTIONS}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="index.php" method="get" name="AnnualSalesChartOptions">
|
||||
<input type="hidden" name="module" value="EcmCharts" />
|
||||
<input type="hidden" name="action" value="AnnualSalesChart" />
|
||||
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_SELECT_YEAR}: </td>
|
||||
<td>
|
||||
<select name="year">
|
||||
{foreach from=$years item=y}
|
||||
<option value="{$y}" { if $y == $year || $year == ""} selected="true" {/if}>{$y}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_INCLUDED_DOCUMENT_TYPE}: </td>
|
||||
<td>
|
||||
<select id="documentTypeSelector" name="type">
|
||||
<option value="%" { if $type == "%" || $type == ""} selected="true" {/if}>{$LANG.LBL_NORMAL_AND_CORRECT}</option>
|
||||
<option value="normal" { if $type == "normal"} selected="true" {/if}>{$LANG.LBL_NORMAL_ONLY}</option>
|
||||
<option value="correct" { if $type == "correct"} selected="true" {/if}>{$LANG.LBL_CORRECT_ONLY}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
{* Search by contractor *}
|
||||
<td>{$LANG.LBL_CONTRACTOR}</td>
|
||||
<td>
|
||||
<input id="search_account_name" type="text" value="{$contractor_name}" name="account_name">
|
||||
<input id="search_account_id" type="hidden" value="{$contractor_id}" name="account_id">
|
||||
<input class="button" type="button" value="{$LANG.LBL_SELECT}" accesskey="T" title="Select [Alt+T]" value="" name="btn_account_name" onClick="getContractor()">
|
||||
|
||||
{* Open popup window to select contractor *}
|
||||
<script type="text/javascript">
|
||||
function getContractor()
|
||||
{ldelim}
|
||||
open_popup("Accounts", 600, 400, "", true, false,
|
||||
{ldelim}
|
||||
"call_back_function":"set_return","form_name":"AnnualSalesChartOptions","field_to_name_array":
|
||||
{ldelim}"id":"search_account_id","name":"search_account_name"{rdelim}
|
||||
{rdelim}, "single", true);
|
||||
{rdelim};
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Typ wykresu: </td>
|
||||
<td>
|
||||
<select id="chartTypeSelector" name="chartType">
|
||||
<option value="column" { if $chartType == "column" || $chartType == ""} selected="true" {/if}>{$LANG.LBL_CHARTTYPECOLUMN}</option>
|
||||
<option value="pie" { if $chartType == "pie"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEPIE}</option>
|
||||
<option value="area" { if $chartType == "area"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEAREA}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_VIEW_COMPARATIVE_DATA}: </td>
|
||||
<td>
|
||||
<input type="radio" name="comparativeData" value="enabled" { if $comparativeData == "enabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
<input type="radio" name="comparativeData" style="margin-left: 20px" value="disabled" { if $comparativeData == "disabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_NO}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input class="button" name="submit" value="{$LANG.LBL_GENERATECHART}" type="submit">
|
||||
<input class="button" name="clear" value="{$LANG.LBL_RESTOREDEFAULTPARAMETERS}" type="button" onclick="location.href='index.php?module=EcmCharts&action=AnnualSalesChart';">
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{*********************************************************************}
|
||||
{*************************** CHART TPL} ******************************}
|
||||
{*********************************************************************}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
.no-data {
|
||||
display: table;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.textCenter {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.textCenter span {
|
||||
font-size: 16px;
|
||||
border: 1px dashed #E03E3E;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 10px 10px 5px #AAAAAA;
|
||||
background-color: #FFDEDE;
|
||||
color: #E03E3E;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
<div id="annual_sales_chart" style="width: 100%; height: 400px;">
|
||||
<div class="no-data">
|
||||
<div class="textCenter">
|
||||
<span>
|
||||
{$LANG.LBL_NO_DATA_CHANGE_FILTER}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div id="annual_sales_chart" style="width: 100%; height: 1000px;"></div>
|
||||
{/if}
|
||||
|
||||
<!-- GOOGLE CHARTS API -->
|
||||
{if $chartOptions != ''}
|
||||
{literal}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script type="text/javascript" src="modules/EcmCharts/Dashlets/MyChartsSalesDashlet/js/salesChart.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Load the Visualization API and the piechart package.
|
||||
google.load('visualization', '1', {'packages':['corechart','geochart','table']});
|
||||
|
||||
function drawChart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Rok', {/literal}'{$LANG.LBL_SALE}'
|
||||
{if $comparativeData == 'enabled'} , '{$LANG.LBL_SALE_IN_PAST_YEAR}'{/if}
|
||||
{literal}],
|
||||
|
||||
{/literal}
|
||||
{$chartOptions}
|
||||
{literal}
|
||||
]);
|
||||
|
||||
var options = {
|
||||
{/literal}
|
||||
title: '{ $LANG.LBL_SALES_CHART_IN }{$year}',
|
||||
{literal}
|
||||
legend: {position: 'bottom', textStyle: {fontSize: 10}},
|
||||
tooltip:{textStyle:{fontSize:'12'}},
|
||||
vAxis:{title: {/literal}'{$LANG.LBL_VALUEOFSALES}'{literal},textStyle:{color: '#000000',fontSize: '13', paddingRight: '100',marginRight: '100'}},
|
||||
hAxis:{title:'',textStyle:{color: '#000000',fontSize: '13', paddingRight: '100',marginRight: '100'}}
|
||||
};
|
||||
|
||||
{/literal}
|
||||
{if $chartType == 'column' or $chartType == ''}
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('annual_sales_chart'));
|
||||
{elseif $chartType == 'pie'}
|
||||
var chart = new google.visualization.PieChart(document.getElementById('annual_sales_chart'));
|
||||
{else}
|
||||
var chart = new google.visualization.AreaChart(document.getElementById('annual_sales_chart'));
|
||||
{/if}
|
||||
{literal}
|
||||
|
||||
chart.draw(data, options);
|
||||
}
|
||||
|
||||
// sekunda opóźnienia, żeby zdążył wczytać się moduł "visualization"
|
||||
setTimeout(drawChart, 1000);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
95
modules/EcmCharts/tpls/QuickCreate.tpl
Normal file
95
modules/EcmCharts/tpls/QuickCreate.tpl
Normal file
@@ -0,0 +1,95 @@
|
||||
{*
|
||||
|
||||
/**
|
||||
* 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".
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*}
|
||||
|
||||
|
||||
<form name="ecmchartsQuickCreate" id="ecmchartsQuickCreate" method="POST" action="index.php">
|
||||
<input type="hidden" name="module" value="EcmCharts">
|
||||
<input type="hidden" name="email_id" value="{$REQUEST.email_id}">
|
||||
<input type="hidden" name="account_id" value="{$REQUEST.account_id}">
|
||||
<input type="hidden" name="case_id" value="{$REQUEST.acase_id}">
|
||||
<input type="hidden" name="contact_id" value="{$REQUEST.contact_id}">
|
||||
<input type="hidden" name="return_action" value="{$REQUEST.return_action}">
|
||||
<input type="hidden" name="return_module" value="{$REQUEST.return_module}">
|
||||
<input type="hidden" name="return_id" value="{$REQUEST.return_id}">
|
||||
<input type="hidden" name="action" value='Save'>
|
||||
<input type="hidden" name="duplicate_parent_id" value="{$REQUEST.duplicate_parent_id}">
|
||||
<input type="hidden" name="to_pdf" value='1'>
|
||||
<input id='assigned_user_id' name='assigned_user_id' type="hidden" value="{$ASSIGNED_USER_ID}" />
|
||||
|
||||
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="left" style="padding-bottom: 2px;">
|
||||
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" type="submit" name="button" {$saveOnclick|default:"onclick=\"return check_form('EcmChartsQuickCreate');\""} value=" {$APP.LBL_SAVE_BUTTON_LABEL} " >
|
||||
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" type="submit" name="button" {$cancelOnclick|default:"onclick=\"this.form.action.value='$RETURN_ACTION'; this.form.module.value='$RETURN_MODULE'; this.form.record.value='$RETURN_ID'\""} value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
|
||||
<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" type="submit" name="button" onclick="this.form.to_pdf.value='0';this.form.action.value='EditView'; this.form.module.value='EcmCharts';" value=" {$APP.LBL_FULL_FORM_BUTTON_LABEL} "></td>
|
||||
<td align="right" nowrap><span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tabForm">
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<th align="left" class="dataLabel" colspan="4"><h4 class="dataLabel"><slot>{$MOD.LBL_ECMCHART_INFORMATION}</slot></h4></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="dataLabel" width="15%"><slot>{$MOD.LBL_SUBJECT} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></slot></td>
|
||||
<td width="35%"><slot><textarea name='name' cols="40" tabindex='1' rows="1">{$NAME}</textarea></slot></td>
|
||||
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_TYPE}</slot></td>
|
||||
<td width="35%"><slot><select tabindex='2' name='type'>{$TYPE_OPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="dataLabel" rowspan="2" width="15%"><slot>{$MOD.LBL_DESCRIPTION}</slot></td>
|
||||
<td rowspan="2" width="35%"><slot><textarea name='description' tabindex='1' cols="40" rows="4">{$DESCRIPTION}</textarea></slot></td>
|
||||
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_PRIORITY}</slot></td>
|
||||
<td class="dataField" nowrap width="35%"><slot><select tabindex='2' name='priority'>{$PRIORITY_OPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="dataLabel" width="15%"><slot>{$MOD.LBL_STATUS}</slot></td>
|
||||
<td width="35%"><slot><select tabindex='2' name='status'>{$STATUS_OPTIONS}</select></slot></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<script>
|
||||
{$additionalScripts}
|
||||
</script>
|
||||
230
modules/EcmCharts/tpls/SalesChart.tpl
Normal file
230
modules/EcmCharts/tpls/SalesChart.tpl
Normal file
@@ -0,0 +1,230 @@
|
||||
<style type="text/css">
|
||||
{literal}
|
||||
.buttons {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
table tr td {
|
||||
padding: 5px;
|
||||
}
|
||||
{/literal}
|
||||
</style>
|
||||
<script type="text/javascript" src="modules/EcmCharts/javascript/jquery-2.1.1.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
$(document).ready(function(){
|
||||
function listenerFunction() {
|
||||
//location.reload();
|
||||
};
|
||||
|
||||
$("#chartTypeSelector").change(function() {
|
||||
if( $(this).val() == 'pie' )
|
||||
{
|
||||
$("#documentTypeSelector").val("normal");
|
||||
}
|
||||
});
|
||||
|
||||
$("#documentTypeSelector").change(function(){
|
||||
if( $(this).val() != 'normal' && $("#chartTypeSelector").val() == 'pie' )
|
||||
{
|
||||
$("#chartTypeSelector").val("column");
|
||||
}
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
<ul class="tablist" style="width:100%;">
|
||||
<li>
|
||||
<a class="current" href="#">{$LANG.LBL_CHARTOPTIONS}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form action="index.php" method="get" name="SalesChartOptions">
|
||||
<input type="hidden" name="module" value="EcmCharts" />
|
||||
<input type="hidden" name="action" value="SalesChart" />
|
||||
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0" cellspacing="0">
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_FROM}: </td>
|
||||
<td>
|
||||
{* Search by date_from *}
|
||||
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title="" value="{$date_from}" autocomplete="off">
|
||||
<img id="date_from_trigger" border="0" align="absmiddle" alt="Enter Date" src="themes/default/images/jscalendar.gif">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "date_from",
|
||||
daFormat : "{$dateFormat}",
|
||||
button : "date_from_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
<td> {$LANG.LBL_TO}: </td>
|
||||
<td>
|
||||
{* Search by date_to *}
|
||||
<input autocomplete="off" name="date_to" id="date_to" value="{$date_to}" title="" tabindex="" size="11" maxlength="10" type="text">
|
||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger" align="absmiddle" border="0">
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
Calendar.setup ({ldelim}
|
||||
inputField : "date_to",
|
||||
daFormat : "{$dateFormat}",
|
||||
button : "date_to_trigger",
|
||||
singleClick : true,
|
||||
dateStr : "",
|
||||
step : 1
|
||||
{rdelim}
|
||||
);
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_SHOW}: </td>
|
||||
<td>
|
||||
<select name="detail">
|
||||
<option value="category" { if $detail == "category" || $detail == ""} selected="true" {/if} >Kategorii</option>
|
||||
<option value="subcategory" { if $detail=="subcategory"} selected {/if} >Podkategorii</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<td>{$LANG.LBL_INCLUDED_DOCUMENT_TYPE}: </td>
|
||||
<td>
|
||||
<select id="documentTypeSelector" name="type">
|
||||
<option value="%" { if $type == "%" || $type == ""} selected="true" {/if}>Faktury i korekty</option>
|
||||
<option value="normal" { if $type == "normal"} selected="true" {/if}>Faktury</option>
|
||||
<option value="correct" { if $type == "correct"} selected="true" {/if}>Korekty</option>
|
||||
</select>
|
||||
</td>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>{$LANG.LBL_CHARTTYPE}: </td>
|
||||
<td>
|
||||
<select id="chartTypeSelector" name="chartType">
|
||||
<option value="column" { if $chartType == "column" || $chartType == ""} selected="true" {/if}>{$LANG.LBL_CHARTTYPECOLUMN}</option>
|
||||
<option value="pie" { if $chartType == "pie"} selected="true" {/if}>{$LANG.LBL_CHARTTYPEPIE}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<td>{$LANG.LBL_VIEW_COMPARATIVE_DATA}: </td>
|
||||
<td>
|
||||
<input type="radio" name="comparativeData" value="enabled" { if $comparativeData == "enabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
<input type="radio" name="comparativeData" style="margin-left: 20px" value="disabled" { if $comparativeData == "disabled" || $comparativeData == "" } checked {/if}> {$LANG.LBL_YES}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<input class="button" name="submit" value="{$LANG.LBL_GENERATECHART}" type="submit">
|
||||
<input class="button" name="clear" value="{$LANG.LBL_RESTOREDEFAULTPARAMETERS}" type="button" onclick="location.href='index.php?module=EcmCharts&action=SalesChart';">
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{*********************************************************************}
|
||||
{*************************** CHART TPL} ******************************}
|
||||
{*********************************************************************}
|
||||
|
||||
{if $chartOptions == ''}
|
||||
{literal}
|
||||
<style type="text/css">
|
||||
.no-data {
|
||||
display: table;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.textCenter {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
.textCenter span {
|
||||
font-size: 16px;
|
||||
border: 1px dashed #E03E3E;
|
||||
padding: 10px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 10px 10px 5px #AAAAAA;
|
||||
background-color: #FFDEDE;
|
||||
color: #E03E3E;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
{if $chartOptions == ''}
|
||||
<div id="sales_chart" style="width: 100%; height: 400px;">
|
||||
<div class="no-data">
|
||||
<div class="textCenter">
|
||||
<span>
|
||||
Brak danych od {$date_from} do {$date_to}, wybierz inny przedział dat.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
<div id="sales_chart" style="width: 100%; height: 1000px;"></div>
|
||||
{/if}
|
||||
<br><br>
|
||||
|
||||
<!-- GOOGLE CHARTS API -->
|
||||
{if $chartOptions != ''}
|
||||
{literal}
|
||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="modules/EcmCharts/Dashlets/MyChartsSalesDashlet/js/salesChart.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// Load the Visualization API and the piechart package.
|
||||
google.load('visualization', '1', {'packages':['corechart','geochart','table']});
|
||||
|
||||
function drawChart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Kategoria', 'Sprzedaż w aktualnym roku'{/literal}
|
||||
{if $comparativeData == 'enabled'} , 'Sprzedaż z poprzedniego roku'{/if}
|
||||
{literal}],
|
||||
|
||||
{/literal}
|
||||
{$chartOptions}
|
||||
{literal}
|
||||
]);
|
||||
|
||||
var options = {
|
||||
{/literal}
|
||||
title: '{$LANG.LBL_CHARTSALES} {$LANG.LBL_FROM} {$date_from} {$LANG.LBL_TO} {$date_to}',
|
||||
{literal}
|
||||
hAxis: {title: {/literal}{if $detail == 'category'}'Kategoria'{else}'Podkategoria'{/if}{literal}, titleTextStyle: {color: 'red'}},
|
||||
legend: {position: 'bottom', textStyle: {fontSize: 10}},
|
||||
tooltip:{textStyle:{fontSize:'12'}},
|
||||
vAxis:{title: {/literal}'{$LANG.LBL_VALUEOFSALES}'{literal},textStyle:{color: '#000000',fontSize: '13', paddingRight: '100',marginRight: '100'}},
|
||||
hAxis:{title:'',textStyle:{color: '#000000',fontSize: '13', paddingRight: '100',marginRight: '100'}}
|
||||
};
|
||||
|
||||
{/literal}
|
||||
{if $chartType == 'column' || $chartType == ''}
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('sales_chart'));
|
||||
{else}
|
||||
var chart = new google.visualization.PieChart(document.getElementById('sales_chart'));
|
||||
{/if}
|
||||
|
||||
{literal}
|
||||
|
||||
chart.draw(data, options);
|
||||
|
||||
}
|
||||
|
||||
// sekunda opóźnienia, żeby zdążył wczytać się moduł "visualization"
|
||||
setTimeout(drawChart, 1000);
|
||||
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
||||
88
modules/EcmCharts/vardefs.php
Normal file
88
modules/EcmCharts/vardefs.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?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".
|
||||
********************************************************************************/
|
||||
$dictionary['EcmChart']=array(
|
||||
'table'=>'ecmcharts',
|
||||
'audited'=>true,
|
||||
'comment'=>'EcmCharts',
|
||||
'duplicate_merge'=>true ,
|
||||
'unified_search'=>true,
|
||||
'fields'=>array(
|
||||
'name'=>array(
|
||||
'name'=>'name',
|
||||
'vname'=>'LBL_NAME',
|
||||
'type'=>'varchar',
|
||||
'len'=>'255',
|
||||
),
|
||||
),
|
||||
'indices'=>array(
|
||||
array('name'=>'idx_ecmchart_id_del','type'=>'index','fields'=>array('id','deleted')),
|
||||
array('name'=>'idx_ecmchart_assigned_del','type'=>'index','fields'=>array( 'deleted', 'assigned_user_id')),
|
||||
),
|
||||
'relationships'=>array(
|
||||
'ecmcharts_assigned_user'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmCharts',
|
||||
'rhs_table'=>'ecmcharts',
|
||||
'rhs_key'=>'assigned_user_id',
|
||||
'relationship_type'=>'one-to-many'
|
||||
),
|
||||
'ecmcharts_modified_user'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmCharts',
|
||||
'rhs_table'=>'ecmcharts',
|
||||
'rhs_key'=>'modified_user_id',
|
||||
'relationship_type'=>'one-to-many'
|
||||
),
|
||||
'ecmcharts_created_by'=>array(
|
||||
'lhs_module'=>'Users',
|
||||
'lhs_table'=>'users',
|
||||
'lhs_key'=>'id',
|
||||
'rhs_module'=>'EcmCharts',
|
||||
'rhs_table'=>'ecmcharts',
|
||||
'rhs_key'=>'created_by',
|
||||
'relationship_type'=>'one-to-many'
|
||||
)
|
||||
),
|
||||
'optimistic_locking'=>true,
|
||||
);
|
||||
require_once('include/SugarObjects/VardefManager.php');
|
||||
VardefManager::createVardef('EcmCharts','EcmChart', array('default','assignable'));
|
||||
?>
|
||||
Reference in New Issue
Block a user