CREATE PROCEDURE DBO.CreateReservationFollowup @AReferenceNumber INT, @AGuestNumber INT, @AUserIdNumber INT, @AFollowupText VARCHAR(8000), @AHotelNumber INT, @AFollowupSubType2 INT = 0 AS
SET NOCOUNT ON

/*
  Created by: Kent Johansen october 2007
  Create a new followup on a reservation

*/

DECLARE @SystemDateTime DATETIME
DECLARE @NewFollowUpNumber INT

EXEC SystemDateTime '', @SystemDateTime OUTPUT

INSERT INTO FollowUp ([Date], Type, Priority, State, Note, CreatedDate, CreatedBy, SubType, HotelNumber, SubType2)
VALUES (@SystemDateTime, 5, 12, 3, @AFollowupText, @SystemDateTime, @AUserIdNumber, 1, @AHotelNumber, @AFollowupSubType2)
SELECT @NewFollowUpNumber = @@identity
INSERT INTO ReservationFollowUpXTab (ReferenceNumber, GuestNumber, FollowUpNumber) VALUES (@AReferenceNumber, @AGuestNumber, @NewFollowUpNumber)