USP_DATAFORMTEMPLATE_VIEW_REALESTATE_SUMMARY

The load procedure used by the view dataform template "Real Estate Summary View Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@REALESTATEASSETS money INOUT Identified value
@C_REALESTATEASSETS money INOUT Confirmed value
@NREALESTATE int INOUT Identified properties
@C_NREALESTATE int INOUT Confirmed properties
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.

Definition

Copy


                    CREATE procedure dbo.[USP_DATAFORMTEMPLATE_VIEW_REALESTATE_SUMMARY]
                    (
                        @ID uniqueidentifier,
                        @REALESTATEASSETS money = null output,
                        @C_REALESTATEASSETS money = null output,
                        @NREALESTATE int = null output,
                        @C_NREALESTATE int = null output,
                        @DATALOADED bit = 0 output
                    )
                    as

                        set NOCOUNT on;
                        set @DATALOADED = 0;

                        declare @ISGROUP bit;

                        select
                            @DATALOADED = 1,
                            @ISGROUP = ISGROUP
                        from
                            dbo.CONSTITUENT
                        where
                            CONSTITUENT.ID = @ID;

                        select 
                            @NREALESTATE = 0,
                            @C_NREALESTATE = 0

                        if @ISGROUP = 0
                            select
                                @REALESTATEASSETS = REALESTATEASSETS,
                                @C_REALESTATEASSETS = REALESTATEASSETSCONFIRMED,
                                @NREALESTATE = REALESTATENUMBER,
                                @C_NREALESTATE = REALESTATENUMBERCONFIRMED
                            from
                                dbo.WEALTH
                            where
                                WEALTH.ID = @ID;
                        else
                            exec dbo.USP_GROUP_GETWEALTHSUMMARY @GROUPID = @ID
                                @REALESTATEASSETS = @REALESTATEASSETS output
                                @C_REALESTATEASSETS = @C_REALESTATEASSETS output
                                @NREALESTATE = @NREALESTATE output,  
                                @C_NREALESTATE = @C_NREALESTATE output

                        if @NREALESTATE = 0
                            set @REALESTATEASSETS = null

                        if @C_NREALESTATE = 0
                           set @C_REALESTATEASSETS = null

                        return 0;