123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?PHP
- // ------------------------------
- // Caractéristiques du module
- // ------------------------------
- unset($module);
- $module = array(
- "titre" => "Compilation de documents",
- "urldest" => $SCRIPT_NAME . "?page=compilation_documents&jeton=" . $jeton,
- "autre" => 1,
- "jeton" => $jeton,
- "tailleentete" => "1000",
- "nombre_a_afficher" => array(
- 0 => array("refid" => 15, "valeur" => 15),
- 1 => array("refid" => 30, "valeur" => 30),
- 2 => array("refid" => 45, "valeur" => 45),
- 3 => array("refid" => 60, "valeur" => 60),
- 4 => array("refid" => 120, "valeur" => 120),
- 5 => array("refid" => 240, "valeur" => 240)
- ),
- "boutonfermeraction" => "fermerfenetre",
- "colonneaction" => false,
- "lientri" => true,
- "entete" => array(
- 1 => array("Employé" => "CONCAT(employes.nomfamille,employes.prenom)", "largeur" => "200px"),
- 2 => array("Type" => "typeoperation", "largeur" => "170px"),
- 3 => array("Date de libération" => "dateliberation", "largeur" => "170px"),
- 4 => array("Article" => "noarticle", "largeur" => "55px"),
- 5 => array("Employeur" => "nomemployeur", "largeur" => "170px"),
- 6 => array("<img alt=\"Pdf\" src=\"images/pdficon_small.gif\">" => "-1", "largeur" => "22px")
- ),
- );
- // ------------------
- // Requête sur le tri
- // ------------------
- $rtri = antiInjection($module["entete"][$tri][key($module["entete"][$tri])] . " " . $dir);
- // ****************************************************
- // Requête SQL principale
- // ****************************************************
- unset($sqlparam);
- $sqlparam["table"][] = "employes";
- $sqlparam["table"][] = "employeurs";
- $sqlparam["table"][] = "liberations";
- $sqlparam["table"][] = "ligneliberations";
- $sqlparam["table"][] = "articles";
- $sqlparam["table"][] = "duree";
- $sqlparam["join"][] = "employes.refemployeur=employeurs.refemployeur";
- $sqlparam["join"][] = "employes.refemploye = liberations.refemploye";
- $sqlparam["join"][] = "liberations.refliberation = ligneliberations.refliberation";
- $sqlparam["join"][] = "ligneliberations.refarticle = articles.refarticle";
- $sqlparam["join"][] = "duree.refduree=ligneliberations.duree";
- $sqlparam["champs"][] = "liberations.refliberation";
- $sqlparam["champs"][] = "CONCAT(employes.nomfamille,', ',employes.prenom) as nomemploye";
- $sqlparam["champs"][] = "employes.numemploye";
- $sqlparam["champs"][] = "employeurs.nomemployeur";
- $sqlparam["champs"][] = "unix_timestamp(liberations.datedemande) as nombre";
- $sqlparam["champs"][] = "If(liberations.typeoperation=2,'Annulation','Demande') AS toperation";
- $sqlparam["champs"][] = "articles.noarticle";
- $sqlparam["champs"][] = "unix_timestamp(ligneliberations.dateliberation) as dateliberation";
- $sqlparam["champs"][] = "If(liberations.typeoperation=1,duree.dureeNombre,0-dureeNombre) AS calculduree";
- $sqlparam["champs"][] = "employes.refemploye";
- $sqlparam["champs"][] = "ligneliberations.commentaire";
- $compte = "(SELECT count(ligneliberations.refliberation) FROM employes, employeurs,liberations,"
- . "ligneliberations,articles "
- . "WHERE employes.refemployeur=employeurs.refemployeur AND ";
- $compte .= "employes.refemploye=liberations.refemploye AND liberations.refliberation=ligneliberations.refliberation "
- . "AND ligneliberations.refarticle=articles.refarticle";
- $compte .= ") as compte";
- $sqlparam["champs"][] = $compte;
- $sqlparam["limite"] = ($nombreaffiche * ($nopage - 1)) . "," . $nombreaffiche;
- if ($_SESSION['gestion_site'] == 'Non') {
- $sqlparam["where"] = sprintf("employes.refemployeur=%d", $_SESSION['employeur']);
- }
- $sqlparam["ordre"][] = $rtri;
- require("lib/librapports.inc.php");
- $result = executerRequeteSql($sqlparam);
- // ****************************************************
- // Vérification de la présence de détails dans la liste
- // ****************************************************
- if (!($result && is_array($result) && !empty($result))) {
- print"<center>Aucune libération trouvée!";
- print "<br>";
- print "<input type='button' onclick='javascript:window.close();' value='Fermer'></center>";
- die();
- }
- $module["compte"] = $result[0]["compte"];
- $i = 1;
- print preparerModule($module);
- //Liste principale;
- if (isset($result) && is_array($result)) {
- if (!empty($result)) {
- $i = ($nopage - 1) * $nombreaffiche + 1;
-
- unset($style);
- $style = "border:1px solid #cfcfcf; font-family:arial, helvetica, sans-serif; font-size:9pt; margin-left:5px; margin-right:5px;";
- foreach ($result as $clef => $champs) {
- $couleur = ($champs["toperation"] == "Demande") ? "style='background-color:#f2f6f7;'" : "style='background-color:#f2f6f7; color:#ff0000; font-weight:700;'";
- print "<tr $couleur>\n";
- print "<td style='$style'>$i</td>\n";
- print "<td style='$style' title=\"" . $champs["nomemploye"] . "\">" . $champs["nomemploye"] . "</td>\n"; //0
- print "<td style='$style' title=\"" . $champs["toperation"] . "\">" . $champs["toperation"] . "</td>"; //2
- print "<td style='$style' title=\"" . date("Y-m-d", $champs["dateliberation"]) . "\">" . date("Y-m-d", $champs["dateliberation"]) . "</td>\n"; //4
- print "<td style='$style' title=\"" . $champs["noarticle"] . "\">" . $champs["noarticle"] . "</td>"; //3
- print "<td style='$style' title=\"\">" . ecrireTexteLimite($champs["nomemployeur"], 170) . "</td>"; //1
- print "<td style='$style'>";
- print "<a href=\"creation_liberation.php?lib=" . $champs["refliberation"] . "&sortie=ecran\"><img alt=\"pdf\" src=\"images/pdficon_small.gif\"></a>"; //5
- print "</td></tr>\n";
- $i++;
- }
- }
- }
- print"</table>";
- // Pagination
- print "<table style='width:968px; margin:auto;'>";
- print "<tr><td style='vertical-align:bottom;'>";
- print $seqpage;
- print "</td>";
- print "<td style='width:320px; text-align:right;'>";
- //Haut de page
- if ($nombreaffiche > 15) {
- print "<a href='#hautpage' title='Aller en haut de la page'>Haut de page</a>";
- print "<a name='baspage'>";
- }
- print "</td></tr>";
- print "</table>";
|