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.

228 lines
15 KiB

1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_remitTranTempToMain] Script Date: 10/21/2023 3:27:12 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER procEDURE [dbo].[proc_remitTranTempToMain]
  9. @id BIGINT
  10. AS
  11. SET NOCOUNT ON
  12. SET XACT_ABORT ON
  13. ---------------------------------------------
  14. --Aug 05 JME-567 ->add col 'receiverNameAlt' changes to show BENEFICIARY NAME AS PER BANK
  15. -- #652 - collected by ddl in verify transaction
  16. -- #1590 - customer Loyalty , add schemeid and isBonusUpdated
  17. ---------------------------------------------
  18. BEGIN
  19. BEGIN TRANSACTION
  20. DECLARE @tranId BIGINT
  21. INSERT INTO remitTran(
  22. [holdTranId]
  23. ,[controlNo]
  24. ,[sCurrCostRate],[sCurrHoMargin],[sCurrSuperAgentMargin],[sCurrAgentMargin]
  25. ,[pCurrCostRate],[pCurrHoMargin],[pCurrSuperAgentMargin],[pCurrAgentMargin]
  26. ,[agentCrossSettRate],[customerRate],[sAgentSettRate],[pDateCostRate]
  27. ,[agentFxGain],[treasuryTolerance],[customerPremium],[schemePremium]
  28. ,[sharingValue],[sharingType]
  29. ,[serviceCharge],[handlingFee]
  30. ,[sAgentComm],[sAgentCommCurrency],[sSuperAgentComm],[sSuperAgentCommCurrency]
  31. ,[pAgentComm],[pAgentCommCurrency],[pSuperAgentComm],[pSuperAgentCommCurrency]
  32. ,[promotionCode],[promotionType],[pMessage]
  33. ,[sCountry],[sSuperAgent],[sSuperAgentName],[sAgent],[sAgentName],[sBranch],[sBranchName]
  34. ,[pCountry],[pSuperAgent],[pSuperAgentName],[pAgent],[pAgentName],[pBranch],[pBranchName]
  35. ,[paymentMethod],[pBank],[pBankName],[pBankBranch],[pBankBranchName],[accountNo],[externalBankCode]
  36. ,[collMode]
  37. ,[collCurr],[tAmt],[cAmt],[pAmt],[payoutCurr]
  38. ,[relWithSender],[purposeOfRemit],[sourceOfFund]
  39. ,[tranStatus],[payStatus]
  40. ,[createdDate],[createdDateLocal],[createdBy]
  41. ,[modifiedDate],[modifiedDateLocal],[modifiedBy]
  42. ,[approvedDate],[approvedDateLocal],[approvedBy]
  43. ,[paidDate],[paidDateLocal],[paidBy]
  44. ,[cancelRequestDate],[cancelRequestDateLocal],[cancelRequestBy]
  45. ,[cancelReason],[refund],[cancelCharge]
  46. ,[cancelApprovedDate],[cancelApprovedDateLocal],[cancelApprovedBy]
  47. ,[blockedDate],[blockedBy]
  48. ,[lockedDate],[lockedDateLocal],[lockedBy],[payTokenId]
  49. ,[tranType],[ContNo],[uploadLogId]
  50. ,[voucherNo],[controlNo2]
  51. ,[pBankType],[expectedPayoutAgent]
  52. ,[routedBy],[routedDate],[senderName],[receiverName]
  53. ,[bonusPoint]
  54. ,pState
  55. ,pDistrict
  56. ,pLocation
  57. ,sRouteId
  58. ,isScMaunal
  59. ,originalSC
  60. ,isOnBehalf
  61. ,PayerId
  62. ,PayerBranchId
  63. ,verifiedBy
  64. ,verifiedDate
  65. ,company
  66. ,receiverNameAlt
  67. ,downloadedBy
  68. ,rewardPoints
  69. ,rewardType
  70. ,isBonusUpdated
  71. ,schemeId
  72. ,requestreference
  73. ,transactionreference
  74. ,depositType
  75. ,isOnlineTxn
  76. )
  77. SELECT
  78. [id]
  79. ,[controlNo]
  80. ,[sCurrCostRate],[sCurrHoMargin],[sCurrSuperAgentMargin],[sCurrAgentMargin]
  81. ,[pCurrCostRate],[pCurrHoMargin],[pCurrSuperAgentMargin],[pCurrAgentMargin]
  82. ,[agentCrossSettRate],[customerRate],[sAgentSettRate],[pDateCostRate]
  83. ,[agentFxGain],[treasuryTolerance],[customerPremium],[schemePremium]
  84. ,[sharingValue],[sharingType]
  85. ,[serviceCharge],[handlingFee]
  86. ,[sAgentComm],[sAgentCommCurrency],[sSuperAgentComm],[sSuperAgentCommCurrency]
  87. ,[pAgentComm],[pAgentCommCurrency],[pSuperAgentComm],[pSuperAgentCommCurrency]
  88. ,[promotionCode],[promotionType],[pMessage]
  89. ,[sCountry],[sSuperAgent],[sSuperAgentName],[sAgent],[sAgentName],[sBranch],[sBranchName]
  90. ,[pCountry],[pSuperAgent],[pSuperAgentName],[pAgent],[pAgentName],[pBranch],[pBranchName]
  91. ,[paymentMethod],[pBank],[pBankName],[pBankBranch],[pBankBranchName],[accountNo],[externalBankCode]
  92. ,[collMode]
  93. ,[collCurr],[tAmt],[cAmt],[pAmt],[payoutCurr]
  94. ,[relWithSender],[purposeOfRemit],[sourceOfFund]
  95. ,[tranStatus],[payStatus]
  96. ,[createdDate],[createdDateLocal],[createdBy]
  97. ,[modifiedDate],[modifiedDateLocal],[modifiedBy]
  98. ,[approvedDate],[approvedDateLocal],[approvedBy]
  99. ,[paidDate],[paidDateLocal],[paidBy]
  100. ,[cancelRequestDate],[cancelRequestDateLocal],[cancelRequestBy]
  101. ,[cancelReason],[refund],[cancelCharge]
  102. ,[cancelApprovedDate],[cancelApprovedDateLocal],[cancelApprovedBy]
  103. ,[blockedDate],[blockedBy]
  104. ,[lockedDate],[lockedDateLocal],[lockedBy],[payTokenId]
  105. ,[tranType],[ContNo],[uploadLogId]
  106. ,[voucherNo],[controlNo2]
  107. ,[pBankType],[expectedPayoutAgent]
  108. ,[routedBy],[routedDate],[senderName],[receiverName]
  109. ,[bonusPoint]
  110. ,pState
  111. ,pDistrict
  112. ,pLocation
  113. ,sRouteId
  114. ,isScMaunal
  115. ,originalSC
  116. ,isOnBehalf
  117. ,PayerId
  118. ,PayerBranchId
  119. ,verifiedBy
  120. ,verifiedDate
  121. ,company
  122. ,receiverNameAlt
  123. ,downloadedby
  124. ,rewardPoints
  125. ,rewardType
  126. ,isBonusUpdated
  127. ,schemeId
  128. ,requestreference
  129. ,transactionreference
  130. ,depositType
  131. ,isOnlineTxn
  132. FROM remitTranTemp WITH(NOLOCK) WHERE id = @id AND ISNULL(sRouteId,'0')='0'
  133. SET @tranId = SCOPE_IDENTITY()
  134. INSERT INTO tranSenders(
  135. [tranId]
  136. ,[holdTranId]
  137. ,[customerId]
  138. ,[membershipId]
  139. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  140. ,[country],[address],[state],[district],[zipCode],[city]
  141. ,[email],[homePhone],[workPhone],[mobile]
  142. ,[nativeCountry],[dob],[placeOfIssue]
  143. ,[customerType],[occupation]
  144. ,[idType],[idNumber],[idPlaceOfIssue],[issuedDate],[validDate]
  145. ,[extCustomerId],[cwPwd],[ttName]
  146. ,[isFirstTran],[customerRiskPoint],[countryRiskPoint]
  147. ,[gender],[salary],[companyName],[address2]
  148. ,[dcInfo],[ipAddress],[notifySms],[txnTestQuestion],[txnTestAnswer]
  149. ,[visaStatus]
  150. )
  151. SELECT
  152. @tranId
  153. ,[tranId]
  154. ,[customerId]
  155. ,[membershipId]
  156. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  157. ,[country],[address],[state],[district],[zipCode],[city]
  158. ,[email],[homePhone],[workPhone],[mobile]
  159. ,[nativeCountry],[dob],[placeOfIssue]
  160. ,[customerType],[occupation]
  161. ,[idType],[idNumber],[idPlaceOfIssue],[issuedDate],[validDate]
  162. ,[extCustomerId],[cwPwd],[ttName]
  163. ,[isFirstTran],[customerRiskPoint],[countryRiskPoint]
  164. ,[gender],[salary],[companyName],[address2]
  165. ,[dcInfo],[ipAddress],[notifySms],[txnTestQuestion],[txnTestAnswer]
  166. ,[visaStatus]
  167. FROM tranSendersTemp WITH(NOLOCK) WHERE tranId = @id
  168. INSERT INTO tranReceivers(
  169. [tranId]
  170. ,[holdTranId]
  171. ,[customerId]
  172. ,[membershipId]
  173. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  174. ,[country],[address],[state],[district],[zipCode],[city]
  175. ,[email],[homePhone],[workPhone],[mobile]
  176. ,[nativeCountry],[dob],[placeOfIssue]
  177. ,[customerType],[occupation]
  178. ,[idType],[idNumber],[idPlaceOfIssue]
  179. ,[issuedDate],[validDate]
  180. ,[idType2],[idNumber2],[idPlaceOfIssue2],[issuedDate2],[validDate2]
  181. ,[relationType],[relativeName]
  182. ,[gender],[address2]
  183. ,[dcInfo],[ipAddress]
  184. ,[goodsType] ,[goodsOrigin],[portOfShipment]
  185. )
  186. SELECT
  187. @tranId
  188. ,[tranId]
  189. ,[customerId]
  190. ,[membershipId]
  191. ,[firstName],[middleName],[lastName1],[lastName2],[fullName]
  192. ,[country],[address],[state],[district],[zipCode],[city]
  193. ,[email],[homePhone],[workPhone],[mobile]
  194. ,[nativeCountry],[dob],[placeOfIssue]
  195. ,[customerType],[occupation]
  196. ,[idType],[idNumber],[idPlaceOfIssue]
  197. ,[issuedDate],[validDate]
  198. ,[idType2],[idNumber2],[idPlaceOfIssue2],[issuedDate2],[validDate2]
  199. ,[relationType],[relativeName]
  200. ,[gender],[address2]
  201. ,[dcInfo],[ipAddress]
  202. ,[goodsType] ,[goodsOrigin],[portOfShipment]
  203. FROM tranReceiversTemp WITH(NOLOCK) WHERE tranId = @id
  204. UPDATE bankCollectionVoucherDetail SET mainTranId = @tranId WHERE tempTranId = @id
  205. DELETE FROM remitTranTemp WHERE id = @id
  206. DELETE FROM tranSendersTemp WHERE tranId = @id
  207. DELETE FROM tranReceiversTemp WHERE tranId = @id
  208. COMMIT TRANSACTION
  209. END