summaryrefslogtreecommitdiff
path: root/views/mods/mod_statistics/chartsalestopaymentmethod/all.phtml
blob: 9b5fe3a901debd64202029f23f50fe2b21fd5c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/simplefilter.phtml'); ?>

<?php if (wpsg_isSizedArray($this->view['chart']['data']['records'])) { ?>

<div id="chartsalestopaymentmethod-bar" style="height:<?php echo $this->get_option('wpsg_mod_statistics_bar_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_bar_chart_width'); ?>px;"></div>

<br/>
<h3><?php echo __('Anteile (prozentual)', 'wpsg'); ?></h3>
<div id="chartsalestopaymentmethod-pie" style="height:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_bar_chart_width'); ?>px;"></div>

<br/>

<div id="table-data">
	<?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/chartsalestopaymentmethod/data.phtml'); ?>	
</div>

<div class="wpsg_clearer"></div>
	
<?php 
	$barChartJS = Array();
	$pieChartJS = Array();
	$barChartJS['amount'] = '';
	$barChartJS['payment'] = '';
	$barChartJS['total'] = '';

	$pieChartJS['amount'] = '';
	$pieChartJS['sales'] = '';
	$pieChartJS['percent'] = '';
	
	foreach ($this->view['chart']['data']['records'] as $data) 
	{ 
		$barChartJS['payment'] .= "'".wpsg_hspc($data['name'])."', "; 
		$barChartJS['total'] .= wpsg_hspc($data['total']).", "; 
		$pieChartJS['percent'] .= "['".wpsg_hspc($data['name'])."', ".wpsg_hspc($data['percent'])."], ";
	} 
	
	$barChartJS['payment'] = substr($barChartJS['payment'], 0, -2); 
	$barChartJS['total'] = substr($barChartJS['total'], 0, -2); 
	$pieChartJS['percent'] = substr($pieChartJS['percent'], 0, -2);

?>

<script type="text/javascript">
	jQuery(document).ready(function()
	{

		jQuery.jqplot.config.enablePlugins = true;
	    var totals = [<?php echo $barChartJS['total']; ?>];
	    var payment = [<?php echo $barChartJS['payment']; ?>];
	     
	    var chartsalestopaymentmethodBar = jQuery.jqplot('chartsalestopaymentmethod-bar', [totals], {
	        animate: !jQuery.jqplot.use_excanvas,
	        seriesDefaults:{
	            renderer:jQuery.jqplot.BarRenderer,
	            rendererOptions: {
                	varyBarColor: true
              	},          
	            pointLabels: { show: true }
	        },
	        axesDefaults: {
	            labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer
	        },
	        axes: {
	            xaxis: {
	                renderer: jQuery.jqplot.CategoryAxisRenderer,
	                ticks: payment,
	                label:'<?php echo wpsg_hspc(wpsg_getStr($this->view['chart']['info']['xaxis']['label'])); ?>'
	            },
	            yaxis:{
	                label:'<?php echo wpsg_hspc($this->view['chart']['info']['yaxis']['label']); ?>',
	                tickOptions: {
	            		formatter: wpsg_statistics_number_format
                	},
    				min:0
	            }
	        },
	        highlighter: { show: false }
	    });

	    var data = [<?php echo $pieChartJS['percent']; ?>];
		  
	  	var chartsalestopaymentmethodPie = jQuery.jqplot ('chartsalestopaymentmethod-pie', [data],
	    {
	      seriesDefaults: {
	        renderer: jQuery.jqplot.PieRenderer,
	        rendererOptions: { padding: 50, sliceMargin: 4, showDataLabels: true } 
	      },
	      legend: { show:true, location: 'e' }
	    }
	  	);

	  	wpsg_statistic_addExportButton();
	    
	});
</script>


<?php } else { ?>
<?php echo __('Keine Daten zur Auswertung vorhanden.', 'wpsg'); ?>
<?php } ?>