init
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user