CREATE procedure DBO.GetTotalPriceFromReservation @ReferenceNumber int, @GuestNumber int, @FirstAddressNumber INT=0, @IgnoreStatus INT = 1, @IncludeOutOfHouse INT = 0 AS
SET NOCOUNT ON

/*
  Changes:
--nb20140721 FolioIdentity discontinued
    KJ 20070410: Department rewrite
    TL 20061117: Added @IncludeOutOfHouse
    JP 09/04-2003 Jacob Pedersen default params
    nbl20040213 NB tilføjet ekstra param @IgnoreStatus
*/

declare @totalprice money
declare @fee money

if @GuestNumber = 0
  exec ChargeAndCalcCancellationFee @referencenumber, @GuestNumber, @totalprice output, @fee output, 1, -1, -1, 1, @FirstAddressNumber, @IgnoreStatus, @IncludeOutOfHouse
else
  exec ChargeAndCalcCancellationFee @referencenumber, @GuestNumber, @totalprice output, @fee output, 1, -1, -1, 0, @FirstAddressNumber, @IgnoreStatus, @IncludeOutOfHouse

select @totalprice as totalprice

