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.

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