1202 lines
39 KiB
Transact-SQL
1202 lines
39 KiB
Transact-SQL
USE [DD_ECM]
|
|
GO
|
|
|
|
/****** Object: View [dbo].[VWCUST_NAVISION_PURCHASE_HEADER] Script Date: 21.03.2024 17:00:52 ******/
|
|
SET ANSI_NULLS ON
|
|
GO
|
|
|
|
SET QUOTED_IDENTIFIER ON
|
|
GO
|
|
|
|
|
|
|
|
|
|
-- TSQL View um Eingangsrechnungen/Eingangsgutschriften aus NAV abzurufen
|
|
|
|
-- Stand: MS // 14.07.2023
|
|
-- 14.07.2023 Update BC ID
|
|
-- 10.01.2022 Ergänzung IBAN per join
|
|
-- 05.11.2021 Dummy Nummer "ER99-9999" für die "Nuller" Rechnungen hinzugefügt
|
|
-- 27.10.2021 [Discount Amount], [Invoice Amount less Discount] und [Payment Discount _] Float Konvertierung und Umbenannt
|
|
-- 25.10.2021 [Amount able to Discount] - Float Konvertierung; [Vendor Invoice No_] umbennant
|
|
-- 23.09.2021 Order By eingefügt
|
|
-- 22.09.2021 "Stadtentwicklung Bebra GmbH" entfernt, da seit 2016 inaktiv
|
|
-- 20.09.2021 initial
|
|
|
|
CREATE view [dbo].[VWCUST_NAVISION_PURCHASE_HEADER]
|
|
as
|
|
|
|
SELECT
|
|
'Alle Mandanten' as 'Mandant'
|
|
,NULL as [Document Type]
|
|
,'ER99-9999' as 'Belegnummer'
|
|
,NULL as [Buy-from Vendor No_]
|
|
,NULL as [Pay-to Vendor No_]
|
|
,NULL as [Pay-to Name]
|
|
,NULL as [Pay-to Name 2]
|
|
,NULL as [Pay-to Address]
|
|
,NULL as [Pay-to Address 2]
|
|
,NULL as [Pay-to City]
|
|
,NULL as [Pay-to Contact]
|
|
,NULL as 'Pay-to IBAN'
|
|
,NULL as [Your Reference]
|
|
,NULL as [Ship-to Code]
|
|
,NULL as [Ship-to Name]
|
|
,NULL as [Ship-to Name 2]
|
|
,NULL as [Ship-to Address]
|
|
,NULL as [Ship-to Address 2]
|
|
,NULL as [Ship-to City]
|
|
,NULL as [Ship-to Contact]
|
|
,NULL as [Order Date]
|
|
,NULL as [Posting Date]
|
|
,NULL as [Expected Receipt Date]
|
|
,'Nuller Rechnung' as [Posting Description]
|
|
,NULL as [Payment Terms Code]
|
|
,NULL as [Due Date]
|
|
,NULL as 'Skonto/Rabatt Prozent'
|
|
,NULL as [Pmt_ Discount Date]
|
|
,NULL as [Shipment Method Code]
|
|
,NULL as [Location Code]
|
|
,NULL as [Shortcut Dimension 1 Code]
|
|
,NULL as [Shortcut Dimension 2 Code]
|
|
,NULL as [Vendor Posting Group]
|
|
,NULL as [Currency Code]
|
|
,NULL as [Currency Factor]
|
|
,NULL as [Prices Including VAT]
|
|
,NULL as [Invoice Disc_ Code]
|
|
,NULL as [Language Code]
|
|
,NULL as [Purchaser Code]
|
|
,NULL as [Order Class]
|
|
,NULL as [No_ Printed]
|
|
,NULL as [On Hold]
|
|
,NULL as [Applies-to Doc_ Type]
|
|
,NULL as [Applies-to Doc_ No_]
|
|
,NULL as [Bal_ Account No_]
|
|
,NULL as [Receive]
|
|
,NULL as [Invoice]
|
|
,NULL as [Print Posted Documents]
|
|
,NULL as [Receiving No_]
|
|
,NULL as [Posting No_]
|
|
,NULL as [Last Receiving No_]
|
|
,NULL as [Last Posting No_]
|
|
,NULL as [Vendor Order No_]
|
|
,NULL as [Vendor Shipment No_]
|
|
,'----' as 'Ex. Rech-Nr.'
|
|
,NULL as [Vendor Cr_ Memo No_]
|
|
,NULL as [VAT Registration No_]
|
|
,NULL as [Sell-to Customer No_]
|
|
,NULL as [Reason Code]
|
|
,NULL as [Gen_ Bus_ Posting Group]
|
|
,NULL as [Transaction Type]
|
|
,NULL as [Transport Method]
|
|
,NULL as [VAT Country_Region Code]
|
|
,NULL as [Buy-from Vendor Name]
|
|
,NULL as [Buy-from Vendor Name 2]
|
|
,NULL as [Buy-from Address]
|
|
,NULL as [Buy-from Address 2]
|
|
,NULL as [Buy-from City]
|
|
,NULL as [Buy-from Contact]
|
|
,NULL as [Pay-to Post Code]
|
|
,NULL as [Pay-to County]
|
|
,NULL as [Pay-to Country_Region Code]
|
|
,NULL as [Buy-from Post Code]
|
|
,NULL as [Buy-from County]
|
|
,NULL as [Buy-from Country_Region Code]
|
|
,NULL as [Ship-to Post Code]
|
|
,NULL as [Ship-to County]
|
|
,NULL as [Ship-to Country_Region Code]
|
|
,NULL as [Bal_ Account Type]
|
|
,NULL as [Order Address Code]
|
|
,NULL as [Entry Point]
|
|
,NULL as [Correction]
|
|
,NULL as [Document Date]
|
|
,NULL as [Area]
|
|
,NULL as [Transaction Specification]
|
|
,NULL as [Payment Method Code]
|
|
,NULL as [No_ Series]
|
|
,NULL as [Posting No_ Series]
|
|
,NULL as [Receiving No_ Series]
|
|
,NULL as [Tax Area Code]
|
|
,NULL as [Tax Liable]
|
|
,NULL as [VAT Bus_ Posting Group]
|
|
,NULL as [Applies-to ID]
|
|
,NULL as [VAT Base Discount _]
|
|
,NULL as [Status]
|
|
,NULL as [Invoice Discount Calculation]
|
|
,NULL as [Invoice Discount Value]
|
|
,NULL as [Send IC Document]
|
|
,NULL as [IC Status]
|
|
,NULL as [Buy-from IC Partner Code]
|
|
,NULL as [Pay-to IC Partner Code]
|
|
,NULL as [IC Direction]
|
|
,NULL as [Prepayment No_]
|
|
,NULL as [Last Prepayment No_]
|
|
,NULL as [Prepmt_ Cr_ Memo No_]
|
|
,NULL as [Last Prepmt_ Cr_ Memo No_]
|
|
,NULL as [Prepayment _]
|
|
,NULL as [Prepayment No_ Series]
|
|
,NULL as [Compress Prepayment]
|
|
,NULL as [Prepayment Due Date]
|
|
,NULL as [Prepmt_ Cr_ Memo No_ Series]
|
|
,NULL as [Prepmt_ Posting Description]
|
|
,NULL as [Prepmt_ Pmt_ Discount Date]
|
|
,NULL as [Prepmt_ Payment Terms Code]
|
|
,NULL as [Prepmt_ Payment Discount _]
|
|
,NULL as [Quote No_]
|
|
,NULL as [Job Queue Status]
|
|
,NULL as [Job Queue Entry ID]
|
|
,NULL as [Incoming Document Entry No_]
|
|
,NULL as [Creditor No_]
|
|
,NULL as [Payment Reference]
|
|
,NULL as [Dimension Set ID]
|
|
,NULL as [Doc_ No_ Occurrence]
|
|
,NULL as [Campaign No_]
|
|
,NULL as [Buy-from Contact No_]
|
|
,NULL as [Pay-to Contact No_]
|
|
,NULL as [Responsibility Center]
|
|
,NULL as [Posting from Whse_ Ref_]
|
|
,NULL as [Requested Receipt Date]
|
|
,NULL as [Promised Receipt Date]
|
|
,NULL as [Lead Time Calculation]
|
|
,NULL as [Inbound Whse_ Handling Time]
|
|
,NULL as [Vendor Authorization No_]
|
|
,NULL as [Return Shipment No_]
|
|
,NULL as [Return Shipment No_ Series]
|
|
,NULL as [Ship]
|
|
,NULL as [Last Return Shipment No_]
|
|
,NULL as [Id]
|
|
,NULL as [Assigned User ID]
|
|
,NULL as [Registration No_]
|
|
,NULL as [OU]
|
|
,NULL as [OU Manual]
|
|
,NULL as [OU Code]
|
|
,NULL as [Pay-to Salutation]
|
|
,NULL as [Pay-to Title]
|
|
,NULL as [Pay-to First Name]
|
|
,NULL as [Buy-from Salutation]
|
|
,NULL as [Buy-from Title]
|
|
,NULL as [Buy-from First Name]
|
|
,NULL as [Print Text Code]
|
|
,NULL as [Resource Requester]
|
|
,NULL as [User ID]
|
|
,NULL as [Work Order Charging (Customer)]
|
|
,NULL as [WO Charging Doc_ No_ Sales]
|
|
,NULL as [Res_ Department No_]
|
|
,NULL as [Submissionno_]
|
|
,NULL as [Contract of Value]
|
|
,NULL as [Contract guilty from]
|
|
,NULL as [Contract guilty to]
|
|
,NULL as [Contract Value Agree]
|
|
,NULL as [Contract Of Value No_]
|
|
,NULL as [Due Date for Quote]
|
|
,NULL as [Source Type]
|
|
,NULL as [Source No_]
|
|
,NULL as [Source Charging Company]
|
|
,NULL as [Destination Charging Company]
|
|
,NULL as [Document Text Code]
|
|
,NULL as [Purchase Rating Code]
|
|
,NULL as [Exemption answer]
|
|
,NULL as [Exemption answer valid to]
|
|
,NULL as [Responsibly Tax office]
|
|
,NULL as [Business Area Code]
|
|
,NULL as [VU Bank Account Entry No_]
|
|
,NULL as [Bank Branch No_]
|
|
,NULL as [Bank Account No_]
|
|
,NULL as [Bank Name]
|
|
,NULL as [Bank Account Holder]
|
|
,NULL as [Bank Account Entry Type]
|
|
,NULL as [Bank Account Entry Priority]
|
|
,NULL as [Vendor Bank Account Code]
|
|
,NULL as [Receipt Date]
|
|
,NULL as [Follow-up Date]
|
|
,NULL as [Payment Terms Code (IR)]
|
|
,NULL as [Payment Discount _ (IR)]
|
|
,0 as 'Gesamtbetrag'
|
|
,0 as 'Skonto/Rabatt Wert'
|
|
,0 as 'Gesamtbetrag (brutto) abzgl. Skonto/Rabatt'
|
|
,NULL as [Action Chain Code]
|
|
,NULL as [Reason Code (IR)]
|
|
,NULL as [Status Value (IR)]
|
|
,NULL as [Action Date]
|
|
,NULL as [Label printed]
|
|
,NULL as [Origin No_ (IR)]
|
|
,NULL as [Origin No_ Series (IR)]
|
|
,NULL as [Invoice No_]
|
|
,NULL as [Invoice No_ Series]
|
|
,NULL as [Receipt Type]
|
|
,NULL as [Responsibility Center (IR)]
|
|
,NULL as [Accessed Order No_]
|
|
,NULL as [Payment Discount Income]
|
|
,NULL as [Check Tolerance Amount]
|
|
,NULL as [EDAP Invoice No_ Series]
|
|
,NULL as [ILN No_]
|
|
,NULL as [Data Reference]
|
|
,NULL as [Accept (IR)]
|
|
,NULL as [ProcessID Transfer]
|
|
,NULL as [ILN No_ Receiver]
|
|
,NULL as [Metering Point Description]
|
|
,NULL as [INVOIC Error]
|
|
,NULL as [Security Given]
|
|
,NULL as [Security Given _]
|
|
,NULL as [Security Given Amount]
|
|
,NULL as [Security Given Due Date]
|
|
,NULL as [Country_Region Code (BV)]
|
|
,NULL as [Status DMS]
|
|
,NULL as [Doc_ with Order]
|
|
,NULL as [Reverse Charge]
|
|
,NULL as [No Document RC]
|
|
,NULL as [Transfered to D3]
|
|
,NULL as [CH DTA Transaction Type]
|
|
,NULL as [CH DTA ESR No_]
|
|
,NULL as [windream Job No_]
|
|
,NULL as [E-Procurement]
|
|
|
|
UNION --####################################################################################--
|
|
|
|
SELECT TOP 1000000
|
|
'SB-Abwasserbetrieb' as 'Mandant'
|
|
,[PH].[Document Type]
|
|
,[PH].[No_] as 'Belegnummer'
|
|
,[PH].[Buy-from Vendor No_]
|
|
,[PH].[Pay-to Vendor No_]
|
|
,[PH].[Pay-to Name]
|
|
,[PH].[Pay-to Name 2]
|
|
,[PH].[Pay-to Address]
|
|
,[PH].[Pay-to Address 2]
|
|
,[PH].[Pay-to City]
|
|
,[PH].[Pay-to Contact]
|
|
,[VBA].[IBAN] as 'Pay-to IBAN'
|
|
,[PH].[Your Reference]
|
|
,[PH].[Ship-to Code]
|
|
,[PH].[Ship-to Name]
|
|
,[PH].[Ship-to Name 2]
|
|
,[PH].[Ship-to Address]
|
|
,[PH].[Ship-to Address 2]
|
|
,[PH].[Ship-to City]
|
|
,[PH].[Ship-to Contact]
|
|
,[PH].[Order Date]
|
|
,[PH].[Posting Date]
|
|
,[PH].[Expected Receipt Date]
|
|
,[PH].[Posting Description]
|
|
,[PH].[Payment Terms Code]
|
|
,[PH].[Due Date]
|
|
,convert(FLOAT,[PH].[Payment Discount _]) as 'Skonto/Rabatt Prozent'
|
|
,[PH].[Pmt_ Discount Date]
|
|
,[PH].[Shipment Method Code]
|
|
,[PH].[Location Code]
|
|
,[PH].[Shortcut Dimension 1 Code]
|
|
,[PH].[Shortcut Dimension 2 Code]
|
|
,[PH].[Vendor Posting Group]
|
|
,[PH].[Currency Code]
|
|
,[PH].[Currency Factor]
|
|
,[PH].[Prices Including VAT]
|
|
,[PH].[Invoice Disc_ Code]
|
|
,[PH].[Language Code]
|
|
,[PH].[Purchaser Code]
|
|
,[PH].[Order Class]
|
|
,[PH].[No_ Printed]
|
|
,[PH].[On Hold]
|
|
,[PH].[Applies-to Doc_ Type]
|
|
,[PH].[Applies-to Doc_ No_]
|
|
,[PH].[Bal_ Account No_]
|
|
,[PH].[Receive]
|
|
,[PH].[Invoice]
|
|
,[PH].[Print Posted Documents]
|
|
,[PH].[Receiving No_]
|
|
,[PH].[Posting No_]
|
|
,[PH].[Last Receiving No_]
|
|
,[PH].[Last Posting No_]
|
|
,[PH].[Vendor Order No_]
|
|
,[PH].[Vendor Shipment No_]
|
|
,[PH].[Vendor Invoice No_] as 'Ex. Rech-Nr.'
|
|
,[PH].[Vendor Cr_ Memo No_]
|
|
,[PH].[VAT Registration No_]
|
|
,[PH].[Sell-to Customer No_]
|
|
,[PH].[Reason Code]
|
|
,[PH].[Gen_ Bus_ Posting Group]
|
|
,[PH].[Transaction Type]
|
|
,[PH].[Transport Method]
|
|
,[PH].[VAT Country_Region Code]
|
|
,[PH].[Buy-from Vendor Name]
|
|
,[PH].[Buy-from Vendor Name 2]
|
|
,[PH].[Buy-from Address]
|
|
,[PH].[Buy-from Address 2]
|
|
,[PH].[Buy-from City]
|
|
,[PH].[Buy-from Contact]
|
|
,[PH].[Pay-to Post Code]
|
|
,[PH].[Pay-to County]
|
|
,[PH].[Pay-to Country_Region Code]
|
|
,[PH].[Buy-from Post Code]
|
|
,[PH].[Buy-from County]
|
|
,[PH].[Buy-from Country_Region Code]
|
|
,[PH].[Ship-to Post Code]
|
|
,[PH].[Ship-to County]
|
|
,[PH].[Ship-to Country_Region Code]
|
|
,[PH].[Bal_ Account Type]
|
|
,[PH].[Order Address Code]
|
|
,[PH].[Entry Point]
|
|
,[PH].[Correction]
|
|
,[PH].[Document Date]
|
|
,[PH].[Area]
|
|
,[PH].[Transaction Specification]
|
|
,[PH].[Payment Method Code]
|
|
,[PH].[No_ Series]
|
|
,[PH].[Posting No_ Series]
|
|
,[PH].[Receiving No_ Series]
|
|
,[PH].[Tax Area Code]
|
|
,[PH].[Tax Liable]
|
|
,[PH].[VAT Bus_ Posting Group]
|
|
,[PH].[Applies-to ID]
|
|
,[PH].[VAT Base Discount _]
|
|
,[PH].[Status]
|
|
,[PH].[Invoice Discount Calculation]
|
|
,[PH].[Invoice Discount Value]
|
|
,[PH].[Send IC Document]
|
|
,[PH].[IC Status]
|
|
,[PH].[Buy-from IC Partner Code]
|
|
,[PH].[Pay-to IC Partner Code]
|
|
,[PH].[IC Direction]
|
|
,[PH].[Prepayment No_]
|
|
,[PH].[Last Prepayment No_]
|
|
,[PH].[Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Last Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Prepayment _]
|
|
,[PH].[Prepayment No_ Series]
|
|
,[PH].[Compress Prepayment]
|
|
,[PH].[Prepayment Due Date]
|
|
,[PH].[Prepmt_ Cr_ Memo No_ Series]
|
|
,[PH].[Prepmt_ Posting Description]
|
|
,[PH].[Prepmt_ Pmt_ Discount Date]
|
|
,[PH].[Prepmt_ Payment Terms Code]
|
|
,[PH].[Prepmt_ Payment Discount _]
|
|
,[PH].[Quote No_]
|
|
,[PH].[Job Queue Status]
|
|
,[PH].[Job Queue Entry ID]
|
|
,[PH].[Incoming Document Entry No_]
|
|
,[PH].[Creditor No_]
|
|
,[PH].[Payment Reference]
|
|
,[PH].[Dimension Set ID]
|
|
,[PH].[Doc_ No_ Occurrence]
|
|
,[PH].[Campaign No_]
|
|
,[PH].[Buy-from Contact No_]
|
|
,[PH].[Pay-to Contact No_]
|
|
,[PH].[Responsibility Center]
|
|
,[PH].[Posting from Whse_ Ref_]
|
|
,[PH].[Requested Receipt Date]
|
|
,[PH].[Promised Receipt Date]
|
|
,[PH].[Lead Time Calculation]
|
|
,[PH].[Inbound Whse_ Handling Time]
|
|
,[PH].[Vendor Authorization No_]
|
|
,[PH].[Return Shipment No_]
|
|
,[PH].[Return Shipment No_ Series]
|
|
,[PH].[Ship]
|
|
,[PH].[Last Return Shipment No_]
|
|
,[PH].[Id]
|
|
,[PH].[Assigned User ID]
|
|
,[PH].[Registration No_]
|
|
,[PH].[OU]
|
|
,[PH].[OU Manual]
|
|
,[PH].[OU Code]
|
|
,[PH].[Pay-to Salutation]
|
|
,[PH].[Pay-to Title]
|
|
,[PH].[Pay-to First Name]
|
|
,[PH].[Buy-from Salutation]
|
|
,[PH].[Buy-from Title]
|
|
,[PH].[Buy-from First Name]
|
|
,[PH].[Print Text Code]
|
|
,[PH].[Resource Requester]
|
|
,[PH].[User ID]
|
|
,[PH].[Work Order Charging (Customer)]
|
|
,[PH].[WO Charging Doc_ No_ Sales]
|
|
,[PH].[Res_ Department No_]
|
|
,[PH].[Submissionno_]
|
|
,[PH].[Contract of Value]
|
|
,[PH].[Contract guilty from]
|
|
,[PH].[Contract guilty to]
|
|
,[PH].[Contract Value Agree]
|
|
,[PH].[Contract Of Value No_]
|
|
,[PH].[Due Date for Quote]
|
|
,[PH].[Source Type]
|
|
,[PH].[Source No_]
|
|
,[PH].[Source Charging Company]
|
|
,[PH].[Destination Charging Company]
|
|
,[PH].[Document Text Code]
|
|
,[PH].[Purchase Rating Code]
|
|
,[PH].[Exemption answer]
|
|
,[PH].[Exemption answer valid to]
|
|
,[PH].[Responsibly Tax office]
|
|
,[PH].[Business Area Code]
|
|
,[PH].[VU Bank Account Entry No_]
|
|
,[PH].[Bank Branch No_]
|
|
,[PH].[Bank Account No_]
|
|
,[PH].[Bank Name]
|
|
,[PH].[Bank Account Holder]
|
|
,[PH].[Bank Account Entry Type]
|
|
,[PH].[Bank Account Entry Priority]
|
|
,[PH].[Vendor Bank Account Code]
|
|
,[PH].[Receipt Date]
|
|
,[PH].[Follow-up Date]
|
|
,[PH].[Payment Terms Code (IR)]
|
|
,[PH].[Payment Discount _ (IR)]
|
|
,convert(FLOAT,[PH].[Amount able to Discount]) as 'Gesamtbetrag'
|
|
,convert(FLOAT,[PH].[Discount Amount]) as 'Skonto/Rabatt Wert'
|
|
,convert(FLOAT,[PH].[Invoice Amount less Discount]) as 'Gesamtbetrag (brutto) abzgl. Skonto/Rabatt'
|
|
,[PH].[Action Chain Code]
|
|
,[PH].[Reason Code (IR)]
|
|
,[PH].[Status Value (IR)]
|
|
,[PH].[Action Date]
|
|
,[PH].[Label printed]
|
|
,[PH].[Origin No_ (IR)]
|
|
,[PH].[Origin No_ Series (IR)]
|
|
,[PH].[Invoice No_]
|
|
,[PH].[Invoice No_ Series]
|
|
,[PH].[Receipt Type]
|
|
,[PH].[Responsibility Center (IR)]
|
|
,[PH].[Accessed Order No_]
|
|
,[PH].[Payment Discount Income]
|
|
,[PH].[Check Tolerance Amount]
|
|
,[PH].[EDAP Invoice No_ Series]
|
|
,[PH].[ILN No_]
|
|
,[PH].[Data Reference]
|
|
,[PH].[Accept (IR)]
|
|
,[PH].[ProcessID Transfer]
|
|
,[PH].[ILN No_ Receiver]
|
|
,[PH].[Metering Point Description]
|
|
,[PH].[INVOIC Error]
|
|
,[PH].[Security Given]
|
|
,[PH].[Security Given _]
|
|
,[PH].[Security Given Amount]
|
|
,[PH].[Security Given Due Date]
|
|
,[PH].[Country_Region Code (BV)]
|
|
,[PH].[Status DMS]
|
|
,[PH].[Doc_ with Order]
|
|
,[PH].[Reverse Charge]
|
|
,[PH].[No Document RC]
|
|
,[PH].[Transfered to D3]
|
|
,[PH].[CH DTA Transaction Type]
|
|
,[PH].[CH DTA ESR No_]
|
|
,NULL [windream Job No_]
|
|
,[PH].[E-Procurement]
|
|
FROM
|
|
--[NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Abwasserbetrieb d_ Stadt Bebra$Purchase Header] as [PH] (NOLOCK)
|
|
[NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Abwasserbetrieb d_ Stadt Bebra$Purchase Header$437dbf0e-84ff-417a-965d-ed2bb9650972] as [PH] (NOLOCK) LEFT JOIN
|
|
[NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Abwasserbetrieb d_ Stadt Bebra$Vendor Bank Account$437dbf0e-84ff-417a-965d-ed2bb9650972] as [VBA] (NOLOCK) ON [PH].[Pay-to Vendor No_] = [VBA].[Vendor No_]
|
|
|
|
UNION --####################################################################################--
|
|
|
|
SELECT TOP 1000000
|
|
'SB-Bäderbetrieb' as 'Mandant'
|
|
,[PH].[Document Type]
|
|
,[PH].[No_] as 'Belegnummer'
|
|
,[PH].[Buy-from Vendor No_]
|
|
,[PH].[Pay-to Vendor No_]
|
|
,[PH].[Pay-to Name]
|
|
,[PH].[Pay-to Name 2]
|
|
,[PH].[Pay-to Address]
|
|
,[PH].[Pay-to Address 2]
|
|
,[PH].[Pay-to City]
|
|
,[PH].[Pay-to Contact]
|
|
,[VBA].[IBAN] as 'Pay-to IBAN'
|
|
,[PH].[Your Reference]
|
|
,[PH].[Ship-to Code]
|
|
,[PH].[Ship-to Name]
|
|
,[PH].[Ship-to Name 2]
|
|
,[PH].[Ship-to Address]
|
|
,[PH].[Ship-to Address 2]
|
|
,[PH].[Ship-to City]
|
|
,[PH].[Ship-to Contact]
|
|
,[PH].[Order Date]
|
|
,[PH].[Posting Date]
|
|
,[PH].[Expected Receipt Date]
|
|
,[PH].[Posting Description]
|
|
,[PH].[Payment Terms Code]
|
|
,[PH].[Due Date]
|
|
,convert(FLOAT,[PH].[Payment Discount _]) as 'Skonto/Rabatt Prozent'
|
|
,[PH].[Pmt_ Discount Date]
|
|
,[PH].[Shipment Method Code]
|
|
,[PH].[Location Code]
|
|
,[PH].[Shortcut Dimension 1 Code]
|
|
,[PH].[Shortcut Dimension 2 Code]
|
|
,[PH].[Vendor Posting Group]
|
|
,[PH].[Currency Code]
|
|
,[PH].[Currency Factor]
|
|
,[PH].[Prices Including VAT]
|
|
,[PH].[Invoice Disc_ Code]
|
|
,[PH].[Language Code]
|
|
,[PH].[Purchaser Code]
|
|
,[PH].[Order Class]
|
|
,[PH].[No_ Printed]
|
|
,[PH].[On Hold]
|
|
,[PH].[Applies-to Doc_ Type]
|
|
,[PH].[Applies-to Doc_ No_]
|
|
,[PH].[Bal_ Account No_]
|
|
,[PH].[Receive]
|
|
,[PH].[Invoice]
|
|
,[PH].[Print Posted Documents]
|
|
,[PH].[Receiving No_]
|
|
,[PH].[Posting No_]
|
|
,[PH].[Last Receiving No_]
|
|
,[PH].[Last Posting No_]
|
|
,[PH].[Vendor Order No_]
|
|
,[PH].[Vendor Shipment No_]
|
|
,[PH].[Vendor Invoice No_] as 'Ex. Rech-Nr.'
|
|
,[PH].[Vendor Cr_ Memo No_]
|
|
,[PH].[VAT Registration No_]
|
|
,[PH].[Sell-to Customer No_]
|
|
,[PH].[Reason Code]
|
|
,[PH].[Gen_ Bus_ Posting Group]
|
|
,[PH].[Transaction Type]
|
|
,[PH].[Transport Method]
|
|
,[PH].[VAT Country_Region Code]
|
|
,[PH].[Buy-from Vendor Name]
|
|
,[PH].[Buy-from Vendor Name 2]
|
|
,[PH].[Buy-from Address]
|
|
,[PH].[Buy-from Address 2]
|
|
,[PH].[Buy-from City]
|
|
,[PH].[Buy-from Contact]
|
|
,[PH].[Pay-to Post Code]
|
|
,[PH].[Pay-to County]
|
|
,[PH].[Pay-to Country_Region Code]
|
|
,[PH].[Buy-from Post Code]
|
|
,[PH].[Buy-from County]
|
|
,[PH].[Buy-from Country_Region Code]
|
|
,[PH].[Ship-to Post Code]
|
|
,[PH].[Ship-to County]
|
|
,[PH].[Ship-to Country_Region Code]
|
|
,[PH].[Bal_ Account Type]
|
|
,[PH].[Order Address Code]
|
|
,[PH].[Entry Point]
|
|
,[PH].[Correction]
|
|
,[PH].[Document Date]
|
|
,[PH].[Area]
|
|
,[PH].[Transaction Specification]
|
|
,[PH].[Payment Method Code]
|
|
,[PH].[No_ Series]
|
|
,[PH].[Posting No_ Series]
|
|
,[PH].[Receiving No_ Series]
|
|
,[PH].[Tax Area Code]
|
|
,[PH].[Tax Liable]
|
|
,[PH].[VAT Bus_ Posting Group]
|
|
,[PH].[Applies-to ID]
|
|
,[PH].[VAT Base Discount _]
|
|
,[PH].[Status]
|
|
,[PH].[Invoice Discount Calculation]
|
|
,[PH].[Invoice Discount Value]
|
|
,[PH].[Send IC Document]
|
|
,[PH].[IC Status]
|
|
,[PH].[Buy-from IC Partner Code]
|
|
,[PH].[Pay-to IC Partner Code]
|
|
,[PH].[IC Direction]
|
|
,[PH].[Prepayment No_]
|
|
,[PH].[Last Prepayment No_]
|
|
,[PH].[Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Last Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Prepayment _]
|
|
,[PH].[Prepayment No_ Series]
|
|
,[PH].[Compress Prepayment]
|
|
,[PH].[Prepayment Due Date]
|
|
,[PH].[Prepmt_ Cr_ Memo No_ Series]
|
|
,[PH].[Prepmt_ Posting Description]
|
|
,[PH].[Prepmt_ Pmt_ Discount Date]
|
|
,[PH].[Prepmt_ Payment Terms Code]
|
|
,[PH].[Prepmt_ Payment Discount _]
|
|
,[PH].[Quote No_]
|
|
,[PH].[Job Queue Status]
|
|
,[PH].[Job Queue Entry ID]
|
|
,[PH].[Incoming Document Entry No_]
|
|
,[PH].[Creditor No_]
|
|
,[PH].[Payment Reference]
|
|
,[PH].[Dimension Set ID]
|
|
,[PH].[Doc_ No_ Occurrence]
|
|
,[PH].[Campaign No_]
|
|
,[PH].[Buy-from Contact No_]
|
|
,[PH].[Pay-to Contact No_]
|
|
,[PH].[Responsibility Center]
|
|
,[PH].[Posting from Whse_ Ref_]
|
|
,[PH].[Requested Receipt Date]
|
|
,[PH].[Promised Receipt Date]
|
|
,[PH].[Lead Time Calculation]
|
|
,[PH].[Inbound Whse_ Handling Time]
|
|
,[PH].[Vendor Authorization No_]
|
|
,[PH].[Return Shipment No_]
|
|
,[PH].[Return Shipment No_ Series]
|
|
,[PH].[Ship]
|
|
,[PH].[Last Return Shipment No_]
|
|
,[PH].[Id]
|
|
,[PH].[Assigned User ID]
|
|
,[PH].[Registration No_]
|
|
,[PH].[OU]
|
|
,[PH].[OU Manual]
|
|
,[PH].[OU Code]
|
|
,[PH].[Pay-to Salutation]
|
|
,[PH].[Pay-to Title]
|
|
,[PH].[Pay-to First Name]
|
|
,[PH].[Buy-from Salutation]
|
|
,[PH].[Buy-from Title]
|
|
,[PH].[Buy-from First Name]
|
|
,[PH].[Print Text Code]
|
|
,[PH].[Resource Requester]
|
|
,[PH].[User ID]
|
|
,[PH].[Work Order Charging (Customer)]
|
|
,[PH].[WO Charging Doc_ No_ Sales]
|
|
,[PH].[Res_ Department No_]
|
|
,[PH].[Submissionno_]
|
|
,[PH].[Contract of Value]
|
|
,[PH].[Contract guilty from]
|
|
,[PH].[Contract guilty to]
|
|
,[PH].[Contract Value Agree]
|
|
,[PH].[Contract Of Value No_]
|
|
,[PH].[Due Date for Quote]
|
|
,[PH].[Source Type]
|
|
,[PH].[Source No_]
|
|
,[PH].[Source Charging Company]
|
|
,[PH].[Destination Charging Company]
|
|
,[PH].[Document Text Code]
|
|
,[PH].[Purchase Rating Code]
|
|
,[PH].[Exemption answer]
|
|
,[PH].[Exemption answer valid to]
|
|
,[PH].[Responsibly Tax office]
|
|
,[PH].[Business Area Code]
|
|
,[PH].[VU Bank Account Entry No_]
|
|
,[PH].[Bank Branch No_]
|
|
,[PH].[Bank Account No_]
|
|
,[PH].[Bank Name]
|
|
,[PH].[Bank Account Holder]
|
|
,[PH].[Bank Account Entry Type]
|
|
,[PH].[Bank Account Entry Priority]
|
|
,[PH].[Vendor Bank Account Code]
|
|
,[PH].[Receipt Date]
|
|
,[PH].[Follow-up Date]
|
|
,[PH].[Payment Terms Code (IR)]
|
|
,[PH].[Payment Discount _ (IR)]
|
|
,convert(FLOAT,[PH].[Amount able to Discount]) as 'Gesamtbetrag'
|
|
,convert(FLOAT,[PH].[Discount Amount]) as 'Skonto/Rabatt Wert'
|
|
,convert(FLOAT,[PH].[Invoice Amount less Discount]) as 'Gesamtbetrag (brutto) abzgl. Skonto/Rabatt'
|
|
,[PH].[Action Chain Code]
|
|
,[PH].[Reason Code (IR)]
|
|
,[PH].[Status Value (IR)]
|
|
,[PH].[Action Date]
|
|
,[PH].[Label printed]
|
|
,[PH].[Origin No_ (IR)]
|
|
,[PH].[Origin No_ Series (IR)]
|
|
,[PH].[Invoice No_]
|
|
,[PH].[Invoice No_ Series]
|
|
,[PH].[Receipt Type]
|
|
,[PH].[Responsibility Center (IR)]
|
|
,[PH].[Accessed Order No_]
|
|
,[PH].[Payment Discount Income]
|
|
,[PH].[Check Tolerance Amount]
|
|
,[PH].[EDAP Invoice No_ Series]
|
|
,[PH].[ILN No_]
|
|
,[PH].[Data Reference]
|
|
,[PH].[Accept (IR)]
|
|
,[PH].[ProcessID Transfer]
|
|
,[PH].[ILN No_ Receiver]
|
|
,[PH].[Metering Point Description]
|
|
,[PH].[INVOIC Error]
|
|
,[PH].[Security Given]
|
|
,[PH].[Security Given _]
|
|
,[PH].[Security Given Amount]
|
|
,[PH].[Security Given Due Date]
|
|
,[PH].[Country_Region Code (BV)]
|
|
,[PH].[Status DMS]
|
|
,[PH].[Doc_ with Order]
|
|
,[PH].[Reverse Charge]
|
|
,[PH].[No Document RC]
|
|
,[PH].[Transfered to D3]
|
|
,[PH].[CH DTA Transaction Type]
|
|
,[PH].[CH DTA ESR No_]
|
|
,NULL [windream Job No_]
|
|
,[PH].[E-Procurement]
|
|
FROM [NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Bäderbetrieb der Stadt Bebra$Purchase Header$437dbf0e-84ff-417a-965d-ed2bb9650972] as [PH] (NOLOCK)
|
|
LEFT JOIN [NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Bäderbetrieb der Stadt Bebra$Vendor Bank Account$437dbf0e-84ff-417a-965d-ed2bb9650972] as [VBA] (NOLOCK) ON [PH].[Pay-to Vendor No_] = [VBA].[Vendor No_]
|
|
|
|
UNION --####################################################################################--
|
|
|
|
SELECT TOP 1000000
|
|
'SWB-Netz' as 'Mandant'
|
|
,[PH].[Document Type]
|
|
,[PH].[No_] as 'Belegnummer'
|
|
,[PH].[Buy-from Vendor No_]
|
|
,[PH].[Pay-to Vendor No_]
|
|
,[PH].[Pay-to Name]
|
|
,[PH].[Pay-to Name 2]
|
|
,[PH].[Pay-to Address]
|
|
,[PH].[Pay-to Address 2]
|
|
,[PH].[Pay-to City]
|
|
,[PH].[Pay-to Contact]
|
|
,[VBA].[IBAN] as 'Pay-to IBAN'
|
|
,[PH].[Your Reference]
|
|
,[PH].[Ship-to Code]
|
|
,[PH].[Ship-to Name]
|
|
,[PH].[Ship-to Name 2]
|
|
,[PH].[Ship-to Address]
|
|
,[PH].[Ship-to Address 2]
|
|
,[PH].[Ship-to City]
|
|
,[PH].[Ship-to Contact]
|
|
,[PH].[Order Date]
|
|
,[PH].[Posting Date]
|
|
,[PH].[Expected Receipt Date]
|
|
,[PH].[Posting Description]
|
|
,[PH].[Payment Terms Code]
|
|
,[PH].[Due Date]
|
|
,convert(FLOAT,[PH].[Payment Discount _]) as 'Skonto/Rabatt Prozent'
|
|
,[PH].[Pmt_ Discount Date]
|
|
,[PH].[Shipment Method Code]
|
|
,[PH].[Location Code]
|
|
,[PH].[Shortcut Dimension 1 Code]
|
|
,[PH].[Shortcut Dimension 2 Code]
|
|
,[PH].[Vendor Posting Group]
|
|
,[PH].[Currency Code]
|
|
,[PH].[Currency Factor]
|
|
,[PH].[Prices Including VAT]
|
|
,[PH].[Invoice Disc_ Code]
|
|
,[PH].[Language Code]
|
|
,[PH].[Purchaser Code]
|
|
,[PH].[Order Class]
|
|
,[PH].[No_ Printed]
|
|
,[PH].[On Hold]
|
|
,[PH].[Applies-to Doc_ Type]
|
|
,[PH].[Applies-to Doc_ No_]
|
|
,[PH].[Bal_ Account No_]
|
|
,[PH].[Receive]
|
|
,[PH].[Invoice]
|
|
,[PH].[Print Posted Documents]
|
|
,[PH].[Receiving No_]
|
|
,[PH].[Posting No_]
|
|
,[PH].[Last Receiving No_]
|
|
,[PH].[Last Posting No_]
|
|
,[PH].[Vendor Order No_]
|
|
,[PH].[Vendor Shipment No_]
|
|
,[PH].[Vendor Invoice No_] as 'Ex. Rech-Nr.'
|
|
,[PH].[Vendor Cr_ Memo No_]
|
|
,[PH].[VAT Registration No_]
|
|
,[PH].[Sell-to Customer No_]
|
|
,[PH].[Reason Code]
|
|
,[PH].[Gen_ Bus_ Posting Group]
|
|
,[PH].[Transaction Type]
|
|
,[PH].[Transport Method]
|
|
,[PH].[VAT Country_Region Code]
|
|
,[PH].[Buy-from Vendor Name]
|
|
,[PH].[Buy-from Vendor Name 2]
|
|
,[PH].[Buy-from Address]
|
|
,[PH].[Buy-from Address 2]
|
|
,[PH].[Buy-from City]
|
|
,[PH].[Buy-from Contact]
|
|
,[PH].[Pay-to Post Code]
|
|
,[PH].[Pay-to County]
|
|
,[PH].[Pay-to Country_Region Code]
|
|
,[PH].[Buy-from Post Code]
|
|
,[PH].[Buy-from County]
|
|
,[PH].[Buy-from Country_Region Code]
|
|
,[PH].[Ship-to Post Code]
|
|
,[PH].[Ship-to County]
|
|
,[PH].[Ship-to Country_Region Code]
|
|
,[PH].[Bal_ Account Type]
|
|
,[PH].[Order Address Code]
|
|
,[PH].[Entry Point]
|
|
,[PH].[Correction]
|
|
,[PH].[Document Date]
|
|
,[PH].[Area]
|
|
,[PH].[Transaction Specification]
|
|
,[PH].[Payment Method Code]
|
|
,[PH].[No_ Series]
|
|
,[PH].[Posting No_ Series]
|
|
,[PH].[Receiving No_ Series]
|
|
,[PH].[Tax Area Code]
|
|
,[PH].[Tax Liable]
|
|
,[PH].[VAT Bus_ Posting Group]
|
|
,[PH].[Applies-to ID]
|
|
,[PH].[VAT Base Discount _]
|
|
,[PH].[Status]
|
|
,[PH].[Invoice Discount Calculation]
|
|
,[PH].[Invoice Discount Value]
|
|
,[PH].[Send IC Document]
|
|
,[PH].[IC Status]
|
|
,[PH].[Buy-from IC Partner Code]
|
|
,[PH].[Pay-to IC Partner Code]
|
|
,[PH].[IC Direction]
|
|
,[PH].[Prepayment No_]
|
|
,[PH].[Last Prepayment No_]
|
|
,[PH].[Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Last Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Prepayment _]
|
|
,[PH].[Prepayment No_ Series]
|
|
,[PH].[Compress Prepayment]
|
|
,[PH].[Prepayment Due Date]
|
|
,[PH].[Prepmt_ Cr_ Memo No_ Series]
|
|
,[PH].[Prepmt_ Posting Description]
|
|
,[PH].[Prepmt_ Pmt_ Discount Date]
|
|
,[PH].[Prepmt_ Payment Terms Code]
|
|
,[PH].[Prepmt_ Payment Discount _]
|
|
,[PH].[Quote No_]
|
|
,[PH].[Job Queue Status]
|
|
,[PH].[Job Queue Entry ID]
|
|
,[PH].[Incoming Document Entry No_]
|
|
,[PH].[Creditor No_]
|
|
,[PH].[Payment Reference]
|
|
,[PH].[Dimension Set ID]
|
|
,[PH].[Doc_ No_ Occurrence]
|
|
,[PH].[Campaign No_]
|
|
,[PH].[Buy-from Contact No_]
|
|
,[PH].[Pay-to Contact No_]
|
|
,[PH].[Responsibility Center]
|
|
,[PH].[Posting from Whse_ Ref_]
|
|
,[PH].[Requested Receipt Date]
|
|
,[PH].[Promised Receipt Date]
|
|
,[PH].[Lead Time Calculation]
|
|
,[PH].[Inbound Whse_ Handling Time]
|
|
,[PH].[Vendor Authorization No_]
|
|
,[PH].[Return Shipment No_]
|
|
,[PH].[Return Shipment No_ Series]
|
|
,[PH].[Ship]
|
|
,[PH].[Last Return Shipment No_]
|
|
,[PH].[Id]
|
|
,[PH].[Assigned User ID]
|
|
,[PH].[Registration No_]
|
|
,[PH].[OU]
|
|
,[PH].[OU Manual]
|
|
,[PH].[OU Code]
|
|
,[PH].[Pay-to Salutation]
|
|
,[PH].[Pay-to Title]
|
|
,[PH].[Pay-to First Name]
|
|
,[PH].[Buy-from Salutation]
|
|
,[PH].[Buy-from Title]
|
|
,[PH].[Buy-from First Name]
|
|
,[PH].[Print Text Code]
|
|
,[PH].[Resource Requester]
|
|
,[PH].[User ID]
|
|
,[PH].[Work Order Charging (Customer)]
|
|
,[PH].[WO Charging Doc_ No_ Sales]
|
|
,[PH].[Res_ Department No_]
|
|
,[PH].[Submissionno_]
|
|
,[PH].[Contract of Value]
|
|
,[PH].[Contract guilty from]
|
|
,[PH].[Contract guilty to]
|
|
,[PH].[Contract Value Agree]
|
|
,[PH].[Contract Of Value No_]
|
|
,[PH].[Due Date for Quote]
|
|
,[PH].[Source Type]
|
|
,[PH].[Source No_]
|
|
,[PH].[Source Charging Company]
|
|
,[PH].[Destination Charging Company]
|
|
,[PH].[Document Text Code]
|
|
,[PH].[Purchase Rating Code]
|
|
,[PH].[Exemption answer]
|
|
,[PH].[Exemption answer valid to]
|
|
,[PH].[Responsibly Tax office]
|
|
,[PH].[Business Area Code]
|
|
,[PH].[VU Bank Account Entry No_]
|
|
,[PH].[Bank Branch No_]
|
|
,[PH].[Bank Account No_]
|
|
,[PH].[Bank Name]
|
|
,[PH].[Bank Account Holder]
|
|
,[PH].[Bank Account Entry Type]
|
|
,[PH].[Bank Account Entry Priority]
|
|
,[PH].[Vendor Bank Account Code]
|
|
,[PH].[Receipt Date]
|
|
,[PH].[Follow-up Date]
|
|
,[PH].[Payment Terms Code (IR)]
|
|
,[PH].[Payment Discount _ (IR)]
|
|
,convert(FLOAT,[PH].[Amount able to Discount]) as 'Gesamtbetrag'
|
|
,convert(FLOAT,[PH].[Discount Amount]) as 'Skonto/Rabatt Wert'
|
|
,convert(FLOAT,[PH].[Invoice Amount less Discount]) as 'Gesamtbetrag (brutto) abzgl. Skonto/Rabatt'
|
|
,[PH].[Action Chain Code]
|
|
,[PH].[Reason Code (IR)]
|
|
,[PH].[Status Value (IR)]
|
|
,[PH].[Action Date]
|
|
,[PH].[Label printed]
|
|
,[PH].[Origin No_ (IR)]
|
|
,[PH].[Origin No_ Series (IR)]
|
|
,[PH].[Invoice No_]
|
|
,[PH].[Invoice No_ Series]
|
|
,[PH].[Receipt Type]
|
|
,[PH].[Responsibility Center (IR)]
|
|
,[PH].[Accessed Order No_]
|
|
,[PH].[Payment Discount Income]
|
|
,[PH].[Check Tolerance Amount]
|
|
,[PH].[EDAP Invoice No_ Series]
|
|
,[PH].[ILN No_]
|
|
,[PH].[Data Reference]
|
|
,[PH].[Accept (IR)]
|
|
,[PH].[ProcessID Transfer]
|
|
,[PH].[ILN No_ Receiver]
|
|
,[PH].[Metering Point Description]
|
|
,[PH].[INVOIC Error]
|
|
,[PH].[Security Given]
|
|
,[PH].[Security Given _]
|
|
,[PH].[Security Given Amount]
|
|
,[PH].[Security Given Due Date]
|
|
,[PH].[Country_Region Code (BV)]
|
|
,[PH].[Status DMS]
|
|
,[PH].[Doc_ with Order]
|
|
,[PH].[Reverse Charge]
|
|
,[PH].[No Document RC]
|
|
,[PH].[Transfered to D3]
|
|
,[PH].[CH DTA Transaction Type]
|
|
,[PH].[CH DTA ESR No_]
|
|
,NULL [windream Job No_]
|
|
,[PH].[E-Procurement]
|
|
FROM [NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[STW Bebra GmbH inkl Netz$Purchase Header$437dbf0e-84ff-417a-965d-ed2bb9650972] as [PH] (NOLOCK)
|
|
LEFT JOIN [NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[STW Bebra GmbH inkl Netz$Vendor Bank Account$437dbf0e-84ff-417a-965d-ed2bb9650972] as [VBA] (NOLOCK) ON [PH].[Pay-to Vendor No_] = [VBA].[Vendor No_]
|
|
|
|
UNION --####################################################################################--
|
|
|
|
SELECT TOP 1000000
|
|
'SWB-Vertrieb' as 'Mandant'
|
|
,[PH].[Document Type]
|
|
,[PH].[No_] as 'Belegnummer'
|
|
,[PH].[Buy-from Vendor No_]
|
|
,[PH].[Pay-to Vendor No_]
|
|
,[PH].[Pay-to Name]
|
|
,[PH].[Pay-to Name 2]
|
|
,[PH].[Pay-to Address]
|
|
,[PH].[Pay-to Address 2]
|
|
,[PH].[Pay-to City]
|
|
,[PH].[Pay-to Contact]
|
|
,[VBA].[IBAN] as 'Pay-to IBAN'
|
|
,[PH].[Your Reference]
|
|
,[PH].[Ship-to Code]
|
|
,[PH].[Ship-to Name]
|
|
,[PH].[Ship-to Name 2]
|
|
,[PH].[Ship-to Address]
|
|
,[PH].[Ship-to Address 2]
|
|
,[PH].[Ship-to City]
|
|
,[PH].[Ship-to Contact]
|
|
,[PH].[Order Date]
|
|
,[PH].[Posting Date]
|
|
,[PH].[Expected Receipt Date]
|
|
,[PH].[Posting Description]
|
|
,[PH].[Payment Terms Code]
|
|
,[PH].[Due Date]
|
|
,convert(FLOAT,[PH].[Payment Discount _]) as 'Skonto/Rabatt Prozent'
|
|
,[PH].[Pmt_ Discount Date]
|
|
,[PH].[Shipment Method Code]
|
|
,[PH].[Location Code]
|
|
,[PH].[Shortcut Dimension 1 Code]
|
|
,[PH].[Shortcut Dimension 2 Code]
|
|
,[PH].[Vendor Posting Group]
|
|
,[PH].[Currency Code]
|
|
,[PH].[Currency Factor]
|
|
,[PH].[Prices Including VAT]
|
|
,[PH].[Invoice Disc_ Code]
|
|
,[PH].[Language Code]
|
|
,[PH].[Purchaser Code]
|
|
,[PH].[Order Class]
|
|
,[PH].[No_ Printed]
|
|
,[PH].[On Hold]
|
|
,[PH].[Applies-to Doc_ Type]
|
|
,[PH].[Applies-to Doc_ No_]
|
|
,[PH].[Bal_ Account No_]
|
|
,[PH].[Receive]
|
|
,[PH].[Invoice]
|
|
,[PH].[Print Posted Documents]
|
|
,[PH].[Receiving No_]
|
|
,[PH].[Posting No_]
|
|
,[PH].[Last Receiving No_]
|
|
,[PH].[Last Posting No_]
|
|
,[PH].[Vendor Order No_]
|
|
,[PH].[Vendor Shipment No_]
|
|
,[PH].[Vendor Invoice No_] as 'Ex. Rech-Nr.'
|
|
,[PH].[Vendor Cr_ Memo No_]
|
|
,[PH].[VAT Registration No_]
|
|
,[PH].[Sell-to Customer No_]
|
|
,[PH].[Reason Code]
|
|
,[PH].[Gen_ Bus_ Posting Group]
|
|
,[PH].[Transaction Type]
|
|
,[PH].[Transport Method]
|
|
,[PH].[VAT Country_Region Code]
|
|
,[PH].[Buy-from Vendor Name]
|
|
,[PH].[Buy-from Vendor Name 2]
|
|
,[PH].[Buy-from Address]
|
|
,[PH].[Buy-from Address 2]
|
|
,[PH].[Buy-from City]
|
|
,[PH].[Buy-from Contact]
|
|
,[PH].[Pay-to Post Code]
|
|
,[PH].[Pay-to County]
|
|
,[PH].[Pay-to Country_Region Code]
|
|
,[PH].[Buy-from Post Code]
|
|
,[PH].[Buy-from County]
|
|
,[PH].[Buy-from Country_Region Code]
|
|
,[PH].[Ship-to Post Code]
|
|
,[PH].[Ship-to County]
|
|
,[PH].[Ship-to Country_Region Code]
|
|
,[PH].[Bal_ Account Type]
|
|
,[PH].[Order Address Code]
|
|
,[PH].[Entry Point]
|
|
,[PH].[Correction]
|
|
,[PH].[Document Date]
|
|
,[PH].[Area]
|
|
,[PH].[Transaction Specification]
|
|
,[PH].[Payment Method Code]
|
|
,[PH].[No_ Series]
|
|
,[PH].[Posting No_ Series]
|
|
,[PH].[Receiving No_ Series]
|
|
,[PH].[Tax Area Code]
|
|
,[PH].[Tax Liable]
|
|
,[PH].[VAT Bus_ Posting Group]
|
|
,[PH].[Applies-to ID]
|
|
,[PH].[VAT Base Discount _]
|
|
,[PH].[Status]
|
|
,[PH].[Invoice Discount Calculation]
|
|
,[PH].[Invoice Discount Value]
|
|
,[PH].[Send IC Document]
|
|
,[PH].[IC Status]
|
|
,[PH].[Buy-from IC Partner Code]
|
|
,[PH].[Pay-to IC Partner Code]
|
|
,[PH].[IC Direction]
|
|
,[PH].[Prepayment No_]
|
|
,[PH].[Last Prepayment No_]
|
|
,[PH].[Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Last Prepmt_ Cr_ Memo No_]
|
|
,[PH].[Prepayment _]
|
|
,[PH].[Prepayment No_ Series]
|
|
,[PH].[Compress Prepayment]
|
|
,[PH].[Prepayment Due Date]
|
|
,[PH].[Prepmt_ Cr_ Memo No_ Series]
|
|
,[PH].[Prepmt_ Posting Description]
|
|
,[PH].[Prepmt_ Pmt_ Discount Date]
|
|
,[PH].[Prepmt_ Payment Terms Code]
|
|
,[PH].[Prepmt_ Payment Discount _]
|
|
,[PH].[Quote No_]
|
|
,[PH].[Job Queue Status]
|
|
,[PH].[Job Queue Entry ID]
|
|
,[PH].[Incoming Document Entry No_]
|
|
,[PH].[Creditor No_]
|
|
,[PH].[Payment Reference]
|
|
,[PH].[Dimension Set ID]
|
|
,[PH].[Doc_ No_ Occurrence]
|
|
,[PH].[Campaign No_]
|
|
,[PH].[Buy-from Contact No_]
|
|
,[PH].[Pay-to Contact No_]
|
|
,[PH].[Responsibility Center]
|
|
,[PH].[Posting from Whse_ Ref_]
|
|
,[PH].[Requested Receipt Date]
|
|
,[PH].[Promised Receipt Date]
|
|
,[PH].[Lead Time Calculation]
|
|
,[PH].[Inbound Whse_ Handling Time]
|
|
,[PH].[Vendor Authorization No_]
|
|
,[PH].[Return Shipment No_]
|
|
,[PH].[Return Shipment No_ Series]
|
|
,[PH].[Ship]
|
|
,[PH].[Last Return Shipment No_]
|
|
,[PH].[Id]
|
|
,[PH].[Assigned User ID]
|
|
,[PH].[Registration No_]
|
|
,[PH].[OU]
|
|
,[PH].[OU Manual]
|
|
,[PH].[OU Code]
|
|
,[PH].[Pay-to Salutation]
|
|
,[PH].[Pay-to Title]
|
|
,[PH].[Pay-to First Name]
|
|
,[PH].[Buy-from Salutation]
|
|
,[PH].[Buy-from Title]
|
|
,[PH].[Buy-from First Name]
|
|
,[PH].[Print Text Code]
|
|
,[PH].[Resource Requester]
|
|
,[PH].[User ID]
|
|
,[PH].[Work Order Charging (Customer)]
|
|
,[PH].[WO Charging Doc_ No_ Sales]
|
|
,[PH].[Res_ Department No_]
|
|
,[PH].[Submissionno_]
|
|
,[PH].[Contract of Value]
|
|
,[PH].[Contract guilty from]
|
|
,[PH].[Contract guilty to]
|
|
,[PH].[Contract Value Agree]
|
|
,[PH].[Contract Of Value No_]
|
|
,[PH].[Due Date for Quote]
|
|
,[PH].[Source Type]
|
|
,[PH].[Source No_]
|
|
,[PH].[Source Charging Company]
|
|
,[PH].[Destination Charging Company]
|
|
,[PH].[Document Text Code]
|
|
,[PH].[Purchase Rating Code]
|
|
,[PH].[Exemption answer]
|
|
,[PH].[Exemption answer valid to]
|
|
,[PH].[Responsibly Tax office]
|
|
,[PH].[Business Area Code]
|
|
,[PH].[VU Bank Account Entry No_]
|
|
,[PH].[Bank Branch No_]
|
|
,[PH].[Bank Account No_]
|
|
,[PH].[Bank Name]
|
|
,[PH].[Bank Account Holder]
|
|
,[PH].[Bank Account Entry Type]
|
|
,[PH].[Bank Account Entry Priority]
|
|
,[PH].[Vendor Bank Account Code]
|
|
,[PH].[Receipt Date]
|
|
,[PH].[Follow-up Date]
|
|
,[PH].[Payment Terms Code (IR)]
|
|
,[PH].[Payment Discount _ (IR)]
|
|
,convert(FLOAT,[PH].[Amount able to Discount]) as 'Gesamtbetrag'
|
|
,convert(FLOAT,[PH].[Discount Amount]) as 'Skonto/Rabatt Wert'
|
|
,convert(FLOAT,[PH].[Invoice Amount less Discount]) as 'Gesamtbetrag (brutto) abzgl. Skonto/Rabatt'
|
|
,[PH].[Action Chain Code]
|
|
,[PH].[Reason Code (IR)]
|
|
,[PH].[Status Value (IR)]
|
|
,[PH].[Action Date]
|
|
,[PH].[Label printed]
|
|
,[PH].[Origin No_ (IR)]
|
|
,[PH].[Origin No_ Series (IR)]
|
|
,[PH].[Invoice No_]
|
|
,[PH].[Invoice No_ Series]
|
|
,[PH].[Receipt Type]
|
|
,[PH].[Responsibility Center (IR)]
|
|
,[PH].[Accessed Order No_]
|
|
,[PH].[Payment Discount Income]
|
|
,[PH].[Check Tolerance Amount]
|
|
,[PH].[EDAP Invoice No_ Series]
|
|
,[PH].[ILN No_]
|
|
,[PH].[Data Reference]
|
|
,[PH].[Accept (IR)]
|
|
,[PH].[ProcessID Transfer]
|
|
,[PH].[ILN No_ Receiver]
|
|
,[PH].[Metering Point Description]
|
|
,[PH].[INVOIC Error]
|
|
,[PH].[Security Given]
|
|
,[PH].[Security Given _]
|
|
,[PH].[Security Given Amount]
|
|
,[PH].[Security Given Due Date]
|
|
,[PH].[Country_Region Code (BV)]
|
|
,[PH].[Status DMS]
|
|
,[PH].[Doc_ with Order]
|
|
,[PH].[Reverse Charge]
|
|
,[PH].[No Document RC]
|
|
,[PH].[Transfered to D3]
|
|
,[PH].[CH DTA Transaction Type]
|
|
,[PH].[CH DTA ESR No_]
|
|
,NULL [windream Job No_]
|
|
,[PH].[E-Procurement]
|
|
FROM [NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Vertrieb STW Bebra$Purchase Header$437dbf0e-84ff-417a-965d-ed2bb9650972] as [PH] (NOLOCK)
|
|
LEFT JOIN [NTSERP\NTSSUITE].[NTSsuite2015].[dbo].[Vertrieb STW Bebra$Vendor Bank Account$437dbf0e-84ff-417a-965d-ed2bb9650972] as [VBA] (NOLOCK) ON [PH].[Pay-to Vendor No_] = [VBA].[Vendor No_]
|
|
|
|
ORDER BY Mandant, Belegnummer DESC
|
|
|
|
--------------------------------------------------------------------------------------
|
|
|
|
---- Stand: MK // 05.11.2021 (2)
|
|
--SELECT [Belegnummer]
|
|
-- ,[Ex. Rech-Nr.]
|
|
-- ,[Gesamtbetrag]
|
|
-- ,[Pay-to Name]
|
|
-- ,[Posting Description]
|
|
-- FROM [DD_ECM].[dbo].[VWCUST_NAVISION_PURCHASE_HEADER]
|
|
-- WHERE [Mandant] = 'Alle Mandanten'
|
|
-- OR ([Mandant] = '{#CTRL#CMB_Mandant}'
|
|
-- AND [Buy-from Vendor No_] = '{#CTRL#LU_LieferantenNummer}'
|
|
-- OR [Pay-to Vendor No_] = '{#CTRL#LU_LieferantenNummer}')
|
|
--ORDER BY [Belegnummer] DESC
|
|
|
|
---- Test mit
|
|
---- SB-Abwasserbetrieb | 4004 | 4004
|
|
---- SWB-Netz | 308001 | 308001
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GO
|
|
|
|
|