USP_SALESORDER_DELETE_UNPRINTEDTICKETS

Executes the "Order Clean Unprinted Tickets Record Operation" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


CREATE procedure dbo.USP_SALESORDER_DELETE_UNPRINTEDTICKETS
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier
)
as begin

    declare @e int;
    declare @contextCache varbinary(128);

    set @contextCache = CONTEXT_INFO();

    if not @CHANGEAGENTID is null
        set CONTEXT_INFO @CHANGEAGENTID

    delete from dbo.TICKETPRINTINFO
    where
        WORKSTATIONID is null and
        TICKETID in (select ID from dbo.UFN_ORDER_GETTICKETS(@ID))

    if not @contextCache is null
        set CONTEXT_INFO @contextCache

    select @e=@@error;

    if @e<>0 return -456; --always return non-zero sp result if an error occurs


    return 0;

end