
/****** Object:  View [dbo].[ApiPaymentView]    Script Date: 13.09.2021 14:32:27 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO




CREATE VIEW [dbo].[ApiPaymentView] as

SELECT  [BZd_BZdID] Id, [BZd_BZdID] ErpId, [BZd_PodmiotID] CustId, [BZd_DokumentID] DocId, [BZd_DokumentID] DocErpId, [BZd_NumerPelny] Document,
CAST([BZd_Kierunek] as int) Direction, [BZd_DataDok] DocumentDate,  [BZd_Termin] DueDate,ISNULL([BZd_DataRoz],[BZd_DataDok])  SettlementDate,
BZd_FPlId PaymentType, BZd_Kwota Total , BZd_Kwota- BZd_KwotaRoz ToPay ,
BZd_Waluta Currency, 0 VendorId, BZd_Opis Description, CURRENT_TIMESTAMP TS
  FROM [CDN].[BnkZdarzenia] where 	((((BZd_Rozliczono<>2 AND BZd_Rozliczono<>0) AND (1=1))))
  and BZd_Kierunek = 1



GO


