Licenciatura en Cs. Informátivas

Páginas: 3 (550 palabras) Publicado: 13 de diciembre de 2013
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
-- EXEC spHistorialPagoMatriculas 3159

CREATE PROCEDURE [dbo].[spHistorialPagoMatriculas]
(@ProfesionalID int)

AS
BEGIN
SELECTPCHM.ProfesionalID,
MAT.Singular as Matricula,
PCHM.NroMatricula,
(ltrim(rtrim(PF.Apellido)) + ' ' + ltrim(rtrim(PF.Nombres))) as Profesional,
(SELECT top 1 CA2.fecha_vigencia FROMCategoriasActuaciones CA2 WHERE CA2.idProfesional = PRO.idProfesional ORDER BY CA2.fecha_vigencia) as FechaAltaEnConsejo,
CAT.descripcion as CategoriaVigente,
PRO.Fecha_Vigencia as FechaVigenciaCategoria,PCHM.Anio,

CASE WHEN PCHM.Anio >= 2007 THEN
(SELECT sum(importeCredito)
FROM vw_vista_contable_general AM
WHERE AM.idAsiento in (SELECT AC.idAsiento FROM asientosCabecera ACwhere AC.Explicacion like 'INGRESOS POR CUOTA HABILITACION%' AND year(AC.FechaImputacion) = PCHM.Anio)
AND AM.idPersona = PRO.idPersona
AND AM.idCuenta = 170
AND AM.importeCredito > 0)ELSE
0
END AS ImporteAPagar,

PCHM.NroCuota,
PCHM.ImportePago,
PCHM.FechaPago,
0 as Compensacion

FROM PagoCuotaHabilitacionMatricula PCHM
JOIN Profesionales PRO ONPRO.idProfesional = PCHM.ProfesionalID
JOIN Personas P ON P.idPersona = PRO.idPersona
JOIN PersonasFisicas PF ON PF.idPersona_id = P.idPersona_id
JOIN Categorias CAT ON CAT.idCategoria =PRO.idCategoriaVigente
JOIN Matriculas MAT ON MAT.idMatricula = PRO.idMatricula

WHERE PCHM.ProfesionalID = @ProfesionalID

UNION

SELECT
AM.idPersonaRef as ProfesionalID,PRO.Matricula,--MAT.Singular as Matricula,
PRO.Numero as NroMatricula,
PRO.Profesional,--(ltrim(rtrim(PF.Apellido)) + ' ' + ltrim(rtrim(PF.Nombres))) as Profesional,
(SELECT top 1 CA2.fecha_vigencia FROMCategoriasActuaciones CA2 WHERE CA2.idProfesional = PRO.idProfesional ORDER BY CA2.fecha_vigencia) as FechaAltaEnConsejo,
PRO.Categoria as CategoriaVigente,--CAT.descripcion as CategoriaVigente,...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Informe de cs
  • Informe Cs De La Tierra Eas
  • INFORME CS. NATURALES
  • Informe De Cs De La Tierra
  • Informe Sobre Rocas Cs De La Tierra
  • Informe sobre el film peli taller de cs
  • informe de cs de la tierra
  • INFORME 1 CS TIERRA

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS