Beispiel #1
0
 function grabar()
 {
     $sql = "";
     $count = 0;
     if (!$this->_existe) {
         $this->cveTramite = UtilDB::getSiguienteNumero("tramites", "cve_tramite");
         $sql = "INSERT INTO tramites VALUES({$this->cveTramite}," . $this->cveCategoriaTramite->getCveCategoriaTramite() . "," . $this->cveDependencia->getCveDependencia() . ",'{$this->nombre}',NULL,{$this->activo})";
         $count = UtilDB::ejecutaSQL($sql);
         if ($count > 0) {
             $this->_existe = true;
         }
     } else {
         $sql = "UPDATE tramites SET ";
         $sql .= "cve_categoria_tramite = " . $this->cveCategoriaTramite->getCveCategoriaTramite() . ",";
         $sql .= "cve_dependencia = " . $this->cveDependencia->getCveDependencia() . ",";
         $sql .= "nombre = '{$this->nombre}',";
         $sql .= "activo = {$this->activo} ";
         $sql .= " WHERE cve_tramite = {$this->cveDependencia}";
         $count = UtilDB::ejecutaSQL($sql);
     }
     return $count;
 }
                    <div class="col-lg-12">
                        <h1 class="page-header">Dependencias</h1>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <div class="row" >
                    <div class="col-sm-4">&nbsp;</div>
                    <div class="col-sm-4">
                        <form role="form" name="frmDependencia" id="frmDependencia" action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="POST">
                            <div class="form-group">
                                <input type="hidden" class="form-control" name="xAccion" id="xAccion" value="0" />
                                <input type="hidden" class="form-control" id="txtCveDependencia" name="txtCveDependencia" value="<?php 
echo $dependencia->getCveDependencia();
?>
">
                            </div>
                            <div class="form-group">
                                <label for="cmbTipoDependencia">Tipo dependencia</label>
                                <select name="cmbTipoDependencia" id="cmbTipoDependencia" class="form-control">
                                    <option value="0">--------- SELECCIONE UNA OPCIÓN ---------</option>
                                    <?php 
$sql = "SELECT * FROM tipos_dependencia where activo=1 ORDER BY nombre";
$rst = UtilDB::ejecutaConsulta($sql);
foreach ($rst as $row) {
    echo "<option value='" . $row['cve_tipo_dependencia'] . "' " . ($dependencia->getCveTipoDependencia() != NULL ? $dependencia->getCveTipoDependencia()->getCveTipoDependencia() == $row['cve_tipo_dependencia'] ? "selected" : "" : "") . ">" . $row['nombre'] . "</option>";
}
$rst->closeCursor();
?>