CREATE PROCEDURE dbo.OnlineDeleteArrangementLines  @Refnumber  INT AS
SET NOCOUNT ON
/*
    Created by Troels Buch Juni 2005

       Changes: N/A
		TB20101011: Delete xtab before lines.
		AV 20060222 : remember to delete the cross tabs too

    NOTES: 	- 

*/

DELETE FROM ArrangementRoomXtab WHERE ArrangementLineNumber in (select arrangementlinenumber from arrangementreservationsxtab (NOLOCK) where ReferenceNumber = @Refnumber)
DELETE FROM ArrangementReservationsXTab WHERE ReferenceNumber = @RefNumber
DELETE arrangementlines WHERE arrangementlinenumber in (select aline.arrangementlinenumber from arrangementlines aline (nolock) inner join arrangementreservationsxtab alineTab (NOLOCK)  on aline.arrangementlinenumber = alineTab.arrangementlinenumber where ReferenceNumber = @Refnumber)

