SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE     VIEW [transform].[OP_aus_LOC_Belege_nur_8520] AS

select "GC_Department"."Hauptbetrieb_ID"            AS "Hauptbetrieb_ID",
       "GC_Department"."Hauptbetrieb_Name"          AS "Hauptbetrieb_Name",
       "GC_Department"."Standort_ID"                AS "Standort_ID",
       "GC_Department"."Standort_Name"              AS "Standort_Name",
       "OP_aus_LOC_Belege_nur_8520"."Sel Name"      AS "Sel_Name",
       "OP_aus_LOC_Belege_nur_8520"."Kunde"         AS "Kunde",
       "OP_aus_LOC_Belege_nur_8520"."Text"          AS "Beleg",
       "OP_aus_LOC_Belege_nur_8520"."Forderungsart" AS "Kostenstelle",
       "OP_aus_LOC_Belege_nur_8520"."Forderungsart" AS "Bereich",
       "OP_aus_LOC_Belege_nur_8520"."Staffel"       AS "Staffel",
       "OP_aus_LOC_Belege_nur_8520"."Forderungsart" AS "Forderungsart",
       ''                                           AS "Abwarten",
       ''                                           AS "Leasing",
       "OP_aus_LOC_Belege_nur_8520"."OP-Saldo"      AS "offen",
       0                                            AS "Rechnungsbetrag",
       0                                            AS "Gesamt_offen_KD__Info_",
       "OP_aus_LOC_Belege_nur_8520"."Bookkeep Date" AS "Invoice_Date",
	   '' AS "Bonus/Startguthaben"
from locosoft."OP_aus_LOC_Belege_nur_8520" "OP_aus_LOC_Belege_nur_8520"
         LEFT OUTER JOIN "data"."GC_Department" "GC_Department"
                         on "OP_aus_LOC_Belege_nur_8520"."Hauptbetrieb" = "GC_Department"."Hauptbetrieb" and
                            "OP_aus_LOC_Belege_nur_8520"."Standort" = "GC_Department"."Standort"
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
