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.

567 lines
16 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_sendDomesticTransaction] Script Date: 7/4/2019 11:35:48 AM ******/
  4. DROP PROCEDURE [dbo].[proc_sendDomesticTransaction]
  5. GO
  6. /****** Object: StoredProcedure [dbo].[proc_sendDomesticTransaction] 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_sendDomesticTransaction](
  12. @flag VARCHAR(50)
  13. ,@user VARCHAR(30)
  14. ,@id BIGINT = NULL
  15. ,@membershipId VARCHAR(20) = NULL
  16. ,@agentUniqueRefId VARCHAR(20) = NULL
  17. ,@senderId BIGINT = NULL
  18. ,@sMemId VARCHAR(20) = NULL
  19. ,@sFirstName VARCHAR(50) = NULL
  20. ,@sMiddleName VARCHAR(50) = NULL
  21. ,@sLastName1 VARCHAR(50) = NULL
  22. ,@sLastName2 VARCHAR(50) = NULL
  23. ,@sAddress VARCHAR(200) = NULL
  24. ,@sContactNo VARCHAR(20) = NULL
  25. ,@sIdType VARCHAR(50) = NULL
  26. ,@sIdNo VARCHAR(30) = NULL
  27. ,@sEmail VARCHAR(50) = NULL
  28. ,@receiverId BIGINT = NULL
  29. ,@rMemId VARCHAR(20) = NULL
  30. ,@rFirstName VARCHAR(50) = NULL
  31. ,@rMiddleName VARCHAR(50) = NULL
  32. ,@rLastName1 VARCHAR(50) = NULL
  33. ,@rLastName2 VARCHAR(50) = NULL
  34. ,@rAddress VARCHAR(200) = NULL
  35. ,@rContactNo VARCHAR(20) = NULL
  36. ,@rIdType VARCHAR(50) = NULL
  37. ,@rIdNo VARCHAR(30) = NULL
  38. ,@remarks VARCHAR(200) = NULL
  39. ,@sBranch INT = NULL
  40. ,@sBranchName VARCHAR(100) = NULL
  41. ,@sAgent INT = NULL
  42. ,@sAgentName VARCHAR(100) = NULL
  43. ,@sSuperAgent INT = NULL
  44. ,@sSuperAgentName VARCHAR(100) = NULL
  45. ,@settlingAgent INT = NULL
  46. ,@mapCode VARCHAR(8) = NULL
  47. ,@mapCodeDom VARCHAR(8) = NULL
  48. ,@pBranch INT = NULL
  49. ,@pBank INT = NULL
  50. ,@pBankBranch INT = NULL
  51. ,@accountNo VARCHAR(30) = NULL
  52. ,@pCountry VARCHAR(100) = NULL --payout Country
  53. ,@pState VARCHAR(100) = NULL --payout State
  54. ,@pDistrict VARCHAR(100) = NULL --payout District
  55. ,@pLocation INT = NULL --payout Location
  56. ,@collMode VARCHAR(50) = NULL
  57. ,@collCurr VARCHAR(3) = NULL
  58. ,@transferAmt MONEY = NULL
  59. ,@serviceCharge MONEY = NULL
  60. ,@handlingFee MONEY = NULL
  61. ,@cAmt MONEY = NULL
  62. ,@exRate MONEY = NULL
  63. ,@pAmt MONEY = NULL
  64. ,@payoutCurr VARCHAR(3) = NULL
  65. ,@deliveryMethod VARCHAR(50) = NULL
  66. ,@purpose VARCHAR(100) = NULL
  67. ,@sourceOfFund VARCHAR(100) = NULL
  68. ,@relationship VARCHAR(100) = NULL
  69. ,@controlNo VARCHAR(20) = NULL
  70. ,@txnId VARCHAR(50) = NULL
  71. ,@agentRefId VARCHAR(50) = NULL
  72. ,@mode VARCHAR(10) = NULL
  73. ,@fromSendTrnTime VARCHAR(20) = NULL
  74. ,@toSendTrnTime VARCHAR(20) = NULL
  75. ,@txtPass VARCHAR(50) = NULL
  76. ,@sDcInfo VARCHAR(50) = NULL
  77. ,@sIpAddress VARCHAR(50) = NULL
  78. )
  79. AS
  80. DECLARE
  81. @sCurrCostRate DECIMAL(15, 9)
  82. ,@sCurrHoMargin DECIMAL(15, 9)
  83. ,@pCurrCostRate DECIMAL(15, 9)
  84. ,@pCurrHoMargin DECIMAL(15, 9)
  85. ,@sCurrAgentMargin DECIMAL(15, 9)
  86. ,@pCurrAgentMargin DECIMAL(15, 9)
  87. ,@sCurrSuperAgentMargin DECIMAL(15, 9)
  88. ,@pCurrSuperAgentMargin DECIMAL(15, 9)
  89. ,@customerRate DECIMAL(15, 9)
  90. ,@sAgentSettRate DECIMAL(15, 9)
  91. ,@pDateCostRate DECIMAL(15, 9)
  92. ,@sAgentComm MONEY
  93. ,@sAgentCommCurrency VARCHAR(3)
  94. ,@sSuperAgentComm MONEY
  95. ,@sSuperAgentCommCurrency VARCHAR(3)
  96. ,@sHubComm MONEY
  97. ,@sHubCommCurrency VARCHAR(3)
  98. ,@pAgentComm MONEY
  99. ,@pAgentCommCurrency VARCHAR(3)
  100. ,@pSuperAgentComm MONEY
  101. ,@pSuperAgentCommCurrency VARCHAR(3)
  102. ,@pHubComm MONEY
  103. ,@pHubCommCurrency VARCHAR(3)
  104. ,@pBankName VARCHAR(100)
  105. ,@pBankBranchName VARCHAR(100)
  106. ,@promotionCode INT
  107. ,@promotionType INT
  108. ,@sCountry VARCHAR(100)
  109. ,@pSuperAgent INT
  110. ,@pSuperAgentName VARCHAR(100)
  111. ,@pAgent INT
  112. ,@pAgentName VARCHAR(100)
  113. ,@pBranchName VARCHAR(100)
  114. ,@branchMapCode VARCHAR(8)
  115. ,@bankBranchName VARCHAR(200)
  116. ,@code VARCHAR(50)
  117. ,@userName VARCHAR(50)
  118. ,@password VARCHAR(50)
  119. ,@sCountryId VARCHAR(30)
  120. DECLARE
  121. @limitBal MONEY
  122. ,@sendingCustType INT
  123. ,@sendingCurrency VARCHAR(3)
  124. ,@receivingCurrency VARCHAR(3)
  125. ,@receivingCustType INT
  126. DECLARE
  127. @sendingCount INT
  128. ,@sendingAmount MONEY
  129. ,@receivingCount INT
  130. ,@receivingAmount MONEY
  131. ,@tranCount INT
  132. ,@tranAmount MONEY
  133. ,@period INT
  134. ,@nextAction INT
  135. DECLARE
  136. @pCountryId INT
  137. ,@deliveryMethodId INT
  138. ,@agentType INT
  139. ,@actAsBranchFlag CHAR(1)
  140. ,@approveFlag CHAR(1)
  141. ,@currentDate DATETIME
  142. ,@sFullName VARCHAR(200)
  143. ,@rFullName VARCHAR(200)
  144. ,@iCollectAmount MONEY
  145. EXEC proc_GetAPI @user OUTPUT,@code OUTPUT, @userName OUTPUT, @password OUTPUT
  146. DECLARE @controlNoEncrypted VARCHAR(20)
  147. SET XACT_ABORT ON
  148. BEGIN TRY
  149. IF @flag = 'i'
  150. BEGIN
  151. IF @user IS NULL
  152. BEGIN
  153. EXEC proc_errorHandler 1, 'Your session has expired. Cannot send transaction', NULL
  154. RETURN
  155. END
  156. SET @txtPass = dbo.FNAEncryptString(@txtPass)
  157. IF NOT EXISTS(SELECT 'X' FROM applicationUsers WITH(NOLOCK) WHERE PWD = @txtPass AND userName = @user)
  158. BEGIN
  159. EXEC proc_errorHandler 1, 'TXN password is invalid !', @user
  160. RETURN
  161. END
  162. IF(DATEDIFF(MI,CAST(dbo.FNAGetDateInNepalTZ() AS TIME), CAST(@fromSendTrnTime AS TIME))) > 0
  163. BEGIN
  164. EXEC proc_errorHandler 1, 'You are not authorized to send at this time', NULL
  165. RETURN
  166. END
  167. IF(DATEDIFF(MI,CAST(dbo.FNAGetDateInNepalTZ() AS TIME), CAST(@toSendTrnTime AS TIME))) < 0
  168. BEGIN
  169. EXEC proc_errorHandler 1, 'You are not authorized to send at this time', NULL
  170. RETURN
  171. END
  172. SET @controlNo = '7' + LEFT(CAST(ABS(CHECKSUM(NEWID())) AS VARCHAR(10)) + '0000000000', 9) + 'D'
  173. SELECT @controlNoEncrypted = dbo.FNAEncryptString(@controlNo)
  174. IF @user IS NULL
  175. BEGIN
  176. EXEC proc_errorHandler 1, 'Your session has expired. Cannot send transaction', NULL
  177. RETURN
  178. END
  179. SELECT @pCountry = 'Nepal'
  180. SELECT @sCountry = 'Nepal'
  181. SELECT @pCountryId = '151'
  182. SELECT @sCountryId = '151'
  183. SELECT @collCurr = 'NPR', @payoutCurr = 'NPR'
  184. SELECT @sendingCurrency = @collCurr
  185. SELECT @receivingCurrency = @payoutCurr
  186. SET @limitBal = [dbo].FNAGetLimitBal(@settlingAgent)
  187. SET @currentDate = dbo.FNAGetDateInNepalTz()
  188. IF EXISTS(SELECT 'X' FROM remitTran trn WITH(NOLOCK)
  189. LEFT JOIN tranSenders sen WITH(NOLOCK) ON trn.id = sen.tranId
  190. LEFT JOIN tranReceivers rec WITH(NOLOCK) ON trn.id = rec.tranId
  191. WHERE
  192. sen.firstName = @sFirstName
  193. AND ISNULL(sen.middleName, '') = ISNULL(@sMiddleName, '')
  194. AND ISNULL(sen.lastName1, '') = ISNULL(@sLastName1, '')
  195. AND ISNULL(sen.lastName2, '') = ISNULL(@sLastName2, '')
  196. AND rec.firstName = @rFirstName
  197. AND ISNULL(rec.middleName, '') = ISNULL(@rMiddleName, '')
  198. AND ISNULL(rec.lastName1, '') = ISNULL(@rLastName1, '')
  199. AND ISNULL(rec.lastName2, '') = ISNULL(@rLastName2, '')
  200. AND trn.tAmt = @transferAmt
  201. AND trn.pLocation = @pLocation
  202. AND trn.serviceCharge = @serviceCharge
  203. AND trn.cAmt = @cAmt
  204. AND DATEDIFF(MI, trn.createdDate, @currentDate) <= 5)
  205. BEGIN
  206. EXEC proc_errorHandler 1, 'Similar Transaction Found', NULL
  207. RETURN
  208. END
  209. IF @transferAmt > @limitBal
  210. BEGIN
  211. EXEC proc_errorHandler 1, 'Transfer amount exceeds Limit. Please, Check your available limit.', NULL
  212. RETURN
  213. END
  214. IF NOT EXISTS (
  215. SELECT
  216. 'X'
  217. FROM sendTranLimit
  218. WHERE countryId = @sCountryId
  219. AND (tranType = @collMode OR tranType IS NULL)
  220. AND (paymentType = @deliveryMethod OR paymentType IS NULL)
  221. AND (customerType = @sendingCustType OR customerType IS NULL)
  222. AND currency = @sendingCurrency
  223. AND (receivingCountry = @pCountryId OR receivingCountry IS NULL)
  224. AND ISNULL(minLimitAmt, 0) <= @transferAmt
  225. AND ISNULL(maxLimitAmt, 0) >= @transferAmt
  226. AND ISNULL(isActive, 'N') = 'Y'
  227. )
  228. BEGIN
  229. EXEC proc_errorHandler 1, 'Country Sending limit is not defined or exceeds.', NULL
  230. RETURN
  231. END
  232. --1.Txn Amount and Service Charge Validation
  233. SELECT @deliveryMethodId = serviceTypeId FROM serviceTypeMaster WITH(NOLOCK) WHERE typeTitle = @deliveryMethod AND ISNULL(isDeleted, 'N') = 'N'
  234. --Domestic Service Charge and Commission Calculation
  235. IF @deliveryMethod = 'Bank Deposit'
  236. BEGIN
  237. SELECT @pLocation = agentLocation, @pLocation = agentLocation, @pBank = parentId, @pBankBranchName = agentName, @bankBranchName = agentAddress
  238. FROM agentMaster WITH(NOLOCK) WHERE agentId = @pBankBranch
  239. SELECT @pBankName = agentName, @branchMapCode = mapCodeDom FROM agentMaster WITH(NOLOCK) WHERE agentId = @pBank
  240. SET @pAgentComm = 0
  241. SET @pSuperAgentComm = 0
  242. END
  243. ELSE
  244. BEGIN
  245. SELECT
  246. @pAgentComm = ISNULL(pAgentComm, 0)
  247. ,@pSuperAgentComm = ISNULL(psAgentComm, 0)
  248. FROM dbo.FNAGetDomesticPayCommForCancel(@sBranch, @pLocation, @deliveryMethodId, @transferAmt)
  249. END
  250. SELECT
  251. @serviceCharge = ISNULL(serviceCharge, 0)
  252. ,@sAgentComm = ISNULL(sAgentComm, 0)
  253. ,@sSuperAgentComm = ISNULL(ssAgentComm, 0)
  254. FROM dbo.FNAGetDomesticSendComm(@sBranch, NULL, @pLocation, @deliveryMethodId, @transferAmt)
  255. SELECT @sAgentCommCurrency = 'NPR', @sSuperAgentCommCurrency = 'NPR', @pAgentCommCurrency = 'NPR', @pSuperAgentCommCurrency = 'NPR'
  256. IF (@cAmt IS NULL)
  257. BEGIN
  258. SET @cAmt = @transferAmt + @serviceCharge
  259. END
  260. SET @iCollectAmount = @transferAmt + @serviceCharge
  261. IF(@cAmt <> @iCollectAmount)
  262. BEGIN
  263. SELECT 1 code, @agentUniqueRefId agent_refId, 'Collection Amount not match' [message], NULL
  264. RETURN
  265. END
  266. SELECT @sFullName = @sFirstName + ISNULL( ' ' + @sMiddleName, '') + ISNULL( ' ' + @sLastName1, '') + ISNULL( ' ' + @sLastName2, '')
  267. SELECT @rFullName = @rFirstName + ISNULL( ' ' + @rMiddleName, '') + ISNULL( ' ' + @rLastName1, '') + ISNULL( ' ' + @rLastName2, '')
  268. --## Start Bonus Point
  269. IF (ISNULL(@senderId, 0) <> 0)
  270. BEGIN
  271. DECLARE @maxPointsPerTxn INT, @bonusSchemeId INT, @bonusUnit INT, @bonusPoint INT
  272. SELECT @bonusSchemeId = bonusId
  273. ,@maxPointsPerTxn = maxPointsPerTxn
  274. FROM dbo.FNAGetBonusSetupDetail(@sCountryId, @sAgent, @sBranch, @pCountryId, @pAgent)
  275. SELECT @bonusUnit = unit, @bonusPoint = points FROM bonusOperationSetup WITH(NOLOCK) WHERE bonusSchemeId = @bonusSchemeId
  276. IF @bonusSchemeId IS NOT NULL
  277. BEGIN
  278. DECLARE @txnBonusPoint FLOAT
  279. SET @txnBonusPoint = @pAmt * (CAST(@bonusPoint AS FLOAT)/CAST(@bonusUnit AS FLOAT))
  280. SET @txnBonusPoint = CASE WHEN @txnBonusPoint > ISNULL(@maxPointsPerTxn, 0) THEN ISNULL(@maxPointsPerTxn, 0) ELSE ISNULL(@txnBonusPoint, 0) END
  281. UPDATE customerMaster SET
  282. bonusPointPending = ISNULL(bonusPointPending, 0) + @txnBonusPoint
  283. ,bonusTxnCount = ISNULL(bonusTxnCount, 0) + 1
  284. ,bonusTxnAmount = ISNULL(bonusTxnAmount, 0) + @pAmt
  285. WHERE customerId = @senderId
  286. END
  287. END
  288. --Commission Calculation End
  289. BEGIN TRANSACTION
  290. INSERT INTO remitTran(
  291. controlNo
  292. ,sCurrCostRate
  293. ,sCurrHoMargin
  294. ,pCurrCostRate
  295. ,pCurrHoMargin
  296. ,sCurrAgentMargin
  297. ,pCurrAgentMargin
  298. ,sCurrSuperAgentMargin
  299. ,pCurrSuperAgentMargin
  300. ,customerRate
  301. ,sAgentSettRate
  302. ,pDateCostRate
  303. ,serviceCharge
  304. ,handlingFee
  305. ,sAgentComm
  306. ,sAgentCommCurrency
  307. ,sSuperAgentComm
  308. ,sSuperAgentCommCurrency
  309. ,sHubComm
  310. ,sHubCommCurrency
  311. ,pAgentComm
  312. ,pAgentCommCurrency
  313. ,pSuperAgentComm
  314. ,pSuperAgentCommCurrency
  315. ,pHubComm
  316. ,pHubCommCurrency
  317. ,promotionCode
  318. ,promotionType
  319. ,pMessage
  320. ,sSuperAgent
  321. ,sSuperAgentName
  322. ,sAgent
  323. ,sAgentName
  324. ,sBranch
  325. ,sBranchName
  326. ,sCountry
  327. ,pSuperAgent
  328. ,pSuperAgentName
  329. ,pAgent
  330. ,pAgentName
  331. ,pBranch
  332. ,pBranchName
  333. ,pCountry
  334. ,pState
  335. ,pDistrict
  336. ,pLocation
  337. ,paymentMethod
  338. ,pBank
  339. ,pBankName
  340. ,pBankBranch
  341. ,pBankBranchName
  342. ,accountNo
  343. ,collMode
  344. ,collCurr
  345. ,tAmt
  346. ,cAmt
  347. ,pAmt
  348. ,payoutCurr
  349. ,relWithSender
  350. ,purposeOfRemit
  351. ,sourceOfFund
  352. ,tranStatus
  353. ,payStatus
  354. ,createdDate
  355. ,createdDateLocal
  356. ,createdBy
  357. ,approvedDate
  358. ,approvedDateLocal
  359. ,approvedBy
  360. ,tranType
  361. ,senderName
  362. ,receiverName
  363. ,bonusPoint
  364. )
  365. SELECT
  366. dbo.FNAEncryptString(@controlNo)
  367. ,@sCurrCostRate
  368. ,@sCurrHoMargin
  369. ,@pCurrCostRate
  370. ,@pCurrHoMargin
  371. ,@sCurrAgentMargin
  372. ,@pCurrAgentMargin
  373. ,@sCurrSuperAgentMargin
  374. ,@pCurrSuperAgentMargin
  375. ,@customerRate
  376. ,@sAgentSettRate
  377. ,@pDateCostRate
  378. ,@serviceCharge
  379. ,@handlingFee
  380. ,@sAgentComm
  381. ,@sAgentCommCurrency
  382. ,@sSuperAgentComm
  383. ,@sSuperAgentCommCurrency
  384. ,@sHubComm
  385. ,@sHubCommCurrency
  386. ,@pAgentComm
  387. ,@pAgentCommCurrency
  388. ,@pSuperAgentComm
  389. ,@pSuperAgentCommCurrency
  390. ,@pHubComm
  391. ,@pHubCommCurrency
  392. ,@promotionCode
  393. ,@promotionType
  394. ,@remarks
  395. ,@sSuperAgent
  396. ,@sSuperAgentName
  397. ,@sAgent
  398. ,@sAgentName
  399. ,@sBranch
  400. ,@sBranchName
  401. ,@sCountry
  402. ,@pSuperAgent
  403. ,@pSuperAgentName
  404. ,@pAgent
  405. ,@pAgentName
  406. ,@pBranch
  407. ,@pBranchName
  408. ,@pCountry
  409. ,@pState
  410. ,@pDistrict
  411. ,@pLocation
  412. ,@deliveryMethod
  413. ,@pBank
  414. ,@pBankName
  415. ,@pBankBranch
  416. ,@pBankBranchName
  417. ,@accountNo
  418. ,@collMode
  419. ,@collCurr
  420. ,@transferAmt
  421. ,@cAmt
  422. ,@pAmt
  423. ,@payoutCurr
  424. ,@relationship
  425. ,@purpose
  426. ,@sourceOfFund
  427. ,'Payment'
  428. ,'Unpaid'
  429. ,dbo.FNAGetDateInNepalTZ()
  430. ,dbo.FNAGetDateInNepalTZ()
  431. ,@user
  432. ,dbo.FNAGetDateInNepalTZ()
  433. ,dbo.FNAGetDateInNepalTZ()
  434. ,@user
  435. ,'D'
  436. ,@sFullName
  437. ,@rFullName
  438. ,@txnBonusPoint
  439. SET @id = SCOPE_IDENTITY()
  440. IF (ISNULL(@senderId, 0) <> 0 and ISNULL(@sMemId, 0) <> 0)
  441. BEGIN
  442. INSERT INTO tranSenders(
  443. tranId,customerId,membershipId,firstName,middleName,lastName1,lastName2
  444. ,country,[address],[state],district,email,mobile
  445. ,dob,idPlaceOfIssue,idType,idNumber,dcInfo,ipAddress
  446. )
  447. SELECT top 1
  448. @id,@senderId,membershipId,@sFirstName,@sMiddleName,@sLastName1,@sLastName2
  449. ,pCountry,@sAddress,pZone,pDistrict,@sEmail,@sContactNo
  450. ,dobEng,c.placeOfIssue,@sIdType,@sIdNo,@sDcInfo,@sIpAddress
  451. FROM customerMaster c WITH(NOLOCK)
  452. WHERE c.customerId = @senderId
  453. END
  454. ELSE
  455. BEGIN
  456. INSERT INTO tranSenders(
  457. tranId,membershipId,firstName,middleName,lastName1,lastName2
  458. ,country,[address],[state],zipCode,city,email,homePhone,workPhone,mobile,nativeCountry
  459. ,dob,placeOfIssue,idType,idNumber,idPlaceOfIssue,issuedDate,validDate,dcInfo,ipAddress
  460. )
  461. SELECT
  462. @id,@sMemId,@sFirstName,@sMiddleName,@sLastName1,@sLastName2
  463. ,'Nepal',@sAddress,NULL,NULL,NULL,@sEmail,NULL,NULL,@sContactNo,NULL
  464. ,NULL,NULL,@sIdType,@sIdNo,NULL,NULL,NULL,@sDcInfo,@sIpAddress
  465. END
  466. IF (ISNULL(@receiverId, 0) <> 0 and ISNULL(@rMemId, 0) <> 0)
  467. BEGIN
  468. INSERT INTO tranReceivers(
  469. tranId,customerId,membershipId,firstName,middleName,lastName1,lastName2
  470. ,country,[address],[state],district,email,mobile
  471. ,dob,idPlaceOfIssue,idType,idNumber
  472. )
  473. SELECT top 1
  474. @id,@receiverId,membershipId,@rFirstName,@rMiddleName,@rLastName1,@rLastName2
  475. ,pCountry,@rAddress,pZone,pDistrict,email,@rContactNo
  476. ,dobEng,c.placeOfIssue,@rIdType,@rIdNo
  477. FROM customerMaster c WITH(NOLOCK)
  478. WHERE c.customerId = @receiverId
  479. END
  480. ELSE
  481. BEGIN
  482. INSERT INTO tranReceivers(
  483. tranId,membershipId,firstName,middleName,lastName1,lastName2
  484. ,country,[address],[state],zipCode,city,email,homePhone,workPhone,mobile,nativeCountry
  485. ,dob,placeOfIssue,idType,idNumber,idPlaceOfIssue,issuedDate,validDate
  486. )
  487. SELECT
  488. @id,@rMemId,@rFirstName,@rMiddleName,@rLastName1,@rLastName2
  489. ,'Nepal',@rAddress,NULL,NULL,NULL,NULL,NULL,NULL,@rContactNo,NULL
  490. ,NULL,NULL,@rIdType,@rIdNo,NULL,NULL,NULL
  491. END
  492. EXEC FastMoneyPro_account.dbo.[PROC_REMIT_DATA_UPDATE]
  493. @flag = 's'
  494. ,@controlNo = @controlNo
  495. ,@mapCode = @mapCodeDom
  496. ,@sFirstName = @sFirstName
  497. ,@sMiddleName = @sMiddleName
  498. ,@sLastName1 = @sLastName1
  499. ,@sLastName2 = @sLastName2
  500. ,@rFirstName = @rFirstName
  501. ,@rMiddleName = @rMiddleName
  502. ,@rLastName1 = @rLastName1
  503. ,@rLastName2 = @rLastName2
  504. ,@cAmt = @cAmt
  505. ,@pAmt = @pAmt
  506. ,@serviceCharge = @serviceCharge
  507. ,@sAgentComm = @sAgentComm
  508. ,@pAgentComm = @pAgentComm
  509. ,@pBank = @pBank
  510. ,@pBankName = @pBankName
  511. ,@pBankBranch = @pBankBranch
  512. ,@deliveryMethod = @deliveryMethod
  513. ,@user = @user
  514. ,@tranId = @id
  515. IF @remarks IS NOT NULL
  516. BEGIN
  517. INSERT INTO tranModifyLog(tranId,[message],createdBy,createdDate,MsgType,[status])
  518. SELECT @id,@remarks,@user,dbo.FNAGetDateInNepalTZ(),'','Not Resolved'
  519. END
  520. IF @@TRANCOUNT > 0
  521. COMMIT TRANSACTION
  522. EXEC [proc_errorHandler] 0, 'Transaction has been sent successfully', @controlNo
  523. END
  524. END TRY
  525. BEGIN CATCH
  526. IF @@TRANCOUNT > 0
  527. ROLLBACK TRANSACTION
  528. SELECT 1 error_code, ERROR_MESSAGE() mes, null id
  529. END CATCH
  530. GO