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

/alta_firmantes.php

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