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

/modificar_cuenta.php

https://github.com/ejgallegos/tgpcuentas
PHP | 421 lines | 387 code | 21 blank | 13 comment | 12 complexity | c3c0b7067bfa2bdd948123e158f9a359 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. require_once 'class/Resoluciones.php';
  12. if (!empty($_GET["id"]))
  13. {
  14. $id = $_GET["id"];
  15. $obj5 = new Cuentas();
  16. $row = $obj5->idCuentaEdit_2($id);
  17. }
  18. $obj1 = new Saf();
  19. $saf = $obj1->Ordenar_Saf();
  20. $obj2 = new Sectores();
  21. $sector = $obj2->Ordenar_Sector();
  22. $obj3 = new Bancos();
  23. $banco = $obj3->Ordenar_Banco();
  24. if (isset($_POST["Guardar"]) and $_POST["Guardar"] == 1 ) {
  25. $obj6 = new Cuentas();
  26. $id_cta = $obj6->idCta($_POST["saf"]);
  27. $saf = $id_cta[0]["servicio"];
  28. $obj4 = new Cuentas();
  29. $obj4->editarCuenta_2($_POST["id"], $saf, $_POST["sector"], $_POST["denominacion"], $_POST["banco"], $_POST["tipo"], $_POST["nro_cta"], $_POST["acto_adm"], $_POST["fecha_acto"], $_POST["observacion"]);
  30. $obj8 = new Resoluciones();
  31. $obj8->guardarResolucionModificacion();
  32. exit;
  33. }
  34. ?>
  35. <!DOCTYPE html>
  36. <html lang="es">
  37. <head>
  38. <meta charset="utf-8">
  39. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  40. <meta name="viewport" content="width=device-width, initial-scale=1">
  41. <title>Sistema de Padrón de Cuentas Oficiales</title>
  42. <link rel="shortcut icon" href="img/favicon.ico"/>
  43. <!-- Bootstrap core CSS -->
  44. <link href="css/bootstrap.css" rel="stylesheet">
  45. <link href="css/bootstrap-theme.css" rel="stylesheet">
  46. <link href="css/datepicker.css" rel="stylesheet">
  47. <link href="css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
  48. <script src="js/jquery.min.js"></script>
  49. <script src="js/fileinput.js" type="text/javascript"></script>
  50. <!-- Just for debugging purposes. Don't actually copy this line! -->
  51. <!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
  52. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  53. <!--[if lt IE 9]>
  54. <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  55. <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
  56. <![endif]-->
  57. <style type="text/css"> body {padding-bottom: 40px; background-color: #eee; } </style>
  58. </head>
  59. <body>
  60. <div class="container">
  61. <?php include ("partes/nav.php"); ?>
  62. <div class="row">
  63. <div class="col-md-12">
  64. <ul class="breadcrumb" style="margin-bottom: 5px;">
  65. <li><a href="home.php"><span class="glyphicon glyphicon-home"></a></li>
  66. <li>CUENTAS OFICIALES</li>
  67. <li><a href="edit_cuentas.php?cta=<?php echo $row[0]["cta"]; ?>">MODIFICACIÓN DE CUENTAS</a></li>
  68. <li class="active">ACTUALIZACIÓN DE CUENTAS</li>
  69. </ul>
  70. </div>
  71. <?php include ("partes/menu.php"); ?>
  72. <div class="col-md-10">
  73. <div class="panel panel-primary">
  74. <div class="panel-heading">
  75. <h3 class="panel-title"><span class="glyphicon glyphicon-chevron-right"></span>&nbsp;Completar Datos de la Cuenta</h3>
  76. </div>
  77. <div class="panel-body">
  78. <form action="modificar_cuenta.php" method="POST" class="form-horizontal" enctype="multipart/form-data">
  79. <div class="form-group">
  80. <label class="col-sm-2 control-label">Tipo de Cuenta</label>
  81. <div class="col-sm-5">
  82. <select class="form-control" name="tipo" required title="Seleccione un Tipo de Cuenta">
  83. <option value="<?php echo $row[0]['fdopropio']; ?>"><?php echo $row[0]['fdopropio']; ?></option>
  84. <option value="OPERATIVA">OPERATIVA</option>
  85. <option value="CTA. UNICA">CTA. UNICA</option>
  86. </select>
  87. </div>
  88. </div>
  89. <div class="form-group">
  90. <label class="col-sm-2 control-label">Nro. Cuenta</label>
  91. <div class="col-sm-3">
  92. <input type="text" class="form-control" name="nro_cta" value="<?php echo $row[0]['cta']; ?>" required title="Ingrese el Nro. de Cuenta">
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="col-sm-2 control-label">Acto Administrativo</label>
  97. <div class="col-sm-5">
  98. <input type="text" class="form-control" name="acto_adm" value="<?php echo $row[0]['actoadm']; ?>" title="Ingrese el Acto Administrativo">
  99. </div>
  100. </div>
  101. <div class="form-group">
  102. <label class="col-sm-2 control-label">Fecha Acto</label>
  103. <div class="col-sm-3">
  104. <div class="input-append date" id="dp3" data-date="" data-date-format="yyyy/mm/dd">
  105. <div class="input-group">
  106. <input class="form-control" type="text" value="<?php echo $row[0]['fecha']; ?>" name="fecha_acto" required placeholder="aaaa/mm/dd" title="Ingrese la Fecha">
  107. <span class="input-group-btn">
  108. <button class="btn btn-default" type="button"><span class="add-on"><span class="glyphicon glyphicon-calendar"></span></span></button>
  109. </span>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="form-group">
  115. <label class="col-sm-2 control-label">Observaciones</label>
  116. <div class="col-sm-5">
  117. <input type="text" class="form-control" name="observacion" value="<?php echo $row[0]['obs']; ?>">
  118. </div>
  119. </div>
  120. <div class="form-group">
  121. <label class="col-sm-2 control-label">SAF</label>
  122. <div class="col-sm-3">
  123. <select class="form-control" name="saf" onchange="slctryole(this,this.form.sector)" required title="Debe Seleccionar un SAF">
  124. <?php
  125. $cta1 = $row[0]["nombre"];
  126. $cta2 = $row[0]["cod_ser"];
  127. $cta3 = $row[0]["servicio"];
  128. for($i=0;$i<sizeof($saf);$i++){
  129. ?>
  130. <option title="<?php echo $saf[$i]["nombre"]; ?>" value="<?php echo $saf[$i]["cod_ser"]; ?>"
  131. <?php if ($saf[$i]["cod_ser"]==$cta2)
  132. {
  133. echo 'selected';
  134. }
  135. echo '>'.$saf[$i]["servicio"];
  136. }
  137. ?>
  138. </option>
  139. </select>
  140. </div>
  141. </div>
  142. <div class="form-group">
  143. <label class="col-sm-2 control-label">Sector</label>
  144. <div class="col-sm-5">
  145. <select class="form-control" name="sector" id="sector" required title="Debe Seleccionar un Sector">
  146. <?php
  147. $cta5 = $row[0]["idsector"];
  148. for($i=0;$i<sizeof($sector);$i++){
  149. ?>
  150. <option value="<?php echo $sector[$i]["id"]; ?>"
  151. <?php if ($sector[$i]["id"]==$cta5)
  152. {
  153. echo 'selected';
  154. }
  155. echo '>'.$sector[$i]["sector"];
  156. }
  157. ?>
  158. </select>
  159. </select>
  160. </div>
  161. </div>
  162. <div class="form-group">
  163. <label class="col-sm-2 control-label">Denominación</label>
  164. <div class="col-sm-6">
  165. <input type="text" class="form-control" name="denominacion" value="<?php echo $row[0]['denominacion']; ?>" required title="Ingrese una Denominac&oacute;n">
  166. </div>
  167. </div>
  168. <div class="form-group">
  169. <label class="col-sm-2 control-label">Banco</label>
  170. <div class="col-sm-5">
  171. <select class="form-control" name="banco">
  172. <?php
  173. $cta4 = $row[0]["id"];
  174. for($i=0;$i<sizeof($banco);$i++){
  175. ?>
  176. <option value="<?php echo $banco[$i]['nombre']; ?>"
  177. <?php if ($banco[$i]['id']==$cta4)
  178. {
  179. echo 'selected';
  180. }
  181. echo '>'.$banco[$i]['nombre'];
  182. }
  183. ?>
  184. </select>
  185. </div>
  186. </div>
  187. <hr>
  188. <?php
  189. if(isset($_POST['cant_archivos'])){
  190. $cant = $_POST['cant_archivos'];
  191. }
  192. else{
  193. $cant = 1;
  194. }
  195. $x = 1;
  196. while($x <= $cant){
  197. echo "<div class='form-group'>
  198. <label class='col-sm-2 control-label'>Resolución de Modificación $x</label>
  199. <div class='col-sm-6'>
  200. <input id='file-1' type='file' class='file' name='foto$x' title='Seleccione la Resolucion Escaneada' data-preview-file-type='any'>
  201. </div>
  202. </div>";
  203. $x++;
  204. }
  205. echo "<input type='hidden' value='$cant' name='cant'/>";
  206. ?>
  207. <!-- Button trigger modal -->
  208. <div class="form-group">
  209. <label class="col-sm-2 control-label">&nbsp;</label>
  210. <div class="col-sm-6">
  211. <p class="text-right text-muted">* Cantidad de Resoluciones Escaneadas <button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#myModal">
  212. <span class="glyphicon glyphicon-plus"></span>
  213. </button></p>
  214. </div>
  215. </div>
  216. <div class="form-group">
  217. <div class="col-sm-offset-2 col-sm-10">
  218. <button type="submit" class="btn btn-primary">Aceptar</button>
  219. <button type="button" class="btn btn-default" onclick="location='edit_cuentas.php'">Cancelar</button>
  220. <input type="hidden" name="Guardar" value="1" />
  221. <input type="hidden" name="id" value="<?php echo $row[0]['idcta'];?>">
  222. </div>
  223. </div>
  224. </form>
  225. <!-- Modal para ingresar la cantidad de INPUT FILE-->
  226. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  227. <div class="modal-dialog">
  228. <div class="modal-content">
  229. <div class="modal-header">
  230. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  231. <h4 class="modal-title" id="myModalLabel">Cantidad de Imagenes a Cargar</h4>
  232. </div>
  233. <div class="modal-body">
  234. <form class="form-horizontal" action="#" method="POST" role="form">
  235. <div class="form-group">
  236. <label class="col-sm-4 control-label">Imágenes a Cargar</label>
  237. <div class="col-sm-5">
  238. <div class="input-group">
  239. <input type="text" name="cant_archivos" class="form-control">
  240. <span class="input-group-btn">
  241. <button class="btn btn-success" type="submit"><span class="glyphicon glyphicon-refresh"></span></button>
  242. </span>
  243. </div>
  244. </div>
  245. </div>
  246. </form>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <div class="panel-footer"><?php include ("partes/footer.php");?></div>
  253. </div>
  254. </div>
  255. </div>
  256. </div> <!-- /container -->
  257. <!-- Bootstrap core JavaScript
  258. ================================================== -->
  259. <!-- Placed at the end of the document so the pages load faster -->
  260. <script src="js/bootstrap.min.js"></script>
  261. <script type="text/javascript" src="js/bootstrap-datepicker.js" charset="UTF-8"></script>
  262. <script>
  263. $('#dp3').datepicker();
  264. </script>
  265. <script language='javascript' type='text/javascript'>
  266. function slctr(texto,valor)
  267. {
  268. this.texto = texto
  269. this.valor = valor
  270. }
  271. </script>
  272. <?php
  273. ///////////////////////////////////////////////////////////////////////////////////
  274. // SCRIPT QUE AUTOMATIZA LA SELECCION DE DOS SELECT POR EJ: LOCALIDADES - PCIA
  275. ///////////////////////////////////////////////////////////////////////////////////
  276. echo "<script language='javascript' type='text/javascript'>".chr(13).chr(10);
  277. $varaux= $sector[0]['cod_saf'];
  278. echo "var ".$sector[0]['cod_saf']."=new Array()".chr(13).chr(10);
  279. $cont=0;
  280. //MENSAJE DESPUES DE SELECCIONAR SELECT
  281. //echo $sector[0]['cod_saf']."[$cont] = new slctr('Seleccione Sector','d00')".chr(13).chr(10);
  282. //$cont++;
  283. echo $sector[0]['cod_saf']."[$cont] = new slctr('".trim($sector[0]['sector'])."','".$sector[0]['id']."')";
  284. echo chr(13).chr(10);
  285. //$cont++; GENERA ERROR
  286. for($i=0;$i<sizeof($sector);$i++)
  287. {
  288. if ($sector[$i]['cod_saf']==$varaux)
  289. {
  290. $vcod=$sector[$i]['cod_saf'];
  291. echo $sector[$i]['cod_saf']."[$cont] = new slctr('".trim($sector[$i]['sector'])."','".$sector[$i]['id']."')";
  292. echo chr(13).chr(10);
  293. $cont++;
  294. }
  295. else
  296. {
  297. $varaux=$sector[$i]['cod_saf'];
  298. echo "var ".$sector[$i]['cod_saf']."=new Array()".chr(13).chr(10);
  299. $cont=0;
  300. //MENSAJE DESPUES DE SELECCIONAR SELECT
  301. //echo $sector[$i]['cod_saf']."[$cont] = new slctr('Seleccione Sector','d00')".chr(13).chr(10);
  302. //$cont++;
  303. echo $sector[$i]['cod_saf']."[$cont] = new slctr('".trim($sector[$i]['sector'])."','".$sector[$i]['id']."')";
  304. echo chr(13).chr(10);
  305. $cont++;
  306. }
  307. }
  308. echo "</script>";
  309. ///////////////////////////////////////////////////////////////////////////////////
  310. // SCRIPT QUE AUTOMATIZA LA SELECCION DE DOS SELECT POR EJ: LOCALIDADES - PCIA
  311. ///////////////////////////////////////////////////////////////////////////////////
  312. ?>
  313. <script language='javascript' type='text/javascript'>
  314. function slctryole(cual,donde)
  315. {
  316. if(cual.selectedIndex != 0)
  317. {
  318. donde.length=0
  319. cual = eval(cual.value)
  320. for(m=0;m<cual.length;m++)
  321. {
  322. var nuevaOpcion = new Option(cual[m].texto);
  323. donde.options[m] = nuevaOpcion;
  324. if(cual[m].valor != null)
  325. {
  326. donde.options[m].value = cual[m].valor
  327. }
  328. else
  329. {
  330. donde.options[m].value = cual[m].texto
  331. }
  332. }
  333. }
  334. }
  335. </script>
  336. </body>
  337. </html>
  338. <!--FINALIZA LA SESION-->
  339. <?php
  340. }else
  341. {
  342. echo "<script type='text/javascript'>
  343. alert('Ud debe Iniciar Sesi\u00f3n para acceder a este contenido.');
  344. window.location='index.php';
  345. </script>";
  346. }