Becker-Tiemann 1 день назад
Родитель
Сommit
a5dfba7056

+ 30 - 0
schema/GC_CONFIG/tables/ari.Planung_Monat.sql

@@ -0,0 +1,30 @@
+CREATE TABLE [ari].[Planung_Monat] (
+   [Hauptbetrieb_ID] [varchar](20) NULL,
+   [Hauptbetrieb_Name] [varchar](50) NULL,
+   [Standort_ID] [varchar](20) NULL,
+   [Standort_Name] [varchar](50) NULL,
+   [Jahr] [int] NULL,
+   [Kostenstelle] [varchar](50) NULL,
+   [Ebene1] [varchar](50) NULL,
+   [Ebene2] [varchar](50) NULL,
+   [Ebene3] [varchar](50) NULL,
+   [Ebene4] [varchar](50) NULL,
+   [Ebene5] [varchar](50) NULL,
+   [Marke] [varchar](50) NULL,
+   [Plan] [decimal](28,8) NULL,
+   [Wert01] [decimal](28,8) NULL,
+   [Wert02] [decimal](28,8) NULL,
+   [Wert03] [decimal](28,8) NULL,
+   [Wert04] [decimal](28,8) NULL,
+   [Wert05] [decimal](28,8) NULL,
+   [Wert06] [decimal](28,8) NULL,
+   [Wert07] [decimal](28,8) NULL,
+   [Wert08] [decimal](28,8) NULL,
+   [Wert09] [decimal](28,8) NULL,
+   [Wert10] [decimal](28,8) NULL,
+   [Wert11] [decimal](28,8) NULL,
+   [Wert12] [decimal](28,8) NULL
+)
+
+
+GO

+ 13 - 0
schema/GC_ETL_ARI/views/load.Planung_Tag.sql

@@ -0,0 +1,13 @@
+SET QUOTED_IDENTIFIER ON 
+GO
+SET ANSI_NULLS ON 
+GO
+create view [load].[Planung_Tag] AS
+SELECT * FROM [transform].[Planung_Tag]
+GO
+SET QUOTED_IDENTIFIER OFF 
+GO
+SET ANSI_NULLS OFF 
+GO
+
+GO

+ 30 - 0
schema/GC_ETL_ARI/views/transform.Planung_Tag.sql

@@ -0,0 +1,30 @@
+SET QUOTED_IDENTIFIER ON 
+GO
+SET ANSI_NULLS ON 
+GO
+CREATE   VIEW [transform].[Planung_Tag] AS
+
+SELECT [PM].[Hauptbetrieb_ID]
+     , [PM].[Hauptbetrieb_Name]
+     , [PM].[Standort_ID]
+     , [PM].[Standort_Name]
+     , [PM].[Jahr]
+     , [PM].[Kostenstelle]
+     , [PM].[Ebene1]
+     , [PM].[Ebene2]
+     , [PM].[Ebene3]
+     , [PM].[Ebene4]
+     , [PM].[Ebene5]
+     , [PM].[Marke]
+     , [KM].[Datum] AS [Bookkeep Date]
+     , [PM].[Plan] * [KM].[ProduktivFaktorJahr] AS [Plan]
+
+FROM [x_data].[Planung_Monat] [PM]
+         LEFT JOIN [x_data].[Kalender_Mandant] [KM] ON [PM].[Jahr] = [KM].[Jahr]
+GO
+SET QUOTED_IDENTIFIER OFF 
+GO
+SET ANSI_NULLS OFF 
+GO
+
+GO

+ 15 - 0
schema/GC_ETL_ARI/views/x_data.Kalender_Mandant.sql

@@ -0,0 +1,15 @@
+SET QUOTED_IDENTIFIER ON 
+GO
+SET ANSI_NULLS ON 
+GO
+CREATE VIEW [x_data].[Kalender_Mandant] AS
+
+SELECT *
+FROM [Kalender].[kalender].[Kalender_Mandant]
+GO
+SET QUOTED_IDENTIFIER OFF 
+GO
+SET ANSI_NULLS OFF 
+GO
+
+GO

+ 51 - 0
schema/GC_ETL_ARI/views/x_data.Planung_Monat.sql

@@ -0,0 +1,51 @@
+SET QUOTED_IDENTIFIER ON 
+GO
+SET ANSI_NULLS ON 
+GO
+CREATE VIEW [x_data].[Planung_Monat] AS
+
+SELECT [Hauptbetrieb_ID]
+     , [Hauptbetrieb_Name]
+     , [Standort_ID]
+     , [Standort_Name]
+     , [Jahr]
+     , [Kostenstelle]
+     , isnull([Ebene1], '') AS [Ebene1]
+     , isnull([Ebene2], '') AS [Ebene2]
+     , CASE
+           WHEN [Ebene2] IN ('Verkaufsabh. Kosten', 'Direkte Fixkosten') THEN
+               CASE
+                   WHEN [Kostenstelle] = '1' THEN '1 - NA'
+                   WHEN [Kostenstelle] = '2' THEN '2 - GA'
+                   WHEN [Kostenstelle] = '3' THEN '3 - T&Z'
+                   WHEN [Kostenstelle] = '4' THEN '4 - SC'
+                   WHEN [Kostenstelle] = '5' THEN '5 - sonst. Abt.'
+                   WHEN [Kostenstelle] = '0' THEN '0 - VW'
+                   ELSE ''
+                   END
+           ELSE isnull([Ebene3], '') END AS [Ebene3]
+     , isnull([Ebene4], '') AS [Ebene4]
+     , isnull([Ebene5], '') AS [Ebene5]
+     , [Marke]
+     , isnull([Plan], 0.0) AS [Plan]
+     , isnull([Wert01], 0.0) AS [Wert01]
+     , isnull([Wert02], 0.0) AS [Wert02]
+     , isnull([Wert03], 0.0) AS [Wert03]
+     , isnull([Wert04], 0.0) AS [Wert04]
+     , isnull([Wert05], 0.0) AS [Wert05]
+     , isnull([Wert06], 0.0) AS [Wert06]
+     , isnull([Wert07], 0.0) AS [Wert07]
+     , isnull([Wert08], 0.0) AS [Wert08]
+     , isnull([Wert09], 0.0) AS [Wert09]
+     , isnull([Wert10], 0.0) AS [Wert10]
+     , isnull([Wert11], 0.0) AS [Wert11]
+     , isnull([Wert12], 0.0) AS [Wert12]
+
+FROM [GC_CONFIG].[ari].[Planung_Monat]
+GO
+SET QUOTED_IDENTIFIER OFF 
+GO
+SET ANSI_NULLS OFF 
+GO
+
+GO