
/****************************************************************************

*****************************************************************************/

-- Use the Invoice application's database
USE NSPingPingIPs;

-- Start an event batch
DECLARE @BatchID bigint;
EXEC dbo.NSEventBeginBatchInvoiceData N'InvoiceSPEventProvider', @BatchID OUTPUT;

-- Write three events
DECLARE @ConvertDate DATETIME;

SET @ConvertDate = CONVERT(DATETIME, GetDate(), 114);
EXEC dbo.NSEventWriteInvoiceData
	@EventBatchId=@BatchID,
	@ope=2,
	@EmailSubject="PING TEST",
	@Date = @ConvertDate,
	@EmailAttachment= "C:\ping.pdf",
	@RDF_ID  = "1",
	@REP_ID  = "PDF",
	@EmailBody='Ping ready'
	

SET @ConvertDate = CONVERT(DATETIME, GetDate(), 114);
EXEC dbo.NSEventWriteInvoiceData
	@EventBatchId=@BatchID,
	@ope=1,
	@EmailSubject="PING TEST",
	@Date = @ConvertDate,
	@EmailAttachment= "C:\ping.pdf",
	@RDF_ID = "1",
	@REP_ID  = "PDF",
	@EmailBody='Ping ready'
	


SET @ConvertDate = CONVERT(DATETIME, GetDate(), 114);
EXEC dbo.NSEventWriteInvoiceData
	@EventBatchId=@BatchID,
	@ope=3,
	@EmailSubject="PING TEST",
	@Date = @ConvertDate,
	@EmailAttachment= "C:\ping.pdf",
	@RDF_ID= "1",
	@REP_ID  = "PDF",
	@EmailBody='Ping ready'
	


-- Flush event batch
EXEC dbo.NSEventFlushBatchInvoiceData @BatchID;

-- Display event batch ID
SELECT @BatchID 'Event Batch ID';