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;
 }
                    <!-- /.col-lg-12 -->
                </div>
                <div class="row">
                    <div class="col-md-12 text-center"><a href="cat_tipos_tramite.php">Tipos de trámites</a> | <a href="cat_tramites.php">Trámites</a></div>
                </div>
                <div class="row" >
                    <div class="col-sm-4">&nbsp;</div>
                    <div class="col-sm-4">
                        <form role="form" name="frmCategoriaTramite" id="frmCategoriaTramite" 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="txtCveCategoriaTramite" name="txtCveCategoriaTramite" value="<?php 
echo $categoria->getCveCategoriaTramite();
?>
">
                            </div>
                            <div class="form-group">
                                <label for="cmbClasificacionTramite">Clasificación trámite</label>
                                <select name="cmbClasificacionTramite" id="cmbClasificacionTramite" class="form-control">
                                    <option value="0">--------- SELECCIONE UNA OPCIÓN ---------</option>
                                    <?php 
$sql = "SELECT * FROM clasificaciones_tramites where activo = 1 ORDER BY nombre";
$rst = UtilDB::ejecutaConsulta($sql);
foreach ($rst as $row) {
    echo "<option value='" . $row['cve_clasificacion_tramite'] . "' " . ($categoria->getCveTipoTramite() != NULL ? $categoria->getCveTipoTramite()->getCveClasificacionTramite()->getCveClasificacionTramite() == $row['cve_clasificacion_tramite'] ? "selected" : "" : "") . ">" . $row['nombre'] . "</option>";
}
$rst->closeCursor();
?>