UFN_RESERVATIONRATESCALE_ISFEEINCLUDED

Indicates whether or not a fee is included in the rate scale on a reservation.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN
@FEEID uniqueidentifier IN

Definition

Copy


        CREATE function dbo.UFN_RESERVATIONRATESCALE_ISFEEINCLUDED
        (
            @ID uniqueidentifier,
            @FEEID uniqueidentifier = null
        )
        returns bit
        with execute as caller
        as 
        begin
            if @FEEID is null
                return 0;

            if exists
            (
                select top 1 1 from dbo.RESERVATIONRATESCALE
                left join dbo.RESERVATIONRATESCALEFEE on
                    RESERVATIONRATESCALE.ID = RESERVATIONRATESCALEFEE.RESERVATIONRATESCALEID
                where
                    RESERVATIONRATESCALE.ID = @ID and
                    (
                        (
                            RESERVATIONRATESCALEFEE.FEEID is not null and
                            RESERVATIONRATESCALEFEE.FEEID = @FEEID 
                        )
                        or
                        INCLUDEALLFEES = 1
                    )
            )
            begin
                return 1;
            end

            return 0;
        end