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
4.5 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_ExchangeRateLog] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. CREATE proc [dbo].[proc_ExchangeRateLog]
  9. (
  10. @flag VARCHAR(50)
  11. ,@user VARCHAR(100) = NULL
  12. ,@userName VARCHAR(100) = NULL
  13. ,@updatedDate VARCHAR(50) = NULl
  14. ,@sortBy VARCHAR(50) = NULL
  15. ,@sortOrder VARCHAR(5) = NULL
  16. ,@pageSize INT = NULL
  17. ,@pageNumber INT = NULL
  18. )
  19. AS
  20. SET NOCOUNT ON
  21. SET XACT_ABORT ON
  22. IF @flag = 's'
  23. BEGIN
  24. DECLARE
  25. @selectFieldList VARCHAR(MAX)
  26. ,@extraFieldList VARCHAR(MAX)
  27. ,@table VARCHAR(MAX)
  28. ,@sqlFilter VARCHAR(MAX)
  29. IF @sortBy IS NULL
  30. SET @sortBy = 'createdDate'
  31. IF @sortOrder IS NULL
  32. SET @sortOrder = 'DESC'
  33. SET @table = '(
  34. SELECT
  35. erth.rowId
  36. ,cm.countryName
  37. ,am.agentName
  38. ,cCurrency = ''1 USD - ''+ CAST(cRate AS VARCHAR)+ '' ''+ cCurrency
  39. ,updatedBy = erth.createdBy
  40. ,updatedDate = DATEADD(MINUTE,-135,erth.createdDate)
  41. ,erth.approvedBy
  42. ,approvedDate= DATEADD(MINUTE,-135,erth.approvedDate)
  43. ,pCurrency = ''1 USD - ''+ CAST(erth.pRate AS VARCHAR)+'' NPR''
  44. FROM exRateTreasuryHistory erth WITH(NOLOCK)
  45. INNER JOIN countryMaster cm WITH(NOLOCK) ON erth.cCountry = cm.countryId
  46. INNER JOIN agentMaster am WITH(NOLOCK) ON erth.cAgent = am.agentId
  47. inner join applicationUsers au with(nolock) on erth.createdBy = au.username
  48. where au.agentId = 1001'
  49. SET @sqlFilter = ''
  50. SET @selectFieldList = 'rowId
  51. , countryName
  52. , agentName
  53. , cCurrency
  54. , pCurrency
  55. , updatedBy
  56. , updatedDate
  57. , approvedBy
  58. , approvedDate'
  59. IF @userName IS NOT NULL
  60. SET @table = @table + ' AND erth.createdBy = ''' + @userName + ''''
  61. IF @updatedDate IS NOT NULL
  62. SET @table = @table + ' AND erth.createdDate BETWEEN ''' + @updatedDate + ''' AND ''' + @updatedDate + ' 23:59:59'''
  63. SET @table = @table + ')x'
  64. EXEC dbo.proc_paging
  65. @table
  66. ,@sqlFilter
  67. ,@selectFieldList
  68. ,@extraFieldList
  69. ,@sortBy
  70. ,@sortOrder
  71. ,@pageSize
  72. ,@pageNumber
  73. END
  74. GO