Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- #
- #
- class Alumno < ActiveRecord::Base
- establish_connection 'sega_' + Rails.env
- self.table_name = 'movcInscripciones'
- self.primary_key = 'IdInscripcion'
- # datos de prueba
- # 242633
- # matricula 206829
- def self.por_matricula(matricula)
- Alumno.where(Matricula: matricula, IdEstatus: [2, 4, 11,17])
- end
- def horario
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sql_query = "
- Declare @IdInscripcion As Int
- Declare @IdCicloEscolar As Int
- Set @IdInscripcion = #{self.IdInscripcion}
- Set @IdCicloEscolar = #{self.IdCicloEscolar}
- Select Distinct @IdInscripcion as IdInscripcion, i.Ciclo, j.Materia as Clave,
- i.Descripcion as Materia,
- isnull(k.Descripcion,'') as Opcion, aa.Grupo, aa.IdGrupo,
- l.Descripcion as Tipo,
- isnull(HLunes,'') as HLunes, isnull(L_SalonGrupo,'') as SLunes,
- isnull(HMartes,'') as HMartes, isnull(M_SalonGrupo,'') as sMartes,
- isnull(HMiercoles,'') as HMiercoles, isnull(MM_SalonGrupo,'') as SMiercoles,
- isnull(HJueves,'') as HJueves, isnull(J_SalonGrupo,'') as SJueves,
- isnull(HViernes,'') as HViernes, isnull(V_SalonGrupo,'') as SViernes,
- isnull(HSabado,'') as HSabado, isnull(S_SalonGrupo,'') as SSabado,
- --isnull(HViernes,'') as HDomingo, isnull(V_SalonGrupo,'') as SDomingo,
- isnull(HDomingo,'') As HDomingo, isNull(D_SalonGrupo,'') As SDomingo,
- '' as Maestro, Fechas
- From (
- Select Distinct h.IdMateriaPlanEstudios, a.IdOpcionMateria, a.IdTipoGrupo, a.Grupo,
- row_number() over(Partition by a.IdGrupo order by a.IdGrupo) as Ren, a.IdGrupo,
- Convert(char(5), b.HoraEntrada, 108) + ' - ' + Convert(char(5), b.HoraSalida, 108) as HLunes,
- b.SalonGrupo as L_SalonGrupo, b.Ren as RLunes,
- Convert(char(5), c.HoraEntrada, 108) + ' - ' + Convert(char(5), c.HoraSalida, 108) as HMartes,
- c.SalonGrupo as M_SalonGrupo, c.Ren as RMartes,
- Convert(char(5), d.HoraEntrada, 108) + ' - ' + Convert(char(5), d.HoraSalida, 108) as HMiercoles,
- d.SalonGrupo as MM_SalonGrupo, d.Ren as RMiercoles,
- Convert(char(5), e.HoraEntrada, 108) + ' - ' + Convert(char(5), e.HoraSalida, 108) as HJueves,
- e.SalonGrupo as J_SalonGrupo, e.Ren as RJueves,
- Convert(char(5), f.HoraEntrada, 108) + ' - ' + Convert(char(5), f.HoraSalida, 108) as HViernes,
- f.SalonGrupo as V_SalonGrupo, f.Ren as RViernes,
- Convert(char(5), g.HoraEntrada, 108) + ' - ' + Convert(char(5), g.HoraSalida, 108) as HSabado,
- g.SalonGrupo as S_SalonGrupo, g.Ren as RSabado,
- Convert(char(5), m.HoraEntrada, 108) + ' - ' + Convert(char(5), m.HoraSalida, 108) as HDomingo,
- m.SalonGrupo as D_SalonGrupo, m.Ren as RDomingo,
- Convert(char(10), a.FechaInicio, 103) /*+ ' - ' + Convert(char(10), a.FechaFin, 103)*/ as Fechas
- From movdInscripciones h with (nolock)
- Inner Join movcGrupos a with (nolock)
- On h.IdGrupo = a.IdGrupo
- --And a.IdTipoGrupo = 1
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 1) as b
- On a.IdGrupo = b.IdGrupo
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 2) as c
- On a.IdGrupo = c.IdGrupo
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 3) as d
- On a.IdGrupo = d.IdGrupo
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 4) as e
- On a.IdGrupo = e.IdGrupo
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 5) as f
- On a.IdGrupo = f.IdGrupo
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 6) as g
- On a.IdGrupo = g.IdGrupo
- Left Join (Select ab.*,bb.SalonGrupo, row_number() over(partition by IdGrupo order By IdGrupo) as Ren
- From movdGrupos ab with (nolock)
- Inner Join catcSalonesGrupos bb with (nolock)
- On ab.IdSalonGrupo = bb.IdSalonGrupo
- Where ab.IdDia = 7) as m
- On a.IdGrupo = m.IdGrupo
- Where IdInscripcion = @IdInscripcion
- And a.IdCicloEscolar = @IdCicloEscolar) as aa
- Inner Join catdMateriasPlanesEstudio i
- On aa.IdMateriaPlanEstudios = i.IdMateriaPlanEstudios
- Inner Join catcMaterias j
- On i.IdMateria = j.IdMateria
- Left Join catcOpcionesMaterias k
- On (aa.IdOpcionMateria = k.IdOpcionMateria )
- Inner Join catcTiposGrupos l
- On aa.IdTipoGrupo = l.IdTipoGrupo
- Order By i.Ciclo, j.Materia
- "
- @resultado = @connection.connection.exec_query(sql_query, :skip_logging)
- end
- def horario_juan
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sql_query = ""
- end
- def self.info_matricula_odonto(matricula)
- #Alumno.where(Matricula: matricula, IdEstatus: [2, 4, 17])
- #Alumno.joins("INNER JOIN catdDetalleCampus on movcInscripciones.iddcampus = catdDetalleCampus.IddCampus INNER JOIN ").where(Matricula: matricula, IdEstatus: [2, 4, 11,17])
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sql_query = "Select b.nombre+' '+ b.primerapellido +' '+b.Segundoapellido AS Nombre, d.Descripcion AS Estatus,c.DescProgramaEducativo AS 'Programa', c.DescModalidad As Modalidad,
- c.campus,
- a.IdInscripcion ,a.Matricula
- From
- movcInscripciones a
- INNER JOIN catcPersonas b ON a.idPersona = b.idPersona
- INNER JOIN catdDetalleCampus c ON a.iddCampus = c.iddCampus
- INNER JOIN catcEstatus d ON a.idEstatus = d.idEstatus
- WHERE a.Matricula ="+ matricula +
- " AND a.IdEstatus in (2, 4, 11,17)"
- @resultado = @connection.connection.exec_query(sql_query, :skip_logging)
- end
- #Método que nos sirve para saber el horario del alumno con su idinscripcion respecto a un ciclo escolar
- def self.programas_educativos_x_matricula(matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_ConsultasAlumno14 14,#{matricula}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para saber el horario del alumno con su idinscripcion respecto a un ciclo escolar
- def self.horario_x_idInscripcion_idCicloEscolar(idInscripcion,idCicloEscolar)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_SEGAMovilHorarioAlumno 5,#{idInscripcion},#{idCicloEscolar}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para saber las faltas del alumno con su idinscripcion respecto a un ciclo escolar
- def self.faltas_x_idInscripcion_idCicloEscolar(idInscripcion,idCicloEscolar)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_SEGAMovilHorarioAlumno 6,#{idInscripcion},#{idCicloEscolar}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.titulacion_x_idInscripcion(idInscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONTitulaciones 5,#{idInscripcion}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para consultar la fotografia del alumno
- def self.fotografia_alumno matricula
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- #TODO Eliminar esta funcion cuando pasaemos a producción y que esta quede fija en la BD.
- =begin
- CREATE FUNCTION dbo.f_BinaryToBase64(@bin VARBINARY(MAX))
- RETURNS VARCHAR(MAX)
- AS
- BEGIN
- DECLARE @Base64 VARCHAR(MAX)
- SET @Base64 = CAST(N'' AS XML).value('xs:base64Binary(xs:hexBinary(sql:variable("@bin")))','VARCHAR(MAX)')
- RETURN @Base64
- END
- =end
- sql_query =
- "
- Declare @matricula As Int
- Set @matricula = #{matricula.strip}
- Select top 1 dbo.f_BinaryToBase64(b.Fotografia) As fotografia
- From credenciales..movcCredenciales a
- Inner Join credenciales..catdFotografias b
- On a.IdFoto = b.IdFoto
- where a.clave = @matricula And b.tipo = 'A'
- Order by a.IdCredencial desc
- "
- @resultado = @connection.connection.exec_query(sql_query, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.kardex_alumno(idInscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = " sp_movdKardex9 9,0,#{idInscripcion},0,0,0,0,0,0,'',0,0,'',0,0,'',0,0,'',0,0,'','','','','','',0,0,0,0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.bloqueo_alumno(matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONValidarBloqueoAlumno 3,#{matricula},'',0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.carnet_alumno(matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_movil_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONCarnetCultural #{matricula},1"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.calificaciones_alumno(idInscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_codafyr_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = " sp_CONConsultaCalificacionesAlumnos #{idInscripcion}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.informacion_gral_alumno(matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql =
- "
- Select c.PrimerApellido,c.SegundoApellido,c.Nombre,c.Genero,a.promedio,b.UnidadAcademica,b.DescProgramaEducativo,b.DescNivelAcademico,b.DescModalidad,b.Campus
- From movcInscripciones a
- Inner Join catdDetalleCampus b
- On a.IddCampus = b.IddCampus
- Inner Join catcPersonas c
- On a.IdPersona = c.IdPersona
- Where a.Matricula = #{matricula.strip}
- And a.IdEstatus in (4)
- "
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos regresa los datos academicos y los datos personales del alumno por su matricula
- def self.datos_academicos_personales_alumno(matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONDatosAlumnoBECA 5, #{matricula.strip}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_documentos_tutorias (matricula)
- #sp_movcDocumentosAlumnos 5, 0,[Matricula], 3, 0, '', 0, 0, 0, '', 0, 0, '', '', 0, 0, 0, '', '', '', '', '', '', '', 0
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_movcDocumentosAlumnos 5, 0,#{matricula}, 3, 0, '', 0, 0, 0, '', 0, 0, '', '', 0, 0, 0, '', '', '', '', '', '', '', 0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_academicos_personales_tutorias(matricula)
- #sp_TutoriasConsultaDatosEscolares 8,'','',235129, 0,'','',0
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_TutoriasConsultaDatosEscolares 8,'','',#{matricula}, 0,'','',0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_inscripcion_tutorias(id_unidad, matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_TutoriasConsultaDatosEscolares 11,#{id_unidad},'',#{matricula}, 0,'','',0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_calificaciones_alumno_tutorias(id_inscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONConsultaCalificacionesAlumnos #{id_inscripcion}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_faltas_alumno_tutorias(id_inscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONFaltasEvaluacion #{id_inscripcion}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_horario_alumno_tutorias (id_inscripcion, id_ciclo_escolar)
- #sp_movcInscripcionesAnexo6 8,[IdInscripcion], 0, 0, 0, 0, 0, 0, 0, 0,[IdCicloEscolar], '', '', '', 0, 0, 0, '', '', '', '', '', '', 0, '', 0, '', 0, '', 0, 0
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_movcInscripcionesAnexo6 8,#{id_inscripcion}, 0, 0, 0, 0, 0, 0, 0, 0,#{id_ciclo_escolar}, '', '', '', 0, 0, 0, '', '', '', '', '', '', 0, '', 0, '', 0, '', 0, 0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_horario_examenes_tutorias(id_inscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_CONHorarioEvaluacionesAlumno #{id_inscripcion}"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_carnet_salud_tutorias (matricula, id_facultad, id_programa_edicativo)
- #sp_catcCarnetAlumnos 6, 0,[Matricula],'[Facultad]','[IdProgramaEducativo]','','',0,'','','','',''
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_catcCarnetAlumnos 6, 0, #{matricula}, '#{id_facultad}', #{id_programa_edicativo}','','',0,'','','','',''"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_kardex_tutorias (id_inscripcion)
- #sp_movdKardex 9, 0,[IdInscripcion], 0, 0, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, '', 0, 0, '', 0, 0, '', '', '', '', '', 0, 0, 0, 0, '', 0
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_movdKardex 9, 0,#{id_inscripcion}, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, '', 0, 0, '', 0, 0, '', 0, 0, '', '', '', '', '', 0, 0, 0, 0, '', 0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_ceneval_globales_tutorias (matricula, id_facultad)
- #sp_TutoriasConsultaDatosEscolares 15,'[Facultad]','',[Matricula], 0,'','',0
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_TutoriasConsultaDatosEscolares 15,'#{id_facultad}','',#{matricula}, 0,'','',0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- def self.datos_ceneval_modulos_tutorias (matricula, id_facultad)
- #sp_TutoriasConsultaDatosEscolares 15,'[Facultad]','',[Matricula], 0,'','',0
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = "sp_TutoriasConsultaDatosEscolares 16,'#{id_facultad}','',#{matricula}, 0,'','',0"
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.informacion_gral_alumno_codafyr(matricula)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql =
- "
- Select c.PrimerApellido,c.SegundoApellido,c.Nombre,c.Genero,c.FechaNacimiento,c.Curp,c.RFC,c.Calle +' '+ c.NumeroExterior+' Col. '+ c.Colonia As Direccion,c.CodigoPostal,c.Telefono,
- c.Celular,d.descripcion As Nacionalidad,g.descripcion as Estado, f.descripcion as Municipio,
- a.promedio,b.UnidadAcademica,b.DescProgramaEducativo,b.DescNivelAcademico,b.DescModalidad,b.Campus
- From movcInscripciones a
- Inner Join catdDetalleCampus b
- On a.IddCampus = b.IddCampus
- Inner Join catcPersonas c
- On a.IdPersona = c.IdPersona
- Inner Join catcNacionalidades d
- On c.IdNacionalidad = d.IdNacionalidad
- Inner Join catcLocalidades e
- On c.IdLocalidad = e.IdLocalidad
- Inner Join catcMunicipios f
- On e.IdMunicipio = f.IdMunicipio
- Inner Join catcEstados g
- On f.IdEstado = g.IdEstado
- Where a.Matricula = #{matricula.strip}
- "
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- #Método que nos sirve para conocer el estatus de la titulación de los alumnos por idInscripcion
- def self.faltas_alumno_codafyr(idInscripcion)
- config = Rails.configuration.database_configuration
- enviroment = 'sega_codafyr_' + Rails.env
- @connection = ActiveRecord::Base.establish_connection(
- :adapter => config[enviroment]['adapter'],
- :url => config[enviroment]['url'],
- :database => config[enviroment]['database'],
- :username => config[enviroment]['username'],
- :password => config[enviroment]['password']
- )
- sentencia_sql = " sp_CONFaltasMes #{idInscripcion}"
- p sentencia_sql.inspect
- @resultado = @connection.connection.exec_query(sentencia_sql, :skip_logging)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement