
/****** Object:  View [dbo].[ViwAccFactorDaysEnd]    Script Date: 29/05/2022 01:28:50 ب.ظ ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[ViwAccWarehouseDaysEnd]
AS
	SELECT m.[InOROut]
           ,m.[Number]
           ,m.[UserNumber] as MainUserNumber
           ,m.[Date]
           ,m.[WarehouseID] as Warehouse
           ,m.[PersonTotalID]
           ,m.[PersonControlID]
           ,m.[PersonDetailID1]
           ,m.[PersonDetailID2]
           ,m.[Description] as MainDescription
           ,m.[UpdateDate] as MainUpdateDate
           ,m.[Updater]
           ,m.[WarehouseIDTo]
           ,m.[FormID]
           ,m.[FromForm]
           ,m.[OutID]
           ,m.[Takhfif] as MainTakhfif
           ,m.[HamlAndOther]
           ,m.[TakhfifDocItemID]
           ,m.[TakhfifDocHeaderID]
           ,m.[HamlDocItemID]
           ,m.[HamlDocHeaderID]
           ,m.[CostCenter]
           ,m.[Project]
           ,m.[Flags], s.*, DATEDIFF(Day, GETDATE(), DATEADD(Day, [Time], Date)) AS DaysEnd
	FROM ViwAccWarehouseDetails as s left outer join AccWarehouse as m on m.id=s.WarehouseID 
        
GO


