
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

IF EXISTS (SELECT name FROM sysobjects 
         WHERE name = 'CIZINST' AND type = 'P')
   DROP PROCEDURE CIZINST
GO

CREATE PROCEDURE CIZINST
@P_REPORT_CD  CHAR(12),
@P_USER_ID CHAR(8)
AS

/******************************************************************************
   NAME:       CIZINST
   PURPOSE:    Standard Extract User Profile and font info for Crystal Report

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

   DECLARE   @V_USER_ID    CHAR(8)
   DECLARE   @V_RETURN_CD  int

   SELECT @V_RETURN_CD = 0

BEGIN

      SELECT @V_USER_ID=USER_ID
	  FROM	 SC_USER
	  WHERE  SC_USER.USER_ID = @P_USER_ID;
      IF	(SELECT @@ROWCOUNT) = 0
      BEGIN
	SELECT @V_USER_ID = 'CDX'
	SELECT @V_RETURN_CD = 1003
      END

	SELECT  USR.LANGUAGE_CD, 
		DIS.DT_DISP_FMT, 
		DIS.TIME_FORMAT,
       		DIS.NBR_GRP_SYMBOL, 
		DIS.DECIMAL_SYMBOL,
       		L1.DESCR AS NBR_NEG_FMT_FLG, 
		L2.DESCR AS CUR_NEG_FMT_FLG,
       		CURR.CUR_SYMBOL, 
		CURR.DECIMAL_POSITIONS,
       		CURR.SCALE_POSITIONS, 
		CURR.CUR_POS_FLG,
	   	R.RPT_FONT , 
		R.RPT_FONT_SIZE,
       		R.OVRD_RPT_FONT , 
		R.OVRD_RPT_FONT_SIZE
  	FROM	CI_CURRENCY_CD CURR,
       		CI_INSTALLATION INS,
		CI_DISP_PROF DIS,
       		SC_USER USR,
       		CI_LOOKUP L1,
       		CI_LOOKUP L2,
	   	CI_MD_RPT_L R
  	WHERE	USR.USER_ID = @V_USER_ID
        AND	USR.DISP_PROF_CD = DIS.DISP_PROF_CD
        AND	INS.CURRENCY_CD = CURR.CURRENCY_CD
	AND	L1.LANGUAGE_CD = USR.LANGUAGE_CD
	AND	L1.FIELD_NAME = 'NBR_NEG_FMT_FLG' 
	AND	L1.FIELD_VALUE = DIS.NBR_NEG_FMT_FLG
  	AND	L2.LANGUAGE_CD = USR.LANGUAGE_CD
  	AND	L2.FIELD_NAME = 'CUR_NEG_FMT_FLG' 
	AND	L2.FIELD_VALUE = DIS.CUR_NEG_FMT_FLG
  	AND	R.REPORT_CD = @P_REPORT_CD  
	AND	R.LANGUAGE_CD = USR.LANGUAGE_CD ;



    RETURN

END


GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

