SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

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

CREATE PROCEDURE WINV_Almacen_GetCombo
AS
BEGIN

	SELECT	LTRIM(RTRIM(codigo))codigo, LTRIM(RTRIM(descripcion))descripcion, id_alma
	INTO	#TEM_Alma 
	FROM	STOKALMA
	
	SELECT	*
	FROM	#TEM_Alma
	
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_Almacen_Edicion_GetCombo') )
--DROP PROCEDURE WINV_Almacen_Edicion_GetCombo
--GO

--CREATE PROCEDURE WINV_Almacen_Edicion_GetCombo
--AS
--BEGIN

--	SELECT	LTRIM(RTRIM(a.codigo))codigo, LTRIM(RTRIM(a.descripcion))descripcion, a.id_alma 
--	INTO	#TEM_Alma
--	FROM	stokalma a  
--	where	a.inv_cerrado=1 
--	order by 1
	
--	SELECT	*
--	FROM	#TEM_Alma
	
--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_Almacen_TrasladoED_Filtro_GetCombo') )
--DROP PROCEDURE WINV_Almacen_TrasladoED_Filtro_GetCombo
--GO

--CREATE PROCEDURE WINV_Almacen_TrasladoED_Filtro_GetCombo
--		@origen INT,
--		@id_origen INT
		
--AS
--BEGIN

--	DECLARE @Sql nVARCHAR(MAX)
	
--	SET @Sql = ''

	
--	SET @Sql = 'SELECT LTRIM(RTRIM(a.codigo))codigo, LTRIM(RTRIM(a.descripcion))descripcion, a.id_alma FROM stokalma a '

--	IF(@id_origen > 0)
--	BEGIN
	
--		IF(@origen = 0)
--		BEGIN
--			SET @Sql = @Sql + ' where a.id_alma is null '
--		END
--		ELSE
--		BEGIN
--			SET @Sql = @Sql + ' inner join stokalse s on a.id_alma = s.id_alma where s.id_secc = '+STR(@id_origen,14,0)
--		END 
		
--		SET @Sql = @Sql + ' and a.inv_cerrado = 1'
		
--	END
--	ELSE
--	BEGIN
--		SET @Sql = @Sql + ' where a.inv_cerrado = 1'
--	END

--	SET @Sql = @Sql + ' order by 1'

--	EXEC sp_executesql @Sql
	
--END
--GO




