You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
2.5 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[remoteSP_tranCancel] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. CREATE proc [dbo].[remoteSP_tranCancel]
  9. AS
  10. SET XACT_ABORT ON
  11. BEGIN
  12. BEGIN TRANSACTION
  13. IF EXISTS(SELECT TOP 1 'X' FROM rs_remitTranCancel WITH(NOLOCK))
  14. BEGIN
  15. SELECT rtc.* INTO #tempData FROM rs_remitTranCancel rtc WITH(NOLOCK)
  16. INNER JOIN dbo.remitTran rt WITH(NOLOCK) ON rtc.controlNo = rt.controlNo
  17. UPDATE dbo.remitTran SET
  18. tranStatus = 'Cancel'
  19. ,cancelApprovedBy = rs.cancelBy
  20. ,cancelApprovedDate = rs.cancelDate
  21. ,cancelApprovedDateLocal = rs.cancelDate
  22. FROM dbo.remitTran rt
  23. INNER JOIN #tempData rs ON rt.controlNo = rs.controlNo
  24. INSERT INTO tranModifyLog(controlNo, message, createdDate, createdBy)
  25. SELECT rs.controlNo, 'Transaction has been cancelled : ' + rs.cancelReason, rs.cancelDate, rs.cancelBy
  26. FROM #tempData rs WITH(NOLOCK)
  27. INNER JOIN dbo.remitTran rt WITH(NOLOCK) ON rt.controlNo = rs.controlNo
  28. DELETE FROM rs_remitTranCancel
  29. FROM rs_remitTranCancel rs
  30. INNER JOIN #tempData t ON rs.id = t.id
  31. DROP TABLE #tempData
  32. END
  33. COMMIT TRANSACTION
  34. END
  35. GO