PageRenderTime 52ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/Adicaemobile/mobile/simulador-comparador-pruebas.php

https://gitlab.com/fredyteheranto/gestionet
PHP | 332 lines | 284 code | 47 blank | 1 comment | 87 complexity | db48022c1d3e8fed7f453f7e637834ee MD5 | raw file
  1. <?php
  2. session_start();
  3. error_reporting(E_ALL & ~E_NOTICE);
  4. if(empty($_GET['opcion'])){
  5. //redirecciono
  6. }
  7. require_once 'inc/new_header.php';
  8. require_once 'inc/config.php';
  9. if ($_GET['opcion'] == '1') {
  10. $tipoConsulta = 43; //<30
  11. }
  12. else
  13. {
  14. $tipoConsulta = 54; //>30
  15. }
  16. $noSeleccion = false;
  17. if ($_GET['result'] == 'on') {
  18. foreach ($_POST as $key => $value) {
  19. if (!is_array($value)) {
  20. $$key = $value;
  21. } else {
  22. $$key = $value;
  23. }
  24. }
  25. $seleccion = substr($seleccion,0,-1);
  26. $seleccionArray = explode(",",$seleccion);
  27. if (count($seleccionArray) < 2) {
  28. $noSeleccion = true;
  29. }
  30. }
  31. ?>
  32. <div class="simulador">
  33. <div class="subheader">
  34. <?php if ($_GET['opcion'] == '1') { ?>
  35. <h3>HIPOTECAS HASTA 30 AÑOS</h3>
  36. <?php } ?>
  37. <?php if ($_GET['opcion'] == '2') { ?>
  38. <h3>HIPOTECAS MÁS DE 30 AÑOS</h3>
  39. <?php } ?>
  40. </div>
  41. <?php if ( ($_GET['result'] == 'off') || ($noSeleccion) ) { ?>
  42. <p>Si quiere conocer las características de un producto concreto, pulse el botón +INFO que aparece a la derecha de cada producto.</p>
  43. <p>Si quiere comparar dos productos, selecciónelos marcando la casilla que aparece a la izquierda de los productos y después pulse el botón Comparar que figura al final de la pantalla.</p>
  44. <p>No olvide que la información que aquí se expone es meramente orientativa y nunca definitiva. Usted debe pedir siempre al banco con el que quiera negociar la información exacta y concreta de la oferta.</p>
  45. <?php if ($noSeleccion) { ?>
  46. <span class="alert corner-all">
  47. <p>Debe seleccionar al menos dos productos para comparar</p>
  48. </span>
  49. <?php } ?>
  50. <input type="hidden" name="opcion" id="opcion" value="<?php echo $_GET['opcion']; ?>">
  51. <table style="width:100%">
  52. <tr>
  53. <th><b>ESCOGER</b></th>
  54. <th><b>ENTIDAD</b></th>
  55. <th><b>PRODUCTO</b></th>
  56. <th><b>+INFO</b></th>
  57. </tr>
  58. <?php
  59. $hoy = date("Y-m-d");
  60. $result = mysql_query("SELECT * FROM extranet_cash_productos WHERE id_tipo_producto = $tipoConsulta AND fecha_hasta >= '$hoy' ORDER BY cuantia_max ASC, anyos ASC;");
  61. while ($row=mysql_fetch_array($result)) {
  62. $idBanco = $row['id_entidad'];
  63. $resultBanco = mysql_query("SELECT * FROM extranet_cash_entidades WHERE id = $idBanco;");
  64. $rowBanco=mysql_fetch_array($resultBanco);
  65. ?>
  66. <tr style="text-align:center;">
  67. <td>
  68. <input type="checkbox" id="check_<?php echo $row['id'];?>" name="check_<?php echo $row['id'];?>" value="<?php echo $row['id']; ?>"/>
  69. </td>
  70. <td>
  71. <img style="border: 1px solid #999;padding: 5px 0;width: 100px;text-align: center;background-color: white;margin: 5px 0;" src="http://www.adicae.net/img/news/<?php echo $rowBanco['logo']; ?>"/>
  72. </td>
  73. <td>
  74. <p><?php echo $row['producto']; ?></p>
  75. <p><b><?php echo $row['tipo_interes']; ?></b></p>
  76. <p>Cuantía máxima: <?php echo $row['cuantia_max'].'%'; ?></p>
  77. <p>Plazo máximo: <?php echo $row['anyos'].' años'; ?></p>
  78. </td>
  79. <td>
  80. <input type="button" style="background-image:none;width:100%;height:50px;padding:0;font-size:18px;margin-top:0" value="+INFO" onclick="mostrarInfo(<?php echo $row['id'];?>)"/>
  81. </td>
  82. </tr>
  83. <input type="hidden" id="nombreBanco<?php echo $row['id'];?>" value="<?php echo $rowBanco['nombre']; ?>">
  84. <input type="hidden" id="nombreProducto<?php echo $row['id'];?>" value="<?php echo $row['producto']; ?>">
  85. <input type="hidden" id="imgBanco<?php echo $row['id'];?>" value="<?php echo $rowBanco['logo']; ?>">
  86. <input type="hidden" id="tipointeres<?php echo $row['id'];?>" value="<?php echo $row['tipo_interes']; ?>">
  87. <input type="hidden" id="cuantiamax<?php echo $row['id'];?>" value="<?php echo $row['cuantia_max']; ?>">
  88. <input type="hidden" id="anyos<?php echo $row['id'];?>" value="<?php echo $row['anyos']; ?>">
  89. <input type="hidden" id="condiciones1_<?php echo $row['id'];?>" value="<?php $texto = $row['condiciones1']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto; ?>">
  90. <input type="hidden" id="condiciones2_<?php echo $row['id'];?>" value="<?php $texto = $row['condiciones2']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto; ?>">
  91. <input type="hidden" id="condiciones3_<?php echo $row['id'];?>" value="<?php $texto = $row['condiciones3']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto; ?>">
  92. <input type="hidden" id="condiciones4_<?php echo $row['id'];?>" value="<?php $texto = $row['condiciones4']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto; ?>">
  93. <input type="hidden" id="avisos1_<?php echo $row['id'];?>" value="<?php $texto = $row['avisos1']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto; ?>">
  94. <input type="hidden" id="avisos2_<?php echo $row['id'];?>" value="<?php $texto = $row['avisos2']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto; ?>">
  95. <input type="hidden" id="fecha<?php echo $row['id'];?>" value="<?php echo substr($row['f_user'], 0, strpos($row['f_user'], ' ')); ?>">
  96. <?php
  97. }
  98. ?>
  99. </table>
  100. <br>
  101. <div style="text-align:right;">
  102. <?php
  103. $resultFecha = mysql_query("SELECT MAX(f_user) AS fecha FROM extranet_cash_productos");
  104. $rowFecha=mysql_fetch_array($resultFecha);
  105. ?>
  106. Última Actualización: <?php echo substr($rowFecha['fecha'], 0, strpos($rowFecha['fecha'], ' ')); ?> <br>
  107. Fuente: ADICAE elaboración propia
  108. </div>
  109. <form method="post" action="simulador-comparador-pruebas.php?action=form&result=on&opcion=<?php echo $_GET['opcion'];?>">
  110. <input type="hidden" name="seleccion" id="seleccion" value="">
  111. <input type="submit" value="Comparar"/>
  112. </form>
  113. <div id="info" style="display:none;position:fixed;top:0;left:0;right:0;bottom:0;background-color:rgba(0,0,0,0.3);text-align:center;overflow: auto;" onclick="ocultarInfo()">
  114. <div id="infoContent" style="display:inline-block;width:80%;height:auto;background-color:#FFFFFF;margin-top:10%;margin-bottom:10%;">
  115. </div>
  116. </div>
  117. <?php
  118. }
  119. else
  120. if ($_GET['result'] == 'on') {
  121. ?>
  122. <p>Contratar una hipoteca es una decisión que exige tiempo.</p>
  123. <p>ADICAE le ayuda con el COMPARADOR FINANCIERO.</p>
  124. <ul>
  125. <li><p>Conozca las condiciones financieras de las ofertas hipotecarias: plazo, tipo de interés, cuantía, periodos de carencia, etc.</p></li>
  126. <li><p>Detecte los riesgos de cada préstamo: índice de referencia y diferenciales altos, contratación de productos vinculados, comisiones, etc.</p></li>
  127. <li><p>No contrate su hipoteca sin antes acudir a ADICAE.</p></li>
  128. <li><p>Si necesita más información o tiene problemas con su hipoteca o con otros créditos, la <a href='http://hipotecaconderechos.org/'>Plataforma Hipotecaria de ADICAE</a> es la respuesta:</p></li>
  129. </ul>
  130. <div id="container" style="width:100%;overflow-x:auto;height:auto;">
  131. <table style="width:100%">
  132. <tr style="text-align:center;">
  133. <?php
  134. $result = mysql_query("SELECT * FROM extranet_cash_productos WHERE id IN ($seleccion) ORDER BY cuantia_max ASC, anyos ASC;");
  135. while ($row=mysql_fetch_array($result)) {
  136. $idBanco = $row['id_entidad'];
  137. $resultBanco = mysql_query("SELECT * FROM extranet_cash_entidades WHERE id = $idBanco;");
  138. $rowBanco=mysql_fetch_array($resultBanco);
  139. ?>
  140. <td width="25%" style="vertical-align:text-top">
  141. <div>
  142. <img style="border: 1px solid #999;padding: 5px 0;width: 100px;text-align: center;background-color: white;margin: 5px 0;" src="http://www.adicae.net/img/news/<?php echo $rowBanco['logo']; ?>"/>
  143. </div>
  144. <h3><?php echo $row['producto'];?></h3>
  145. <p><?php echo $rowBanco['nombre'];?></p>
  146. <p><b><?php echo $row['tipo_interes']; ?></b></p>
  147. <p>Cuantía máxima: <?php echo $row['cuantia_max'].'%'; ?></p>
  148. <p>Plazo máximo: <?php echo $row['anyos'].' años'; ?></p>
  149. <?php if ( ($row['condiciones1'] != "") || ( $row['condiciones2'] != "") || ( $row['condiciones3'] != "") || ( $row['condiciones4'] != "") ) { ?>
  150. <p><b>CONDICIONES</b></p>
  151. <?php
  152. if ( ($row['condiciones1'] != "") || ( $row['condiciones2'] != "") ) { ?>
  153. <div style='text-align:justify;background-color:#00CC66;padding:10px'>
  154. <?php if ($row['condiciones1'] != "") { ?>
  155. <p><?php $texto = $row['condiciones1']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto;?></p>
  156. <?php }
  157. if ($row['condiciones2'] != "") { ?>
  158. <p><?php $texto = $row['condiciones2']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto;?></p>
  159. <?php } ?>
  160. </div>
  161. <?php }
  162. if ( ($row['condiciones3'] != "") || ( $row['condiciones3'] != "") ) { ?>
  163. <div style='text-align:justify;background-color:#C0C0C0;padding:10px'>
  164. <?php if ($row['condiciones3'] != "") { ?>
  165. <p><?php $texto = $row['condiciones3']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto;?></p>
  166. <?php }
  167. if ($row['condiciones4'] != "") { ?>
  168. <p><?php $texto = $row['condiciones4']; $texto = nl2br(str_replace("-","<br>-", $texto)); echo $texto;?></p>
  169. <?php } ?>
  170. </div>
  171. <?php
  172. }
  173. }
  174. ?>
  175. <?php if ( ($row['avisos1'] != "") || ( $row['avisos2'] != "") ) { ?>
  176. <p><b>ADVERTENCIAS</b></p>
  177. <div style='text-align:justify;background-color:#FF6666;padding:10px'>
  178. <?php if ($row['avisos1'] != "") { ?>
  179. <p><?php echo $row['avisos1'];?></p>
  180. <?php }
  181. if ($row['avisos2'] != "") { ?>
  182. <p><?php echo $row['avisos2'];?></p>
  183. <?php } ?>
  184. </div>
  185. <?php
  186. }
  187. ?>
  188. </td>
  189. <?php
  190. }
  191. ?>
  192. </tr>
  193. </table>
  194. </div>
  195. <div style="text-align:right;">
  196. <?php
  197. $resultFecha = mysql_query("SELECT MAX(f_user) AS fecha FROM extranet_cash_productos");
  198. $rowFecha=mysql_fetch_array($resultFecha);
  199. ?>
  200. Última Actualización: <?php echo substr($rowFecha['fecha'], 0, strpos($rowFecha['fecha'], ' ')); ?> <br>
  201. Fuente: ADICAE elaboración propia
  202. </div>
  203. <?php
  204. }
  205. ?>
  206. </div>
  207. <?php
  208. require_once 'inc/new_footer.php';
  209. if(isset($_SESSION['errores'])){
  210. unset($_SESSION['errores']);
  211. }
  212. if(isset($_SESSION['valores'])){
  213. unset($_SESSION['valores']);
  214. }
  215. ?>
  216. <script type="text/javascript">
  217. $(document).ready(function(){
  218. });
  219. $(document).on('change', 'input[type="checkbox"]', function(e) {
  220. var selAux = document.getElementById("seleccion").value;
  221. var opcAux = e.currentTarget.value;
  222. if (e.currentTarget.checked) {
  223. selAux += opcAux + ",";
  224. }
  225. else
  226. {
  227. selAux = selAux.replace(opcAux+",","")
  228. }
  229. document.getElementById("seleccion").value = selAux;
  230. });
  231. function mostrarInfo(valor) {
  232. textoInfo = "<div style='margin-top:20px;width:100%;text-align:center;'>";
  233. textoInfo += "<p>"+document.getElementById("nombreBanco"+valor).value+" - "+document.getElementById("nombreProducto"+valor).value+"</p>";
  234. textoInfo += "<div><img style='border: 1px solid #999;padding:5px 0;width: 100px;text-align:center;background-color:white;margin:5px 0;' src='http://www.adicae.net/img/news/"+document.getElementById("imgBanco"+valor).value+"'/></div>";
  235. textoInfo += "<p>"+document.getElementById("tipointeres"+valor).value+"</p>";
  236. textoInfo += "<p>Cuantía máxima: "+document.getElementById("cuantiamax"+valor).value+"%</p>";
  237. textoInfo += "<p>Plazo máximo: "+document.getElementById("anyos"+valor).value+" años</p>";
  238. if ( (document.getElementById("condiciones1_"+valor).value != "") || (document.getElementById("condiciones2_"+valor).value != "") || (document.getElementById("condiciones3_"+valor).value != "") || (document.getElementById("condiciones4_"+valor).value != "") ) {
  239. textoInfo += "<p><b>CONDICIONES</b></p>";
  240. if ( (document.getElementById("condiciones1_"+valor).value != "") || (document.getElementById("condiciones2_"+valor).value != "") ) {
  241. textoInfo += "<div style='text-align:justify;background-color:#00CC66;padding:10px 10px'>";
  242. if (document.getElementById("condiciones1_"+valor).value != "") {
  243. textoInfo += "<p>"+document.getElementById("condiciones1_"+valor).value+"</p>";
  244. }
  245. if (document.getElementById("condiciones2_"+valor).value != "") {
  246. textoInfo += "<p>"+document.getElementById("condiciones2_"+valor).value+"</p>";
  247. }
  248. textoInfo += "</div>";
  249. }
  250. if ( (document.getElementById("condiciones3_"+valor).value != "") || (document.getElementById("condiciones4_"+valor).value != "") ) {
  251. textoInfo += "<div style='text-align:justify;background-color:#C0C0C0;padding:10px 10px'>";
  252. if (document.getElementById("condiciones3_"+valor).value != "") {
  253. textoInfo += "<p>"+document.getElementById("condiciones3_"+valor).value+"</p>";
  254. }
  255. if (document.getElementById("condiciones4_"+valor).value != "") {
  256. textoInfo += "<p>"+document.getElementById("condiciones4_"+valor).value+"</p>";
  257. }
  258. textoInfo += "</div>";
  259. }
  260. }
  261. if ( (document.getElementById("avisos1_"+valor).value != "") || (document.getElementById("avisos2_"+valor).value != "") ) {
  262. textoInfo += "<p><b>ADVERTENCIAS</b></p>";
  263. textoInfo += "<div style='text-align:justify;background-color:#FF6666;padding:10px 10px'>";
  264. if (document.getElementById("avisos1_"+valor).value != "") {
  265. textoInfo += "<p>"+document.getElementById("avisos1_"+valor).value+"</p>";
  266. }
  267. if (document.getElementById("avisos2_"+valor).value != "") {
  268. textoInfo += "<p>"+document.getElementById("avisos2_"+valor).value+"</p>";
  269. }
  270. textoInfo += "</div>";
  271. }
  272. textoInfo += "<div>";
  273. textoInfo += "<p><a href='simulador-hipotecario.php'>Calcule su hipoteca en el simulador hipotecario de ADICAE.</a></p>";
  274. textoInfo += "<p>Última actualización: " + document.getElementById("fecha"+valor).value+"</p>";
  275. textoInfo += "<p>Fuente: ADICAE elaboración propia</p>";
  276. textoInfo += "</div>";
  277. textoInfo += "</div>"
  278. document.getElementById("infoContent").innerHTML = textoInfo;
  279. document.getElementById("info").style.display = "block";
  280. }
  281. function ocultarInfo() {
  282. document.getElementById("infoContent").innerHTML = "";
  283. document.getElementById("info").style.display = "none";
  284. }
  285. </script>