206 lines
5.0 KiB
PHP
206 lines
5.0 KiB
PHP
<?php
|
|
|
|
|
|
|
|
require_once 'MonitoringVMHeader.php';
|
|
|
|
require_once 'MonitoringDBRequest.php';
|
|
|
|
|
|
|
|
if(isset($_POST['year'])){
|
|
|
|
$year = $_POST['year'];
|
|
|
|
}
|
|
|
|
$result = getResultatVMWillayaSpe($year,$roleid);
|
|
|
|
$specialites = getSpecialties();
|
|
|
|
$wilayas = getWilayas();
|
|
|
|
|
|
|
|
$result = convertArray($result);
|
|
|
|
|
|
|
|
|
|
|
|
echo getMonitoringMainBar(2,$roleid).getMonitoringVisiteSubBar(8,$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 (Wilaya Par Specialite) en ', $year).
|
|
|
|
'<hr>
|
|
|
|
<div class="form-row">
|
|
|
|
<div class="form-group col-md-4">
|
|
|
|
<label for="inputCity">Wilaya</label>
|
|
|
|
<select class="form-control" name="Wilaya" onchange="WilayaChange(this.value)">
|
|
|
|
<option value="ALL">ALL</option>';
|
|
|
|
for($m = 0 ; $m < sizeof($wilayas); $m++){
|
|
|
|
echo '<option value="'.$wilayas[$m]['wilaya'].'">'.$wilayas[$m]['wilaya'].'</option>';
|
|
|
|
}
|
|
|
|
echo '</select>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo '<table id="tabcenter" class="table table-bordered table-striped" >
|
|
|
|
<tr class="center borderline">
|
|
|
|
<th></th>';
|
|
|
|
for($ss = 0 ; $ss < sizeof($specialites); $ss++){
|
|
|
|
echo '<th>'.$specialites[$ss]['specialite'].'</th>';
|
|
|
|
}
|
|
|
|
echo'<th>Total</th>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tbody id="values"></tbody>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</div></div>';
|
|
|
|
|
|
|
|
$viewer->view('CustomDashboardFooter.tpl');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function search($array, $accountwilaya , $accounttypeID) {
|
|
|
|
|
|
|
|
$result = -1 ;
|
|
|
|
for($i = 0 ; $i < sizeof($array) ; $i++) {
|
|
|
|
if( strcasecmp($array[$i]['accountwilaya'] , $accountwilaya ) == 0 && strcasecmp($array[$i]['accounttypeid'] , $accounttypeID ) == 0){
|
|
|
|
$result = $i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function convertArray($result){
|
|
|
|
|
|
|
|
$specialites = getSpecialties();
|
|
|
|
$wilayas = getWilayas();
|
|
|
|
$resultFinal = array();
|
|
|
|
|
|
|
|
for($b = 0 ; $b < sizeof($wilayas); $b++){
|
|
|
|
|
|
|
|
$temp = array();
|
|
|
|
$res = array();
|
|
|
|
|
|
|
|
$wilaya = $wilayas[$b]['wilaya'];
|
|
|
|
|
|
|
|
for($v = 0 ; $v < sizeof($specialites); $v++){
|
|
|
|
|
|
|
|
$specialiteID = $specialites[$v]['accounttypeid'];
|
|
|
|
$index = search($result, $wilaya , $specialiteID);
|
|
|
|
if($index == -1)
|
|
|
|
$temp = $temp + [$v =>0];
|
|
|
|
else
|
|
|
|
$temp = $temp + [$v =>$result[$index]['nbrvisite']];
|
|
|
|
}
|
|
|
|
|
|
|
|
$res = ['wilaya'=>$wilaya];
|
|
|
|
$res = $res + $temp;
|
|
|
|
|
|
|
|
array_push($resultFinal,$res);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $resultFinal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
function loadTable(data){
|
|
|
|
|
|
|
|
$('#tabcenter tr').slice(1).remove();
|
|
|
|
var temp4 = [];
|
|
|
|
|
|
|
|
var specialites = <?php echo json_encode($specialites); ?>;
|
|
|
|
|
|
|
|
if(data.length > 0) {
|
|
|
|
|
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
|
|
|
|
|
var temp5 = [];
|
|
|
|
|
|
|
|
var temp=[];
|
|
|
|
|
|
|
|
var row = data[i];
|
|
|
|
|
|
|
|
var sum = 0;
|
|
|
|
|
|
|
|
for(var f = 0; f < specialites.length; f++) {
|
|
|
|
|
|
|
|
var totalcol = 0;
|
|
|
|
for(var b = 0; b < data.length; b++) {
|
|
|
|
totalcol = totalcol + data[b][f];
|
|
|
|
}
|
|
|
|
|
|
|
|
if(totalcol>0)
|
|
|
|
temp[f]="<td>"+row[f]+"</td>";
|
|
|
|
else {
|
|
|
|
var corresponding_th = document.querySelector('#tabcenter th:nth-child(' + (f+2) + ')');
|
|
|
|
corresponding_th.style.display = "none";
|
|
|
|
}
|
|
|
|
|
|
|
|
temp5[f]=parseInt(row[f]);
|
|
|
|
|
|
|
|
sum = sum + parseInt(row[f]) ;//total colonnes
|
|
|
|
|
|
|
|
if(f+1 == specialites.length){
|
|
|
|
|
|
|
|
temp[f+1]="<td style=' background:#7f8fa6; color: #ffffff;'>"+sum+"</td>";
|
|
|
|
|
|
|
|
temp5[f+1]=sum;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
temp4.push(temp5);
|
|
|
|
|
|
|
|
var temp2=["<td>"+row['wilaya']+"</td>"];
|
|
|
|
|
|
|
|
var temp3=temp2+temp
|
|
|
|
|
|
|
|
$('#tabcenter').append("<tr>"+temp3.toString()+"</tr>");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//total lignes
|
|
|
|
|
|
|
|
var temp6= [];
|
|
|
|
|
|
|
|
for(var a = 0; a < specialites.length +1 ; a++) {
|
|
|
|
|
|
|
|
var totalligne = 0;
|
|
|
|
|
|
|
|
for(var b = 0; b < temp4.length; b++) {
|
|
|
|
|
|
|
|
totalligne = totalligne + temp4[b][a];
|
|
|
|
|
|
|
|
}
|
|
|
|
if(totalligne > 0)
|
|
|
|
temp6[a] = "<td>"+totalligne+"</td>";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var temp7 = ["<td>Total</td>"] + temp6;
|
|
|
|
|
|
|
|
$('#tabcenter').append("<tfoot><tr style=' background:#7f8fa6; color: #ffffff;'>"+temp7.toString()+"</tr></tfoot>");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//filtre nom/prenom
|
|
|
|
function WilayaChange(e) {
|
|
|
|
|
|
|
|
var res = result.filter(a => a.wilaya == e);
|
|
|
|
if(e == "ALL"){ res = result;}
|
|
|
|
loadTable(res);
|
|
|
|
}
|
|
|
|
|
|
|
|
var result = <?php echo json_encode($result); ?>;
|
|
|
|
|
|
|
|
loadTable(result);
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
|
|
</html>
|