/****** Object:  View [dbo].[AccDocumentGoodsPhase2]    Script Date: 5/14/2021 12:41:38 ق.ظ ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[AccDocumentGoodsPhase2]
AS
SELECT        dbo.AccDocumentGoodsPhase1.ID, dbo.AccDocumentGoodsPhase1.Number, dbo.AccDocumentGoodsPhase1.UserNumber, dbo.AccDocumentGoodsPhase1.DocDate, dbo.AccDocumentGoodsPhase1.Flags, 
                         dbo.AccDocumentGoodsPhase1.IsPermanent, dbo.AccDocumentGoodsPhase1.ItemID, dbo.AccDocumentGoodsPhase1.TotalID, dbo.AccDocumentGoodsPhase1.ControlID, dbo.AccDocumentGoodsPhase1.DetailID1, 
                         dbo.AccDocumentGoodsPhase1.DetailID2, dbo.AccDocumentGoodsPhase1.Credit, dbo.AccDocumentGoodsPhase1.Debit, dbo.AccDocumentGoodsPhase1.Description, dbo.AccDocumentGoodsPhase1.Selected, 
                         dbo.AccDocumentGoodsPhase1.DocDatePer, dbo.AccDocumentGoodsPhase1.TotalCode, dbo.AccDocumentGoodsPhase1.ControlCode, dbo.AccDocumentGoodsPhase1.DetailCode1, dbo.AccDetail.Code AS DetailCode2, 
                         COALESCE (dbo.AccDetail.Title, dbo.AccDocumentGoodsPhase1.AccTitle) AS AccTitle, dbo.AccDocumentGoodsPhase1.RelationID, dbo.AccDocumentGoodsPhase1.ShowOrder, dbo.AccDocumentGoodsPhase1.CostCenter, 
                         dbo.AccDocumentGoodsPhase1.Project, dbo.AccDetail.Title AS Detail2Title, dbo.AccDocumentGoodsPhase1.TempNumber, dbo.AccDocumentGoodsPhase1.TempDate,
						 dbo.AccDocumentGoodsPhase1.Detail1Title, dbo.AccDocumentGoodsPhase1.ControlTitle, dbo.AccDocumentGoodsPhase1.TotalTitle
FROM            dbo.AccDocumentGoodsPhase1 WITH (NOLOCK) LEFT OUTER JOIN
                         dbo.AccDetail ON dbo.AccDocumentGoodsPhase1.DetailID2 = dbo.AccDetail.ID
GO


