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
3.0 KiB

  1. using System;
  2. using Swift.web.Library;
  3. namespace Swift.web.Responsive.Reports.SettlementDomestic
  4. {
  5. public partial class Manage : System.Web.UI.Page
  6. {
  7. protected string AgentMapCode = "";
  8. protected string BranchMapCode = "";
  9. protected string Flag = "";
  10. protected string AgentId = "";
  11. protected string BranchId = "";
  12. private readonly StaticDataDdl _sdd = new StaticDataDdl();
  13. private readonly RemittanceLibrary _rl = new RemittanceLibrary();
  14. private const string ViewFunctionId = "40121300";
  15. private const string ViewAllBranchReportFunctionId = "40121310";
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. if (!IsPostBack)
  19. {
  20. Authenticate();
  21. fromDate.Text = DateTime.Now.ToString("d");
  22. toDate.Text = DateTime.Now.ToString("d");
  23. PopulateData();
  24. }
  25. }
  26. private void Authenticate()
  27. {
  28. _rl.CheckAuthentication(ViewFunctionId);
  29. }
  30. private void PopulateData()
  31. {
  32. var isActAsBranch = GetStatic.GetIsActAsBranch();
  33. var agentType = GetStatic.GetAgentType();
  34. var agentMapCode = GetStatic.GetMapCodeInt();
  35. var parentMapCode = GetStatic.GetParentMapCodeInt();
  36. var agentId = GetStatic.GetAgentId();
  37. AgentId = GetStatic.GetAgent();
  38. BranchId = GetStatic.GetBranch();
  39. var settlingAgent = GetStatic.GetSettlingAgent();
  40. var isSettlingAgent = "N";
  41. if (agentId == settlingAgent)
  42. isSettlingAgent = "Y";
  43. if (isActAsBranch == "Y" && agentType == "2903") // Private Agents
  44. {
  45. AgentMapCode = agentMapCode;
  46. BranchMapCode = agentMapCode;
  47. }
  48. else if (agentType == "2904") // Bank & Finance
  49. {
  50. if (isSettlingAgent == "N")
  51. {
  52. if (_rl.HasRight(ViewAllBranchReportFunctionId))
  53. {
  54. AgentMapCode = parentMapCode;
  55. BranchMapCode = agentMapCode;
  56. Flag = "Y";
  57. trBranch.Visible = true;
  58. PopulateDdl(parentMapCode);
  59. }
  60. else
  61. {
  62. AgentMapCode = parentMapCode;
  63. BranchMapCode = agentMapCode;
  64. }
  65. }
  66. if (isSettlingAgent == "Y")
  67. {
  68. AgentMapCode = agentMapCode;
  69. BranchMapCode = agentMapCode;
  70. }
  71. }
  72. }
  73. private void PopulateDdl(string aMapCode)
  74. {
  75. string sql = "EXEC FastMoneyPro_account.dbo.PROC_SETTLEMENT_REPORT_V2 @FLAG = 'DDL_BRANCH',@AGENT =" + _rl.FilterString(aMapCode) + "";
  76. _sdd.SetDDL3(ref branch, sql, "map_code", "agent_name", "", "All");
  77. }
  78. }
  79. }