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.

87 lines
2.5 KiB

1 year ago
  1. alter PROCEDURE Proc_Get_Transaction_Cebuana(
  2. @controlNo VARCHAR(100) = NULL
  3. ,@flag VARCHAR(20)
  4. )AS
  5. BEGIN
  6. DECLARE @decryptedControlNo VARCHAR(100),@tranId BIGINT,@partnerId BIGINT
  7. SELECT @tranId=id,@partnerId=pSuperAgent FROM dbo.vwRemitTran(NOLOCK) WHERE controlNo=@controlNo
  8. IF @flag='tran'
  9. BEGIN
  10. SET @decryptedControlNo=dbo.FNADecryptString(@controlNo)
  11. SELECT '0' ErrorCode, 'Can process the transaction' Msg, @decryptedControlNo Id
  12. SELECT rt.id
  13. ,controlNo=dbo.FNADecryptString(rt.controlNo)
  14. ,sCountryIso3=cms.isoAlpha3
  15. ,pCountryIso3=cmp.isoAlpha3
  16. ,rt.pAgent
  17. ,rt.pAgentName
  18. ,rt.pBranch
  19. ,rt.pBranchName
  20. ,rt.paymentMethod
  21. ,BankCode= am.BANKCODE
  22. ,rt.pBankName
  23. ,rt.pBankBranch
  24. ,rt.pBankBranchName
  25. ,rt.accountNo
  26. ,rt.externalBankCode
  27. ,rt.collMode
  28. ,rt.collCurr
  29. ,pAmt =FORMAT(rt.pAmt, '0.00')
  30. ,rt.payoutCurr
  31. ,createdDate =FORMAT(rt.createdDate,'yyyy-MM-dd hh:mm:ss')
  32. FROM dbo.vwRemitTran(NOLOCK) rt
  33. INNER JOIN dbo.countryMaster(NOLOCK) cms ON rt.sCountry=cms.countryName
  34. INNER JOIN dbo.countryMaster(NOLOCK) cmp ON rt.pCountry=cmp.countryName
  35. INNER JOIN agentMaster(NOLOCK) am ON am.agentId=rt.pBank
  36. WHERE rt.id=@tranId
  37. SELECT firstName=(SELECT firstName FROM dbo.FNASplitName(ts.firstName) )
  38. ,middleName=(SELECT middleName FROM dbo.FNASplitName(ts.firstName) )
  39. ,lastName1=(SELECT lastName1 FROM dbo.FNASplitName(ts.firstName) )
  40. ,lastName2=(SELECT lastName2 FROM dbo.FNASplitName(ts.firstName) )
  41. ,ts.fullName
  42. ,ts.address
  43. ,ts.STATE
  44. ,ts.address2
  45. FROM dbo.vwtranSenders (NOLOCK)ts
  46. WHERE ts.tranid=@tranId
  47. SELECT tr.firstName
  48. ,tr.middleName
  49. ,tr.lastName1
  50. ,tr.lastName2
  51. ,tr.fullName
  52. ,tr.address
  53. ,tr.address2
  54. FROM dbo.vwtranReceivers (NOLOCK)tr
  55. WHERE
  56. tr.tranid=@tranId
  57. END
  58. ELSE IF @flag='getpayout'
  59. BEGIN
  60. SELECT paymentMethod , controlNo=dbo.FNADecryptString(controlNo),controlNo2=dbo.FNADecryptString(controlNo2) FROM dbo.remitTran(NOLOCK) WHERE id=@tranId
  61. END
  62. ELSE IF @flag='update'
  63. BEGIN
  64. SELECT controlNo=dbo.FNADecryptString(tr.controlNo)
  65. ,ts.firstName
  66. ,ts.lastName1
  67. ,tl.message
  68. FROM dbo.remitTran(NOLOCK) tr
  69. INNER JOIN dbo.tranReceivers (NOLOCK) ts ON ts.tranId = tr.id
  70. left JOIN tranmodifylog tl ON tl.tranId = tr.id
  71. WHERE tr.id=@tranId and [status]='Not Resolved'
  72. END
  73. IF @flag='Cancel'
  74. BEGIN
  75. SELECT TOP 1 controlNo=dbo.FNADecryptString(tr.controlNo)
  76. ,cancelReason=tr.cancelReason
  77. FROM dbo.remitTran(NOLOCK) tr
  78. WHERE tr.id=@tranId
  79. END
  80. END