summaryrefslogtreecommitdiff
path: root/views/mods/mod_statistics/charttopsellertosales/all.phtml
blob: 6544b94bc98f2b53ad67904e7c5d8979b9f8d1f4 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php $this->render(WPSG_PATH_VIEW.'/mods/mod_statistics/simplefilter.phtml'); ?>

<?php if (wpsg_isSizedArray($this->view['chart']['data']['records'])) { ?>
<div id="charttopsellertosales-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 __('Umsatz (prozentual)', 'wpsg'); ?><h3>
<div id="charttopsellertosales-pie-sales" style="height:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_height'); ?>px; width:<?php echo $this->get_option('wpsg_mod_statistics_pie_chart_width'); ?>px;"></div>

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

<br/>

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

<div class="wpsg_clearer"></div>

<?php 
	$barChartJS = Array();
	$pieChartJS = Array();
	$barChartJS['amount'] = '';
	$barChartJS['payment'] = '';
	$barChartJS['total'] = '';
	
	$pieChartJS['amount'] = '';
	$pieChartJS['sales'] = '';
	
	foreach ($this->view['chart']['data']['records'] as $data) 
	{ 
		$barChartJS['payment'] .= "'".wpsg_hspc($data['name'])."', "; 
		$barChartJS['amount'] .= "['".wpsg_hspc($data['name'])."','".wpsg_hspc($data['amount'])."'], "; 
		$barChartJS['total'] .= wpsg_hspc($data['total']).", "; 
		$pieChartJS['amount'] .= "['".wpsg_hspc($data['name'])."', ".wpsg_hspc($data['percent-amount'])."], ";	
		$pieChartJS['sales'] .= "['".wpsg_hspc($data['name'])."', ".wpsg_hspc($data['percent-sales'])."], ";		
	} 
	
	$barChartJS['amount'] = substr($barChartJS['amount'], 0, -2);
	$barChartJS['payment'] = substr($barChartJS['payment'], 0, -2); 
	$barChartJS['total'] = substr($barChartJS['total'], 0, -2); 
	
	$pieChartJS['amount'] = substr($pieChartJS['amount'], 0, -2);
	$pieChartJS['sales'] = substr($pieChartJS['sales'], 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 amount = [<?php echo $barChartJS['amount']; ?>];

	   //eries:[{renderer:jQuery.jqplot.BarRenderer}, {xaxis:'x2axis', yaxis:'y2axis'}],
			     
	    var charttopsellertosalesBar = jQuery.jqplot('charttopsellertosales-bar', [totals, amount], {
	        animate: !jQuery.jqplot.use_excanvas,
	        axesDefaults: {
	            labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer
	        },
	        /*{Each series has same options as seriesDefaults},
	        {You can override each series individually here}*/
	        series:[
	    	     {
	    	    	 renderer:jQuery.jqplot.BarRenderer,
	    	    	 rendererOptions: {
	                	varyBarColor: true
	              	},
	              	pointLabels: { show: true }
		    	 }, 
	    	     {
		    	     xaxis:'x2axis', 
		    	     yaxis:'y2axis'
			   	 }
   	    	],
   	    	grid: {
	        	drawGridLines: false
	        },
	        axes: {
	            xaxis: {
	                renderer: jQuery.jqplot.CategoryAxisRenderer,
	                ticks: payment,
	                tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
	                tickOptions: {
	                    angle: -50,
	                    fontFamily: 'Arial',
                        fontSize: '10pt',
                        fontWeight: 'normal',
                        textColor: '#666666'
	                },
	                label:'<?php echo wpsg_hspc(wpsg_getStr($this->view['chart']['info']['xaxis']['label'])); ?>',
	                labelOptions: {
                        fontFamily: 'Arial',
                        fontSize: '14pt',
                        fontWeight: 'bold',
                        textColor: '#666666'
                    }
	            },
	            x2axis: {
	                renderer: jQuery.jqplot.CategoryAxisRenderer,
	                label: '',
	                labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
	                tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
	                showMarker: false,
	                showTickMarks:false,
	                showticks: false,
	                tickOptions: {
	                }
	            },
	            yaxis:{
	                label:'<?php echo wpsg_hspc($this->view['chart']['info']['yaxis']['label']); ?>',
	                tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
	                tickOptions: {
	                    fontFamily: 'Arial',
                        fontSize: '8pt',
                        fontWeight: 'normal',
                        textColor: '#666666',
                        formatter: wpsg_statistics_number_format
	                },
        			min:0
	            },
	            y2axis: {
	                label: '<?php echo __('Menge', 'wpsg'); ?>',
	                labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
	                tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
	                tickOptions: {
	                	showGridline: false,
	                    fontFamily: 'Arial',
	                    fontSize: '8pt',
	                    fontWeight: 'normal',
	                    textColor: '#666666',
	                    formatter: wpsg_statistics_integer_format
	                },
	                min:0,
	                max: <?php echo $this->view['chart']['data']['y2max']; ?>,
	            }
	        },
	        highlighter: { show: false }
	    });

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

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

<style type="text/css">
	.jqplot-x2axis { display:none; }
</style>

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