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.

85 lines
3.6 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
  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. AS
  25. SET NOCOUNT ON ;
  26. SET XACT_ABORT ON;
  27. BEGIN
  28. IF @flag = 'sendRequest'
  29. BEGIN
  30. DECLARE @CUSTOMERID BIGINT, @rowId BIGINT
  31. IF NOT EXISTS (select 1 from customermaster where idnumber = @idNumber AND ISNULL(isActive, 'Y') = 'Y')
  32. BEGIN
  33. SELECT '1' ERROR_CODE, 'Customer with idNumber '''+@idNumber+''' does not exixts' Msg,@idNumber id
  34. RETURN
  35. END
  36. select @CUSTOMERID = CUSTOMERID,@membershipId = membershipId FROM CUSTOMERMASTER WHERE idNumber = @idNumber AND ISNULL(ISACTIVE, 'Y') = 'Y'
  37. --IF NOT EXISTS (SELECT 1 from receiverinformation where fullname = LTRIM(RTRIM(@receiverFullName)) and customerid = @CUSTOMERID)
  38. --BEGIN
  39. -- SELECT '1' ERROR_CODE, 'Receiver with name '''+@receiverFullName+''' does not exist of customer with membershipId '''+@membershipId+'''' Msg,@membershipId id
  40. -- RETURN
  41. --END
  42. --ALTER TABLE send_money_request ADD BranchManual VARCHAR(50)
  43. INSERT INTO send_money_request(IdNumber,MembershipId,ReceiverFullName,Receiveraddress
  44. ,ReceiverMobileNumber,purposeOfRemittance,otherPurpose,relationShip,otherRelation,referralName
  45. ,PCountryId,PmodeId,PagentId,BranchId,AccountNumber,CAmt,Tamt,ServiceCharge,createdby,createddate,BranchManual
  46. )
  47. values
  48. (
  49. @idNumber,@membershipId,@receiverFullName ,@receiveraddress
  50. ,@receiverMobileNumber,@purposeOfRemittanceId,@otherPurposeOfRemittance,@relationShipId,@otherRelation,@referralName
  51. ,@pCountryId ,@pModeId,@pagentId ,@branchId ,@accountNumber ,@cAmt ,@tamt ,@serviceCharge,@user,Getdate(),@branchManual
  52. )
  53. SET @rowId = @@IDENTITY
  54. SELECT '0' ERROR_CODE,'Request Send Successfully' Msg,@rowId id, cast(@CUSTOMERID as varchar) + '|' + cast(@membershipId as varchar) EXTRA
  55. END
  56. IF @flag = 'validateData'
  57. BEGIN
  58. SELECT @CUSTOMERID = CUSTOMERID
  59. FROM CUSTOMERMASTER (NOLOCK)
  60. WHERE idNumber = @idNumber
  61. AND ISNULL(ISACTIVE, 'Y') = 'Y'
  62. AND ISNULL(ISDELETED, 'N') = 'N'
  63. IF @CUSTOMERID IS NULL
  64. BEGIN
  65. SELECT '1' errorCode, 'Customer with idNumber '''+ISNULL(@idNumber, '')+''' does not exixts' Msg,@idNumber id
  66. RETURN
  67. END
  68. SELECT FULLNAME = RI.firstName + ISNULL(' '+RI.middleName, '') + ISNULL(' '+RI.lastName1, '') , RI.RECEIVERID, errorCode = 0,CM.FULLNAME CUSTOMERNAME,CM.MEMBERSHIPID
  69. FROM RECEIVERINFORMATION ri(NOLOCK)
  70. INNER JOIN CUSTOMERMASTER CM (NOLOCK) ON CM.CUSTOMERID = RI.CUSTOMERID
  71. WHERE RI.CUSTOMERID = @CUSTOMERID
  72. END
  73. IF @flag = 'receiver-data'
  74. BEGIN
  75. SELECT FULLNAME, address, mobile, country, paymentMode, bankLocation, payOutPartner, city
  76. , homePhone, idType, idNumber, placeOfIssue, purposeOfRemit, relationship, relationOther, purposeOther, errorCode = 0
  77. FROM RECEIVERINFORMATION (NOLOCK)
  78. WHERE receiverId = @benefeciaryId
  79. END
  80. END