UFN_MKTMARKETINGPLANITEMEXPENSE_BASECURRENCIESMATCH

Indicates whether or not the base currency of a marketing plan item expense matches that of its parent item.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@BASECURRENCYID uniqueidentifier IN
@MARKETINGPLANITEMID uniqueidentifier IN

Definition

Copy


create function dbo.[UFN_MKTMARKETINGPLANITEMEXPENSE_BASECURRENCIESMATCH]
(
  @BASECURRENCYID uniqueidentifier,
  @MARKETINGPLANITEMID uniqueidentifier
)
returns bit
as 
  begin
    declare @MATCH bit;

    set @MATCH = 1;

    if not @BASECURRENCYID is null
      set @MATCH = case when @BASECURRENCYID = (select [BASECURRENCYID] from dbo.[MKTMARKETINGPLANITEM] where [ID] = @MARKETINGPLANITEMID) then 1 else 0 end;

    -- if @BASECURRENCYID is null, the trigger on the plan brief table is going to set it to match that of the item, which matches the plan, 

    -- so the point is moot


    return @MATCH;
  end;