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.

112 lines
4.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. ALTER PROC proc_sendRequest
  2. @flag VARCHAR(20)
  3. ,@user VARCHAR(20) = NULL
  4. ,@membershipId VARCHAR(20) = NULL
  5. ,@idNumber VARCHAR(20) = NULL
  6. ,@receiverFullName varchar(200) = NULL
  7. ,@receiveraddress varchar(100) = NULL
  8. ,@receiverMobileNumber varchar(20) = NULL
  9. ,@pCountryId BIGINT = NULL
  10. ,@pModeId BIGINT = NULL
  11. ,@pagentId BIGINT = NULL
  12. ,@branchId BIGINT = NULL
  13. ,@branchManual VARCHAR(100) = NULL
  14. ,@accountNumber varchar(50) = NULL
  15. ,@cAmt MONEY = NULL
  16. ,@tamt MONEY = NULL
  17. ,@serviceCharge MONEY = NULL
  18. ,@purposeOfRemittanceId BIGINT = NULL
  19. ,@otherPurposeOfRemittance VARCHAR(100) = NULL
  20. ,@relationShipId BIGINT = NULL
  21. ,@otherRelation VARCHAR(100) = NULL
  22. ,@referralName VARCHAR(50) = NULL
  23. ,@benefeciaryId BIGINT = NULL
  24. ,@bankName VARCHAR(100) = NULL
  25. ,@branchName VARCHAR(100) = NULL
  26. AS
  27. SET NOCOUNT ON ;
  28. SET XACT_ABORT ON;
  29. BEGIN
  30. IF @flag = 'sendRequest'
  31. BEGIN
  32. DECLARE @CUSTOMERID BIGINT, @rowId BIGINT
  33. IF NOT EXISTS (select 1 from customermaster where idnumber = @idNumber AND ISNULL(isActive, 'Y') = 'Y')
  34. BEGIN
  35. SELECT '1' ERROR_CODE, 'Customer with idNumber '''+@idNumber+''' does not exixts' Msg,@idNumber id
  36. RETURN
  37. END
  38. select @CUSTOMERID = CUSTOMERID,@membershipId = membershipId FROM CUSTOMERMASTER WHERE idNumber = @idNumber AND ISNULL(ISACTIVE, 'Y') = 'Y'
  39. --IF NOT EXISTS (SELECT 1 from receiverinformation where fullname = LTRIM(RTRIM(@receiverFullName)) and customerid = @CUSTOMERID)
  40. --BEGIN
  41. -- SELECT '1' ERROR_CODE, 'Receiver with name '''+@receiverFullName+''' does not exist of customer with membershipId '''+@membershipId+'''' Msg,@membershipId id
  42. -- RETURN
  43. --END
  44. --ALTER TABLE send_money_request ADD BranchManual VARCHAR(50)
  45. INSERT INTO send_money_request(IdNumber,MembershipId,ReceiverFullName,Receiveraddress
  46. ,ReceiverMobileNumber,purposeOfRemittance,otherPurpose,relationShip,otherRelation,referralName
  47. ,PCountryId,PmodeId,PagentId,BranchId,AccountNumber,CAmt,Tamt,ServiceCharge,createdby,createddate,BranchManual
  48. ,pBankName, pBranchName
  49. )
  50. values
  51. (
  52. @idNumber,@membershipId,@receiverFullName ,@receiveraddress
  53. ,@receiverMobileNumber,@purposeOfRemittanceId,@otherPurposeOfRemittance,@relationShipId,@otherRelation,@referralName
  54. ,@pCountryId ,@pModeId,@pagentId ,@branchId ,@accountNumber ,@cAmt ,@tamt ,@serviceCharge,@user,Getdate(),@branchManual,
  55. @bankName, @branchName
  56. )
  57. SET @rowId = @@IDENTITY
  58. SELECT '0' ERROR_CODE,'Request Send Successfully' Msg,@rowId id, cast(@CUSTOMERID as varchar) + '|' + cast(@membershipId as varchar) EXTRA
  59. END
  60. IF @flag = 'validateData'
  61. BEGIN
  62. SELECT @CUSTOMERID = CUSTOMERID
  63. FROM CUSTOMERMASTER (NOLOCK)
  64. WHERE idNumber = @idNumber
  65. AND ISNULL(ISACTIVE, 'Y') = 'Y'
  66. AND ISNULL(ISDELETED, 'N') = 'N'
  67. AND APPROVEDDATE IS NOT NULL
  68. IF @CUSTOMERID IS NULL
  69. BEGIN
  70. SELECT '1' errorCode, 'Customer with idNumber '+ISNULL(@idNumber, '')+' does not exixts or is not approved!' Msg,@idNumber id
  71. RETURN
  72. END
  73. --CHECKING CUSTOMER KYC STATUS
  74. DECLARE @kycStatus INT, @MSG VARCHAR(150)
  75. SELECT @kycStatus = kycStatus
  76. FROM TBL_CUSTOMER_KYC (NOLOCK)
  77. WHERE CUSTOMERID = @CUSTOMERID
  78. AND ISDELETED = 0
  79. --AND kycStatus=11044
  80. ORDER BY KYC_DATE
  81. IF ISNULL(@kycStatus, 0) <> 11044
  82. BEGIN
  83. IF @kycStatus IS NOT NULL
  84. SELECT @MSG = 'KYC for selected customer is not completed, it is in status:' + detailTitle FROM staticDataValue (NOLOCK) WHERE valueId = @kycStatus
  85. ELSE
  86. SELECT @MSG = 'Please complete KYC status first'
  87. SELECT '1' ErrCode, @MSG Msg,NULL id
  88. RETURN
  89. END
  90. SELECT FULLNAME = RI.firstName + ISNULL(' '+RI.middleName, '') + ISNULL(' '+RI.lastName1, '') , RI.RECEIVERID, errorCode = 0,CM.FULLNAME CUSTOMERNAME,CM.MEMBERSHIPID
  91. FROM RECEIVERINFORMATION ri(NOLOCK)
  92. INNER JOIN CUSTOMERMASTER CM (NOLOCK) ON CM.CUSTOMERID = RI.CUSTOMERID
  93. WHERE RI.CUSTOMERID = @CUSTOMERID
  94. END
  95. IF @flag = 'receiver-data'
  96. BEGIN
  97. SELECT FULLNAME, address, mobile, country, paymentMode, bankLocation, payOutPartner, city
  98. , homePhone, idType, idNumber, placeOfIssue, purposeOfRemit, relationship, relationOther, purposeOther, errorCode = 0
  99. FROM RECEIVERINFORMATION (NOLOCK)
  100. WHERE receiverId = @benefeciaryId
  101. END
  102. END