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