PageRenderTime 45ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/e_cuenta.php

https://github.com/ejgallegos/tgpcuentas
PHP | 294 lines | 281 code | 13 blank | 0 comment | 5 complexity | 823705e1573cc7c2c44cdce9af6087ed MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause
  1. <?php
  2. require_once("class/class.php");
  3. require_once("class/class_usuarios.php");
  4. if ($_SESSION["session_user"] and $_SESSION["session_perfil"]) {
  5. $obj = new Usuarios();
  6. $perfil = $obj->get_permisos_por_id();
  7. require_once 'class/saf.php';
  8. require_once 'class/sectores.php';
  9. require_once 'class/bancos.php';
  10. require_once 'class/cuentas.php';
  11. $obj1 = new Saf();
  12. $saf = $obj1->Ordenar_Saf();
  13. $obj2 = new Sectores();
  14. $sector = $obj2->Ordenar_Sector();
  15. $obj3 = new Bancos();
  16. $banco = $obj3->Ordenar_Banco();
  17. $obj4 = new Cuentas();
  18. if (isset($_POST["Guardar"]) and $_POST["Guardar"] == "Si") {
  19. $obj6 = new Cuentas();
  20. $id_cta = $obj6->idCta($_POST["saf"]);
  21. $saf = $id_cta[0]['servicio'];
  22. $obj4->editarCuenta($_GET["id"], $saf, $_POST["sector"], $_POST["denominacion"], $_POST["banco"]);
  23. exit;
  24. }
  25. if (!empty($_GET["id"]))
  26. {
  27. $id = $_GET["id"];
  28. $obj5 = new Cuentas();
  29. $row = $obj5->idCuentaEdit($id);
  30. }
  31. ?>
  32. <!DOCTYPE html>
  33. <html lang="es">
  34. <head>
  35. <meta charset="utf-8">
  36. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  37. <meta name="viewport" content="width=device-width, initial-scale=1">
  38. <title>Sistema de Padrón de Cuentas Oficiales</title>
  39. <link rel="shortcut icon" href="img/favicon.ico"/>
  40. <!-- Bootstrap core CSS -->
  41. <link href="css/bootstrap.css" rel="stylesheet">
  42. <link href="css/bootstrap-theme.css" rel="stylesheet">
  43. <!-- Just for debugging purposes. Don't actually copy this line! -->
  44. <!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
  45. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  46. <!--[if lt IE 9]>
  47. <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  48. <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
  49. <![endif]-->
  50. <style type="text/css"> body {padding-bottom: 40px; background-color: #eee; } </style>
  51. </head>
  52. <body>
  53. <div class="container">
  54. <?php include ("partes/nav.php"); ?>
  55. <div class="row">
  56. <div class="col-md-12">
  57. <ul class="breadcrumb" style="margin-bottom: 5px;">
  58. <li><a href="home.php"><span class="glyphicon glyphicon-home"></a></li>
  59. <li>CUENTAS OFICIALES</li>
  60. <li><a href="alta_cuentas.php">ALTA DE CUENTAS</a></li>
  61. <li class="active">ACTUALIZACIÓN DE CUENTAS OFICIALES</li>
  62. </ul>
  63. </div>
  64. <?php include ("partes/menu.php"); ?>
  65. <div class="col-md-10">
  66. <div class="panel panel-primary">
  67. <div class="panel-heading">
  68. <h3 class="panel-title"><span class="glyphicon glyphicon-chevron-right"></span>&nbsp;Actualizaci&oacute;n de Datos de Cuentas Oficiales</h3>
  69. </div>
  70. <div class="panel-body">
  71. <form class="form-horizontal" role="form" action="e_cuenta.php?id=<?php echo $id; ?>" method="POST">
  72. <div class="form-group">
  73. <label class="col-sm-2 control-label">SAF</label>
  74. <div class="col-sm-3">
  75. <select class="form-control" name="saf" onchange="slctryole(this,this.form.sector)" autofocus required title="Debe Seleccionar un SAF">
  76. <?php
  77. $cta1 = $row[0]["nombre"];
  78. $cta2 = $row[0]["cod_ser"];
  79. $cta3 = $row[0]["servicio"];
  80. for($i=0;$i<sizeof($saf);$i++){
  81. ?>
  82. <option title="<?php echo $saf[$i]["nombre"]; ?>" value="<?php echo $saf[$i]["cod_ser"]; ?>"
  83. <?php if ($saf[$i]["cod_ser"]==$cta2)
  84. {
  85. echo 'selected';
  86. }
  87. echo '>'.$saf[$i]["servicio"];
  88. }
  89. ?>
  90. </option>
  91. </select>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label class="col-sm-2 control-label">Sector</label>
  96. <div class="col-sm-5">
  97. <select class="form-control" name="sector" id="sector" required title="Debe Seleccionar un Sector">
  98. <?php
  99. $cta5 = $row[0]["idsector"];
  100. for($i=0;$i<sizeof($sector);$i++){
  101. ?>
  102. <option value="<?php echo $sector[$i]["id"]; ?>"
  103. <?php if ($sector[$i]["id"]==$cta5)
  104. {
  105. echo 'selected';
  106. }
  107. echo '>'.$sector[$i]["sector"];
  108. }
  109. ?>
  110. </select>
  111. </select>
  112. </div>
  113. </div>
  114. <div class="form-group">
  115. <label class="col-sm-2 control-label">Denominación</label>
  116. <div class="col-sm-9">
  117. <input type="text" name="denominacion" class="form-control" value="<?php echo $row[0]["denominacion"]; ?>" placeholder="Denominación" name="denominacion" required title="Ingrese una Denominaci&oacute;n">
  118. </div>
  119. </div>
  120. <div class="form-group">
  121. <label class="col-sm-2 control-label">Banco</label>
  122. <div class="col-sm-5">
  123. <select class="form-control" name="banco" required title="Debe Seleccionar un Banco">
  124. <?php
  125. $cta4 = $row[0]["id"];
  126. for($i=0;$i<sizeof($banco);$i++){
  127. ?>
  128. <option value="<?php echo $banco[$i]["nombre"]; ?>"
  129. <?php if ($banco[$i]["id"]==$cta4)
  130. {
  131. echo 'selected';
  132. }
  133. echo '>'.$banco[$i]["nombre"];
  134. }
  135. ?>
  136. </select>
  137. </div>
  138. </div>
  139. <br>
  140. <div class="form-group">
  141. <div class="col-sm-offset-2 col-sm-10">
  142. <button type="submit" class="btn btn-primary">Aceptar</button>
  143. <button type="button" class="btn btn-default" onclick="location='alta_cuentas.php'">Cancelar</button>
  144. <input type="hidden" name="Guardar" value="Si" />
  145. </div>
  146. </div>
  147. </form>
  148. </div>
  149. <div class="panel-footer"><?php include ("partes/footer.php");?></div>
  150. </div>
  151. </div>
  152. </div>
  153. </div> <!-- /container -->
  154. <!-- Bootstrap core JavaScript
  155. ================================================== -->
  156. <!-- Placed at the end of the document so the pages load faster -->
  157. <script src="js/jquery.min.js"></script>
  158. <script src="js/bootstrap.min.js"></script>
  159. <script language='javascript' type='text/javascript'>
  160. function slctr(texto,valor)
  161. {
  162. this.texto = texto
  163. this.valor = valor
  164. }
  165. </script>
  166. <?php
  167. ///////////////////////////////////////////////////////////////////////////////////
  168. // SCRIPT QUE AUTOMATIZA LA SELECCION DE DOS SELECT POR EJ: LOCALIDADES - PCIA
  169. ///////////////////////////////////////////////////////////////////////////////////
  170. echo "<script language='javascript' type='text/javascript'>".chr(13).chr(10);
  171. $varaux= $sector[0]['cod_saf'];
  172. echo "var ".$sector[0]['cod_saf']."=new Array()".chr(13).chr(10);
  173. $cont=0;
  174. //MENSAJE DESPUES DE SELECCIONAR SELECT
  175. //echo $sector[0]['cod_saf']."[$cont] = new slctr('Seleccione Sector','d00')".chr(13).chr(10);
  176. //$cont++;
  177. echo $sector[0]['cod_saf']."[$cont] = new slctr('".trim($sector[0]['sector'])."','".$sector[0]['id']."')";
  178. echo chr(13).chr(10);
  179. //$cont++; GENERA ERROR
  180. for($i=0;$i<sizeof($sector);$i++)
  181. {
  182. if ($sector[$i]['cod_saf']==$varaux)
  183. {
  184. $vcod=$sector[$i]['cod_saf'];
  185. echo $sector[$i]['cod_saf']."[$cont] = new slctr('".trim($sector[$i]['sector'])."','".$sector[$i]['id']."')";
  186. echo chr(13).chr(10);
  187. $cont++;
  188. }
  189. else
  190. {
  191. $varaux=$sector[$i]['cod_saf'];
  192. echo "var ".$sector[$i]['cod_saf']."=new Array()".chr(13).chr(10);
  193. $cont=0;
  194. //MENSAJE DESPUES DE SELECCIONAR SELECT
  195. //echo $sector[$i]['cod_saf']."[$cont] = new slctr('Seleccione Sector','d00')".chr(13).chr(10);
  196. //$cont++;
  197. echo $sector[$i]['cod_saf']."[$cont] = new slctr('".trim($sector[$i]['sector'])."','".$sector[$i]['id']."')";
  198. echo chr(13).chr(10);
  199. $cont++;
  200. }
  201. }
  202. echo "</script>";
  203. ///////////////////////////////////////////////////////////////////////////////////
  204. // SCRIPT QUE AUTOMATIZA LA SELECCION DE DOS SELECT POR EJ: LOCALIDADES - PCIA
  205. ///////////////////////////////////////////////////////////////////////////////////
  206. ?>
  207. <script language='javascript' type='text/javascript'>
  208. function slctryole(cual,donde)
  209. {
  210. if(cual.selectedIndex != 0)
  211. {
  212. donde.length=0
  213. cual = eval(cual.value)
  214. for(m=0;m<cual.length;m++)
  215. {
  216. var nuevaOpcion = new Option(cual[m].texto);
  217. donde.options[m] = nuevaOpcion;
  218. if(cual[m].valor != null)
  219. {
  220. donde.options[m].value = cual[m].valor
  221. }
  222. else
  223. {
  224. donde.options[m].value = cual[m].texto
  225. }
  226. }
  227. }
  228. }
  229. </script>
  230. </body>
  231. </html>
  232. <!--FINALIZA LA SESION-->
  233. <?php
  234. }else
  235. {
  236. echo "<script type='text/javascript'>
  237. alert('Ud debe Iniciar Sesi\u00f3n para acceder a este contenido.');
  238. window.location='index.php';
  239. </script>";
  240. }