CREATE PROCEDURE [dbo].[OnlineRoomBookingStatus]  @ArrivalDate DATETIME, @DepartureDate DATETIME  AS
SET NOCOUNT ON
/*
    	Created by Troels Buch May 2016
    	

    	NOTES: 	

*/
DECLARE @ArrivalDateStr CHAR (8)
DECLARE @DepartureDateStr CHAR (8)

SET @ArrivalDateStr = CONVERT (CHAR (8), @ArrivalDate, 112)-- '20160601'
SET @DepartureDateStr = CONVERT (CHAR (8), @DepartureDate, 112)-- '20160603'


SELECT DateStamp, RoomTypeNumber, HotelNumber, ReservationGroup, SoldRooms, Adults, Children1, Children2, NumberOfConfirmed, NumberOfProvisionals, NumberOfGuaranteed, NumberOfTentative,
NumberOfWaitinglists, NumberOfDayrooms, FreeRoomsAllotment, TotalRoomsAllotment, PaxAllotment, NumberOfRoomsSoldToday, NumberOfOutOfOrder, NumberOfOutForService, NumberOfOccupied, 0,SoldPrice
FROM roombookingstatus WITH (NOLOCK) 
WHERE DateStamp >= @ArrivalDateStr AND DateStamp < @DepartureDateStr
AND RoomTypeNumber IN (SELECT RoomTypeNumber FROM RoomTypes WITH (NOLOCK) WHERE OnlineRoomTypeNumber > 0)
order by DateStamp, roomtypenumber 




