Beispiel #1
1
 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETRUTACONDUCTOR(:p_id, :rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     $this->id = $id;
     oci_bind_by_name($sent, ':p_id', $this->id);
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $this->ruta = $row['ID_RUTA'];
         $this->conductor = $row['ID_CONDUCTOR'];
         $this->kilometraje = $row['KILOMETRAJE'];
         $this->descripcion = $row['DESCRIPCION'];
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return true;
 }
 function loadAtendente()
 {
     include_once 'app.ado/DataBase.php';
     $db = new DataBase();
     $aten = $db->getConn()->query('select nome_usuario from usuarios where id_usuario = ' . $this->usuario_id . ';')->fetchAll(PDO::FETCH_CLASS, "Item");
     return $aten;
 }
 public function render()
 {
     if (!$this->conteudo) {
         include_once 'app.ado/DataBase.php';
         $pdo = new DataBase();
         $db = $pdo->getConn();
         $sql = 'select * from ctrl_chaves';
         if ($this->dt_inicial or $this->dt_final) {
             $this->dt_inicial = $this->dt_inicial ? $this->dt_inicial : '2012/01/01';
             $this->dt_final = $this->dt_final ? $this->dt_final : date('Y/m/d');
             $sql .= ' where ((dt_inicial_controle between ? and ?) or (dt_final_controle between ? and ?))';
             $exec[] = $this->dt_inicial;
             $exec[] = $this->dt_final;
             if ($this->id) {
                 $sql .= ' and id_controle = ?';
                 $exec[] = $this->id;
             }
         } elseif ($this->id) {
             $sql .= ' where id_controle = ?';
             $exec[] = $this->id;
         }
         if ($this->order) {
             $sql .= ' order by ?';
             $exec[] = $this->order;
         }
         $sth = $db->prepare($sql);
         $conteudo = $sth->execute($exec);
         $this->conteudo = $conteudo->fetchAll(PDO::FETCH_CLASS, 'CrlChave');
     }
     $tabela = new TTableChave($this->conteudo);
     $pdf = new TRelatorio();
     $pdf->writeHTML($tabela->render());
     $pdf->render();
     $pdf->exit();
 }
 function loadLaboratorio()
 {
     include_once 'app.ado/DataBase.php';
     $db = new DataBase();
     $lab = $db->getConn()->query('select nome_laboratorio from laboratorios where id_laboratorio = ' . $this->laboratorio_id . ';')->fetch(PDO::FETCH_COLUMN);
     unset($db);
     return $lab;
 }
function buscaPermissoes($id)
{
    include 'app.ado/DataBase.php';
    $db = new DataBase();
    $modulos = $db->getConn()->query('select m.nome_modulo from modulos m
inner join modulos_permissoes mp on (mp.modulo_id = m.id_modulo)
inner join modulos_permissoes_usuarios mpu on (mpu.modulo_permissao_id = mp.id_modulo_permissao)
where mpu.usuario_id = ' . $id . '
group by m.nome_modulo;')->fetchAll(PDO::FETCH_COLUMN);
    foreach ($modulos as $modulo) {
        $permissoes[$modulo] = $db->getConn()->query('select p.nome_permissao from permissoes p
inner join modulos_permissoes mp on (mp.permissao_id = p.id_permissao)
inner join modulos m on (mp.modulo_id = m.id_modulo)
inner join modulos_permissoes_usuarios mpu on (mpu.modulo_permissao_id = mp.id_modulo_permissao)
where mpu.usuario_id = ' . $id . ' and m.nome_modulo like "' . $modulo . '"
group by p.nome_permissao;')->fetchAll(PDO::FETCH_COLUMN);
    }
    $permissoes['usuarios'][] = 'info-usuario';
    $permissoes['usuarios'][] = 'logout';
    $permissoes['manutencoes'][] = 'm-manutencoes';
    return $permissoes;
}
/**
 * 取得一个AdoDB的数据库连接对象
 */
function get_conn($dbhost = '', $dbname = '', $dbuser = '', $dbpsw = '', $charset = '')
{
    require_once EZBOSS_CLASSES_PATH . DIRECTORY_SEPARATOR . 'DataBase.class.php';
    if ($dbhost == '') {
        global $dbhost, $dbname, $dbuser, $dbpsw, $charset;
    }
    $db = new DataBase($dbhost, $dbname, $dbuser, $dbpsw, $charset);
    try {
        $conn = $db->getConn();
        return $conn;
    } catch (Exception $e) {
        echo "数据库连接失败";
        exit;
    }
}
Beispiel #7
0
 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETPLANIFICACION(:id, :nombre, :distancia, :ruta); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $this->id);
     oci_bind_by_name($sent, ':nombre', $this->nombre);
     oci_bind_by_name($sent, ':distancia', $this->distancia);
     oci_bind_by_name($sent, ':ruta', $this->ruta);
     oci_execute($sent);
     $data->free($sent);
     $data->close();
 }
 public function render()
 {
     if (!$this->conteudo) {
         include_once 'app.ado/DataBase.php';
         $pdo = new DataBase();
         $db = $pdo->getConn();
         $sql = 'select * from req_manutencoes';
         if ($this->dt_inicial or $this->dt_final) {
             $this->dt_inicial = $this->dt_inicial ? $this->dt_inicial : '2012/01/01';
             $this->dt_final = $this->dt_final ? $this->dt_final : date('Y/m/d');
             $sql .= ' where (dt_requisicao between ? and ?)';
             $exec[] = $this->dt_inicial;
             $exec[] = $this->dt_final;
             if ($this->id) {
                 $sql .= ' and id_requisicao = ?';
                 $exec[] = $this->id;
             }
         } elseif ($this->id) {
             $sql .= ' where id_requisicao = ?';
             $exec[] = $this->id;
         }
         if ($this->order) {
             $sql .= ' order by ?';
             $exec[] = $this->order;
         }
         $sth = $db->prepare($sql);
         $conteudo = $sth->execute($exec);
         $this->conteudo = $conteudo->fetchAll(PDO::FETCH_CLASS, 'Requerir');
     }
     if (is_array($this->conteudo)) {
         $html = '';
         foreach ($this->conteudo as $requisicao) {
             $tabela = new TTableManutencao($requisicao);
             $html .= $tabela->render();
         }
     } else {
         $tabela = new TTableManutencao($this->conteudo);
         $html .= $tabela->render();
     }
     //        $pdf = new TRelatorio();
     //
     //        $pdf->writeHTML($html);
     //
     //        $pdf->render();
     //        $pdf->exit();
 }
 function loadManutencoes()
 {
     include_once 'app.ado/DataBase.php';
     $db = new DataBase();
     $manu = $db->getConn()->query('select * from manutencoes where req_manutencao_id =' . $this->id_requisicao . ';')->fetchAll(PDO::FETCH_CLASS, 'Manu');
     return $manu;
 }
Beispiel #10
0
<?php 
include 'app.ado/DataBase.php';
$db = new DataBase();
$con = $db->getConn()->query('select * from emprestimos where usuario_id = 2;')->fetchAll(PDO::FETCH_CLASS, 'Emp');
$pdf = new TRelEmprestimo($con);
$pdf->render();
// include_once '../componentes/MPDF54/mpdf.php';
// $pdf = new mPDF();
// $pdf->WriteHTML("alo mundo");
// $pdf->Output('jomaro.pdf',"D");
// exit();
Beispiel #11
0
<?php

$username = $_POST['user'];
$password = $_POST['pass'];
$rol = 0;
require_once 'DataBase.php';
$data = new DataBase();
$data->open();
$id = 0;
$sql = "BEGIN LOGIN(:user, :pass, :rol, :id); END;";
$sent = oci_parse($data->getConn(), $sql);
oci_bind_by_name($sent, ':user', $username);
oci_bind_by_name($sent, ':pass', $password);
oci_bind_by_name($sent, ':rol', $rol);
oci_bind_by_name($sent, ':id', $id);
oci_execute($sent);
$data->free($sent);
$data->close();
if ($rol > 0 && $id > 0) {
    session_start();
    $_SESSION['id'] = $id;
    $_SESSION['user'] = $username;
    $_SESSION['rol'] = $rol;
    header('Location: index.php');
} else {
    header('Location: loginform.php?error=1');
}
Beispiel #12
0
 public function getAll()
 {
     $respuesta = array();
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETALLRUTAS(:rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $elemento = new Ruta();
         $elemento->id = $row['ID_RUTA'];
         $elemento->nombre = $row['NOMBRE'];
         $respuesta[] = $elemento;
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return $respuesta;
 }
Beispiel #13
0
 public function delete($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN DELUSUARIO(:id); END;";
     $sent = oci_parse($data->getConn(), $sql);
     oci_bind_by_name($sent, ':id', $id);
     if (!oci_execute($sent)) {
         return false;
     }
     $data->free($sent);
     $data->close();
     return true;
 }
Beispiel #14
0
 public function update()
 {
     if ($this->factura != "" && $this->proveedor != "" && $this->id != 0) {
         require_once 'DataBase.php';
         $data = new DataBase();
         $data->open();
         $sql = "BEGIN UPDMANTENIMIENTO(:id, :factura, :proveedor, :fecha, :monto, :descripcion, :vehiculo, :tipo); END;";
         $sent = oci_parse($data->getConn(), $sql);
         oci_bind_by_name($sent, ':id', $this->id);
         oci_bind_by_name($sent, ':factura', $this->factura);
         oci_bind_by_name($sent, ':proveedor', $this->proveedor);
         oci_bind_by_name($sent, ':fecha', $this->fecha);
         oci_bind_by_name($sent, ':monto', $this->monto);
         oci_bind_by_name($sent, ':descripcion', $this->descripcion);
         oci_bind_by_name($sent, ':vehiculo', $this->vehiculo);
         oci_bind_by_name($sent, ':tipo', $this->tipoMantenimiento);
         if (!oci_execute($sent)) {
             return false;
         }
         $data->free($sent);
         $data->close();
         return true;
     } else {
         return false;
     }
 }
Beispiel #15
0
 function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN GETVEHICULO(:id, :rc); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $refcur = oci_new_cursor($data->getConn());
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $this->id);
     oci_bind_by_name($sent, ':rc', $refcur, -1, OCI_B_CURSOR);
     if (!oci_execute($sent)) {
         return false;
     }
     if (!oci_execute($refcur)) {
         return false;
     }
     while (($row = oci_fetch_array($refcur, OCI_ASSOC + OCI_RETURN_NULLS)) != false) {
         $this->id = $row['ID_VEHICULO'];
         $this->placa = $row['PLACA'];
         $this->kilometraje = $row['KILOMETRAJE'];
         $this->serie = $row['SERIE'];
         $this->motor = $row['MOTOR'];
         $this->anio = $row['ANIO'];
         $this->color = $row['COLOR'];
         $this->marca = $row['MARCA'];
     }
     oci_free_statement($refcur);
     $data->free($sent);
     $data->close();
     return true;
 }
Beispiel #16
0
 public function get($id)
 {
     require_once 'DataBase.php';
     $data = new DataBase();
     $data->open();
     $sql = "BEGIN UPDATECONDUCTOR(:id, :nombre, :cui, :direccion, :telefono, :fechanac); END;";
     $sent = oci_parse($data->getConn(), $sql);
     $this->id = $id;
     oci_bind_by_name($sent, ':id', $id);
     oci_bind_by_name($sent, ':nombre', $this->nombre);
     oci_bind_by_name($sent, ':cui', $this->cui);
     oci_bind_by_name($sent, ':direccion', $this->direccion);
     oci_bind_by_name($sent, ':telefono', $this->telefono);
     oci_bind_by_name($sent, ':fechanac', $this->fechanac);
     oci_execute($sent);
     $data->free($sent);
     $data->close();
 }
 function loadResponsavel()
 {
     include_once 'app.ado/DataBase.php';
     $db = new DataBase();
     $est = $db->getConn()->query('select nome_usuario from usuarios where id_usuario = ' . $this->responsavel_id . ';')->fetch(PDO::FETCH_COLUMN);
     return $est;
 }