Made currency showing configurable from the controller (#342)

This commit is contained in:
FrancescoUK
2016-05-25 23:10:43 +01:00
parent 3c25a9ba8d
commit 9ae5957473
5 changed files with 106 additions and 25 deletions

View File

@@ -417,7 +417,8 @@ class Reports extends Secure_area
"series_data_1" => $series,
"summary_data_1" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type)),
"yaxis_title" => $this->lang->line('reports_revenue'),
"xaxis_title" => $this->lang->line('reports_date')
"xaxis_title" => $this->lang->line('reports_date'),
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -447,7 +448,8 @@ class Reports extends Secure_area
"series_data_1" => $series,
"summary_data_1" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type)),
"yaxis_title" => $this->lang->line('reports_items'),
"xaxis_title" => $this->lang->line('reports_revenue')
"xaxis_title" => $this->lang->line('reports_revenue'),
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -476,7 +478,8 @@ class Reports extends Secure_area
"chart_type" => "reports/graphs/pie",
"labels_1" => $labels,
"series_data_1" => $series,
"summary_data_1" => $summary
"summary_data_1" => $summary,
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -505,7 +508,8 @@ class Reports extends Secure_area
"chart_type" => "reports/graphs/pie",
"labels_1" => $labels,
"series_data_1" => $series,
"summary_data_1" => $summary
"summary_data_1" => $summary,
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -534,7 +538,8 @@ class Reports extends Secure_area
"chart_type" => "reports/graphs/pie",
"labels_1" => $labels,
"series_data_1" => $series,
"summary_data_1" => $summary
"summary_data_1" => $summary,
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -563,7 +568,8 @@ class Reports extends Secure_area
"chart_type" => "reports/graphs/pie",
"labels_1" => $labels,
"series_data_1" => $series,
"summary_data_1" => $summary
"summary_data_1" => $summary,
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -593,7 +599,8 @@ class Reports extends Secure_area
"series_data_1" => $series,
"summary_data_1" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type)),
"yaxis_title" => $this->lang->line('reports_customers'),
"xaxis_title" => $this->lang->line('reports_revenue')
"xaxis_title" => $this->lang->line('reports_revenue'),
"show_currency" => true
);
$this->load->view("reports/graphical", $data);
@@ -623,7 +630,8 @@ class Reports extends Secure_area
"series_data_1" => $series,
"summary_data_1" => $model->getSummaryData(array('start_date'=>$start_date, 'end_date'=>$end_date, 'sale_type'=>$sale_type)),
"yaxis_title" => $this->lang->line('reports_count'),
"xaxis_title" => $this->lang->line('reports_discount_percent')
"xaxis_title" => $this->lang->line('reports_discount_percent'),
"show_currency" => false
);
$this->load->view("reports/graphical", $data);
@@ -652,7 +660,8 @@ class Reports extends Secure_area
"chart_type" => "reports/graphs/pie",
"labels_1" => $labels,
"series_data_1" => $series,
"summary_data_1" => $summary
"summary_data_1" => $summary,
"show_currency" => true
);
$this->load->view("reports/graphical", $data);

View File

@@ -32,7 +32,34 @@
// Y-Axis specific configuration
axisY: {
// Lets offset the chart a bit from the labels
offset: 60
offset: 60,
// The label interpolation function enables you to modify the values
// used for the labels on each axis.
labelInterpolationFnc: function(value) {
<?php
if( $show_currency )
{
if( $this->config->item('currency_side') )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
<?php
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
<?php
}
}
else
{
?>
return value;
<?php
}
?>
}
},
// plugins configuration

View File

@@ -34,16 +34,25 @@
// used for the labels on each axis.
labelInterpolationFnc: function(value) {
<?php
if( $this->config->item('currency_side') )
if( $show_currency )
{
if( $this->config->item('currency_side') )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
<?php
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
<?php
}
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
return value;
<?php
}
?>

View File

@@ -43,16 +43,25 @@
// used for the labels on each axis.
labelInterpolationFnc: function(value) {
<?php
if( $this->config->item('currency_side') )
if( $show_currency )
{
if( $this->config->item('currency_side') )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
<?php
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
<?php
}
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
return value;
<?php
}
?>
@@ -87,16 +96,25 @@
textAnchor: 'middle',
labelInterpolationFnc: function(value) {
<?php
if( $this->config->item('currency_side') )
if( $show_currency )
{
if( $this->config->item('currency_side') )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
<?php
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
<?php
}
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
return value;
<?php
}
?>
@@ -107,16 +125,25 @@
pointClass: 'ct-tooltip-point',
transformTooltipTextFnc: function(value) {
<?php
if( $this->config->item('currency_side') )
if( $show_currency )
{
if( $this->config->item('currency_side') )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
<?php
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
<?php
}
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
return value;
<?php
}
?>

View File

@@ -26,16 +26,25 @@
Chartist.plugins.tooltip({
transformTooltipTextFnc: function(value) {
<?php
if( $this->config->item('currency_side') )
if( $show_currency )
{
if( $this->config->item('currency_side') )
{
?>
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
return value + '<?php echo $this->config->item('currency_symbol'); ?>';
<?php
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
<?php
}
}
else
{
?>
return '<?php echo $this->config->item('currency_symbol'); ?>' + value;
return value;
<?php
}
?>