SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE   VIEW [transform_imr].[op_aus_loc_belege_8520]
AS
SELECT DISTINCT T1."document_type" AS "Document Type",
	T1."nominal_account_number" AS "Nominal Account Number",
	T1."customer_contra_account" AS "Customer Contra Account",
	T1."invoice_number" AS "Invoice Number",
	T1."skr51_branch" AS "Skr51 Branch",
	'1' AS "Rechtseinheit",
	'0' + (convert(VARCHAR(50), T1."skr51_branch")) AS "Betrieb",
	'1' AS "Mandant",
	'1' AS "Hauptbetrieb",
	('0' + (convert(VARCHAR(50), T1."skr51_branch"))) AS "Standort"
FROM LOCOSOFT."dbo"."journal_accountings" T1
WHERE (
		(T1."nominal_account_number" IN (8520))
		AND (T1."document_type" = 'R')
		)
	-- order by "Invoice Number" asc,"Nominal Account Number" asc
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
