PageRenderTime 115ms CodeModel.GetById 96ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/a_cuenta.php

https://github.com/ejgallegos/tgpcuentas
PHP | 316 lines | 289 code | 14 blank | 13 comment | 11 complexity | 28687e233cd37d46f050b65f9ea12242 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/cuentas.php';
 10        require_once 'class/saf.php';
 11        require_once 'class/firmantes.php'; 
 12        
 13    $obj3=  new Saf();
 14    $saf = $obj3->Ordenar_Saf();
 15   
 16    if (!empty($_GET["id"])) {
 17
 18             $id = $_GET["id"];
 19             $obj1 = new Cuentas();
 20             $row = $obj1->idCuenta($id);
 21           } 
 22
 23    if (isset($_POST["Guardar"]) AND $_POST["Guardar"]=="Si") {
 24            $obj2 = new Cuentas();
 25            $obj2->altaCuenta($_POST["id"], $_POST["tipo"], $_POST["nro_cta"], $_POST["acto_adm"], $_POST["fecha_acto"], $_POST["observacion"]);
 26     }
 27
 28?>
 29<!DOCTYPE html>
 30<html lang="es">
 31<head>
 32    <meta charset="utf-8">
 33    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 34    <meta name="viewport" content="width=device-width, initial-scale=1">
 35    <title>Sistema de Padrč´¸n de Cuentas Oficiales</title>
 36    <link rel="shortcut icon" href="img/favicon.ico"/>
 37
 38    <!-- Bootstrap core CSS -->
 39    <link href="css/bootstrap.css" rel="stylesheet">
 40    <link href="css/bootstrap-theme.css" rel="stylesheet">
 41    <link  href="css/datepicker.css" rel="stylesheet">
 42
 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
 46    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
 47    <!--[if lt IE 9]>
 48      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
 49      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
 50    <![endif]-->
 51    <style type="text/css"> body {padding-bottom: 40px; background-color: #eee; } </style>
 52 </head>
 53
 54  <body>
 55
 56<div class="container">
 57
 58  <?php include ("partes/nav.php"); ?>
 59      
 60      <div class="row">
 61
 62        <div class="col-md-12">
 63          <ul class="breadcrumb" style="margin-bottom: 5px;">
 64            <li><a href="home.php"><span class="glyphicon glyphicon-home"></a></li>
 65            <li>CUENTAS OFICIALES</li>
 66            <li><a href="alta_cuentas.php">ALTA DE CUENTAS</a></li>
 67            <li class="active">RESOLUCION DE CUENTA</li>
 68          </ul>
 69      </div>
 70      
 71      <?php include ("partes/menu.php"); ?>
 72
 73        <div class="col-md-10">
 74
 75      <div class="panel panel-primary">   
 76        <div class="panel-heading">
 77           <h3 class="panel-title"><span class="glyphicon glyphicon-chevron-right"></span>&nbsp;Resoluci&oacute;n de Cuenta</h3>
 78        </div>  
 79
 80        <div class="panel-body">
 81                <form class="form-horizontal" role="form" action="#">
 82                    <div class="form-group">
 83                      <label class="col-sm-2 control-label">SAF</label>
 84                      <div class="col-sm-3">
 85                          <input type="text" class="form-control" readonly value="<?php echo $row[0]['saf']; ?>">
 86                      </div>
 87                    </div>
 88                     <div class="form-group">
 89                      <label class="col-sm-2 control-label">Sector</label>
 90                      <div class="col-sm-5">
 91                          <input type="text" class="form-control" readonly value="<?php echo $row[0]['sector']; ?>">
 92                      </div>
 93                    </div>
 94
 95                    <div class="form-group">
 96                      <label class="col-sm-2 control-label">Denominacič´¸n</label>
 97                      <div class="col-sm-9">
 98                        <input type="text" class="form-control" readonly value='<?php echo $row[0]['denominacion']; ?>' name="denominacion">
 99                      </div>
100                    </div>
101
102                    <div class="form-group">
103                      <label class="col-sm-2 control-label">Banco</label>
104                      <div class="col-sm-5">
105                        <input type="text" class="form-control" readonly value="<?php echo $row[0]['banco']; ?>">
106                      </div>
107                    </div>
108                </form>
109
110                   <hr>
111
112                <form action="a_cuenta.php" method="POST" class="form-horizontal">
113                   <div class="form-group">
114                      <label class="col-sm-2 control-label">Tipo de Cuenta</label>
115                      <div class="col-sm-5">
116                          <select class="form-control" name="tipo" required autofocus title="Seleccione un Tipo de Cuenta">
117                            <option value="">Sin Especificar</option>
118                            <option value="OPERATIVA">OPERATIVA</option>
119                            <option value="CTA. UNICA">CTA. UNICA</option>
120                          </select>              
121                      </div>
122                    </div>
123
124                    <div class="form-group">
125                      <label class="col-sm-2 control-label">Nro. Cuenta</label>
126                      <div class="col-sm-5">
127                        <input type="text" class="form-control" value="" placeholder="Nro. de Cuenta" name="nro_cta" required title="Ingrese el Nro. de Cuenta">
128                      </div>
129                    </div>
130
131                          <?php
132                              if (isset($_GET["error"]) AND $_GET["error"]==2) {
133                            ?>
134                              <div class="form-group">
135                                <label class="col-sm-2 control-label">&nbsp;</label>
136                                <div class="col-sm-5">
137                                        <div class="alert alert-danger alert-dismissable">
138                                          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
139                                          <strong>El Nro. de Cuenta: <?php echo $_GET['cta']; ?> Ya existe!</strong>
140                                        </div>       
141                                </div>
142                              </div>
143
144                              <div class="form-group">
145                                <label class="col-sm-2 control-label">Acto Administrativo</label>
146                                <div class="col-sm-5">
147                                  <input type="text" class="form-control" value="<?php echo $_GET['aa'];?>" name="acto_adm" required title="Ingrese el Acto Administrativo">
148                                </div>
149                              </div>
150
151                               <div class="form-group">
152                                <label class="col-sm-2 control-label">Fecha Acto</label>
153                                <div class="col-sm-3">
154                                  <div class="input-append date" id="dp3" data-date="" data-date-format="yyyy/mm/dd">
155                                    <div class="input-group">
156                                      <input class="form-control" type="text" value="<?php echo $_GET["fa"]; ?>" name="fecha_acto" required placeholder="aaaa/mm/dd" title="Ingrese la Fecha del Acto">
157                                      <span class="input-group-btn">
158                                        <button class="btn btn-default" type="button"><span class="add-on"><span class="glyphicon glyphicon-calendar"></span></span></button>
159                                      </span>
160                                    </div>
161                                  </div>
162                                </div>
163                              </div>
164                          <?php
165                            }else
166
167                            {
168
169                          ?>    
170
171                    <div class="form-group">
172                      <label class="col-sm-2 control-label">Acto Administrativo</label>
173                      <div class="col-sm-5">
174                        <input type="text" class="form-control" value="" placeholder="Acto Administrativo" name="acto_adm" required title="Ingrese el Acto Administrativo">
175                      </div>
176                    </div>
177
178                     <div class="form-group">
179                      <label class="col-sm-2 control-label">Fecha Acto</label>
180                      <div class="col-sm-3">
181                        <div class="input-append date" id="dp3" data-date="" data-date-format="yyyy/mm/dd">
182                          <div class="input-group">
183                            <input class="form-control" type="text" value="" name="fecha_acto" required placeholder="aaaa/mm/dd" title="Ingrese la Fecha del Acto">
184                            <span class="input-group-btn">
185                              <button class="btn btn-default" type="button"><span class="add-on"><span class="glyphicon glyphicon-calendar"></span></span></button>
186                            </span>
187                          </div>
188                        </div>
189                      </div>
190                    </div>
191
192                    <div class="form-group">
193                      <label class="col-sm-2 control-label">Observaciones</label>
194                      <div class="col-sm-5">
195                                <textarea class="form-control" placeholder="Observaciones" type="text" name="observacion"  value=""></textarea>
196                      </div>
197                    </div>
198
199                    <?php
200                      }
201                    ?>
202
203                    <div class="form-group">
204                      <div class="col-sm-offset-2 col-sm-10">
205                        <button type="submit" class="btn btn-primary">Aceptar</button>
206                        <button type="button" class="btn btn-default" onclick="location='alta_cuentas.php'">Cancelar</button>
207                        <input type="hidden" name="Guardar" value="Si">
208                        <input type="hidden" name="id" value="<?php echo $row[0]["id"]; ?>">
209                      </div>
210                    </div>
211                  </form> 
212              </div>  
213            <div class="panel-footer"><?php include ("partes/footer.php");?></div>   
214        </div>
215
216    </div>
217  </div>
218</div> <!-- /container -->
219	
220	
221    <!-- Bootstrap core JavaScript
222    ================================================== -->
223    <!-- Placed at the end of the document so the pages load faster -->
224    <script src="js/jquery.min.js"></script>
225    <script src="js/bootstrap.min.js"></script>
226    <script type="text/javascript" src="js/bootstrap-datepicker.js" charset="UTF-8"></script>
227    <script>
228          $('#dp3').datepicker();
229    </script>
230
231          <script language='javascript' type='text/javascript'>
232              function slctr(texto,valor)
233              {
234                  this.texto = texto
235                  this.valor = valor
236               }
237          </script>
238
239          <?php
240          ///////////////////////////////////////////////////////////////////////////////////
241          //       SCRIPT QUE AUTOMATIZA LA SELECCION DE DOS SELECT POR EJ: LOCALIDADES - PCIA
242          ///////////////////////////////////////////////////////////////////////////////////
243            echo "<script language='javascript' type='text/javascript'>".chr(13).chr(10);
244            $varaux= $sector[0]['cod_saf'];
245            echo "var ".$sector[0]['cod_saf']."=new Array()".chr(13).chr(10);
246                  $cont=0;
247                  //MENSAJE DESPUES DE SELECCIONAR SELECT
248                  //echo $sector[0]['cod_saf']."[$cont] = new slctr('Seleccione Sector','d00')".chr(13).chr(10);
249                  //$cont++;
250            echo $sector[0]['cod_saf']."[$cont] = new slctr('".trim($sector[0]['sector'])."','".$sector[0]['id']."')";
251            echo chr(13).chr(10);
252            //$cont++; GENERA ERROR
253            
254                  for($i=0;$i<sizeof($sector);$i++)
255                  {
256              if ($sector[$i]['cod_saf']==$varaux)
257              {
258                $vcod=$sector[$i]['cod_saf'];
259                echo $sector[$i]['cod_saf']."[$cont] = new slctr('".trim($sector[$i]['sector'])."','".$sector[$i]['id']."')";
260                echo chr(13).chr(10);
261                $cont++;
262              }
263              else
264              {
265                $varaux=$sector[$i]['cod_saf'];
266                echo "var ".$sector[$i]['cod_saf']."=new Array()".chr(13).chr(10);
267                $cont=0;
268                                  //MENSAJE DESPUES DE SELECCIONAR SELECT
269                //echo $sector[$i]['cod_saf']."[$cont] = new slctr('Seleccione Sector','d00')".chr(13).chr(10);
270                //$cont++;
271                echo $sector[$i]['cod_saf']."[$cont] = new slctr('".trim($sector[$i]['sector'])."','".$sector[$i]['id']."')";
272                echo chr(13).chr(10);
273                $cont++;
274              }
275            }
276            echo "</script>";
277          ///////////////////////////////////////////////////////////////////////////////////
278          //       SCRIPT QUE AUTOMATIZA LA SELECCION DE DOS SELECT POR EJ: LOCALIDADES - PCIA
279          /////////////////////////////////////////////////////////////////////////////////// 
280          ?>
281
282          <script language='javascript' type='text/javascript'>
283              function slctryole(cual,donde)
284              {
285                if(cual.selectedIndex != 0)
286                {
287                  donde.length=0
288                  cual = eval(cual.value)
289                  for(m=0;m<cual.length;m++)
290                  {
291                    var nuevaOpcion = new Option(cual[m].texto);
292                    donde.options[m] = nuevaOpcion;
293                    if(cual[m].valor != null)
294                    {
295                      donde.options[m].value = cual[m].valor
296                    }
297                    else
298                    {
299                      donde.options[m].value = cual[m].texto
300                    }
301                  }
302                }
303              }
304          </script>  
305
306</body>
307</html>
308<!--FINALIZA LA SESION-->
309<?php
310}else
311{
312	echo "<script type='text/javascript'>
313	alert('Ud debe Iniciar Sesi\u00f3n para acceder a este contenido.');
314	window.location='index.php';
315	</script>";
316}