set ANSI_NULLS OFF
set QUOTED_IDENTIFIER OFF
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[a_sel_cat_resumenOtro]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[a_sel_cat_resumenOtro]
GO
CREATE PROCEDURE a_sel_cat_resumenOtro
@p_id_catalogo as  int
AS
BEGIN
select 'Total Reportado' as descripcion,convert(varchar,case when sum(doc_itemDocumento.costoEjecutado) is null then 0 else sum(doc_itemDocumento.costoEjecutado) end  ) as dato
from doc_itemDocumento inner join [doc_documento.ot]  as ot on ot.id=doc_itemDocumento.id_documento
where id_catalogo=@p_id_catalogo and doc_itemDocumento.active=1

select 'Total Consumido' as descripcion,convert(varchar, case when sum(cantidad)is null then 0 else sum(cantidad) end )as dato
from dis_evento_catalogo
where id_catalogo=@p_id_catalogo and active=1
END
GO
