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.

65 lines
2.0 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_CustomerInquiry] Script Date: 7/4/2019 11:35:48 AM ******/
  4. DROP PROCEDURE [dbo].[proc_CustomerInquiry]
  5. GO
  6. /****** Object: StoredProcedure [dbo].[proc_CustomerInquiry] Script Date: 7/4/2019 11:35:48 AM ******/
  7. SET ANSI_NULLS ON
  8. GO
  9. SET QUOTED_IDENTIFIER ON
  10. GO
  11. CREATE proc [dbo].[proc_CustomerInquiry]
  12. @flag varchar(20),
  13. @mobileNo varchar(15) = null,
  14. @complian varchar(max) = null,
  15. @msgType varchar(50) = null,
  16. @Country varchar(50) = null,
  17. @startDate varchar(10) = null,
  18. @endDate varchar(20) = null,
  19. @User varchar(50)
  20. as
  21. set nocount on ;
  22. if @flag = 'i'
  23. begin
  24. insert into tblCustomerInquiry(mobileNo,complian,msgType,Country,createdBy)
  25. select @mobileNo,@complian,@msgType,@Country,@User
  26. exec proc_errorHandler '0','Complain added successfully',null
  27. return
  28. end
  29. ELSE IF @flag ='S'
  30. BEGIN
  31. DECLARE @mobileNo1 VARCHAR(15)
  32. SET @mobileNo1 = CASE WHEN LEFT(@mobileNo,1) = '0' THEN '82'+RIGHT(@mobileNo,LEN(@mobileNo)-1) ELSE @mobileNo END
  33. SELECT * FROM tblCustomerInquiry(NOLOCK) WHERE mobileNo = @mobileNo
  34. UNION ALL
  35. select t.id,s.mobile,'Transaction'
  36. ,'Send Transaction of control no : '+'<a target="_blank" href="../../Remit/Transaction/Reports/SearchTransaction.aspx?commentFlag=N&showBankDetail=N&tranId='+cast(t.id as varchar)+'" >'+dbo.FNADecryptString(t.controlNo)+' </a>'
  37. ,t.pCountry,t.approvedBy,t.approvedDate
  38. from tranSenders s(nolock)
  39. INNER JOIN remitTran t(nolock) on t.id = s.tranId
  40. where s.mobile = @mobileNo1
  41. order by id desc
  42. RETURN
  43. END
  44. ELSE IF @flag ='r'
  45. BEGIN
  46. SELECT Country,MobileNo,[Complain] = complian,[Inquiry Type]= msgType,[Submitted By] = createdBy,[Submitted Date] = createdDate
  47. FROM tblCustomerInquiry(NOLOCK)
  48. WHERE createdDate between @startDate and @endDate +' 23:59:59'
  49. EXEC proc_errorHandler '0', 'Report has been prepared successfully.', NULL
  50. SELECT 'From Date ' head,@startDate value union all
  51. SELECT 'To Date ' head,@endDate value
  52. SELECT 'Customer Inquiry Report' title
  53. RETURN
  54. END
  55. GO