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.

162 lines
13 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_remitTranTempToRemitMain] 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 PROCEDURE [dbo].[proc_remitTranTempToRemitMain]
  9. @id BIGINT
  10. AS
  11. SET NOCOUNT ON
  12. BEGIN
  13. DECLARE @tranId BIGINT
  14. INSERT INTO remitTran(
  15. [holdTranId]
  16. ,[controlNo]
  17. ,[sCurrCostRate],[sCurrHoMargin],[sCurrSuperAgentMargin],[sCurrAgentMargin]
  18. ,[pCurrCostRate],[pCurrHoMargin],[pCurrSuperAgentMargin],[pCurrAgentMargin]
  19. ,[agentCrossSettRate],[customerRate],[sAgentSettRate],[pDateCostRate]
  20. ,[agentFxGain],[treasuryTolerance],[customerPremium],[schemePremium]
  21. ,[sharingValue],[sharingType]
  22. ,[serviceCharge],[handlingFee]
  23. ,[sAgentComm],[sAgentCommCurrency],[sSuperAgentComm],[sSuperAgentCommCurrency]
  24. ,[pAgentComm],[pAgentCommCurrency],[pSuperAgentComm],[pSuperAgentCommCurrency]
  25. ,[promotionCode],[promotionType],[pMessage]
  26. ,[sCountry],[sSuperAgent],[sSuperAgentName],[sAgent],[sAgentName],[sBranch],[sBranchName]
  27. ,[pCountry],[pSuperAgent],[pSuperAgentName],[pAgent],[pAgentName],[pBranch],[pBranchName]
  28. ,[paymentMethod],[pBank],[pBankName],[pBankBranch],[pBankBranchName],[accountNo],[externalBankCode]
  29. ,[collMode]
  30. ,[collCurr],[tAmt],[cAmt],[pAmt],[payoutCurr]
  31. ,[relWithSender],[purposeOfRemit],[sourceOfFund]
  32. ,[tranStatus],[payStatus]
  33. ,[createdDate],[createdDateLocal],[createdBy]
  34. ,[modifiedDate],[modifiedDateLocal],[modifiedBy]
  35. ,[approvedDate],[approvedDateLocal],[approvedBy]
  36. ,[paidDate],[paidDateLocal],[paidBy]
  37. ,[cancelRequestDate],[cancelRequestDateLocal],[cancelRequestBy]
  38. ,[cancelReason],[refund],[cancelCharge]
  39. ,[cancelApprovedDate],[cancelApprovedDateLocal],[cancelApprovedBy]
  40. ,[blockedDate],[blockedBy]
  41. ,[lockedDate],[lockedDateLocal],[lockedBy],[payTokenId]
  42. ,[tranType],[ContNo],[uploadLogId]
  43. ,[voucherNo],[controlNo2]
  44. ,[pBankType],[expectedPayoutAgent]
  45. ,[routedBy],[routedDate],[senderName],[receiverName]
  46. ,[bonusPoint]
  47. )
  48. SELECT
  49. [id]
  50. ,[controlNo]
  51. ,[sCurrCostRate],[sCurrHoMargin],[sCurrSuperAgentMargin],[sCurrAgentMargin]
  52. ,[pCurrCostRate],[pCurrHoMargin],[pCurrSuperAgentMargin],[pCurrAgentMargin]
  53. ,[agentCrossSettRate],[customerRate],[sAgentSettRate],[pDateCostRate]
  54. ,[agentFxGain],[treasuryTolerance],[customerPremium],[schemePremium]
  55. ,[sharingValue],[sharingType]
  56. ,[serviceCharge],[handlingFee]
  57. ,[sAgentComm],[sAgentCommCurrency],[sSuperAgentComm],[sSuperAgentCommCurrency]
  58. ,[pAgentComm],[pAgentCommCurrency],[pSuperAgentComm],[pSuperAgentCommCurrency]
  59. ,[promotionCode],[promotionType],[pMessage]
  60. ,[sCountry],[sSuperAgent],[sSuperAgentName],[sAgent],[sAgentName],[sBranch],[sBranchName]
  61. ,[pCountry],[pSuperAgent],[pSuperAgentName],[pAgent],[pAgentName],[pBranch],[pBranchName]
  62. ,[paymentMethod],[pBank],[pBankName],[pBankBranch],[pBankBranchName],[accountNo],[externalBankCode]
  63. ,[collMode]
  64. ,[collCurr],[tAmt],[cAmt],[pAmt],[payoutCurr]
  65. ,[relWithSender],[purposeOfRemit],[sourceOfFund]
  66. ,[tranStatus],[payStatus]
  67. ,[createdDate],[createdDateLocal],[createdBy]
  68. ,[modifiedDate],[modifiedDateLocal],[modifiedBy]
  69. ,[approvedDate],[approvedDateLocal],[approvedBy]
  70. ,[paidDate],[paidDateLocal],[paidBy]
  71. ,[cancelRequestDate],[cancelRequestDateLocal],[cancelRequestBy]
  72. ,[cancelReason],[refund],[cancelCharge]
  73. ,[cancelApprovedDate],[cancelApprovedDateLocal],[cancelApprovedBy]
  74. ,[blockedDate],[blockedBy]
  75. ,[lockedDate],[lockedDateLocal],[lockedBy],[payTokenId]
  76. ,[tranType],[ContNo],[uploadLogId]
  77. ,[voucherNo],[controlNo2]
  78. ,[pBankType],[expectedPayoutAgent]
  79. ,[routedBy],[routedDate],[senderName],[receiverName]
  80. ,[bonusPoint]
  81. FROM remitTranTemp WITH(NOLOCK) WHERE id = @id
  82. SET @tranId = SCOPE_IDENTITY()
  83. INSERT INTO tranSenders(
  84. [tranId]
  85. ,[holdTranId]
  86. ,[customerId]
  87. ,[membershipId]
  88. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  89. ,[country],[address],[state],[district],[zipCode],[city]
  90. ,[email],[homePhone],[workPhone],[mobile]
  91. ,[nativeCountry],[dob],[placeOfIssue]
  92. ,[customerType],[occupation]
  93. ,[idType],[idNumber],[idPlaceOfIssue],[issuedDate],[validDate]
  94. ,[extCustomerId],[cwPwd],[ttName]
  95. ,[isFirstTran],[customerRiskPoint],[countryRiskPoint]
  96. ,[gender],[salary],[companyName],[address2]
  97. ,[dcInfo],[ipAddress],[notifySms],[txnTestQuestion],[txnTestAnswer]
  98. )
  99. SELECT
  100. @tranId
  101. ,[tranId]
  102. ,[customerId]
  103. ,[membershipId]
  104. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  105. ,[country],[address],[state],[district],[zipCode],[city]
  106. ,[email],[homePhone],[workPhone],[mobile]
  107. ,[nativeCountry],[dob],[placeOfIssue]
  108. ,[customerType],[occupation]
  109. ,[idType],[idNumber],[idPlaceOfIssue],[issuedDate],[validDate]
  110. ,[extCustomerId],[cwPwd],[ttName]
  111. ,[isFirstTran],[customerRiskPoint],[countryRiskPoint]
  112. ,[gender],[salary],[companyName],[address2]
  113. ,[dcInfo],[ipAddress],[notifySms],[txnTestQuestion],[txnTestAnswer]
  114. FROM tranSendersTemp WITH(NOLOCK) WHERE tranId = @id
  115. INSERT INTO tranReceivers(
  116. [tranId]
  117. ,[holdTranId]
  118. ,[customerId]
  119. ,[membershipId]
  120. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  121. ,[country],[address],[state],[district],[zipCode],[city]
  122. ,[email],[homePhone],[workPhone],[mobile]
  123. ,[nativeCountry],[dob],[placeOfIssue]
  124. ,[customerType],[occupation]
  125. ,[idType],[idNumber],[idPlaceOfIssue]
  126. ,[issuedDate],[validDate]
  127. ,[idType2],[idNumber2],[idPlaceOfIssue2],[issuedDate2],[validDate2]
  128. ,[relationType],[relativeName]
  129. ,[gender],[address2]
  130. ,[dcInfo],[ipAddress],isNewAc
  131. )
  132. SELECT
  133. @tranId
  134. ,[tranId]
  135. ,[customerId]
  136. ,[membershipId]
  137. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  138. ,[country],[address],[state],[district],[zipCode],[city]
  139. ,[email],[homePhone],[workPhone],[mobile]
  140. ,[nativeCountry],[dob],[placeOfIssue]
  141. ,[customerType],[occupation]
  142. ,[idType],[idNumber],[idPlaceOfIssue]
  143. ,[issuedDate],[validDate]
  144. ,[idType2],[idNumber2],[idPlaceOfIssue2],[issuedDate2],[validDate2]
  145. ,[relationType],[relativeName]
  146. ,[gender],[address2]
  147. ,[dcInfo],[ipAddress],isNewAc
  148. FROM tranReceiversTemp WITH(NOLOCK) WHERE tranId = @id
  149. DELETE FROM remitTranTemp WHERE id = @id
  150. DELETE FROM tranSendersTemp WHERE tranId = @id
  151. DELETE FROM tranReceiversTemp WHERE tranId = @id
  152. END
  153. GO