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

class Tipos_Model extends CI_Model
{
    //Constructor 
    function __construct()
    {
        parent::__construct();
        //$this->load->library('encryption');
    }
	//===============================================================================================================================
	//Buscar Tipos de Documentos
    public function getTipoDoc($data)
    {  

        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetGeneral @Opcion = ".$data[0].",
                                    @Id     = ".$data[1]."";
		
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
	//===============================================================================================================================
	//Buscar Medio de Pago
    public function getMedioPago($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetGeneral @Opcion = ".$data[0].",
                                    @Id     = ".$data[1]."";
        
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
    //===============================================================================================================================
	//Buscar Tipo factura
    public function getTipoFac($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetGeneral @Opcion = ".$data[0].",
                                    @Id     = ".$data[1]."";
        
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
	//===============================================================================================================================
	//Buscar Tipos de Paises
    public function getPaises($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
        
        $misql = "EXEC spGetPaises @Opcion = ".$data[0].",
                                   @IdPais = ".$data[1]."";
            
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;    
    }
	//===============================================================================================================================
	//Buscar Tipos de Departamentos
    public function getDepartamentos($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
        
        $misql = 'EXEC spGetDepartamentos @Opcion         = '.$data[0].',
                                          @IdDepartamento = '.$data[1].',
                                          @IdPais         = '.$data[2].'';

        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
	//===============================================================================================================================
	//Buscar Tipos de Ciudades
    public function getCiudades($data)
    { 
        // print_r($data); die();
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetCiudades @Opcion         = ".$data[0].",
                                     @IdCiudad       = ".$data[1].",
                                     @IdDepartamento = ".$data[2].",
                                     @IdPais         = ".$data[3]."";
                                     
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
        
    }
    //================================================================================================================================
    public function getOcupaciones($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
        
        $misql = "EXEC spGetGeneral @Opcion = ".$data[0].",
                                    @Id     = ".$data[1]."";
            
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;    
    }
    //================================================================================================================================
    public function getEstados($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
           
        $misql = "EXEC spGetEstados @Opcion   = ".$data[0].",
                                    @IdEstado = ".$data[1].",
                                    @Info     = ".$data[2]."";
                                           
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;    
    }
    //================================================================================================================================
    public function getMotivosViaje($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
        
        $misql = "EXEC spGetGeneral @Opcion = ".$data[0].",
                                    @Id     = ".$data[1]."";
            
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;    
    }
    //================================================================================================================================
    public function getClaseOcupacion($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
         
        $misql = "EXEC spGetClaseOcupacion @Opcion           = ".$data[0].",
                                           @IdClaseMatricula = ".$data[1].",
                                           @IdEstado         = ".$data[2]."";

        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;    
    }
    //================================================================================================================================
    public function getIva($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
           
        $misql = "EXEC spGetGeneral  @Opcion = ".$data[0].",
                                     @Id     = ".$data[1]."";

        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;    
    }
    //===============================================================================================================================
	//Buscar Tipo Habitación
    public function getTipoHabitacion($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetTipoHabitacion @Opcion            = ".$data[0].",
                                           @IdTipoHabitacion  = ".$data[1]."";
        
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
    //===============================================================================================================================
	//Buscar Areas
    public function getAreas($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetGeneral @Opcion = ".$data[0].",
                                    @Id     = ".$data[1]."";
        
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
    //===============================================================================================================================
	//Buscar Eventos
    public function getEventos($data)
    {
        $this->load->library('Consultar');
        $conn = $this->CI_Consultar->conexion(APP_SERVERNAME,APP_DBNAME,APP_USER,APP_PASS);
     
        $misql = "EXEC spGetEventos @Opcion      = ".$data[0].",
                                    @IdEvento    = ".$data[1].",
                                    @Nombre      = ".$data[2].",
                                    @Descripcion = ".$data[3].",
                                    @IdEstado    = ".$data[4]."";
        
        $results=$this->CI_Consultar->consultarsp($misql,$conn);
        $results = mb_convert_encoding($results ,'UTF-8', 'HTML-ENTITIES');
        return $results;
    }
}
?>
