CREATE PROCEDURE dbo.OnlineFindHotelsetupChoose AS
SET NOCOUNT ON
/*
    Created by Troels Buch April 2005
    
    Changes:
	TB20050811: Added @SkipPricePage
	TB20050429: Added @UseCancellationFee
	TB20050426: Added @CancellationEnsuranceText

    NOTES: 	- 
*/



--DECLARE @PicassoOnlineUseCheapProductKey VARCHAR(50)
DECLARE @PicassoOnlineUseCheapProductValue VARCHAR(50)
DECLARE @CancellationEnsuranceText  VARCHAR (8000)
DECLARE @UseCancellationFee BIT
DECLARE @SkipPricePage BIT

 -- Copy from GenerateAvailability SP
  CREATE TABLE #HotelSetupChoose (		
		[UseCheapProductValue] [BIT] NULL,
		[CancellationEnsuranceText] [TEXT] NULL,		
		[UseCancellationFee] [BIT] NULL,
		[SkipPricePage] [BIT] NULL
		)

SELECT @PicassoOnlineUseCheapProductValue=keyvalue FROM Hotelsetup WITH (NOLOCK) WHERE searchkey = 'PicassoOnlineUseCheapProduct'

SELECT @CancellationEnsuranceText =  Note FROM Ware WITH (NOLOCK) INNER JOIN WareGroups WITH (NOLOCK) ON Ware.WareGroupNumber=WareGroups.WareGroupNumber
AND Ware.SortNumber=1 AND WareGroups.Payment=4 AND (Ware.MarkAsDeleted=0 OR Ware.MarkAsDeleted IS NULL) AND (WareGroups.MarkAsDeleted=0 OR WareGroups.MarkAsDeleted IS NULL)

--SELECT @NoCancelFeeOnExtra=keyvalue FROM Hotelsetup WITH (NOLOCK) WHERE searchkey = 'NoCancellationFeeOnExtras'
SELECT @UseCancellationFee=keyvalue FROM Hotelsetup WITH (NOLOCK) WHERE searchkey = 'PicassoOnlineUseCancellationFee'
SELECT @SkipPricePage=keyvalue FROM Hotelsetup WITH (NOLOCK) WHERE searchkey = 'PicassoOnlineSkipPricePage'


INSERT INTO #HotelSetupChoose (UseCheapProductValue, CancellationEnsuranceText, UseCancellationFee, SkipPricePage) VALUES(@PicassoOnlineUseCheapProductValue,  @CancellationEnsuranceText, @UseCancellationFee, @SkipPricePage)

-----------------------------------------------------------------------------------------------------
SELECT * FROM #HotelSetupChoose WITH (NOLOCK)
-----------------------------------------------------------------------------------------------------

DROP TABLE #HotelSetupChoose

--BEGIN TRAN

/*
SELECT Note AS CancellationEnsuranceText INTO #HotelSetupChoose FROM Ware (NOLOCK) INNER JOIN WareGroups (NOLOCK) ON Ware.WareGroupNumber=WareGroups.WareGroupNumber
AND Ware.SortNumber=1 AND WareGroups.Payment=4 AND (Ware.MarkAsDeleted=0 OR Ware.MarkAsDeleted IS NULL) AND (WareGroups.MarkAsDeleted=0 OR WareGroups.MarkAsDeleted IS NULL)

ALTER TABLE #HotelSetupChoose ADD UseCheapProduct BIT NULL

DECLARE @PicassoOnlineUseCheapProductValue BIT
SELECT @PicassoOnlineUseCheapProductValue=keyvalue FROM Hotelsetup (NOLOCK) WHERE Upper(searchkey) = Upper('PicassoOnlineUseCheapProduct')

--UPDATE #HotelSetupChoose SET UseCheapProduct=@PicassoOnlineUseCheapProductValue

-----------------------------------------------------------------------------------------------------
SELECT * FROM #HotelSetupChoose (NOLOCK)
----------------------------------------------------------------------------------------------------- 

DROP TABLE #HotelSetupChoose
*/
--ROLLBACK TRAN


