CREATE PROCEDURE dbo.OnlineFindRoomtypes  @LangInt INT
  , @ChainNumber  INT
  , @APaxCount INT = 0
 AS
SET NOCOUNT ON
/*
    Created by Troels Buch Jun 2005
    
    Changes: 	
	  LJE20120306: OURE, to prevent booking of dbl.room for a "1-customer-reservation".

    NOTES: 	- 
*/
SELECT OnlineRoomTypesTranslated.Text
  , OnlineRoomTypesTranslated.Description
  , OnlineRoomTypes.RoomTypeNumber
  , OnlineRoomTypes.OnlineRoomTypeNumber 
FROM OnlineRoomTypes WITH (nolock) 
  INNER JOIN OnlineRoomTypesTranslated WITH (NOLOCK) 
  ON OnlineRoomTypes.OnlineRoomTypeNumber = OnlineRoomTypesTranslated.OnlineRoomTypeNumber 
  WHERE (CountryNumber = @LangInt) 
    AND OnlineRoomTypes.OnlineRoomTypeNumber IN 
	(
      SELECT Roomtypes.OnlineRoomTypenumber 
	  FROM Onlineroomtypes WITH (NOLOCK) INNER JOIN Roomtypes 
	    WITH (NOLOCK) ON Onlineroomtypes.Onlineroomtypenumber = Roomtypes.onlineroomtypenumber 
	  WHERE IsNull(Roomtypes.Hotelnumber, 0) = @ChainNumber
	    AND (@APaxCount = 0 OR (@APaxCount > 0 AND Roomtypes.DefaultPax <= @APaxCount))  -- Added: OURE...
	) 
ORDER BY OnlineRoomTypesTranslated.Text, OnlineRoomTypes.RoomTypeNumber


--DECLARE @ProductTypeNumber INT
--SET @ProductTypeNumber = 1

--SELECT Productnumber, ProductName, pr.[Description], [Text] AS HolidayType,  (SELECT Count(*) AS RowNumber FROM Products pr (NOLOCK) Inner JOIN ProductTypes pt (NOLOCK) ON pr.ProductTypeNumber = pt.ProductTypeNumber  WHERE AllowFilterpicassoOnline = 1 ) AS RowNumber FROM Products pr (NOLOCK) Inner JOIN ProductTypes pt (NOLOCK) ON pr.ProductTypeNumber = pt.ProductTypeNumber  WHERE AllowFilterpicassoOnline = 1


