PageRenderTime 51ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/baja_sectores.php

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