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.

72 lines
3.1 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
  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. ,@accountNumber varchar(50) = NULL
  14. ,@cAmt MONEY = NULL
  15. ,@tamt MONEY = NULL
  16. ,@serviceCharge MONEY = NULL
  17. ,@purposeOfRemittanceId BIGINT = NULL
  18. ,@otherPurposeOfRemittance VARCHAR(100) = NULL
  19. ,@relationShipId BIGINT = NULL
  20. ,@otherRelation VARCHAR(100) = NULL
  21. ,@referralName VARCHAR(50) = NULL
  22. AS
  23. SET NOCOUNT ON ;
  24. SET XACT_ABORT ON;
  25. BEGIN
  26. IF @flag = 'sendRequest'
  27. BEGIN
  28. DECLARE @CUSTOMERID BIGINT, @rowId BIGINT
  29. IF NOT EXISTS (select 1 from customermaster where idnumber = @idNumber AND ISNULL(isActive, 'Y') = 'Y')
  30. BEGIN
  31. SELECT '1' ERROR_CODE, 'Customer with idNumber '''+@idNumber+''' does not exixts' Msg,@idNumber id
  32. RETURN
  33. END
  34. select @CUSTOMERID = CUSTOMERID,@membershipId = membershipId FROM CUSTOMERMASTER WHERE idNumber = @idNumber AND ISNULL(ISACTIVE, 'Y') = 'Y'
  35. --IF NOT EXISTS (SELECT 1 from receiverinformation where fullname = LTRIM(RTRIM(@receiverFullName)) and customerid = @CUSTOMERID)
  36. --BEGIN
  37. -- SELECT '1' ERROR_CODE, 'Receiver with name '''+@receiverFullName+''' does not exist of customer with membershipId '''+@membershipId+'''' Msg,@membershipId id
  38. -- RETURN
  39. --END
  40. INSERT INTO send_money_request(IdNumber,MembershipId,ReceiverFullName,Receiveraddress
  41. ,ReceiverMobileNumber,purposeOfRemittance,otherPurpose,relationShip,otherRelation,referralName
  42. ,PCountryId,PmodeId,PagentId,BranchId,AccountNumber,CAmt,Tamt,ServiceCharge,createdby,createddate
  43. )
  44. values
  45. (
  46. @idNumber,@membershipId,@receiverFullName ,@receiveraddress
  47. ,@receiverMobileNumber,@purposeOfRemittanceId,@otherPurposeOfRemittance,@relationShipId,@otherRelation,@referralName
  48. ,@pCountryId ,@pModeId,@pagentId ,@branchId ,@accountNumber ,@cAmt ,@tamt ,@serviceCharge,@user,Getdate()
  49. )
  50. SET @rowId = @@IDENTITY
  51. SELECT '0' ERROR_CODE,'Request Send Successfully' Msg,@rowId id, cast(@CUSTOMERID as varchar) + '|' + cast(@membershipId as varchar) EXTRA
  52. END
  53. IF @flag = 'validateData'
  54. BEGIN
  55. IF NOT EXISTS (select 1 from customermaster where idNumber = @idNumber)
  56. BEGIN
  57. SELECT '1' ERROR_CODE, 'Customer with idNumber '''+@idNumber+''' does not exixts' Msg,@idNumber id
  58. RETURN
  59. END
  60. select @CUSTOMERID = CUSTOMERID FROM CUSTOMERMASTER WHERE idNumber = @idNumber AND ISNULL(ISACTIVE, 'Y') = 'Y'
  61. IF NOT EXISTS (SELECT 1 from receiverinformation where fullname = LTRIM(RTRIM(@receiverFullName)) and customerid = @CUSTOMERID)
  62. BEGIN
  63. SELECT '1' ERROR_CODE, 'Receiver with name '''+@receiverFullName+''' does not exist of customer with idNumber '''+@idNumber+'''' Msg,@idNumber id
  64. RETURN
  65. END
  66. SELECT '0' ERROR_CODE, 'Customer and receiver exixts' Msg,@idNumber id
  67. END
  68. END