/****** Object:  View [dbo].[ViwAccWarehouseDetails]    Script Date: 26/07/2022 02:22:02 ب.ظ ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO




ALTER VIEW [dbo].[ViwAccWarehouseDetails]
AS
SELECT     V2.ID, V2.WarehouseID, V2.Request, V2.NetPrice, 
                      V2.TotalPrice, V2.RequestUnit, V2.UnitName, 
                      V2.OrderTitle, COALESCE (D2.Title, D1.Title, C.Title, T.Title, '') AS OtherTitle, 
                      V2.OrderTotalID, V2.OrderControlID, V2.OrderDetailID1, 
                      V2.OrderDetailID2, V2.DocItemID, V2.DocHeaderID, 
                      V2.Status, V2.Selected, V2.UsedDocNumber, 
                      V2.DocNumber, V2.OtherTotalID, V2.OtherControlID, 
                      V2.OtherDetailID1, V2.OtherDetailID2, V2.Value2, V2.Unit2, 
                      V2.Unit2Name, V2.SerialFrom, V2.SerialTo, V2.Oft, 
                      V2.Routobat, V2.OftPayeh, V2.RoutobatPayeh, 
                      V2.RequestPayeh, V2.Time, V2.Description, 
                      V2.UserNumber, V2.Haml, V2.Takhfif, V2.PrdDate, 
                      V2.ExpDate, V2.WarehouseNo, V2.SFKeshti, 
                      V2.SFMojavez, V2.SFTonaj, V2.SFBarbari, V2.SFMabda, 
                      V2.SFCommision, V2.SFAnbarStart, V2.SFAnbarEnd1, 
                      V2.SFAnbarEnd2, V2.SFAfzayeshType, V2.SFAfzayesh1, 
                      V2.SFAfzayesh2, V2.SFSarak, V2.VRequest, v2.VDate, V2.VUpdater
FROM         dbo.AccDetail AS D2 RIGHT OUTER JOIN
                      dbo.ViwAccWarehouseDetailsPhase2 as V2 ON D2.ID = V2.OtherDetailID2 LEFT OUTER JOIN
                      dbo.AccDetail AS D1 WITH (NOLOCK) ON V2.OtherDetailID1 = D1.ID LEFT OUTER JOIN
                      dbo.AccControl as C ON V2.OtherControlID = C.ID LEFT OUTER JOIN
                      dbo.AccTotal as T ON V2.OtherTotalID = T.ID
GO


