USP_DATAFORMTEMPLATE_EDITLOAD_ITINERARYITEMCUSTOMITEM

The load procedure used by the edit dataform template "Itinerary Item Custom Item Edit Data Form"

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN The input ID parameter used to load the fields defined on the form.
@ITINERARYID uniqueidentifier INOUT Itinerary ID
@NAME nvarchar(100) INOUT Name
@STARTDATE date INOUT Start date
@ENDDATE date INOUT End date
@STARTTIME UDT_HOURMINUTE INOUT Start time
@ENDTIME UDT_HOURMINUTE INOUT End time
@NOTES nvarchar(500) INOUT Notes
@LOCATIONID uniqueidentifier INOUT Location
@MARKLOCATIONBUSY bit INOUT Mark location unavailable to other groups
@RESOURCES xml INOUT Supplies/Equipment resources
@IGNORECONFLICTS bit INOUT Ignore conflicts when saving
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@TSLONG bigint INOUT Output parameter indicating the TSLONG value of the record being edited. This is used to manage multi-user concurrency issues when multiple users access the same record.
@STAFFRESOURCES xml INOUT Staffing resources
@ITINERARYCAPACITY int INOUT Itinerary capacity
@LOCATIONPRICE money INOUT Price

Definition

Copy

                CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_ITINERARYITEMCUSTOMITEM
                (
                    @ID uniqueidentifier ,
                    @ITINERARYID uniqueidentifier = null output,
                    @NAME nvarchar(100) = null output,
                    @STARTDATE date = null output,
                    @ENDDATE date = null output,
                    @STARTTIME dbo.UDT_HOURMINUTE = null output,
                    @ENDTIME dbo.UDT_HOURMINUTE = null output,
                    @NOTES nvarchar(500) = null output,
                    @LOCATIONID uniqueidentifier = null output,
                    @MARKLOCATIONBUSY bit = null output,
                    @RESOURCES xml = null output,
                    @IGNORECONFLICTS bit = null output,
                    @DATALOADED bit = 0 output,
                    @TSLONG bigint = 0 output,
                    @STAFFRESOURCES xml = null output,
                    @ITINERARYCAPACITY int = null output,
                    @LOCATIONPRICE money = null output
                )
                as

                set nocount on;

                select @ID = ID,
                    @ITINERARYID = ITINERARYID,
                    @NAME = NAME,
                    @STARTDATE = STARTDATE,
                    @ENDDATE = ENDDATE,
                    @STARTTIME = STARTTIME,
                    @ENDTIME = ENDTIME,
                    @NOTES = NOTES,
                    @LOCATIONID = EVENTLOCATIONID,
                    @MARKLOCATIONBUSY = BLOCKEVENT,
                    @RESOURCES = dbo.UFN_ITINERARYITEMRESOURCE_GETRESOURCES_TOITEMLISTXML(@ID),
                    @STAFFRESOURCES = dbo.UFN_ITINERARYITEM_GETSTAFFRESOURCES_TOITEMLISTXML(@ID),
                    @IGNORECONFLICTS = 0,
                    @DATALOADED = 1,
                    @TSLONG = TSLONG
                from ITINERARYITEM
                where ID = @ID;

                if @DATALOADED = 1
                begin

                    select @ITINERARYCAPACITY = sum(ITINERARYATTENDEE.QUANTITY)
                    from dbo.ITINERARYATTENDEE
                    where ITINERARYATTENDEE.ITINERARYID = @ITINERARYID

                    if @LOCATIONID is not null
                    begin
                        set @LOCATIONPRICE = (select SALESORDERITEM.TOTAL
                        from dbo.ITINERARYITEMLOCATION
                        inner join dbo.SALESORDERITEM on
                            SALESORDERITEM.ID = ITINERARYITEMLOCATION.SALESORDERITEMID 
                        where
                            ITINERARYITEMLOCATION.ID = @ID)
                        set @LOCATIONPRICE = cast(coalesce(@LOCATIONPRICE, 0.0) as money);
                    end
                end
                return 0