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.

83 lines
4.9 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_ScheduleGMENepal] 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_ScheduleGMENepal](
  9. @Flag VARCHAR(20)
  10. ,@TranId BIGINT = NULL
  11. )AS
  12. BEGIN
  13. IF @Flag='list'
  14. BEGIN
  15. SELECT TOP 50
  16. r.id AS TranId
  17. ,Dbo.FNADecryptString(r.controlNo) AS ControlNo
  18. ,r.id AS ExConfirmId
  19. ,r.senderName AS CustomerName
  20. ,ts.address AS CustomerAddress
  21. ,ts.mobile AS CustomerContact
  22. ,ts.city AS CustomerCity
  23. ,ts.country AS CustomerCountry
  24. ,ts.idType AS CustomerIdType
  25. ,ts.idNumber AS CustomerIdNumber
  26. ,r.receiverName AS BeneName
  27. ,tr.address AS BeneAddress
  28. ,tr.mobile AS BeneContact
  29. ,tr.city AS BeneCity
  30. ,tr.country AS BeneCountry
  31. ,ts.occupation AS Profession
  32. ,r.sourceOfFund AS IncomeSource
  33. ,r.relWithSender AS Relationship
  34. ,r.purposeOfRemit AS PurposeOfRemittance
  35. ,r.tAmt AS SendingAmount
  36. ,r.pAmt AS ReceivingAmount
  37. ,'C' AS PaymentMethod
  38. ,CONVERT(VARCHAR,r.createdDate,110) AS TransactionDate
  39. ,'C' AS CalculateBy
  40. ,NULL AS FreeCharge
  41. ,(sCurrCostRate + ISNULL(sCurrHoMargin,0)) AS sCurrCostRate
  42. ,pCurrCostRate
  43. FROM dbo.remitTran r (NOLOCK)
  44. INNER JOIN dbo.tranSenders ts (NOLOCK) ON r.id = ts.tranId
  45. INNER JOIN dbo.tranReceivers tr (NOLOCK) ON r.id = tr.tranId
  46. WHERE r.tranStatus = 'Payment' and r.payStatus = 'Unpaid' AND r.paymentMethod = 'Cash Payment' AND r.pAgent = 1036
  47. and 1=2
  48. return
  49. END
  50. ELSE IF @flag='updateToPost'
  51. BEGIN
  52. UPDATE dbo.remitTran SET payStatus = 'Post', postedBy = 'SCHEDULAR', postedDate = GETDATE() WHERE id = @TranId and pAgent = 1036
  53. IF @@ROWCOUNT=1
  54. BEGIN
  55. SELECT '0' ErrorCode, 'Transaction Status updated.' Msg, NULL Id
  56. RETURN 0
  57. END
  58. END
  59. ELSE IF @flag='updateToPaid'
  60. BEGIN
  61. UPDATE dbo.remitTran SET tranStatus='Paid', payStatus='Paid', paidBy = 'system', paidDate=GETDATE(),paidDateLocal = GETUTCDATE()
  62. WHERE id = @TranId and pAgent = 1036
  63. IF @@ROWCOUNT=1
  64. BEGIN
  65. SELECT '0' ErrorCode, 'Transaction Status updated.' Msg, NULL Id
  66. RETURN 0
  67. END
  68. END
  69. ELSE IF @flag='list-posted'
  70. BEGIN
  71. SELECT
  72. dbo.FNADecryptString(controlNo) AS ControlNo
  73. ,id AS TranId
  74. FROM dbo.remitTran (NOLOCK) WHERE payStatus = 'Post' AND paymentMethod = 'Cash Payment'
  75. and pAgent = 1036
  76. return
  77. END
  78. END
  79. GO