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.

56 lines
3.1 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_internationalSendTarget] 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_internationalSendTarget](
  9. @flag VARCHAR(50) = NULL
  10. ,@year VARCHAR(20) = NULL
  11. ,@month VARCHAR(50) = NULL
  12. ,@branchId VARCHAR(50) = NULL
  13. ,@user VARCHAR(50) = NULL
  14. ,@userType VARCHAR(2) = NULL
  15. ,@agentId INT = NULL
  16. ,@countryId VARCHAR(50) = NULL
  17. )AS
  18. SET NOCOUNT ON
  19. SET XACT_ABORT ON
  20. BEGIN
  21. DECLARE
  22. @previousMonth VARCHAR(20)
  23. ,@previousYr VARCHAR(20)
  24. ,@StartDate VARCHAR(20)
  25. ,@previousMonthDate VARCHAR(20)
  26. ,@incentive VARCHAR(MAX)
  27. IF @flag='s'
  28. BEGIN
  29. select @month = datename(month,getdate())
  30. select @year = datepart(year,getdate())
  31. SET @StartDate = CONVERT(DateTime, LEFT(@month, 3) + ' 1 '+@year+'', 100);
  32. SELECT TOP 1
  33. [Target] =isnull(targentTxn,0)
  34. ,[Actual] =isnull(actualTxn,0)
  35. ,[Remaining]=ISNULL(targentTxn,0)-ISNULL(actualTxn,0)
  36. ,[PreviousActual] = isnull(preMonthActual,0)
  37. ,head = '<span class=\"color-red\">Txn count till <strong>'+@month+' '+cast(DATEPART(day,getdate())-1 as varchar)+'</strong></span>'
  38. FROM RemittanceLogData.dbo.agentTarget WITH(NOLOCK)
  39. WHERE agentId = @branchId
  40. AND yr = @year
  41. AND yrMonth = @month
  42. AND userName = @user
  43. SELECT @incentive WHERE 1=2
  44. SELECT @incentive head
  45. END
  46. END
  47. GO