CREATE PROCEDURE dbo.OnlineCreateBillAndCheckout @AFolioNumber INT, @AHotelCustomerNumber INT AS
SET NOCOUNT ON
/*
nb20240627 mainly moved to CreateReceipt
KJ 20240214: Added timeZone
nb20161115 ReceiptType & ReceiptNumber fields added - currently only supports receipt receipttypes
nb20120705 New  
Created by Nenad Blagojevic july 2012
Comments:
@AHotelCustomerNumber param is considered unsafe to use because receipt is generated by the folio hcn
*/
DECLARE 
  @FkFolio INT,
  @PkInvoice INT
SET @FkFolio = @AFolioNumber
exec dbo.CreateReceipt @PkInvoice OUTPUT, @FkFolio
IF @PKInvoice > 0 
  --Close Folio
  UPDATE Folios SET OpenFolio = 0 WHERE FolioNumber = @FkFolio
