PageRenderTime 44ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/interventi.php

https://bitbucket.org/amorello/changeover
PHP | 307 lines | 270 code | 26 blank | 11 comment | 26 complexity | 9d3c6ed884a8635224bdb9ffe2f3eab8 MD5 | raw file
  1. <?php
  2. session_start();
  3. include 'CSS/templateTop.html';
  4. require_once 'login.php';
  5. if(!isset($_SESSION['changeover_IDutente'])){
  6. header("location: index.php");
  7. }
  8. else
  9. {
  10. /*
  11. /* per far accedere alla pagina solo un amministratore
  12. if($_SESSION['nonconf_DBA']=='Y')
  13. {
  14. */
  15. include 'barramenu.php';
  16. echo "<a href=\"stampainterventi.php\" >versione stampabile</a>";
  17. $query = "SELECT * FROM interventi ORDER BY datarichiesta";
  18. $result = mysql_query($query);
  19. if (!$result) die ("Database access failed: " . mysql_error());
  20. echo <<<_END
  21. <table border="5" bordercolor= "#6FD1D2" rules="all" cellspacing="5" width="900" >
  22. <tr bgcolor="#6FD1D2" bordercolor= "#6FD1D2" >
  23. <td width="70%">
  24. <table align="left">
  25. <tr>
  26. <td align="left">
  27. <table>
  28. <tr>
  29. <td>PC</td>
  30. </tr>
  31. <tr>
  32. <td>Utente di riferimento &nbsp &nbsp</td>
  33. </tr>
  34. <tr>
  35. <td>Collocazione</td>
  36. </tr>
  37. </table>
  38. </td>
  39. <td></td>
  40. <td></td>
  41. </tr>
  42. </table>
  43. </td>
  44. <td bgcolor="#FF0000" bordercolor= "#FF0000" >
  45. STATO
  46. </td>
  47. <td bgcolor="#FFCC33" bordercolor= "#FFCC33" >
  48. SOPRALLUOGO
  49. </td>
  50. </tr>
  51. _END;
  52. $righe = mysql_num_rows($result);
  53. for ($j = 0 ; $j < $righe ; ++$j)
  54. {
  55. $row = mysql_fetch_row($result);
  56. $ID = $row[0];
  57. $tipo = $row[1];
  58. if($tipo=='sost'){
  59. $bene = $row[2];
  60. $query = "SELECT * FROM pc WHERE ID=$bene";
  61. $result2 = mysql_query($query);
  62. if (!$result2) die ("Database access failed: " . mysql_error());
  63. $row2 = mysql_fetch_row($result2);
  64. $ID_bene = $row2[1];
  65. $marcamodello= $row2[2];
  66. $ID_monitor = $row2[3];
  67. $pollici= $row2[4];
  68. }else{
  69. $bene = '';
  70. $ID_bene = '';
  71. $marcamodello= '';
  72. $ID_monitor = '';
  73. $pollici= '';
  74. }
  75. $collocazione= $row[3];
  76. $query = "SELECT * FROM collocazione WHERE ID=$collocazione";
  77. $result2 = mysql_query($query);
  78. if (!$result2) die ("Database access failed: " . mysql_error());
  79. $row2 = mysql_fetch_row($result2);
  80. $ubicazione = $row2[1];
  81. $sc= $row2[2];
  82. $ufficio = $row2[3];
  83. $query = "SELECT * FROM sc WHERE ID=$sc";
  84. $result2 = mysql_query($query);
  85. if (!$result2) die ("Database access failed: " . mysql_error());
  86. $row2 = mysql_fetch_row($result2);
  87. $sc = $row2[1];
  88. $cognome_nome_utente = $row[4];
  89. $telefono = $row[5];
  90. $n1 = $row[8];
  91. $n2 = $row[9];
  92. $n3 = $row[10];
  93. $presadirete=$row[6];
  94. $attiva=$row[7];
  95. $sopralluogo = $row[11];
  96. $stato= $row[12];
  97. $esito= $row[13];
  98. $statol= '';
  99. switch ($stato) {
  100. case "R" :
  101. $statol= 'RICHIESTO';
  102. break;
  103. case "A" :
  104. $statol= 'APPROVATO';
  105. break;
  106. case "S" :
  107. $statol= 'SOSPESO';
  108. break;
  109. case "E" :
  110. $statol= 'EFFETTUATO';
  111. break;
  112. default :
  113. $statol= '';
  114. break;}
  115. $datarichiesta = $row[15];
  116. list($data_a,$data_m,$data_g) = explode("-",$datarichiesta);
  117. $time = mktime(0,0,0, $data_m, $data_g, $data_a);
  118. $datarichiesta= date ('d-m-Y',$time);
  119. echo <<<_END
  120. <tr>
  121. <td>
  122. <table align="left">
  123. <tr>
  124. <td align="left">
  125. <font class="rosso">$ID &nbsp &nbsp &nbsp</font>
  126. _END;
  127. if($tipo=='sost')
  128. echo "<font class=\"blue\">SOSTITUZIONE</font>&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp $datarichiesta";
  129. if($tipo=='nuovo')
  130. echo"<font class=\"blue\">NUOVO</font>&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp $datarichiesta";
  131. if($tipo=='sost'){
  132. echo <<<_END
  133. <table>
  134. <tr>
  135. <td>$ID_bene</td>
  136. <td>$marcamodello</td>
  137. <td>&nbsp &nbsp</td>
  138. <td>$ID_monitor</td>
  139. <td>$pollici</td>
  140. </tr>
  141. </table>
  142. _END;
  143. }
  144. echo <<<_END
  145. <table>
  146. <tr>
  147. <td>$cognome_nome_utente &nbsp &nbsp </td>
  148. <td>$telefono</td>
  149. </tr>
  150. </table>
  151. <table>
  152. <tr>
  153. <td>$ubicazione</td>
  154. <td>$sc</td>
  155. <td>$ufficio</td>
  156. </tr>
  157. </table>
  158. _END;
  159. if($n1!=0 || $n2!=0 ||$n3!=0)
  160. {
  161. echo <<<_END
  162. Note:
  163. <table>
  164. _END;
  165. if($n1!=0)
  166. {
  167. $query = "SELECT * FROM note WHERE ID=$n1";
  168. $result2 = mysql_query($query);
  169. if (!$result2) die ("Database access failed: " . mysql_error());
  170. $row2 = mysql_fetch_row($result2);
  171. $nota1 = $row2[1];
  172. echo <<<_END
  173. <tr>
  174. <td>Programmi:</td>
  175. <td>$nota1</td>
  176. </tr>
  177. _END;
  178. }
  179. if($n2!=0)
  180. {
  181. $query = "SELECT * FROM note WHERE ID=$n2";
  182. $result2 = mysql_query($query);
  183. if (!$result2) die ("Database access failed: " . mysql_error());
  184. $row2 = mysql_fetch_row($result2);
  185. $nota2 = $row2[1];
  186. echo <<<_END
  187. <tr>
  188. <td>Orario:</td>
  189. <td>$nota2</td>
  190. </tr>
  191. _END;
  192. }
  193. if($n3!=0)
  194. {
  195. $query = "SELECT * FROM note WHERE ID=$n3";
  196. $result2 = mysql_query($query);
  197. if (!$result2) die ("Database access failed: " . mysql_error());
  198. $row2 = mysql_fetch_row($result2);
  199. $nota3 = $row2[1];
  200. echo <<<_END
  201. <tr>
  202. <td>Varie:</td>
  203. <td>$nota3</td>
  204. </tr>
  205. _END;
  206. }
  207. echo <<<_END
  208. </table>
  209. _END;
  210. }
  211. echo <<<_END
  212. <form action="modifica.php" method="post"><pre><input type="hidden" name="ID" value="$ID" ><input type="submit" name="modifica" value="MODIFICA" /></td>
  213. </pre></form>
  214. </tr>
  215. </table>
  216. </td>
  217. <td bordercolor= "#FF0000" >
  218. <u><a title="$statol"> $stato</a></u>
  219. </td>
  220. <td bordercolor= "#FFCC33" >
  221. _END;
  222. if ($sopralluogo==0){
  223. echo <<<_END
  224. <form action="sopralluogo.php" method="post"><pre>
  225. <input type="hidden" name="ID" value="$ID">
  226. <input type="submit" name="sopralluogo" value="INSERISCI SOPRALLUOGO" />
  227. </pre></form>
  228. _END;
  229. }else{
  230. $query = "SELECT * FROM sopralluogo WHERE ID=\"$sopralluogo\"";
  231. $result2 = mysql_query($query);
  232. if (!$result2) die ("Database access failed: " . mysql_error());
  233. $row2 = mysql_fetch_row($result2);
  234. $presarete = $row2[1];
  235. $corrente = $row2[2];
  236. $nsop = $row2[3];
  237. if($nsop!=0)
  238. {
  239. $query = "SELECT nota FROM note WHERE ID=\"$nsop\"";
  240. $result2 = mysql_query($query);
  241. if (!$result2) die ("Database access failed: " . mysql_error());
  242. $row2 = mysql_fetch_row($result2);
  243. $notasop = $row2[0];
  244. }
  245. else{
  246. $notasop=' ';
  247. }
  248. echo <<<_END
  249. corrente: $corrente
  250. <br>
  251. presarete: $presarete $presadirete $attiva
  252. <br>
  253. $notasop
  254. <br>esito:
  255. _END;
  256. if($esito=='S')
  257. echo"POSITIVO";
  258. if($esito=='N')
  259. echo"NEGATIVO";
  260. echo <<<_END
  261. <form action="modsopralluogo.php" method="post"><pre>
  262. <input type="hidden" name="ID" value="$ID">
  263. <input type="submit" name="modifica" value="MODIFICA" />
  264. </pre></form>
  265. _END;
  266. }
  267. echo <<<_END
  268. </td>
  269. </tr>
  270. _END;
  271. }
  272. echo" </table>";
  273. /*
  274. } else
  275. {
  276. echo "protezione pagina - no diritti di amministrazine";
  277. }
  278. */
  279. }
  280. include 'CSS/templateEnd.html';
  281. ?>