USP_DATAFORMTEMPLATE_EDITLOAD_ITINERARYITEMDAILYADMISSION

The load procedure used by the edit dataform template "Itinerary Item Daily Admission 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
@PROGRAMID uniqueidentifier INOUT Program
@STARTTIME UDT_HOURMINUTE INOUT Start time
@ENDTIME UDT_HOURMINUTE INOUT End time
@STARTDATE date INOUT Start date
@NOTES nvarchar(500) INOUT Notes
@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
@PRICINGCODE tinyint INOUT
@RESERVATIONRATESCALEINCLUDEALLPROGRAMS bit INOUT
@RESERVATIONRATESCALEPROGRAMS xml INOUT
@ITEMTYPECODE tinyint INOUT
@ITINERARYCAPACITY int INOUT Itinerary capacity

Definition

Copy


                CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDITLOAD_ITINERARYITEMDAILYADMISSION(
                    @ID uniqueidentifier,
                    @ITINERARYID uniqueidentifier = null output,
                    @PROGRAMID uniqueidentifier = null output,
                    @STARTTIME UDT_HOURMINUTE = null output,
                    @ENDTIME UDT_HOURMINUTE = null output,
                    @STARTDATE date = null output,
                    @NOTES nvarchar(500) = null output,
                    @RESOURCES xml = null output,
                    @IGNORECONFLICTS bit = null output,
                    @DATALOADED bit = 0 output,
                    @TSLONG bigint = 0 output,
                    @STAFFRESOURCES xml = null output,
                    @PRICINGCODE tinyint = null output,
                    @RESERVATIONRATESCALEINCLUDEALLPROGRAMS bit = null output,
                    @RESERVATIONRATESCALEPROGRAMS xml = null output,
                    @ITEMTYPECODE tinyint = null output,
                    @ITINERARYCAPACITY int = null output
                )
                as

                    set nocount on;

                    set @DATALOADED = 0
                    set @TSLONG = 0

                    select
                        @DATALOADED = 1,
                        @TSLONG = ITINERARYITEM.TSLONG,
                        @STARTDATE = ITINERARYITEM.STARTDATE,
                        @STARTTIME = ITINERARYITEM.STARTTIME,
                        @ENDTIME = ITINERARYITEM.ENDTIME,
                        @NOTES = ITINERARYITEM.NOTES,
                        @RESOURCES=dbo.UFN_ITINERARYITEMRESOURCE_GETRESOURCES_TOITEMLISTXML(@ID),
                        @STAFFRESOURCES = dbo.UFN_ITINERARYITEM_GETSTAFFRESOURCES_TOITEMLISTXML(@ID),
                        @PROGRAMID = CASE WHEN ITEMTYPECODE != 3 THEN ITINERARYITEM.PROGRAMID ELSE null END,
                        @ITINERARYID = ITINERARYITEM.ITINERARYID,
                        @IGNORECONFLICTS = 0,
                        @PRICINGCODE = RESERVATION.PRICINGCODE,
                        @RESERVATIONRATESCALEINCLUDEALLPROGRAMS = RESERVATIONRATESCALE.INCLUDEALLPROGRAMS,
                        @RESERVATIONRATESCALEPROGRAMS = dbo.UFN_RESERVATIONRATESCALE_GETPROGRAMS_TOITEMLISTXML(RESERVATION.ID),
                        @ITEMTYPECODE = ITEMTYPECODE
                    from dbo.ITINERARYITEM
                    inner join
                        dbo.ITINERARY on ITINERARYITEM.ITINERARYID = ITINERARY.ID
                    inner join
                        dbo.RESERVATION on ITINERARY.RESERVATIONID = RESERVATION.ID
                    left outer join
                        dbo.RESERVATIONRATESCALE on RESERVATION.ID = RESERVATIONRATESCALE.ID
                    where ITINERARYITEM.ID = @ID

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

                    return 0;