Example #1
0
 public function Listar()
 {
     try {
         $result = array();
         $stm = $this->pdo->prepare("SELECT * FROM ut");
         $stm->execute();
         foreach ($stm->fetchAll(PDO::FETCH_OBJ) as $r) {
             $alm = new UT();
             $alm->__SET('id', $r->id);
             $alm->__SET('inicio', $r->inicio);
             $alm->__SET('fin', $r->fin);
             $alm->__SET('valor', $r->valor);
             $result[] = $alm;
         }
         return $result;
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
Example #2
0
 public function queryByValor($valor)
 {
     $this->conex = DataBase::getInstance();
     $consulta = "SELECT * FROM FISC_UNIDADTRIBUTARIA WHERE valor=:valor";
     $stid = oci_parse($this->conex, $consulta);
     if (!$stid) {
         $e = oci_error($this->conex);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Realizar la lógica de la consulta
     oci_bind_by_name($stid, ':valor', $valor);
     $r = oci_execute($stid);
     if (!$r) {
         $e = oci_error($stid);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Obtener los resultados de la consulta
     $alm = new UT();
     while ($fila = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
         $it = new ArrayIterator($fila);
         while ($it->valid()) {
             $alm->__SET(strtolower($it->key()), $it->current());
             $it->next();
         }
     }
     //Libera los recursos
     oci_free_statement($stid);
     // Cierra la conexión Oracle
     oci_close($this->conex);
     //retorna el resultado de la consulta
     return $alm;
 }
Example #3
0
    $anio = addslashes($_POST['yfin']);
    $mes = addslashes($_POST['mfin']);
    $dia = addslashes($_POST['dfin']);
}
// Registrar Unidad Tributaria: INSERT INTO ut
if ($op == 'insertar') {
    $existe = 0;
    $yinicio = addslashes($_POST["yinicio"]);
    $minicio = addslashes($_POST["minicio"]);
    $dinicio = addslashes($_POST["dinicio"]);
    $yfin = addslashes($_POST["yfin"]);
    $mfin = addslashes($_POST["mfin"]);
    $dfin = addslashes($_POST["dfin"]);
    $valor = addslashes($_POST["valor"]);
    $id = "undt_" . $yinicio . "_" . $minicio . "_" . $dinicio;
    $ut->__SET('id_unidadt', $id);
    $ut->__SET("yinicio", $yinicio);
    $ut->__SET("minicio", $minicio);
    $ut->__SET("dinicio", $dinicio);
    $ut->__SET("yfin", $yfin);
    $ut->__SET("mfin", $mfin);
    $ut->__SET("dfin", $dfin);
    $ut->__SET("valor", $valor);
    $actual = $utd->Listar();
    foreach ($actual as $key) {
        if ($key->__GET('yinicio') == $yinicio && $key->__GET('minicio') == $minicio && $key->__GET('yfin') == $yfin && $key->__GET('mfin') == $mfin && $key->__GET('valor') == $valor) {
            $existe++;
        }
    }
    if ($existe != 0) {
        //Impedir registro de ut
Example #4
0
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Registro UT</title>
</head>
<body>
	<?php 
include "../UT/include_ut.php";
if ($_POST["option"] == 1) {
    $inicio = addslashes($_POST["inicio"]);
    $fin = addslashes($_POST["fin"]);
    $valor = addslashes($_POST["valor"]);
    $ut = new UT();
    $ut->__SET("inicio", $inicio);
    $ut->__SET("fin", $fin);
    $ut->__SET("valor", $valor);
    $utd = new UTDAO("mysql");
    if ($utd->Registrar($ut)) {
        echo "Operación exitosa";
    } else {
        echo "Operación Fallida";
    }
} else {
    if ($_POST["option"] == 2) {
        //Código para procesar el Select
    } else {
        if ($_POST["option"] == 3) {
            //Código para procesar el Update
        } else {
            if ($_POST["option"] == 4) {