USP_RECORDOPERATION_WEALTHCAPACITYFORMULARECALCULATECONSTITUENTPROMPT

Provides the prompt for the "Wealth Capacity Formula: Recalculate Constituent" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID nchar IN Represents information to be displayed in the record operation prompt.
@COUNT int INOUT
@LOCKEDCOUNT int INOUT

Definition

Copy


                            CREATE procedure dbo.USP_RECORDOPERATION_WEALTHCAPACITYFORMULARECALCULATECONSTITUENTPROMPT (
                                @ID nchar(72),
                                @COUNT int output,
                                @LOCKEDCOUNT int output
                            ) as
                                set nocount on;

                                declare @WEALTHCAPACITYFORMULAID uniqueidentifier;
                                declare @CONSTITUENTID uniqueidentifier;
                                declare @VALIDIDS bit;

                                begin try
                                    set @WEALTHCAPACITYFORMULAID = convert(uniqueidentifier,substring(@ID,0,37));
                                    set @CONSTITUENTID = convert(uniqueidentifier,substring(@ID,37,37));
                                    set @VALIDIDS = 1;
                                end try
                                begin catch
                                    set @VALIDIDS = 0;
                                end catch

                                if @VALIDIDS = 1 begin
                                    select
                                        @COUNT = count(WC.ID)
                                    from
                                        dbo.WEALTHCAPACITY WC
                                    where
                                        WC.WEALTHCAPACITYFORMULAID = @WEALTHCAPACITYFORMULAID and
                                        WC.CONFIRMED = 0 and
                                        WC.ID = @CONSTITUENTID;

                                    select
                                        @LOCKEDCOUNT = count(WC.ID)
                                    from
                                        dbo.WEALTHCAPACITY WC
                                    where
                                        WC.CONFIRMED = 1 and
                                        WC.ID = @CONSTITUENTID;
                                end

                                return 0;