CREATE VIEW dbo.TArrangementExtraView
AS
SELECT     ArrangementLines.ArrangementLineNumber, ArrangementLines.[Date], ArrangementLines.PacketItemNumber, 
           ArrangementLines.[Time],ArrangementLines.DepartureTime, ArrangementLines.Price, ArrangementLines.TotalPrice, ArrangementLines.Pieces, 
           ArrangementLines.WareText,/* ArrangementLines.Departments,*/ ArrangementLines.FK_ExDepartment, Arrangementlines.FK_PacketChargeDepartment,
           ArrangementLines.PlaceText, ArrangementLines.WareNumber, ArrangementLines.HallNumber, ArrangementLines.Priority, ArrangementLines.FK_HallNumber,ArrangementLines.FK_HallLineNumber,
           ArrangementReservationsXtab.ReferenceNumber, Ware.SortNumber AS WareSortNumber, ArrangementLines.Note, 
           WareGroups.SortNumber AS GroupSortNumber, WareGroups.WareGroupNumber, WareGroups.Text AS WareGroupName, Ware.PluNumber,
           /* Ware.DepartmentService AS PossibleDeps, Not used since 4.0, Removed 20091023/RN */
           Ware.WareName AS RealWareName, ArrangementReservationsXtab.GuestNumber, Departments.DepartmentNumber AS ExDepartment,
           dbo.GetArrangementLineDepartmentStr(ArrangementLines.ArrangementLineNumber,0,0) AS Departments,
           dbo.GetArrangementLineDepartmentStr(ArrangementLines.ArrangementLineNumber,1,1) AS PKDepartments,
           ArrangementLines.ReadOnly
FROM       ArrangementReservationsXtab WITH (NOLOCK) LEFT OUTER JOIN ArrangementLines WITH (NOLOCK) ON ArrangementReservationsXtab.ArrangementLineNumber = ArrangementLines.ArrangementLineNumber 
           LEFT OUTER JOIN Ware WITH (NOLOCK) ON ArrangementLines.WareNumber = Ware.WareNumber LEFT OUTER JOIN WareGroups WITH (NOLOCK) ON Ware.WareGroupNumber = WareGroups.WareGroupNumber
           LEFT OUTER JOIN Departments WITH (NOLOCK) ON Departments.PK_Department = ArrangementLines.FK_ExDepartment



