CREATE PROCEDURE DBO.[OnlineGetGuestInvoiceContent] @ReferenceNumber INT, @GuestNumber INT, @Balance MONEY OUTPUT AS
SET NOCOUNT ON
/*
Changes:
  KS 20150224: To get all the payments, 4 of the parameters must have fixed values as below, according to Nenad.


  NB20101223: Created
  NOTE: Get Transactions from reservation guest folio for Online Booking

*/
DECLARE @FolioNumber INT, @BillTypeNumber INT
SELECT @FolioNumber = FolioNumber --, @BillTypeNumber = BillTypeNumber
FROM dbo.FOLIOS F with (nolock) 
  INNER JOIN dbo.ReservationAddressXTab RAX WITH (NOLOCK) ON F.ReservationAddressNumber = RAX.ADDRESSNUMBER
where F.ReferenceNumber = @ReferenceNumber AND F.GuestNumber = @GuestNumber AND RAX.AddressTypeNumber = 1

--exec dbo.GetTransactions @FolioNumber, @BillTypeNumber, 0, 0, 1, @Balance output
exec dbo.GetTransactions @FolioNumber, 0, 1, 0, 1, @Balance output