/****** Object:  View [dbo].[ViwAccFactorDetailPhase1]    Script Date: 06/11/1404 01:35:37 ب.ظ ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[ViwAccFactorDetailPhase1]
AS
SELECT   dbo.AccFactorDetail.ID, dbo.AccFactorDetail.FactorID, dbo.AccFactorDetail.OrderTotalID, dbo.AccFactorDetail.OrderControlID, dbo.AccFactorDetail.OrderDetailID1, dbo.AccFactorDetail.OrderDetailID2, dbo.AccFactorDetail.Request, 
                dbo.AccFactorDetail.RequestUnit, dbo.AccFactorDetail.NetPrice, dbo.AccFactorDetail.TotalPrice, SmallLists_1.Title AS UnitName, dbo.AccDetail.Title AS OrderTitle, dbo.AccFactorDetail.DocItemID, dbo.AccFactorDetail.DocHeaderID, 
                dbo.AccFactorDetail.Status, AccDocHeader_1.Number AS DocNumber, dbo.AccDocHeader.Number AS UsedDocNumber, dbo.AccFactorDetail.OtherTotalID, dbo.AccFactorDetail.OtherControlID, dbo.AccFactorDetail.OtherDetailID1, 
                dbo.AccFactorDetail.OtherDetailID2, dbo.AccFactorDetail.Value2, dbo.AccFactorDetail.Unit2, dbo.SmallLists.Title AS Unit2Name, dbo.AccFactorDetail.Discont, dbo.AccFactorDetail.Maliat, dbo.AccFactorDetail.Avarez, dbo.AccFactorDetail.Heigh, 
                dbo.AccFactorDetail.Lenght, dbo.AccFactorDetail.Width, dbo.AccFactorDetail.ZowjInUnit, dbo.AccFactorDetail.Pakaging, dbo.AccFactorDetail.Oft, dbo.AccFactorDetail.WarehouseNo, dbo.AccFactorDetail.SumInFactor, dbo.AccFactorDetail.OrderID, 
                dbo.AccFactorDetail.SayerVojoh, dbo.AccFactorDetail.Nw, dbo.AccFactorDetail.Ssrv, dbo.AccFactorDetail.Sscv, dbo.AccFactorDetail.Haml, dbo.AccFactorDetail.HamlTotalID, dbo.AccFactorDetail.HamlControlID, dbo.AccFactorDetail.HamlDetailID1, 
                dbo.AccFactorDetail.HamlDetailID2
FROM      dbo.SmallLists RIGHT OUTER JOIN
                dbo.AccFactorDetail WITH (NOLOCK) ON dbo.SmallLists.ID = dbo.AccFactorDetail.Unit2 LEFT OUTER JOIN
                dbo.AccDocHeader AS AccDocHeader_1 ON dbo.AccFactorDetail.DocHeaderID = AccDocHeader_1.ID LEFT OUTER JOIN
                dbo.AccDocItem INNER JOIN
                dbo.AccDocHeader ON dbo.AccDocItem.HeaderID = dbo.AccDocHeader.ID ON dbo.AccFactorDetail.DocItemID = dbo.AccDocItem.ID LEFT OUTER JOIN
                dbo.AccDetail ON dbo.AccFactorDetail.OrderDetailID2 = dbo.AccDetail.ID LEFT OUTER JOIN
                dbo.SmallLists AS SmallLists_1 ON dbo.AccFactorDetail.RequestUnit = SmallLists_1.ID
GO


