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 180 181 182 183 184 185 186 187 188
| <?php
include 'F_Connection.php';
include('../zklib/ZKLib.php');
//debut de la session
session_name('ZKTeco');
session_start();
$conn = OpenCon();
$myIniFile = parse_ini_file("../ini/Config.ini", TRUE);
$host = $myIniFile["pointeurse"]["adr"];
$zk = new ZKLib($host, 4370);
$DateFrom = null;
$DateTo = null;
//recuperation des valeurs
$IDDep = $_GET['Dep'] ?? "";
$IDSer = $_GET['Ser'] ?? "";
$IDEmp = $_GET['Emp'] ?? "";
$IDSea = $_GET['Sea'] ?? "";
$TxtIDDep = $_GET['DepTxt'] ?? "";
$TxtIDSer = $_GET['SerTxt'] ?? "";
$TxtIDEmp = $_GET['EmpTxt'] ?? "";
$TxtIDSea = $_GET["SeaTxt"] ?? "";
if ($_GET['DateFrom'] ?? "") {
$DateFrom = new DateTime($_GET['DateFrom'] ?? "");
}
if ($_GET['DateTo'] ?? "") {
$DateTo = new DateTime($_GET['DateTo'] ?? "");
}
$DayDiff = $_GET['DayDiff'] ?? "";
$SqlRecherche = null;
$Resultat = "";
$diff = null;
if (!empty($DateFrom) && !empty($DateTo)) {
if ($IDEmp == 'T') {
$SqlRecherche = "SELECT DISTINCT * FROM Employes,Service,Departement,Affectation,xhistorique WHERE Service.IDService=Affectation.IDService AND Employes.IDEmployes=xhistorique.IDEmployePointages AND Service.IDDepartement=Departement.IDDepartement AND Employes.UIDEmployes=Affectation.IDEmployes AND ActiveEmp!=0 AND Service.IDService=".$IDSer." AND Departement.IDDepartement=".$IDDep." AND xhistorique.seances=".$TxtIDSea." AND xhistorique.DatePointages BETWEEN '".$DateFrom->format('Y-m-d')."' AND '".$DateTo->format('Y-m-d')."' ";
} else {
$SqlRecherche = "SELECT DISTINCT * FROM Employes,Service,Departement,Affectation,xhistorique WHERE Service.IDService=Affectation.IDService AND Employes.IDEmployes=xhistorique.IDEmployePointages AND Service.IDDepartement=Departement.IDDepartement AND Employes.UIDEmployes=Affectation.IDEmployes AND ActiveEmp!=0 AND Service.IDService=".$IDSer." AND Departement.IDDepartement=".$IDDep." AND Employes.IDEmployes=".$IDEmp." AND xhistorique.seances=:".$TxtIDSea." AND xhistorique.DatePointages BETWEEN '".$DateFrom->format('Y-m-d')."' AND '".$DateTo->format('Y-m-d')."'";
}
//echo $SqlRecherche."<br/>";
echo '<div class="card border-left-success shadow h-50 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">Recherche
</div>
<div class="row no-gutters align-items-center"> Département : <b>' . $TxtIDDep . '</b> - Filière : <b>' . $TxtIDSer . '</b> - Employée : <b>' . $TxtIDEmp . '</b> <b> - Seances : <b>' . $TxtIDSea . '</b> | De : <b>' . $DateFrom->format('Y-m-d') . '</b> - A : <b>' . $DateTo->format('Y-m-d') . '</b> - Totale Jours : ' . $DayDiff . '</div>
</div>
<div class="col-auto">
<i class="fas fa-search fa-2x text-red-300"></i>
</div>
</div>
</div>
</div>';
$Resultat .= "<table class='table table-bordered' id='dataTable' width='100%' cellspacing='0'>
<thead>
<tr>
<th>Matricule</th>
<th>Nom</th>
<!--th>N° Card</th!-->
<th>Département</th>
<th>Filière</th>
<!--th>Pointage</th!-->
<th>Date</th>
<th>Heure</th>
<!--th>Type</th!-->
<th>Salle</th>
<th>Statut</th>
<th>Seances</th>
</tr>
</thead>
<tbody >";
$statement = $conn->query($SqlRecherche);
$publishers = $statement->fetchAll(PDO::FETCH_ASSOC);
if ($publishers) {
foreach ($publishers as $publisher) {
$Resultat .= "<tr><td>" . $publisher['IDEmployePointages'] . "</td><td>" . $publisher['NomCompletEmployes'] . "</td><td>" . $publisher['LibelleDepartement'] . "</td><td>" . $publisher['LibelleService'] . "</td><td>" . $publisher['DatePointages'] . "</td><td> " . $publisher['HeurPointages'] . "</td><td>" . $publisher['salle'] . "</td>
<td style="color:<?= $publisher['statut'] === 'A' ? 'red' : 'inherit' ?>"">
<?= $publisher['statut'] ?>
</td><td>" . $publisher['seances'] . "</td></tr>";
}
}
} else {
if ($IDEmp == 'T') {
$SqlRecherche = "SELECT * FROM Employes,Service,Departement,Affectation,xhistorique WHERE Service.IDService=Affectation.IDService AND Employes.IDEmployes=xhistorique.IDEmployePointages AND Service.IDDepartement=Departement.IDDepartement AND Employes.UIDEmployes=Affectation.IDEmployes AND ActiveEmp!=0 AND Service.IDService=".$IDSer." AND xhistorique.seances=".$TxtIDSea." AND Departement.IDDepartement=".$IDDep."; ";
} else {
$SqlRecherche = "SELECT * FROM Employes,Service,Departement,Affectation,xhistorique WHERE Service.IDService=Affectation.IDService AND Employes.IDEmployes=xhistorique.IDEmployePointages AND Service.IDDepartement=Departement.IDDepartement AND Employes.UIDEmployes=Affectation.IDEmployes AND ActiveEmp!=0 AND Service.IDService=".$IDSer." AND Departement.IDDepartement=".$IDDep." AND xhistorique.seances=".$TxtIDSea." AND Employes.IDEmployes=".$IDEmp."";
}
// echo $SqlRecherche."<br/>";
echo '<div class="card border-left-success shadow h-50 py-2">
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-success text-uppercase mb-1">Recherche
</div>
<div class="row no-gutters align-items-center"> Département : <b>' . $TxtIDDep . '</b> - Filière : <b>' . $TxtIDSer . '</b> - Etudiants : <b>' . $TxtIDEmp . '</b> - Seances : <b>' . $TxtIDSea . '</b></div>
</div>
<div class="col-auto">
<i class="fas fa-search fa-2x text-red-300"></i>
</div>
</div>
</div>
</div>';
$Resultat .= "
<table class='table table-bordered' id='dataTable' width='100%' cellspacing='0'>
<thead>
<tr>
<th>Matricule</th>
<th>Nom</th>
<!--th>N° Card</th!-->
<th>Département</th>
<th>Filière</th>
<!--th>Pointage</th!-->
<th>Date</th>
<th>Heure</th>
<!--th>Type</th!-->
<th>Salle</th>
<th>Statut</th>
<th>Seances</th>
</tr>
</thead>
<tbody >";
$statement = $conn->query($SqlRecherche);
$publishers = $statement->fetchAll(PDO::FETCH_ASSOC);
if ($publishers) {
foreach ($publishers as $publisher) {
$Color = "red";
$Resultat .= "<tr><td>" . $publisher['IDEmployePointages'] . "</td><td>" . $publisher['NomCompletEmployes'] . "</td><td>" . $publisher['LibelleDepartement'] . "</td><td>" . $publisher['LibelleService'] . "</td><td>" . $publisher['DatePointages'] . "</td><td>" . $publisher['HeurPointages'] . "</td><td>" . $publisher['salle'] . "</td><td>" . $publisher['statut'] . "</td><td>" . $publisher['seances'] . "</td></tr>";
}
}
}
//echo $SqlRecherche.'<br/>';
$Resultat .= "
</tbody>
</table>";
echo '<input type="text" id="ResInput" value="' . $Resultat . '" hidden/>';
?> |
Partager