USP_DATAFORMTEMPLATE_PRELOAD_NAMINGOPPORTUNITYRECOGNITION

The load procedure used by the edit dataform template "Naming Opportunity Recognition Add Form"

Parameters

Parameter Parameter Type Mode Description
@MGOPPORTUNITYLINKID uniqueidentifier IN Input parameter indicating the context ID for the record being added.
@NAMINGOPPORTUNITYNAME nvarchar(100) INOUT Naming opportunity
@CONSTITUENTID uniqueidentifier INOUT Constituent
@AMOUNT money INOUT Recognition amount
@REMAINING int INOUT Quantity available
@BASECURRENCYID uniqueidentifier INOUT Base currency

Definition

Copy


                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_PRELOAD_NAMINGOPPORTUNITYRECOGNITION
                    (
                        @MGOPPORTUNITYLINKID uniqueidentifier,
                        @NAMINGOPPORTUNITYNAME nvarchar(100) = null output,
                        @CONSTITUENTID uniqueidentifier = null output,
                        @AMOUNT money = null output,
                        @REMAINING int = null output,
                        @BASECURRENCYID uniqueidentifier = null output
                    )
                    as
                    set nocount on;

                    select
                        @NAMINGOPPORTUNITYNAME = NAMINGOPPORTUNITY.NAME,
                        @REMAINING = NAMINGOPPORTUNITY.REMAINING,
                        @CONSTITUENTID = PROSPECTPLAN.PROSPECTID,
                        @AMOUNT = case when NAMINGOPPORTUNITY.BASECURRENCYID = OPPORTUNITY.BASECURRENCYID then OPPORTUNITY.AMOUNT when NAMINGOPPORTUNITY.BASECURRENCYID = OPPORTUNITY.TRANSACTIONCURRENCYID then OPPORTUNITY.TRANSACTIONAMOUNT else null end,
                        @BASECURRENCYID = NAMINGOPPORTUNITY.BASECURRENCYID
                    from dbo.NAMINGOPPORTUNITY
                    inner join dbo.NAMINGOPPORTUNITYMGOPPORTUNITY on NAMINGOPPORTUNITYMGOPPORTUNITY.NAMINGOPPORTUNITYID = NAMINGOPPORTUNITY.ID
                    inner join dbo.OPPORTUNITY on OPPORTUNITY.ID = NAMINGOPPORTUNITYMGOPPORTUNITY.OPPORTUNITYID
                    inner join dbo.PROSPECTPLAN on PROSPECTPLAN.ID = OPPORTUNITY.PROSPECTPLANID
                    where NAMINGOPPORTUNITYMGOPPORTUNITY.ID = @MGOPPORTUNITYLINKID;