
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [zapisz_do_reklamy] ON [dbo].[PlatnosciEcard] 
FOR UPDATE
AS
declare @Status bit
declare @Status_data datetime
declare @IDFaktury int
declare @ORDERNUMBER int

select @ORDERNUMBER = ORDERNUMBER, @Status = Status, @Status_data = Status_data, @IDFaktury = IDFaktury from inserted
if @Status = 1

--update REKLAMA set [Rodzaj potwierdzenia] = 'ECARD', [Symbol potwierdzenia] = @ORDERNUMBER, [Data zapłaty] = @Status_data, Zapłacono = @Status where [ID_Faktury] = @IDfaktury

update dbo.Wplaty set
 [rodzajPotwierdzenia] = 'ECARD', 
 [symbolPotwierdzenia] = @ORDERNUMBER, 
 [dataWplaty] = @Status_data
 where [idFaktury] = @IDfaktury
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

