255 lines
5.3 KiB
PHP
255 lines
5.3 KiB
PHP
<?php
|
|
|
|
|
|
|
|
require_once 'MonitoringVMHeader.php';
|
|
|
|
require_once 'MonitoringDBRequest.php';
|
|
|
|
|
|
|
|
if(isset($_POST['year'])){
|
|
|
|
$year = $_POST['year'];
|
|
|
|
}
|
|
|
|
$result = getResultatSPWilaya($year,$roleid);
|
|
|
|
|
|
|
|
echo getMonitoringMainBar(6,$roleid).getMonitoringSuperviseurSubBar(1).
|
|
|
|
'<div class="main-container main-container-Accounts">
|
|
|
|
<div id="scrollbar" style="margin:15px 15px 15px 15px; border:1px solid #ecf0f1; overflow-y: scroll; overflow-x: scroll; height:462.709px ;border:1px solid #bdc3c7;">'.
|
|
|
|
getTopTextSelect('Nombre de visites par produit en', $year).
|
|
|
|
'<hr>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-4">
|
|
|
|
<label for="Produit">Wilaya</label>
|
|
|
|
<input class="form-control mb-4 w-20" type="text" name="Produit" placeholder="Rechercher" onKeyUp="ProduitFiltre(this)">
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
echo '<table id="tabcenter" class="table table-bordered table-striped" >
|
|
|
|
<tr class="center borderline">
|
|
|
|
|
|
|
|
<th id="productname" >Produit</th>
|
|
|
|
|
|
|
|
<th> janvier</th>
|
|
|
|
|
|
|
|
<th> février</th>
|
|
|
|
|
|
|
|
<th> mars</th>
|
|
|
|
|
|
|
|
<th>avril</th>
|
|
|
|
|
|
|
|
<th> mai</th>
|
|
|
|
|
|
|
|
<th>juin</th>
|
|
|
|
|
|
|
|
<th>juillet</th>
|
|
|
|
|
|
|
|
<th> août</th>
|
|
|
|
|
|
|
|
<th> septembre</th>
|
|
|
|
|
|
|
|
<th> octobre</th>
|
|
|
|
|
|
|
|
<th>novembre</th>
|
|
|
|
|
|
|
|
<th>décembre</th>
|
|
|
|
|
|
|
|
<th>Total</th>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tbody id="values"></tbody>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</div></div>';
|
|
|
|
|
|
|
|
|
|
|
|
$viewer->view('CustomDashboardFooter.tpl');
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
function convertArray(data){
|
|
|
|
|
|
|
|
var a=[];
|
|
|
|
var c=[];
|
|
|
|
|
|
|
|
if(data.length > 0) {
|
|
|
|
|
|
|
|
for(var i = 0; i < data.length; i++){
|
|
|
|
|
|
|
|
var row = data[i];
|
|
|
|
|
|
|
|
if(row['month'] !== null && row['nbr'] !== null){
|
|
|
|
|
|
|
|
if(a.indexOf(row[0]) == -1){
|
|
|
|
var b=[0,0,0,0,0,0,0,0,0,0,0,0,0];
|
|
|
|
a.push(row[0]);
|
|
|
|
b[0]=row[0];
|
|
|
|
b[row['month']]=parseInt(row['nbr']);
|
|
|
|
c[a.length-1]=b;
|
|
|
|
|
|
|
|
} else{
|
|
|
|
|
|
|
|
b[row['month']]=parseInt(row['nbr']);
|
|
|
|
c[a.length-1]=b;
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
var b=[0,0,0,0,0,0,0,0,0,0,0,0,0];
|
|
|
|
a.push(row[0]);
|
|
|
|
b[0]=row[0];
|
|
|
|
c[a.length-1]=b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//console.log(c);
|
|
|
|
return c
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//filtre
|
|
|
|
function ProduitFiltre(e) {
|
|
|
|
var res = result.filter(a => a.productname.toUpperCase().includes(e.value.toUpperCase()) );
|
|
|
|
|
|
|
|
loadTable(convertArray(res));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function loadTable(data) {
|
|
|
|
|
|
|
|
$('#tabcenter tr').slice(1).remove();
|
|
|
|
|
|
|
|
if(data.length > 0) {
|
|
|
|
|
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
|
|
|
|
|
var row = data[i];
|
|
|
|
|
|
|
|
var click = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#tabcenter').append(
|
|
|
|
|
|
|
|
"<tr class='center borderline'"+click+">"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+"<td >"+row[0]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[1]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[2]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[3]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[4]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[5]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[6]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[7]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[8]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[9]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[10]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[11]+"</td>"
|
|
|
|
|
|
|
|
+"<td>"+row[12]+"</td>"
|
|
|
|
|
|
|
|
+"<td style=' background:#7f8fa6; color: #ffffff;'>"+(row[1]+row[2]+row[3]+row[4]+row[5]+row[6]+row[7]+row[8]+row[9]+row[10]+row[11]+row[12])+"</td>"
|
|
|
|
|
|
|
|
+"</tr>"
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var totals = [];
|
|
|
|
|
|
|
|
var allTotals = 0;
|
|
|
|
|
|
|
|
for (var i = 1; i < 13; i++) {
|
|
|
|
|
|
|
|
var sum = 0;
|
|
|
|
|
|
|
|
for(var j = 0; j < data.length; j++) {
|
|
|
|
|
|
|
|
var row = data[j];
|
|
|
|
|
|
|
|
sum += row[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
totals.push(sum);
|
|
|
|
|
|
|
|
allTotals += sum;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
allTotals = parseInt(allTotals);
|
|
|
|
|
|
|
|
$('#tabcenter').append(
|
|
|
|
|
|
|
|
"<tfoot><tr class='center borderline'"+click+">"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>TOTAL</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[0]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[1]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[2]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[3]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[4]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[5]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[6]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[7]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[8]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[9]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[10]+"</td>"
|
|
|
|
|
|
|
|
+"<td style='font-weight:bold;'>"+totals[11]+"</td>"
|
|
|
|
|
|
|
|
+"<td style=' background:#7f8fa6; color: #ffffff; font-weight: bold;'>"+allTotals+"</td>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+"</tr></tfoot>"
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = <?php echo json_encode($result); ?>;
|
|
|
|
|
|
|
|
function loadByFullName() {
|
|
|
|
|
|
|
|
loadTable(convertArray(result));
|
|
|
|
}
|
|
|
|
|
|
|
|
loadByFullName();
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|