gest366/modules/pannello/edit.php

162 lines
5.9 KiB
PHP

<?php
include_once(__DIR__."/../../core.php");
$pageTitle = "Info";
include_once (__DIR__."/../../lib/function_home.php");
$_SESSION['pan_dimensione'] = 6;
$rs_profilo = $dbo->fetchArray("SELECT vedo_avvisi , vedo_news FROM zz_utenti WHERE idutente=\"".$_SESSION['idutente']."\"");
$rs_pannelli= $dbo->fetchArray("SELECT * FROM `zz_utenti_righe` WHERE idutente='".$_SESSION['idutente']."' order by id");
$tot_art = sizeof($rs_pannelli);
if( $rs_profilo[0]['vedo_avvisi'] == 1 ){
include ($docroot . "/modules/pannello/avvisi.php");
}
?>
<div class="box-body">
<?php
for( $i=0; $i<$tot_art; $i++ ){
if( $rs_pannelli[$i]['idpannello'] == '1' ) $pan_grafico=1;
if( $rs_pannelli[$i]['idpannello'] == '2' ) $pan_ultimi_10_e=1;
if( $rs_pannelli[$i]['idpannello'] == '3' ) $pan_ultimi_10_u=1;
if( $rs_pannelli[$i]['idpannello'] == '4' ) $pan_incasso=1;
if( $rs_pannelli[$i]['idpannello'] == '5' ) $pan_insoluti=1;
if( $rs_pannelli[$i]['idpannello'] == '6' ) $pan_articoli=1;
?>
<?php
if( $pan_grafico == 1){
$_SESSION['pan_dimensione'] = $rs_pannelli[$i]['dimensione'];
include ($docroot . "/modules/pannello/pan_grafico.php");
}
?>
<?php
if( $pan_ultimi_10_e == 1){
$_SESSION['pan_dimensione'] = $rs_pannelli[$i]['dimensione'];
include ($docroot . "/modules/pannello/pan_ultimi_e.php");
}
?>
<?php
if( $pan_ultimi_10_u == 1){
$_SESSION['pan_dimensione'] = $rs_pannelli[$i]['dimensione'];
include ($docroot . "/modules/pannello/pan_ultimi_u.php");
}
?>
<?php
if( $pan_insoluti == 1){
$_SESSION['pan_dimensione'] = $rs_pannelli[$i]['dimensione'];
include ($docroot . "/modules/pannello/pan_insoluti.php");
}
?>
<?php
if( $pan_incasso == 1){
$_SESSION['pan_dimensione'] = $rs_pannelli[$i]['dimensione'];
include ($docroot . "/modules/pannello/pan_incasso.php");
}
?>
<?php
if( $pan_articoli == 1){
$_SESSION['pan_dimensione'] = $rs_pannelli[$i]['dimensione'];
include ($docroot . "/modules/pannello/pan_articoli.php");
}
?>
<?php
$_SESSION['pan_dimensione'] = 6;
$pan_grafico=0;
$pan_ultimi_10_e=0;
$pan_ultimi_10_u=0;
$pan_incasso=0;
$pan_insoluti=0;
$pan_articoli=0;
}
?>
</div>
<script src="plugins/chartjs/Chart.min.js"></script>
<script>
$(function () {
var areaChartData = {
labels: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],
datasets: [
{
label: "Acquisti",
fillColor: "rgba(210, 214, 222, 1)",
strokeColor: "rgba(210, 214, 222, 1)",
pointColor: "rgba(210, 214, 222, 1)",
pointStrokeColor: "#c1c7d1",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [<?php echo sum_purchases_month(1);?>, <?php echo sum_purchases_month(2);?>, <?php echo sum_purchases_month(3);?>, <?php echo sum_purchases_month(4);?>, <?php echo sum_purchases_month(5);?>, <?php echo sum_purchases_month(6);?>, <?php echo sum_purchases_month(7);?>,<?php echo sum_purchases_month(8);?>,<?php echo sum_purchases_month(9);?>,<?php echo sum_purchases_month(10);?>,<?php echo sum_purchases_month(11);?>,<?php echo sum_purchases_month(12);?>]
},
{
label: "Vendite",
fillColor: "rgba(60,141,188,0.9)",
strokeColor: "rgba(60,141,188,0.8)",
pointColor: "#3b8bba",
pointStrokeColor: "rgba(60,141,188,1)",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(60,141,188,1)",
data: [<?php echo sum_sales_month(1);?>, <?php echo sum_sales_month(2);?>, <?php echo sum_sales_month(3);?>, <?php echo sum_sales_month(4);?>, <?php echo sum_sales_month(5);?>, <?php echo sum_sales_month(6);?>, <?php echo sum_sales_month(7);?>,<?php echo sum_sales_month(8);?>,<?php echo sum_sales_month(9);?>,<?php echo sum_sales_month(10);?>,<?php echo sum_sales_month(11);?>,<?php echo sum_sales_month(12);?>]
}
]
};
//-------------
//- BAR CHART -
//-------------
var barChartCanvas = $("#barChart").get(0).getContext("2d");
var barChart = new Chart(barChartCanvas);
var barChartData = areaChartData;
barChartData.datasets[1].fillColor = "#00a65a";
barChartData.datasets[1].strokeColor = "#00a65a";
barChartData.datasets[1].pointColor = "#00a65a";
var barChartOptions = {
scaleBeginAtZero: true,
scaleShowGridLines: true,
scaleGridLineColor: "rgba(0,0,0,.05)",
scaleGridLineWidth: 1,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: true,
barShowStroke: true,
barStrokeWidth: 2,
barValueSpacing: 5,
barDatasetSpacing: 1,
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
//Boolean - whether to make the chart responsive
responsive: true,
maintainAspectRatio: true
};
barChartOptions.datasetFill = false;
barChart.Bar(barChartData, barChartOptions);
});
</script>