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
| // Requête SQL pour récupérer les données de la table Inventaire
$sql_inventaire = "SELECT ID, AnneeCommande, ServiceCommanditaire, UtilisateurCommanditaire, Acheteur, NumBC, NumTicketCommande, TypeIns, NomLogiciel, VersLogiciel, NumDeSerie, CleLicence, EnvSystem, DateDebAbon, DateFinAbon, NbAchetes, RepDepLogWin, RepDepLogMAC, RepDepProc, CheminFichiersLicences, Commentaires
FROM InventaireAbon";
// Exécution de la requête
$stmt_inventaire = $pdo->query($sql_inventaire);
// Récupération des résultats
$rows_inventaire = $stmt_inventaire->fetchAll();
// Initialisation du compteur de lignes
$rowNum = 1;
// Affichage des résultats sous forme de tableau
echo "<div class='table-conteneur'>";
echo "<table class='table-scrollable'>";
echo "<thead>";
echo "<tr><th>N°</th><th>Année de commande</th><th>Service Commanditaire</th><th>Utilisateur Commanditaire</th><th>Acheteur</th><th>Numéro de Bon de Commande</th><th>Numéro de Ticket de Commande</th><th>Type d'installation</th><th>Nom du Logiciel</th><th>Version du Logiciel</th><th>Numéro de Série</th><th>Clé de Licence</th><th>Environnement du Système</th><th>Date de début de l'abonnement</th><th>Date de fin de l'abonnement</th><th>Nombre Acheté</th><th>Nombre Attribué</th><th>Depot logiciel Windows</th><th>Depot logiciel MAC</th><th>Chemin des Fichiers de Licence</th><th>Procédures</th><th>Commentaires</th></tr>";
echo "</thead>";
echo "<tbody>";
// Affichage des données
foreach ($rows_inventaire as $row) {
echo "<tr>";
// Affichage du numéro de ligne
echo "<td>" . htmlspecialchars($row['ID']) . "</td>";
echo "<td>" . htmlspecialchars($row['AnneeCommande']) . "</td>";
echo "<td>" . htmlspecialchars($row['ServiceCommanditaire']) . "</td>";
echo "<td>" . htmlspecialchars($row['UtilisateurCommanditaire']) . "</td>";
echo "<td>" . htmlspecialchars($row['Acheteur']) . "</td>";
echo "<td>" . htmlspecialchars($row['NumBC']) . "</td>";
echo "<td>" . htmlspecialchars($row['NumTicketCommande']) . "</td>";
echo "<td>" . htmlspecialchars($row['TypeIns']) . "</td>";
echo "<td>" . htmlspecialchars($row['NomLogiciel']) . "</td>";
echo "<td>" . htmlspecialchars($row['VersLogiciel']) . "</td>";
echo "<td>" . htmlspecialchars($row['NumDeSerie']) . "</td>";
echo "<td>" . htmlspecialchars($row['CleLicence']) . "</td>";
echo "<td>" . htmlspecialchars($row['EnvSystem']) . "</td>";
echo "<td>" . htmlspecialchars($row['DateDebAbon']) . "</td>";
echo "<td>" . htmlspecialchars($row['DateFinAbon']) . "</td>";
echo "<td>" . htmlspecialchars($row['NbAchetes']) . "</td>";
// Affichage du nombre attribué pour la clé de licence
$cleLicence = htmlspecialchars($row['CleLicence']);
if (isset($installations[$cleLicence])) {
$nombreAttribue = $installations[$cleLicence];
} else {
$nombreAttribue = 0;
}
// Appliquer un style différent à la colonne en fonction de la condition
$nombreAchete = intval($row['NbAchetes']);
$styleColonne = ($nombreAttribue > $nombreAchete) ? "background-color: red;" : "background-color: #add8e6;"; // Vert clair
echo "<td style='$styleColonne'>" . $nombreAttribue . "</td>";
// Vérification du téléchargement disponible pour la colonne RepDepLogWin
echo "<td>";
if (!empty($row['RepDepLogWin'])) {
echo "<span style='color: green;'>Téléchargement disponible</span>";
} else {
echo "<span style='color: red;'>Téléchargement indisponible</span>";
}
echo "</td>";
// Vérification du téléchargement disponible pour la colonne RepDepLogMAC
echo "<td>";
if (!empty($row['RepDepLogMAC'])) {
echo "<span style='color: green;'>Téléchargement disponible</span>";
} else {
echo "<span style='color: red;'>Téléchargement indisponible</span>";
}
echo "</td>";
// Vérification du téléchargement disponible pour la colonne RepDepProc
echo "<td>";
if (!empty($row['RepDepProc'])) {
echo "<span style='color: green;'>Téléchargement disponible</span>";
} else {
echo "<span style='color: red;'>Téléchargement indisponible</span>";
}
echo "</td>";
// Vérification du téléchargement disponible pour la colonne CheminFichiersLicences
echo "<td>";
if (!empty($row['CheminFichiersLicences'])) {
echo "<span style='color: green;'>Téléchargement disponible</span>";
} else {
echo "<span style='color: red;'>Téléchargement indisponible</span>";
}
echo "</td>";
//Commentaire
echo "<td>" . htmlspecialchars($row['Commentaires']) . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "</div>";
} catch (PDOException $e) {
// En cas d'erreur de connexion ou d'exécution de la requête
echo "Erreur : " . $e->getMessage();
}
?> |
Partager