PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/transmettreFacture.php

#
PHP | 93 lines | 64 code | 10 blank | 19 comment | 5 complexity | ed16e6cb45ee46c0a88dc1ead13d7c9e MD5 | raw file
Possible License(s): AGPL-3.0, GPL-2.0
  1. <?php
  2. /*
  3. GCourrier
  4. Copyright (C) 2005, 2006 Cliss XXI
  5. This file is part of GCourrier.
  6. GCourrier is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU Affero General Public License as
  8. published by the Free Software Foundation, either version 3 of the
  9. License, or (at your option) any later version.
  10. GCourrier is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU Affero General Public License for more details.
  14. You should have received a copy of the GNU Affero General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. require_once('init.php');
  18. if(!isset( $_POST["enregistrer"])){
  19. ?>
  20. <html>
  21. <head><title>gCourrier</title>
  22. <LINK HREF="styles2.css" REL="stylesheet">
  23. </head>
  24. <body>
  25. <div id="page"><br />
  26. <center><img src="images/banniere2.jpg"><br><br>
  27. <i style="font-size: x-small">Note: les services sont crĂŠes par l'administrateur</i>
  28. </center>
  29. <br>
  30. <table align = center>
  31. <form name = transmettreForm method="post" action="transmettreFacture.php">
  32. <tr><td>service</td><td>
  33. <select name = service>
  34. <?php //'
  35. $requete = "SELECT * FROM service ORDER BY libelle; ";
  36. $result = mysql_query($requete) or die( mysql_error() );
  37. while( $ligne = mysql_fetch_array( $result ) ){
  38. if($ligne['libelle'] != "ADMIN")
  39. echo "<option value = '".$ligne['id']."'>".$ligne['libelle']." ".$ligne['designation']."</option>";
  40. }
  41. ?>
  42. </select></td></tr>
  43. <?php
  44. $idCourrier = $_GET["idCourrier"];
  45. echo"<input type = hidden name = idCourrier value=".$idCourrier."></input>";
  46. ?>
  47. </table>
  48. <center>
  49. <input type="submit" name="enregistrer" value="Transmettre"></input></center>
  50. </form>
  51. <center><br>
  52. <?php
  53. echo "<a href='invoice_list.php?id=$idCourrier'>Voir mes factures</a>";
  54. ?>
  55. </center>
  56. <br><br>
  57. </div>
  58. </body>
  59. </html>
  60. <?php
  61. } else {
  62. $service = $_POST['service'];
  63. $idCourrier = $_POST['idCourrier'];
  64. $date = date("Y-m-d");
  65. $requete = "INSERT INTO estTransmisCopie(idFacture,idService,dateTransmission)
  66. VALUES ($idCourrier,$service,'$date')";
  67. $result = mysql_query($requete) or die(mysql_error());
  68. $requete = "SELECT service.libelle AS libService
  69. FROM service
  70. WHERE service.id=$service";
  71. $result = mysql_query($requete) or die(mysql_error());
  72. while ($ligne = mysql_fetch_array($result))
  73. $libService = $ligne['libService'];
  74. $requete = "UPDATE facture SET histo='$libService' WHERE id='$idCourrier'";
  75. $result = mysql_query($requete) or die(mysql_error());
  76. header("Location: invoice_list.php?id=$idCourrier");
  77. }