dbo.obtener_padron_impuestos

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@id_padron int 4

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

--EXEC dbo.obtener_padron_impuestos '1434060'

CREATE OR ALTER PROCEDURE dbo.obtener_padron_impuestos 
@id_padron int
AS



BEGIN
    SET NOCOUNT ON;

 select distinct a.codigo_impuesto, impuestos.nombre_impuesto, 
        iif(fecha_inscripcion is null,null,(convert(varchar,year(fecha_inscripcion))+'-'+right('00'+convert(varchar,month(fecha_inscripcion)),2))) as fecha_inscripcion,
     estado
   from padron_impuestos a
  inner join impuestos
     on impuestos.codigo_impuesto = a.codigo_impuesto
  where id_padron =  @id_padron 
  /* agregado 28/9/2018 */
  and ISNULL(estado,'') != ''
  and id_impuestos = (select MAX(id_impuestos) from padron_impuestos b where b.id_padron = a.id_padron and b.codigo_impuesto = a.codigo_impuesto) 
     and a.visible=1
  /* antes estaba
    and (estado != '') 
    */

  /*and a.id_impuestos in ( select max(id_impuestos) from padron_impuestos b where a.created  > b.created and a.id_padron = @id_padron)*/

END 

GO

Used By

No items found