CREATE FUNCTION [dbo].[FNPMO_GET_CONTROL_CAPTION](@pLANG_TYPE VARCHAR(5), @pSCREEN_ID INTEGER,@pCONTROL_ID INTEGER )
RETURNS VARCHAR(100)
AS
BEGIN
	DECLARE @CAPTION VARCHAR(100),
	@CTRL_SCREEN_ID INTEGER

	SELECT @CTRL_SCREEN_ID = GUID FROM TBPMO_CONTROL_SCREEN WHERE 
	CONTROL_ID = @pCONTROL_ID AND SCREEN_ID = @pSCREEN_ID

	SELECT @CAPTION = CAPTION FROM TBPMO_CONTROL_LANGUAGE WHERE LANGUAGE_TYPE = @pLANG_TYPE AND 
	CONTROL_SCREEN_ID = @CTRL_SCREEN_ID

  RETURN(ISNULL(@CAPTION,''))
END
