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.

84 lines
6.9 KiB

  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_IncompleteKYCReport] Script Date: 8/26/2024 12:50:29 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER PROC [dbo].[proc_IncompleteKYCReport]
  9. (
  10. @searchValue VARCHAR(300) = null
  11. ,@USER VARCHAR(50)
  12. ,@fromDate VARCHAR(20) = NULL
  13. ,@toDate VARCHAR(20) = NULL
  14. ,@rptFor NVARCHAR(10) = NULL
  15. ,@searchCriteria NVARCHAR(20) = NULL
  16. )
  17. AS
  18. -------------------------------------------------------------------
  19. -- #34182 - Changes for registration tracker
  20. -------------------------------------------------------------------
  21. SET NOCOUNT ON;
  22. SET XACT_ABORT ON;
  23. BEGIN
  24. SELECT ROW_NUMBER() OVER (
  25. ORDER BY customerId
  26. ) SN, * FROM (
  27. SELECT ct.customerId, idNumber AS [ID Number], membershipId as 'Membership ID', mobile AS [Mobile Number], email AS [Email ID],
  28. [OTP Verified] = CASE WHEN VERIFIED_DATE is null then 'N' ELSE 'Y' END,
  29. [OTP Verified Date] = CONVERT(VARCHAR(20), VERIFIED_DATE, 121),
  30. [KYC Verified] = CASE WHEN hasDeclare = 1 THEN 'Y' ELSE 'N' END,
  31. [KYC Verified Date] = mobileverifieddate,
  32. [Registration Type] = '',
  33. [Created Date] = ct.createdDate ,
  34. '<button onclick="onclick(''' + CAST(ct.customerId AS VARCHAR) + ''')">Move</button>' AS [Action]
  35. FROM CustomerMasterTemp(NOLOCK) ct
  36. INNER JOIN mobile_userRegistration(NOLOCK) mr ON mr.customerId = ct.customerId
  37. LEFT JOIN TBL_MOBILE_OTP_REQUEST(NOLOCK) otp ON otp.USER_ID = mr.username
  38. WHERE 1=1
  39. AND ct.customerId = isnull(@searchValue,ct.customerId)
  40. AND cast(ct.createdDate as date) BETWEEN @fromDate AND @toDate + ' 23:59:59'
  41. UNION ALL
  42. SELECT cm.customerid , idNumber AS [ID Number], membershipId as 'Membership ID', mobile AS [Mobile Number], email AS [Email ID],
  43. [OTP Verified] = CASE WHEN VERIFIED_DATE is null then 'N' ELSE 'Y' END,
  44. [OTP Verified Date] = CONVERT(VARCHAR(20), VERIFIED_DATE, 121),
  45. [KYC Verified] = CASE WHEN hasDeclare = 1 THEN 'Y' ELSE 'N' END,
  46. [KYC Verified Date] = mobileverifieddate,
  47. [Registration Type] = CASE WHEN cm.registrationtype IS NULL THEN 'MANUAL' WHEN cm.registrationtype='MKYC' THEN 'MANUAL' ELSE 'EKYC' END,
  48. [Created Date] = cm.createdDate,
  49. '<button onclick="onclick(''' + CAST(cm.customerid AS VARCHAR) + ''')">Move</button>' AS [Action]
  50. FROM CustomerMaster(NOLOCK) cm
  51. INNER JOIN mobile_userRegistration(NOLOCK) mr ON mr.customerId = cm.customerId
  52. LEFT JOIN TBL_MOBILE_OTP_REQUEST(NOLOCK) otp ON otp.USER_ID = mr.username
  53. WHERE ISNULL(HasDeclare,0) = 0
  54. AND ISNULL(agreeYn,0) = 0
  55. AND isnull(cm.customerId,'') = isnull(@searchValue,cm.customerid)
  56. AND cast(cm.createdDate as date) BETWEEN @fromDate AND @toDate + ' 23:59:59'
  57. UNION ALL
  58. SELECT tm.tempCustId , '' AS [ID Number], '' as 'Membership ID', mobile AS [Mobile Number], email AS [Email ID],
  59. tm.isOtpVerified AS [isOtpVerified],
  60. '' [OTP Verified Date],
  61. '' AS [KYC Verified],
  62. '' AS [KYC Verified Date],
  63. '' AS [Registration Type],
  64. [Created Date] = tm.createdDate,
  65. '' AS [Action]
  66. FROM TempUserRegister(NOLOCK) tm
  67. WHERE tm.isActive = 'Y' AND
  68. cast(tm.createdDate as date) BETWEEN @fromDate AND @toDate + ' 23:59:59'
  69. )x ORDER BY [Created Date] desc
  70. EXEC proc_errorHandler '0', 'Report has been prepared successfully.', NULL
  71. SELECT 'From Date' head, @fromDate VALUE
  72. UNION ALL
  73. SELECT 'To Date' head, @toDate VALUE
  74. SELECT 'Incomplete KYC Report' title
  75. END