UFN_SALESORDERITEM_GETEXISTINGIDFORPROGRAM

Return

Return Type
uniqueidentifier

Parameters

Parameter Parameter Type Mode Description
@SALESORDERID uniqueidentifier IN
@PROGRAMID uniqueidentifier IN
@PRICETYPECODEID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_SALESORDERITEM_GETEXISTINGIDFORPROGRAM(@SALESORDERID uniqueidentifier, @PROGRAMID uniqueidentifier, @PRICETYPECODEID uniqueidentifier)
returns uniqueidentifier
as begin
    return (
        select SALESORDERITEM.ID
        from dbo.SALESORDERITEMTICKET
        inner join dbo.SALESORDERITEM on SALESORDERITEM.ID = SALESORDERITEMTICKET.ID
        where
            SALESORDERITEM.SALESORDERID = @SALESORDERID
            and SALESORDERITEMTICKET.PROGRAMID = @PROGRAMID
            and SALESORDERITEMTICKET.PRICETYPECODEID = @PRICETYPECODEID
            and SALESORDERITEMTICKET.ID not in (select ID from dbo.SALESORDERITEMTICKETCOMBINATION)
    );
end