obtnombre.php 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. //Début de la session
  3. session_start();
  4. //Librairie de fonctions
  5. require (__DIR__ . '/vendor/autoload.php');
  6. require_once("lib/libconfig.inc.php");
  7. require_once("lib/libsession.inc.php");
  8. require_once("lib/libfonctions.inc.php");
  9. require_once("lib/libmysql.inc.php");
  10. require_once("lib/libencode.inc.php");
  11. require_once("lib/libforms.inc.php");
  12. require_once("lib/libcourriel.inc.php");
  13. require_once("lib/libliberations.inc.php");
  14. require_once("lib/lib2fa.inc.php");
  15. //Encodage des caractères
  16. ini_set('display_errors', 'On');
  17. header('Content-Type: text/html; charset=$ENCODAGE');
  18. setConnectionSql();
  19. $search = antiInjection(sprintf("%d", filter_input(INPUT_POST, 'prm1')));
  20. $search2 = antiInjection(filter_input(INPUT_POST, 'prm2'));
  21. $jeton = antiInjection(filter_input(INPUT_POST, 'jeton'));
  22. if (isset($search) && !empty($search)) {
  23. if ($search != "") {
  24. unset($sqlparam);
  25. unset($dir2);
  26. switch ($search2) {
  27. case "asc":
  28. case "desc":
  29. $dir2 = $search2;
  30. break;
  31. default:
  32. $dir2 = "asc";
  33. break;
  34. }
  35. $tag = $search;
  36. unset($sqlparam);
  37. $sqlparam["table"][] = "periodes";
  38. $sqlparam["table"][] = "nombreemployes";
  39. $sqlparam["join"][] = "nombreemployes.refperiode=periodes.refperiode"; //] = "left";
  40. $sqlparam["champs"][] = "YEAR(periodes.periode)-1 as periode";
  41. $sqlparam["champs"][] = "nombreemployes.nombreemployes";
  42. $sqlparam["champs"][] = "nombreemployes.refemployeur";
  43. $sqlparam["champs"][] = "periodes.refperiode";
  44. $sqlparam["where"][] = sprintf("nombreemployes.refemployeur=%d", $tag);
  45. $sqlparam["ordre"] = "periodes.periode $dir2";
  46. $result = executerRequeteSql($sqlparam);
  47. $i = 1;
  48. if ($result) {
  49. unset($dir3);
  50. $dir3 = $dir2;
  51. $dir2 = ($dir2 == "asc") ? "desc" : "asc";
  52. print "<table style='border-collapse:collapse; width:50%; margin:auto;'>";
  53. print "<tr style='height:35px;'>";
  54. $style = "font-family:arial, helvetica, sans-serif; font-size:9pt; background-color:#00aadb;";
  55. print "<th style='$style'>#</th>";
  56. print "<th style='$style'><a class='tri' style='cursor:pointer; color:#0000ee;' onclick='requestNombre(\"$tag\",\"$dir2\");'>P&eacute;riode";
  57. print "&nbsp;<IMG SRC='images/s_$dir2.png' style='border:0px;'></a></th>\n";
  58. print "<th style='$style'>Nombre</th>";
  59. print "<th style='$style'>Action</th>";
  60. print "</tr>";
  61. $style = "border:1px solid #cfcfcf; font-family:arial, helvetica, sans-serif;; color:black; font-size:9pt; margin-left:5px; margin-right:5px; text-align:center;";
  62. foreach ($result as $clef => $valeur2) {
  63. $valeur0 = htmlentities($valeur2["periode"], ENT_QUOTES, $ENCODAGE) . "-04-01";
  64. $valeur1 = htmlentities($valeur2["nombreemployes"], ENT_QUOTES, $ENCODAGE);
  65. print "<tr>\n";
  66. print "<td style='$style'>$i</td>\n";
  67. print "<td style='$style'>$valeur0</td>\n";
  68. print "<td style='$style'>\n";
  69. print "<form id='changement$i' name='changement$i' method=\"post\" action=\"index2.php?page=liste_nombre_employes\">\n";
  70. print "<input type='hidden' name='lperiode' id='lperiode' value='" . $valeur2["refperiode"] . "'>\n";
  71. print "<input type='hidden' name='lemployeur' id='lemployeur' value='$tag'>\n";
  72. print "<input type='hidden' name='action' id='action' value='Modifier'>\n";
  73. print "<input type='text' name='lvaleur' id='lvaleur' value='$valeur1'>\n";
  74. print "<input type='hidden' name='jeton' id='jeton' value='$jeton'>\n";
  75. print "</form>";
  76. print "</td>\n";
  77. print "<td style='$style'>\n";
  78. print "<input class='modifier' title='Modifier' TYPE='submit' name='action' VALUE='Modifier' onclick='document.changement$i.submit();'>\n"; //placervaleur(\"" . $valeur2["refperiode"] . "\",\"lnombre" . $tag . "_$i\");'>\n";
  79. print "</td></tr>\n";
  80. $i++;
  81. }
  82. print "</table>";
  83. }
  84. }
  85. }