SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'WINV_Seccion_GetGrid') )
DROP PROCEDURE WINV_Seccion_GetGrid
GO

CREATE PROCEDURE WINV_Seccion_GetGrid
	@id_secc  INT,
	@vEliminado BIT
AS
BEGIN

	SELECT id_secc, codigo, LTRIM(RTRIM(descripcion))descripcion, id_cto, consecutivo_ped, unico
	FROM STOKSECC 
	
	RETURN

END
GO

---------------------------------------------------------------------------------
---------------------------------------------------------------------------------

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'WINV_SubmayorArticulos_GetInfo') )
DROP PROCEDURE WINV_SubmayorArticulos_GetInfo
GO

CREATE PROCEDURE WINV_SubmayorArticulos_GetInfo
	@id_secc  INT,
	@vEliminado BIT
AS
BEGIN

	SELECT id_secc, codigo, LTRIM(RTRIM(descripcion))descripcion, id_cto, consecutivo_ped, unico
	FROM STOKSECC secc
	WHERE Exists (SELECT * FROM STOKALSE WHERE id_secc = secc.id_secc and gasto = 0) ORDER BY codigo
	
	RETURN

END
GO