

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO
IF EXISTS (SELECT name FROM sysobjects 
         WHERE name = 'CIZCOMP' AND type = 'P')
   DROP PROCEDURE CIZCOMP
GO

CREATE PROCEDURE CIZCOMP
@P_USER_ID CHAR(8)
AS


/******************************************************************************
   NAME:       CIZCOMP
   PURPOSE:    Standard Extract Company Title for Crystal Report

******************************************************************************/

  DECLARE 	@V_LANGUAGE_CD CHAR(3)

BEGIN

	SELECT	@V_LANGUAGE_CD=LANGUAGE_CD
	FROM	SC_USER
	WHERE  SC_USER.USER_ID = @P_USER_ID;
	IF	(SELECT @@ROWCOUNT) = 0
	BEGIN
		SELECT @V_LANGUAGE_CD = 'ENG'
	END

	SELECT IML.INST_MSG_TEXT AS COMPANY_TITLE
	FROM CI_INSTALL_MSG_L IML
	WHERE	IML.LANGUAGE_CD = @V_LANGUAGE_CD
	AND	IML.INST_MSG_TYPE_FLG = 'RPTC'
   	AND 	IML.SEQ_NUM = (SELECT MAX (SEQ_NUM)
  		 	FROM	CI_INSTALL_MSG
			WHERE	INSTALL_OPT_ID = IML.INSTALL_OPT_ID
			AND	INST_MSG_TYPE_FLG = IML.INST_MSG_TYPE_FLG);

	RETURN

END



GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

