202 lines
9.7 KiB
PHP
202 lines
9.7 KiB
PHP
<?php
|
|
|
|
|
|
require_once 'MonitoringVMHeader.php';
|
|
require_once 'MonitoringDBRequest.php';
|
|
|
|
if(isset($_POST['year'])){
|
|
$year = $_POST['year'];
|
|
}
|
|
$result = getResultatVMVisiteDuo($year,$roleid);
|
|
$result2 = getResultat2VMVisiteDuo($year,$roleid);
|
|
$result3 = getResultat3VMVisiteDuo($year,$roleid);
|
|
|
|
echo getMonitoringMainBar(2,$roleid).getMonitoringVisiteSubBar(2,$roleid).
|
|
'<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 crée en', $year).
|
|
'<hr>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="inputCity">Nom & Prénom</label>
|
|
<input class="form-control mb-4 w-20" type="text" name="nomprenom" placeholder="Rechercher" onKeyUp="fullNameChange(this)">
|
|
</div>'.getRegionSelectSubmit($roleid,false).getRolesSelect().'
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
echo '<table id="tabcenter" class="table table-bordered table-striped" >
|
|
|
|
|
|
<tr class="center borderline">
|
|
|
|
|
|
<th id="role" >Poste</th>
|
|
|
|
|
|
<th id="region">Region</th>
|
|
|
|
|
|
<th id="fullname" > Nom & Prenom</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['visite'] !== 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];
|
|
|
|
|
|
|
|
|
|
for(var j = 0; j < result2.length; j++) {
|
|
|
|
|
|
var arow = result2[j];
|
|
|
|
if(arow[0] == row[0] && arow['month'] !== null) {
|
|
|
|
|
|
b[arow['month']]=parseInt(arow['nbrduo']);
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//b[row['month']]=b[row['month']]+parseInt(row['visite']);
|
|
|
|
|
|
for(var h = 0; h < result3.length; h++) {
|
|
|
|
|
|
var arow3 = result3[h];
|
|
|
|
|
|
if(arow3[0] == row[0] && arow3['month'] !== null) {
|
|
|
|
b[arow3['month']]=b[arow3['month']]+parseInt(arow3['visite']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setJobRegionVM(b, row['role']);
|
|
|
|
c[a.length-1]=b;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for(var j = 0; j < result2.length; j++) {
|
|
|
|
|
|
var arow = result2[j];
|
|
|
|
|
|
|
|
|
|
|
|
if(arow[0] == row[0] && arow['month'] !== null) {
|
|
|
|
|
|
b[arow['month']]=parseInt(arow['nbrduo']);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
setJobRegionVM(b, row['role']);
|
|
|
|
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];
|
|
|
|
|
|
for(var j = 0; j < result2.length; j++) {
|
|
|
|
|
|
var arow = result2[j];
|
|
|
|
if(arow[0] == row[0] && arow['month'] !== null) {
|
|
|
|
b[arow['month']]=parseInt(arow['nbrduo']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
for(var h = 0; h < result3.length; h++) {
|
|
|
|
|
|
var arow3 = result3[h];
|
|
|
|
|
|
if(arow3[0] == row[0] && arow3['month'] !== null) {
|
|
|
|
b[arow3['month']]=b[arow3['month']]+parseInt(arow3['visite']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setJobRegionVM(b, row['role']);
|
|
|
|
c[a.length-1]=b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return c
|
|
|
|
}
|
|
|
|
|
|
//filtre nom/prenom
|
|
|
|
function fullNameChange(e) {
|
|
|
|
|
|
document.getElementById("role").value = "All";
|
|
|
|
document.getElementById("region").value = "All";
|
|
|
|
var res = result.filter(a => a.fullname.toUpperCase().includes(e.value.toUpperCase()) );
|
|
|
|
loadTable(convertArray(res));
|
|
|
|
}
|
|
|
|
|
|
|
|
var year = <?php echo json_encode($year); ?>;
|
|
|
|
|
|
|
|
|
|
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[13]+"</td>"
|
|
|
|
|
|
+"<td>"+row[14]+"</td>"
|
|
|
|
|
|
+"<td >"+row[0].trim()+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-01-"+year+",31-01-"+year+"%22]]]'\">"+row[1]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-02-"+year+",29-02-"+year+"%22]]]'\">"+row[2]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-03-"+year+",31-03-"+year+"%22]]]'\">"+row[3]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-04-"+year+",30-04-"+year+"%22]]]'\">"+row[4]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-05-"+year+",31-05-"+year+"%22]]]'\">"+row[5]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-06-"+year+",30-06-"+year+"%22]]]'\">"+row[6]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-07-"+year+",31-07-"+year+"%22]]]'\">"+row[7]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-08-"+year+",31-08-"+year+"%22]]]'\">"+row[8]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-09-"+year+",30-09-"+year+"%22]]]'\">"+row[9]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-10-"+year+",31-10-"+year+"%22]]]'\">"+row[10]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-11-"+year+",30-11-"+year+"%22]]]'\">"+row[11]+"</td>"
|
|
|
|
|
|
+"<td onclick=\"location.href='?module=Calendar&view=List&search_params=[[[%22assigned_user_id%22,%22c%22,%22"+row[0]+"%22],[%22date_start%22,%22bw%22,%2201-12-"+year+",31-12-"+year+"%22]]]'\">"+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(
|
|
|
|
"<tr class='center borderline'"+click+">"
|
|
|
|
|
|
+"<td>TOTAL</td>"
|
|
|
|
|
|
+"<td></td>"
|
|
|
|
|
|
+"<td ></td>"
|
|
|
|
|
|
+"<td>"+totals[0]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[1]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[2]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[3]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[4]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[5]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[6]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[7]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[8]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[9]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[10]+"</td>"
|
|
|
|
|
|
+"<td>"+totals[11]+"</td>"
|
|
|
|
|
|
+"<td style=' background:#7f8fa6; color: #ffffff; font-weight: bold;'>"+allTotals+"</td>"
|
|
|
|
|
|
+"</tr>"
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
var result = <?php echo json_encode($result); ?>;
|
|
|
|
var result2 = <?php echo json_encode($result2); ?>;
|
|
|
|
var result3 = <?php echo json_encode($result3); ?>;
|
|
|
|
|
|
|
|
|
|
function loadByFullName() {
|
|
|
|
|
|
var fullnames = Array.prototype.slice.call(result).sort(function(a, b){
|
|
|
|
|
|
if(a.fullname < b.fullname) { return -1; }
|
|
|
|
if(a.fullname > b.fullname) { return 1; }
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
loadTable(convertArray(fullnames));
|
|
|
|
}
|
|
|
|
|
|
|
|
roleChange("DELEGUE MEDICAL");
|
|
|
|
|
|
|
|
//filtre region
|
|
|
|
|
|
function regionChange(e) {
|
|
|
|
|
|
document.getElementById("role").value = "All";
|
|
|
|
|
|
var arrayFiltre;
|
|
|
|
|
|
arrayFiltre=convertArray(result);
|
|
|
|
|
|
var filteredValue = arrayFiltre.filter(function (item) {
|
|
|
|
|
|
return item[14] === e ;
|
|
|
|
|
|
});
|
|
|
|
|
|
if(e== "All"){filteredValue=arrayFiltre;}
|
|
|
|
|
|
loadTable(filteredValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//filtre Role
|
|
|
|
function roleChange(e) {
|
|
|
|
|
|
if(document.getElementById("region").options.length > 1)
|
|
|
|
document.getElementById("region").value = "All";
|
|
|
|
|
|
var arrayFiltre=convertArray(result);
|
|
|
|
var filteredValue = arrayFiltre.filter(function (item) {
|
|
|
|
return item[13] === e ;
|
|
|
|
});
|
|
|
|
if(e== "All"){filteredValue=arrayFiltre;}
|
|
|
|
loadTable(filteredValue);
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|