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.

71 lines
3.4 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_crossExchangeRateDummy] 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_crossExchangeRateDummy]
  9. AS
  10. DECLARE @eList TABLE (
  11. sCountry INT
  12. ,sAgent INT
  13. ,sBranch INT
  14. ,rCountry INT
  15. ,rAgent INT
  16. ,rBranch INT
  17. ,sCost MONEY
  18. ,sMargin MONEY
  19. ,sAgentMargin MONEY
  20. ,sNet MONEY
  21. ,rCost MONEY
  22. ,rMargin MONEY
  23. ,rAgentMargin MONEY
  24. ,rNet MONEY
  25. ,crossRate MONEY
  26. )
  27. INSERT INTO @eList(sCountry, sAgent, sBranch, rCountry, rAgent, rBranch, sCost, sMargin, sAgentMargin, sNet, rCost, rMargin, rAgentMargin, rNet, crossRate)
  28. SELECT 3, 59, 78, 1, 9, 19, 50, 0.1, 0.1, 50.2, 80, 0.5, 0.6, 78.9, 1.78 UNION ALL
  29. SELECT 3, 55, 64, 1, 9, 19, 50, 0.08, 0.08, 50.16, 80, 0.3, 0.5, 79.2, 1.58
  30. --SELECT * FROM @eList
  31. SELECT
  32. el.sCountry
  33. ,sCountryName = sc.countryName
  34. ,el.sAgent
  35. ,sAgentName = sa.agentName
  36. ,el.sBranch
  37. ,sBranchName = sb.agentName
  38. ,el.rCountry
  39. ,rCountryName = rc.countryName
  40. ,el.rAgent
  41. ,sAgentName = ra.agentName
  42. ,el.rBranch
  43. ,rBranchName = rb.agentName
  44. ,el.sCost
  45. ,el.sMargin
  46. ,el.sAgentMargin
  47. ,el.sNet
  48. ,el.rCost
  49. ,el.rMargin
  50. ,el.rAgentMargin
  51. ,el.rNet
  52. FROM @eList el
  53. LEFT JOIN countryMaster sc WITH(NOLOCK) ON sc.countryId = el.sCountry
  54. LEFT JOIN agentMaster sa WITH(NOLOCK) ON el.sAgent = sa.agentId
  55. LEFT JOIN agentMaster sb WITH(NOLOCK) ON el.sBranch = sb.agentId
  56. LEFT JOIN countryMaster rc WITH(NOLOCK) ON rc.countryId = el.rCountry
  57. LEFT JOIN agentMaster ra WITH(NOLOCK) ON el.rAgent = ra.agentId
  58. LEFT JOIN agentMaster rb WITH(NOLOCK) ON el.rBranch = rb.agentId
  59. GO