PageRenderTime 753ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/cercaxreparto.php

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