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.

98 lines
3.2 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_payAcDepositAC] Script Date: 7/4/2019 11:35:48 AM ******/
  4. DROP PROCEDURE [dbo].[proc_payAcDepositAC]
  5. GO
  6. /****** Object: StoredProcedure [dbo].[proc_payAcDepositAC] Script Date: 7/4/2019 11:35:48 AM ******/
  7. SET ANSI_NULLS ON
  8. GO
  9. SET QUOTED_IDENTIFIER ON
  10. GO
  11. CREATE PROC [dbo].[proc_payAcDepositAC]
  12. @flag VARCHAR(20)
  13. ,@user VARCHAR(50) = NULL
  14. ,@tranIds VARCHAR(MAX) = NULL
  15. ,@mapCodeInt VARCHAR(100) = NULL
  16. ,@parentMapCodeInt VARCHAR(100) = NULL
  17. AS
  18. SET NOCOUNT ON;
  19. DECLARE @tranDetail TABLE(tranId VARCHAR(50),controlNoEncrypted VARCHAR(50), controlNoDomEncrypted VARCHAR(50))
  20. DECLARE @sql VARCHAR(MAX)
  21. SET @sql = 'SELECT id, controlNo, controlNoDomEnc = dbo.encryptDbLocal(dbo.FNADecryptString(controlNo)) FROM dbo.remitTran WITH(NOLOCK) WHERE id IN (' + @tranIds + ')'
  22. INSERT INTO @tranDetail
  23. EXEC (@sql)
  24. IF @flag = 'payDom'
  25. BEGIN
  26. UPDATE FastMoneyPro_account.dbo.REMIT_TRN_LOCAL SET
  27. R_BRANCH = rt.pBankBranchName
  28. ,R_BANK = rt.pLocation
  29. ,R_AGENT = rt.pAgent
  30. ,paidBy = rt.paidBy
  31. ,P_DATE = rt.paidDate
  32. ,PAY_STATUS = rt.payStatus
  33. ,R_SC = rt.pAgentComm
  34. ,TranIdNew = rt.id
  35. FROM FastMoneyPro_account.dbo.REMIT_TRN_LOCAL rtl
  36. INNER JOIN @tranDetail td ON rtl.TRN_REF_NO = td.controlNoDomEncrypted
  37. INNER JOIN remitTran rt ON td.controlNoEncrypted = rt.controlNo
  38. ----INNER JOIN agentMaster am ON rt.pAgent = am.agentId
  39. END
  40. IF @flag = 'payIntl'
  41. BEGIN
  42. UPDATE FastMoneyPro_account.dbo.REMIT_TRN_MASTER SET
  43. P_BRANCH = rt.pBranch
  44. ,P_AGENT = rt.pAgent
  45. ,paidBy = rt.paidBy
  46. ,PAID_DATE = rt.paidDate
  47. ,PAY_STATUS = 'Paid'
  48. ,SC_P_AGENT = rt.pAgentComm
  49. ,TranIdNew = rt.id
  50. FROM FastMoneyPro_account.dbo.REMIT_TRN_MASTER rtm
  51. INNER JOIN @tranDetail td ON rtm.TRN_REF_NO = td.controlNoEncrypted
  52. INNER JOIN remitTran rt ON td.controlNoEncrypted = rt.controlNo
  53. ----INNER JOIN agentMaster am ON rt.pAgent = am.agentId
  54. ----INNER JOIN agentMaster bm ON rt.pBranch = bm.agentid
  55. END
  56. IF @flag = 'payDomIso'
  57. BEGIN
  58. UPDATE FastMoneyPro_account.dbo.REMIT_TRN_LOCAL SET
  59. R_BRANCH = rt.pBranch
  60. ,R_BANK = rt.pLocation
  61. ,R_AGENT = rt.pAgent
  62. ,paidBy = rt.paidBy
  63. ,P_DATE = rt.paidDate
  64. ,PAY_STATUS = rt.payStatus
  65. ,R_SC = rt.pAgentComm
  66. ,TranIdNew = rt.id
  67. FROM FastMoneyPro_account.dbo.REMIT_TRN_LOCAL rtl
  68. INNER JOIN @tranDetail td ON rtl.TRN_REF_NO = td.controlNoDomEncrypted
  69. INNER JOIN remitTran rt ON td.controlNoEncrypted = rt.controlNo
  70. ----INNER JOIN agentMaster am ON rt.pAgent = am.agentId
  71. ----INNER JOIN agentMaster bm ON rt.pBranch = bm.agentid
  72. END
  73. IF @flag = 'payCooperative'
  74. BEGIN
  75. UPDATE FastMoneyPro_account.dbo.REMIT_TRN_LOCAL SET
  76. R_BRANCH = rt.pBankBranchName
  77. ,R_BANK = rt.pLocation
  78. ,R_AGENT = rt.pAgent
  79. ,paidBy = rt.paidBy
  80. ,P_DATE = rt.paidDate
  81. ,PAY_STATUS = rt.payStatus
  82. ,R_SC = rt.pAgentComm
  83. ,TranIdNew = rt.id
  84. FROM FastMoneyPro_account.dbo.REMIT_TRN_LOCAL rtl
  85. INNER JOIN @tranDetail td ON rtl.TRN_REF_NO = td.controlNoDomEncrypted
  86. INNER JOIN remitTran rt ON td.controlNoEncrypted = rt.controlNo
  87. ----INNER JOIN agentMaster am ON rt.pAgent = am.agentId
  88. END
  89. GO