Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/11/2011, 10:49
dajahero
 
Fecha de Ingreso: noviembre-2011
Mensajes: 3
Antigüedad: 12 años, 6 meses
Puntos: 0
Respuesta: Problema con envío de variables en PHP por URL

Clase recibo-json.php DONDE PROCESO MIS VARIABLES Y LAS MANDO DE REGRESO AL HTML en ControlTelefonico.php

Código PHP:
Ver original
  1. [PHP]
  2. <?php
  3.  
  4. echo "<META HTTP-EQUIV='refresh' CONTENT='0; URL=recivo-json.php'>";
  5. echo strpos($_SERVER['PHP_SELF'], '?') !== false ? substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '?')) : $_SERVER['PHP_SELF'];
  6.  
  7. if($_POST){
  8.  
  9.  
  10. //echo "recibo algo POST";
  11.  
  12. //recibo los datos y los decodifico con PHP
  13. $misDatosJSON = json_decode($_POST["datos"]);
  14.  
  15. //con esto podría mostrar todos los dtos del JSON recibido
  16. //print_r($misDatosJSON);
  17.  
  18. //ahora muestro algún dato de este array bidimiesional
  19.  
  20. $mes ="";
  21. $annio= "";
  22. $subdireccion= "";
  23. $concepto= "";
  24.  
  25. $mes =$misDatosJSON[0][0];
  26. $annio= $misDatosJSON[1][0];
  27. $subdireccion= $misDatosJSON[2][0];
  28. $concepto=$misDatosJSON[3][0];
  29.  
  30. //echo utf8_encode($salida);
  31. echo $mes;
  32. echo '<br>';
  33. echo $annio;
  34. echo '<br>';
  35. echo $subdireccion;
  36. echo '<br>';
  37.  
  38. echo '<br>';
  39. $concepto_bien="";
  40. $concepto_bien= substr($concepto,1);
  41. echo $concepto_bien;
  42.  
  43.  
  44.  
  45.  
  46. if($concepto=="")
  47. //abre A
  48. {
  49. //abre a1
  50. if($subdireccion=="TODOS")
  51. {
  52.  
  53. include_once 'Conexion.php';
  54. $sql="select concepto.concepto,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."' and concepto.cve_cargo = cuenta.cve_cargo group by concepto.concepto order by sum(importe) DESC";
  55. $result= mysql_query($sql) or die(mysql_error());
  56. if(mysql_num_rows($result)==0) die("No hay registros para mostrar");
  57. /* Desplegamos cada uno de los registros dentro de una tabla */
  58.  
  59. echo '<center><table border=1 cellpadding=4 cellspacing=0>';
  60.  
  61. /*Priemro los encabezados*/
  62. echo '
  63. <th bgColor="69a9f7" width="300px"> Concepto </th>
  64. <th bgColor="69a9f7" width="150px" > Minutos </th>
  65. <th bgColor="69a9f7" width="150px"> Importe </th>
  66.  
  67. </tr>';
  68.  
  69. /*Y ahora todos los registros */
  70.  
  71.  
  72. $duracion_suma=0;
  73. $importe_suma=0;
  74.  
  75. while($row=mysql_fetch_array($result))
  76. {
  77.  
  78. $temp=utf8_encode($row["concepto"]);
  79. echo '<tr><td> <div align=left> <a onClick="verseleccion_concepto();verseleccion_conc epto();actualiza()" href="http://srvsiatel12/ControlTelefonico/ControlTelefonico.php#';
  80. echo $temp;
  81. echo utf8_encode('" value="'.$row["concepto"].'" id="'.$row["concepto"].'"> '.$row["concepto"].'</a></div></td>');
  82.  
  83. $duracion=$row["sum(duracion)"];
  84. $duracion_suma=$duracion_suma+ $duracion;
  85. echo '<td> <div align=right>';
  86. echo number_format($duracion,0);
  87. echo '<div></td>';
  88.  
  89. $importe=$row["sum(importe)" ];
  90. $importe_suma= $importe_suma+ $importe;
  91. echo '<td><div><span style="float:right">';
  92. echo number_format($importe,2);
  93. echo '</span>$</div></td>';
  94. }
  95.  
  96. echo '
  97.  
  98. <tr>
  99. <td bgColor="69a9f7"> <div align=right> <strong> Total</strong> </div></td>
  100. <td bgColor="69a9f7">
  101.  
  102. <div align=right> <strong> ';
  103. echo number_format($duracion_suma,0);
  104. echo '</strong></div>';
  105.  
  106. echo '
  107.  
  108. </td>
  109. <td bgColor="69a9f7">
  110. <div><strong><span style="float:right">';
  111. echo number_format($importe_suma,2);
  112. echo '</span>$</strong></div>';
  113.  
  114. echo '</td>
  115. <tr>
  116. <br>
  117. </center>
  118. </table>';
  119. }
  120. //cierra a1
  121.  
  122. //abre a2
  123. else
  124. {
  125.  
  126. include_once 'Conexion.php';
  127. $sql="select concepto.concepto,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."'and area = '".$subdireccion."' and concepto.cve_cargo = cuenta.cve_cargo group by concepto.concepto order by sum(importe) DESC";
  128.  
  129. $result= mysql_query($sql) or die(mysql_error());
  130. if(mysql_num_rows($result)==0) die("No hay registros para mostrar");
  131.  
  132. echo '<center><table border=1 cellpadding=4 cellspacing=0>';
  133.  
  134. /*Priemro los encabezados*/
  135. echo '
  136. <th bgColor="69a9f7" width="300px"> Concepto </th>
  137. <th bgColor="69a9f7" width="150px" > Minutos </th>
  138. <th bgColor="69a9f7" width="150px"> Importe </th>
  139.  
  140. </tr>';
  141.  
  142. /*Y ahora todos los registros */
  143.  
  144.  
  145. $duracion_suma=0;
  146. $importe_suma=0;
  147.  
  148. while($row=mysql_fetch_array($result))
  149. {
  150. $temp=utf8_encode($row["concepto"]);
  151. echo '<tr><td> <div align=left> <a onClick="verseleccion_concepto();verseleccion_conc epto();actualiza()" href="#';
  152. echo $temp;
  153. echo utf8_encode('" value="'.$row["concepto"].'" id="'.$row["concepto"].'"> '.$row["concepto"].'</a></div></td>');
  154.  
  155. $duracion=$row["sum(duracion)"];
  156. $duracion_suma=$duracion_suma+ $duracion;
  157. echo '<td> <div align=right>';
  158. echo number_format($duracion,0);
  159. echo '<div></td>';
  160.  
  161. $importe=$row["sum(importe)" ];
  162. $importe_suma= $importe_suma+ $importe;
  163. echo '<td><div><span style="float:right">';
  164. echo number_format($importe,2);
  165. echo '</span>$</div></td>';
  166. }
  167.  
  168. echo '
  169.  
  170. <tr>
  171. <td bgColor="69a9f7"> <div align=right> <strong> Total</strong> </div></td>
  172. <td bgColor="69a9f7">
  173.  
  174. <div align=right> <strong> ';
  175. echo number_format($duracion_suma,0);
  176. echo '</strong></div>';
  177.  
  178. echo '
  179.  
  180. </td>
  181. <td bgColor="69a9f7">
  182. <div><strong><span style="float:right">';
  183. echo number_format($importe_suma,2);
  184. echo '</span>$</strong></div>';
  185.  
  186. echo '</td>
  187. <tr>
  188. <br>
  189. </center>
  190. </table>';
  191. }
  192. //cierra a2
  193. }
  194. //cierra A
  195.  
  196.  
  197.  
  198. else
  199. //abre B
  200. {
  201.  
  202. $mes ="";
  203. $annio= "";
  204. $subdireccion= "";
  205. $concepto= "";
  206.  
  207. $mes =$misDatosJSON[0][0];
  208. $annio= $misDatosJSON[1][0];
  209. $subdireccion= $misDatosJSON[2][0];
  210. $concepto=$misDatosJSON[3][0];
  211. $concepto_bien="";
  212. $concepto_bien= substr($concepto,1);
  213.  
  214. echo'<center><strong><h2>';
  215. echo $concepto_bien;
  216. echo'</center></strong></h2>';
  217.  
  218. // abre b1
  219. if($subdireccion=="TODOS")
  220. {
  221. include_once 'Conexion.php';
  222. $sql="select telefono,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."' and concepto.concepto = '".$concepto_bien."' and concepto.cve_cargo = cuenta.cve_cargo group by telefono order by sum(importe) DESC";
  223.  
  224. $result= mysql_query($sql) or die(mysql_error());
  225. if(mysql_num_rows($result)==0) die("No hay registros para mostrar");
  226.  
  227. echo '<center><table border=1 cellpadding=4 cellspacing=0>';
  228.  
  229. /*Priemro los encabezados*/
  230. echo '
  231. <th bgColor="69a9f7" width="300px"> Concepto </th>
  232. <th bgColor="69a9f7" width="150px" > Minutos </th>
  233. <th bgColor="69a9f7" width="150px"> Importe </th>
  234.  
  235. </tr>';
  236.  
  237. /*Y ahora todos los registros */
  238.  
  239.  
  240. $duracion_suma=0;
  241. $importe_suma=0;
  242.  
  243. while($row=mysql_fetch_array($result))
  244. {
  245.  
  246. $temp=utf8_encode($row["telefono"]);
  247. echo '<tr><td> <div align=left> <a onClick="verseleccion_concepto();verseleccion_conc epto();actualiza()" href="#';
  248. echo $temp;
  249. echo utf8_encode('" value="'.$row["telefono"].'" id="'.$row["telefono"].'"> '.$row["telefono"].'</a></div></td>');
  250.  
  251. $duracion=$row["sum(duracion)"];
  252. $duracion_suma=$duracion_suma+ $duracion;
  253. echo '<td> <div align=right>';
  254. echo number_format($duracion,0);
  255. echo '<div></td>';
  256.  
  257. $importe=$row["sum(importe)" ];
  258. $importe_suma= $importe_suma+ $importe;
  259. echo '<td><div><span style="float:right">';
  260. echo number_format($importe,2);
  261. echo '</span>$</div></td>';
  262. }
  263.  
  264. echo '
  265.  
  266. <tr>
  267. <td bgColor="69a9f7"> <div align=right> <strong> Total</strong> </div></td>
  268. <td bgColor="69a9f7">
  269.  
  270. <div align=right> <strong> ';
  271. echo number_format($duracion_suma,0);
  272. echo '</strong></div>';
  273.  
  274. echo '
  275.  
  276. </td>
  277. <td bgColor="69a9f7">
  278. <div><strong><span style="float:right">';
  279. echo number_format($importe_suma,2);
  280. echo '</span>$</strong></div>';
  281.  
  282. echo '</td>
  283. <tr>
  284. <br>
  285. </center>
  286. </table>';
  287. //cierra b1
  288. }
  289.  
  290. //abre b2
  291. else
  292. {
  293.  
  294.  
  295. include_once 'Conexion.php';
  296. $sql="select telefono,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."' and area = '".$subdireccion."' and concepto.concepto = '".$concepto_bien."' and concepto.cve_cargo = cuenta.cve_cargo group by telefono order by sum(importe) DESC";
  297.  
  298. //$sql="select cuenta.telefono,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."' and area = '".$subdireccion."' and concepto.concepto = 'EL QUE LLAMA PAGA' group by cuenta.telefono order by sum(importe) DESC";
  299. //$sql="select concepto.concepto,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."' and area ='".$subdireccion."' and concepto.cve_cargo = cuenta.cve_cargo group by concepto.concepto order by sum(importe) DESC";
  300. //$sql="select concepto.concepto,sum(duracion),sum(importe) from cuenta,concepto where mes_text = '".$mes."' and anio = '".$annio."' and area ='".$subdireccion."' and concepto.cve_cargo = cuenta.cve_cargo group by concepto.concepto order by sum(importe) DESC";
  301.  
  302.  
  303. $result= mysql_query($sql) or die(mysql_error());
  304. if(mysql_num_rows($result)==0) die("No hay registros para mostrardsdsdsdsad");
  305. echo '<center><table border=1 cellpadding=4 cellspacing=0>';
  306. /*Priemro los encabezados*/
  307. echo '
  308. <th bgColor="69a9f7" width="300px"> Tel&eacutefono </th>
  309. <th bgColor="69a9f7" width="150px" > Minutos </th>
  310. <th bgColor="69a9f7" width="150px"> Importe </th>
  311.  
  312. </tr>';
  313.  
  314. /*Y ahora todos los registros */
  315.  
  316.  
  317. $duracion_suma=0;
  318. $importe_suma=0;
  319.  
  320. while($row=mysql_fetch_array($result))
  321. {
  322. $temp=utf8_encode($row["telefono"]);
  323. echo '<tr><td> <div align=left> <a onClick="verseleccion_concepto();verseleccion_conc epto();actualiza()" href="#';
  324. echo $temp;
  325. echo utf8_encode('" value="'.$row["telefono"].'" id="'.$row["telefono"].'"> '.$row["telefono"].'</a></div></td>');
  326.  
  327. $duracion=$row["sum(duracion)"];
  328. $duracion_suma=$duracion_suma+ $duracion;
  329. echo '<td> <div align=right>';
  330. echo number_format($duracion,0);
  331. echo '<div></td>';
  332.  
  333. $importe=$row["sum(importe)" ];
  334. $importe_suma= $importe_suma+ $importe;
  335. echo '<td><div><span style="float:right">';
  336. echo number_format($importe,2);
  337. echo '</span>$</div></td>';
  338. }
  339.  
  340. echo '
  341.  
  342. <tr>
  343. <td bgColor="69a9f7"> <div align=right> <strong> Total</strong> </div></td>
  344. <td bgColor="69a9f7">
  345.  
  346. <div align=right> <strong> ';
  347. echo number_format($duracion_suma,0);
  348. echo '</strong></div>';
  349.  
  350. echo '
  351.  
  352. </td>
  353. <td bgColor="69a9f7">
  354. <div><strong><span style="float:right">';
  355. echo number_format($importe_suma,2);
  356. echo '</span>$</strong></div>';
  357.  
  358. echo '</td>
  359. <tr>
  360. <br>
  361. </center>
  362. </table>';
  363. }
  364. //cierra b2
  365. }
  366. //cierro B
  367. } //cierro POST
  368. ?>[/PHP]