USE [EnVisage]
GO

/****** Object:  View [dbo].[VW_Expenditure2Category]    Script Date: 06/07/2016 10:37:45 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



ALTER VIEW [dbo].[VW_Expenditure2Category]
AS
SELECT        EC.Id, EC.ExpenditureId, EC.Name as ExpenditureCategoryName,  EC.GLId, EC.UOMId, EC.Type, EC.UseType, EC.CGEFX, EC.SortOrder, LE.Name AS ExpenditureName, LG.GLNumber, LG.Name AS GLName, 
                         LU.Name AS UOMName, EC.CreditId, EC.SystemAttributeOne, EC.SystemAttributeTwo, LC.Name AS CreditName, EC.WksSubjectToFee, 
                         LS1.Name AS SystemAttributeNameOne, LS1.Type AS SystemAttributeTypeOne, LS2.Name AS SystemAttributeNameTwo, LS2.Type AS SystemAttributeTypeTwo,
						 EC.ExpCategoryWithCcName, EC.AllowResourceAssignment
FROM            dbo.VW_ExpenditureCategory AS EC INNER JOIN
                         dbo.Expenditure AS LE ON EC.ExpenditureId = LE.Id LEFT OUTER JOIN
                         dbo.SystemAttributes AS LS1 ON EC.SystemAttributeOne = LS1.Id LEFT OUTER JOIN
                         dbo.SystemAttributes AS LS2 ON EC.SystemAttributeTwo = LS2.Id LEFT OUTER JOIN
                         dbo.CreditDepartment AS LC ON EC.CreditId = LC.Id LEFT OUTER JOIN
                         dbo.UOM AS LU ON EC.UOMId = LU.Id LEFT OUTER JOIN
                         dbo.GLAccount AS LG ON EC.GLId = LG.Id


GO


