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.

121 lines
6.1 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_CancelTxnReceipt] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER procEDURE [dbo].[proc_CancelTxnReceipt]
  9. (
  10. @user VARCHAR(30) = NULL
  11. ,@controlNo VARCHAR(50) = NULL
  12. )
  13. AS
  14. SET NOCOUNT ON
  15. SET XACT_ABORT ON
  16. BEGIN
  17. SELECT
  18. dbo.FNADecryptString(ct.controlNo) controlNo
  19. ,ct.createdBy
  20. ,ct.createdDate
  21. ,ct.approvedBy
  22. ,ct.approvedDate
  23. ,ct.cancelRequestBy
  24. ,ct.cancelRequestDate
  25. ,ct.cancelApprovedBy
  26. ,ct.cancelApprovedDate
  27. ,ct.tranId
  28. ,'need to update' expectedPayoutAgent
  29. ,ct.paidBy
  30. ,ct.paidDate
  31. ,ct.paidDateLocal
  32. ,ct.createdDateLocal
  33. ,ct.approvedDateLocal
  34. ,s.firstName + isnull(' '+s.middleName,'')+isnull(' '+s.lastName1,'')+isnull(' '+s.lastName2,'') senderName
  35. ,s.address sAddress
  36. ,s.country sCountryName
  37. ,s.city sCity
  38. ,s.mobile sContactNo
  39. ,s.homePhone sTelNo
  40. ,s.idType sIdType
  41. ,s.idNumber sIdNo
  42. ,s.validDate
  43. ,s.email sEmail
  44. ,s.membershipId
  45. ,s.nativeCountry nativeCountry
  46. ,s.membershipId sMemId
  47. ,r.firstName + isnull(' '+r.middleName,'')+isnull(' '+r.lastName1,'')+isnull(' '+r.lastName2,'') receiverName
  48. ,r.address rAddress
  49. ,r.country rCountryName
  50. ,r.city rCity
  51. ,r.mobile rContactNo
  52. ,r.homePhone rTelNo
  53. ,r.idType rIdType
  54. ,r.idNumber rIdNo
  55. ,r.validDate
  56. ,r.relationType
  57. ,ct.sAgentName
  58. ,ct.sBranchName
  59. ,sm.agentAddress sAgentAddress
  60. ,sm.agentCountry sCountryName
  61. ,ct.pAgentName
  62. ,ct.pBranchName
  63. ,rm.agentAddress pAgentAddress
  64. ,rm.agentCountry pAgentCountry
  65. ,ct.cAmt
  66. ,ct.serviceCharge
  67. ,ct.collCurr
  68. ,ct.tAmt
  69. ,ct.collCurr
  70. ,ct.customerRate custRate
  71. ,ct.pAmt
  72. ,ct.payoutCurr
  73. ,ct.pAgentComm
  74. ,ct.pAgentCommCurrency
  75. ,ct.collMode CashOrBank
  76. ,ct.paymentMethod
  77. ,ct.payStatus
  78. ,ct.tranStatus
  79. ,ct.accountNo accountNo
  80. ,ct.pBankName BankName
  81. ,ct.pBankBranchName BranchName
  82. ,ct.sourceOfFund
  83. ,ct.purposeOfRemit
  84. ,ct.pMessage payoutMsg
  85. ,ct.relWithSender relationship
  86. ,ct.payTokenId
  87. FROM cancelTranHistory ct WITH (NOLOCK)
  88. LEFT JOIN cancelTranSendersHistory s WITH (NOLOCK) ON s.tranId = ct.tranId
  89. LEFT JOIN cancelTranReceiversHistory r WITH (NOLOCK) ON r.tranId = ct.tranId
  90. INNER JOIN agentMaster sm WITH (NOLOCK) ON sm.agentId= ct.sBranch
  91. LEFT JOIN agentMaster rm WITH (NOLOCK) ON rm.agentId = ct.pBranch
  92. WHERE ct.controlNo = dbo.FNAEncryptString(UPPER(LTRIM(RTRIM(@controlNo))))
  93. SELECT
  94. bankName = ISNULL(B.bankName, 'Cash')
  95. ,C.collMode
  96. ,amt = ISNULL(amt, 0)
  97. ,collDate
  98. ,voucherNo = A.voucherNo
  99. ,narration
  100. FROM collectionDetails C WITH (NOLOCK)
  101. LEFT JOIN countryBanks B WITH (NOLOCK) ON C.countryBankId = B.countryBankId
  102. INNER JOIN cancelTranHistory A WITH(NOLOCK) ON C.tranId=A.tranId
  103. WHERE A.controlNo = dbo.FNAEncryptString(UPPER(LTRIM(RTRIM(@controlNo))))
  104. END
  105. GO