USP_SALESORDER_GENERATETICKETINSTANCES

Executes the "Order Generate Ticket Instances Record Operation" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being updated.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the update.
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.

Definition

Copy


CREATE procedure dbo.USP_SALESORDER_GENERATETICKETINSTANCES
(
    @ID uniqueidentifier,
    @CHANGEAGENTID uniqueidentifier,
    @CURRENTAPPUSERID uniqueidentifier
)
as begin
    insert into dbo.TICKETPRINTINFO
    (
        ID,
        TICKETID,
        APPUSERID,
        WORKSTATIONID,
        --BARCODE,

        ADDEDBYID,
        CHANGEDBYID,
        DATEADDED,
        DATECHANGED
    )
    select
        newid(),
        TICKET.ID,
        @CURRENTAPPUSERID,
        (select top(1) ID from dbo.WORKSTATION),
        --dbo.UFN_TICKETPRINTINFO_GENERATEBARCODE(),

        @CHANGEAGENTID,
        @CHANGEAGENTID,
        getdate(),
        getdate()
    from
        dbo.TICKET
        inner join dbo.SALESORDERITEMTICKET SOIT on TICKET.SALESORDERITEMTICKETID = SOIT.ID
        inner join dbo.SALESORDERITEM SOI on SOI.ID = SOIT.ID
    where
        SOI.SALESORDERID = @ID

    return 0;

end