fnEventItemPendingCapacity

Return

Return Type
int

Parameters

Parameter Parameter Type Mode Description
@EventItemsID int IN

Definition

Copy


CREATE  FUNCTION dbo.fnEventItemPendingCapacity
    (    
    @EventItemsID int
    )
    RETURNS int
    AS
    BEGIN
    RETURN (
        select sum(NumRegistrants) from dbo.EventItemCapacity eic
        where eic.EventItemPriceBackOfficeID in
            (select distinct(eip.BackOfficeID) from dbo.EventItemPrices eip
                inner join dbo.EventItems ei on eip.EventItemsID = ei.ID
                where ei.BackOfficeID = (select BackOfficeID from dbo.EventItems where [ID]=@EventItemsID)
            )
        and [processed] = 0 
        )
END