



CREATE PROCEDURE DBO.[GetLatestDeletedBefore] @AResult char(8) OUTPUT AS
/*
  Purpose: Returns the latest of ReservationsDeletedBefore and FoliosDeletedBefore
  
  Used by:
    - GenerateTurnoverMIS
    - MadeOrderBook
*/

-- Last modified 24/10-2005 by BJ

-- BJ 24/10-2005: Created


DECLARE @FoliosDeletedBefore char(8)

SELECT @AResult = IsNull(KeyValue, '0') FROM HotelSetup WITH (NOLOCK) WHERE SearchKey = 'ReservationsDeletedBefore'
SELECT @FoliosDeletedBefore = IsNull(KeyValue, '0') FROM HotelSetup WITH (NOLOCK) WHERE SearchKey = 'FoliosDeletedBefore'

IF @FoliosDeletedBefore > @AResult 
  SET @AResult = @FoliosDeletedBefore

