SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



ALTER VIEW [dbo].[AccDocumentGoodsPhase1]
AS
SELECT  Docs.ID, Docs.Number, Docs.UserNumber, Docs.DocDate, Docs.Flags, Docs.IsPermanent, 
        Docs.ItemID, Docs.TotalID, Docs.ControlID, Docs.DetailID1, Docs.DetailID2, Docs.Credit, 
        Docs.Debit, Docs.Description, Docs.Selected, Docs.DocDatePer, Docs.RelationID, Docs.ShowOrder, 
        Acc.TotalCode, Acc.ControlCode, Acc.Detail1Code as DetailCode1, 
		Acc.Title AS AccTitle, Acc.Detail1Title, Acc.ControlTitle, Acc.TotalTitle,
        Docs.CostCenter, Docs.Project, Docs.TempNumber, Docs.TempDate, Acc.Detail2Title,
		Acc.Detail2Code as DetailCode2, Docs.Confirmed 
FROM dbo.AccDocumentGoods as Docs LEFT OUTER JOIN
	 dbo.ViwAccounts AS Acc WITH (NOLOCK) ON Acc.TotalID = Docs.TotalID AND Acc.ControlID = Docs.ControlID AND Acc.Detail1ID = Docs.DetailID1 AND Acc.Detail2ID = Docs.DetailID2 
GO


