75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?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' );
|
|
?>
|