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.

123 lines
4.5 KiB

  1. using Swift.DAL.BL.Remit.Transaction;
  2. using Swift.web.Library;
  3. using System;
  4. using System.Data;
  5. using System.Text;
  6. namespace Swift.web.AgentPanel.Reports.SOADomestic
  7. {
  8. public partial class drilDown : System.Web.UI.Page
  9. {
  10. private readonly TranReportDao rptDao = new TranReportDao();
  11. private readonly RemittanceLibrary rl = new RemittanceLibrary();
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. rl.CheckSession();
  15. string mode = GetStatic.ReadQueryString("mode", "").ToLower();
  16. if (mode == "download")
  17. {
  18. string format = "xls";
  19. string reportName = "soa";
  20. Response.Clear();
  21. Response.ClearContent();
  22. Response.ClearHeaders();
  23. Response.ContentType = "application/vnd.ms-excel";
  24. Response.AddHeader("Content-Disposition", "attachment; filename=" + reportName + "." + format);
  25. exportDiv.Visible = false;
  26. }
  27. LoadSoaHtml();
  28. }
  29. private void LoadSoaHtml()
  30. {
  31. var flag = GetStatic.ReadQueryString("flag", "");
  32. switch (flag)
  33. {
  34. case "PAY_DETAIL":
  35. rptDetail.Text = " >> Paid Principal Detail";
  36. break;
  37. case "PCOM_DETAIL":
  38. rptDetail.Text = " >> Paid Commission Detail";
  39. break;
  40. case "CNL_DETAIL":
  41. rptDetail.Text = " >> Canceled Principal Detail";
  42. break;
  43. case "CNLCOM_DETAIL":
  44. rptDetail.Text = " >> Canceled Commission Detail";
  45. break;
  46. case "SEND_DETAIL":
  47. rptDetail.Text = " >> Send Principal Detail";
  48. break;
  49. case "SCOM_DETAIL":
  50. rptDetail.Text = " >> Send Commission Detail";
  51. break;
  52. default:
  53. break;
  54. }
  55. var fromDate = GetStatic.ReadQueryString("DATE1", "");
  56. var toDate = GetStatic.ReadQueryString("DATE2", "");
  57. var agent = GetStatic.ReadQueryString("AGENT", "");
  58. var TRAN_TYPE = GetStatic.ReadQueryString("TRAN_TYPE", "");
  59. lblAgentName.Text = rl.GetAgentNameByMapCodeInt(agent);
  60. lblFrmDate.Text = fromDate;
  61. lbltoDate.Text = toDate;
  62. lblGeneratedDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
  63. DataTable dt = rptDao.AgentSoaDrilldownReport(fromDate, toDate, agent, flag, TRAN_TYPE);
  64. int cols = dt.Columns.Count;
  65. var str = new StringBuilder("<table class='TBLReport table table-bordered table-condensed' border=\"1\" cellspacing=0 cellpadding=\"3\">");
  66. str.Append("<tr>");
  67. str.Append("<th><div align=\"left\">SN</div></th>");
  68. str.Append("<th><div align=\"left\">Date</div></th>");
  69. str.Append("<th><div align=\"left\">Particulars</div></th>");
  70. str.Append("<th><div align=\"right\">Amount</div></th>");
  71. str.Append("</tr>");
  72. int cnt = 0;
  73. double BAL = 0.00;
  74. if (dt.Rows.Count == 0)
  75. {
  76. str.Append("<tr><td colspan='4'><b>No Record Found</td></tr></table>");
  77. rptDiv.InnerHtml = str.ToString();
  78. return;
  79. }
  80. foreach (DataRow dr in dt.Rows)
  81. {
  82. cnt = cnt + 1;
  83. str.Append("<tr>");
  84. str.Append("<td>" + cnt + "</td>");
  85. for (int i = 0; i < cols; i++)
  86. {
  87. if (i == 4)
  88. {
  89. BAL = BAL + double.Parse(dr[i].ToString());
  90. str.Append("<td><div align=\"right\">" + GetStatic.ShowDecimal(dr[i].ToString()) + "</div></td>");
  91. }
  92. else if (i == 0 || i == 2)
  93. str.Append("<td><div align=\"left\">" + dr[i] + "</div></td>");
  94. }
  95. str.Append("</tr>");
  96. }
  97. str.Append("<tr>");
  98. str.Append("<td colspan='3'><div align=\"right\"><b>Total</b> </div></td>");
  99. str.Append("<td><div align=\"right\"><b>" + GetStatic.ShowDecimal(BAL.ToString()) + "</b></div></td>");
  100. str.Append("</tr>");
  101. str.Append("</table>");
  102. rptDiv.InnerHtml = str.ToString();
  103. }
  104. }
  105. }