USP_SIMPLEDATALIST_SALESORDER_PATRONMEMBERSHIPS

Lists the various memberships belonging to the patron on a given sales order

Parameters

Parameter Parameter Type Mode Description
@SALESORDERID uniqueidentifier IN Sales order ID

Definition

Copy


CREATE procedure dbo.USP_SIMPLEDATALIST_SALESORDER_PATRONMEMBERSHIPS
(
    @SALESORDERID uniqueidentifier
)
as
    select 
        MEMBERSHIP.ID as VALUE
        dbo.UFN_MEMBERSHIP_GETDESCRIPTION(MEMBER.MEMBERSHIPID) as LABEL
    from dbo.SALESORDER
        inner join dbo.MEMBER on SALESORDER.CONSTITUENTID = MEMBER.CONSTITUENTID
        inner join dbo.MEMBERSHIP on MEMBER.MEMBERSHIPID = MEMBERSHIP.ID
    where
        MEMBER.ISDROPPED = 0 and
        MEMBERSHIP.STATUSCODE = 0 and
        MEMBERSHIP.EXPIRATIONDATE >= dbo.UFN_DATE_GETEARLIESTTIME(getdate()) and
        SALESORDER.ID = @SALESORDERID