<?php
    if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Bitacora_Model extends CI_Model
{
    //Constructor 
    function __construct()
    {
        parent::__construct();
        //$this->load->library('encryption');
    }

    //Registrar Correos
    public function saveBitacora($datob)
    {
        //Inicio transaccion    
        $this->db->trans_begin();  
        
		//Insertar el registro
        $this->db->insert('bitacora',$datob);
        
        //Control de transacciones 
        if ($this->db->trans_status() === false) {
            $this->db->trans_rollback();
            return false;
        } else {
            $this->db->trans_commit();
            return true;
        }
              
    }

    public function getBitacora($data)
    {
        
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetBitacora @Opcion    = ".$data[0].",
                                     @IdEvento  = ".$data[1].",
                                     @FechaIni  = ".$data[2].",
                                     @FechaFin  = ".$data[3].",
                                     @IdUsuario = ".$data[4]."";
        
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
	   
    }
}

?>

