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.

67 lines
5.0 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[PROC_PROCESS_TRAN_KBANK] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER PROCEDURE [dbo].[PROC_PROCESS_TRAN_KBANK]
  9. (
  10. @FLAG VARCHAR(50),
  11. @P_CONTROLNO VARCHAR(20)
  12. )
  13. AS
  14. SET NOCOUNT ON
  15. SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
  16. ----------------------------------------------------------------------------------
  17. -- Procedure Start
  18. ----------------------------------------------------------------------------------
  19. BEGIN
  20. IF @FLAG = 'TRAN-TXN'
  21. BEGIN
  22. SELECT '0' AS ErrorCode,
  23. 'SUCCESS' AS Msg,
  24. dbo.FNADecryptString(RT.controlNo) AS [TxnReference], --TxnReference
  25. RT.purposeOfRemit As [Purpose], --Purpose
  26. TS.fullName AS [FullName],
  27. TS.idType AS [IDType],
  28. FORMAT(RT.createdDateLocal,'yyyy-MM-dd HH:mm:ss') AS [SendingDate], --SendingDate
  29. CMU.countryCode AS [CountryCode],
  30. TS.idNumber AS [IDNumber],
  31. TS.address AS [Address],
  32. TS.city AS [City],
  33. RT.receiverName AS [RecvFullName],
  34. '' AS [RecvEmail],
  35. AM.agentCode AS [RecvBankNo],--RecBankNo
  36. RT.accountNo AS [RecvAccount],--RecAccount
  37. RT.pAmt AS [FromAmount],--FromAmount
  38. RT.createdDate ,
  39. SourceOfFund='KOR', --Ordering Customer Source of Fund Country (ISO 3166) CustType='IND' --Ordering Customer TYPE IND  individual COR -Corporate
  40. INTO #TEMP
  41. FROM remitTranTemp(nolock) RT
  42. INNER JOIN tranSendersTemp(nolock) TS ON RT.id = TS.tranid
  43. INNER JOIN tranReceiversTemp(nolock) TR ON RT.id = TR.tranId
  44. INNER JOIN agentMaster(nolock) AM ON RT.pBank = AM.agentId
  45. INNER JOIN customerMaster(nolock) CM ON CM.customerId = TS.customerId
  46. INNER JOIN countryMaster(NOLOCK) CMU ON CM.nativeCountry = CMU.countryId
  47. WHERE pCountry = 'Thailand' --AND payStatus = 'UNPAID' AND tranStatus='PAYMENT'
  48. AND controlNo= @P_CONTROLNO
  49. DELETE FROM #TEMP WHERE FORMAT(GETDATE(), 'ddd') IN ('SAT','SUN')
  50. ----HOLIDAY FOR 2019
  51. DELETE FROM #TEMP WHERE CAST(GETDATE() AS DATE) IN ('2019-10-14','2019-10-23','2019-12-05','2019-12-10','2019-12-31')
  52. SELECT * FROM #TEMP WHERE CAST(GETDATE() AS TIME) BETWEEN '07:10:00' AND '19:50:00'
  53. END
  54. END
  55. ----------------------------------------------------------------------------------
  56. -- Procedure End
  57. ----------------------------------------------------------------------------------
  58. SET TRANSACTION ISOLATION LEVEL READ COMMITTED
  59. SET NOCOUNT OFF
  60. GO