CREATE PROCEDURE [dbo].[OnlineAddCustomer] @ReferenceNumber INT, @GuestNumber INT=0,  @AddressType INT, @CustomerLink INT, @Lastname VARCHAR(50), @Phone VARCHAR(50)='',
@ProvisionType INT=0, @ProvisionRate INT=0, @ProvisionOnGuest BIT=0 AS
SET NOCOUNT ON
/*
    Created by Troels Buch Marts 2011
    
    Changes:
	TBU20160415: Added RoomDiscountRate
    TB20121214: Added ATTENTIONNAME
    TB20120118: Added Provision
    TB20110406: Added @Phone

    NOTES: 	- 

*/
DECLARE @AddressNumber INT

EXEC GetNextNumber 'RESERVATIONADDRESSIDENTITY', 1, @AddressNumber OUTPUT

--SET RoomDiscountRate =@DiscountRooms
INSERT INTO ReservationAddress (AddressNumber,  Addresstype,  Lastname, Link, Phone, PROVISIONTYPE, PROVISIONRATE, ProvisionPostOnGuest, ATTENTIONNAME, RoomDiscountRate) 
VALUES (@AddressNumber, @AddressType, @Lastname, @CustomerLink, @Phone, @ProvisionType, @ProvisionRate, @ProvisionOnGuest, @Lastname, @ProvisionRate)

INSERT INTO ReservationAddressXTab (ReferenceNumber, GuestNumber, AddressNumber, AddressTypeNumber) VALUES (@ReferenceNumber, @GuestNumber, @AddressNumber, @AddressType)
GO

