SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE VIEW [kalender].[Zeitraum]
AS
SELECT [T1].[Datum]
     , [T1].[Datum] AS "Invoice Date"
     , [T1].[Datum] AS "Bookkeep Date"
     , 1 AS [Zeitraum]
FROM [kalender].[Kalender_Tage] [T1]
         -- CROSS JOIN [kalender].[Buchungsbelege] T2
-- WHERE T1.[Datum] BETWEEN DATEFROMPARTS(YEAR(T2.[Buchung_von]), 1, 1) AND EOMONTH(T2.[Buchung_bis])
         CROSS JOIN [kalender].[Konfiguration] [T2]
         CROSS JOIN [kalender].[Datum_Heute] [T3]
WHERE [T1].[Datum] BETWEEN datefromparts([T2].[Jahr_von], 1, 1) AND eomonth([T3].[Datum])
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
