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.

96 lines
3.7 KiB

  1. using Swift.DAL.BL.Remit.Administration.Customer;
  2. using Swift.web.Library;
  3. using System;
  4. using System.Data;
  5. using System.Text;
  6. namespace Swift.web.AgentPanel.Statement
  7. {
  8. public partial class TxnStatement : System.Web.UI.Page
  9. {
  10. private const string ViewFunctionId = "20111600";
  11. private SwiftLibrary _sl = new SwiftLibrary();
  12. private readonly CustomersDao _obj = new CustomersDao();
  13. protected int rowSpan = 23;
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. _sl.CheckSession();
  17. GenerateReport();
  18. }
  19. protected string StartDate()
  20. {
  21. return GetStatic.ReadQueryString("startDate", "");
  22. }
  23. protected string EndDate()
  24. {
  25. return GetStatic.ReadQueryString("endDate", "");
  26. }
  27. protected string IdNumber()
  28. {
  29. return GetStatic.ReadQueryString("acNum", "");
  30. }
  31. private void Authenticate()
  32. {
  33. _sl.CheckAuthentication(ViewFunctionId);
  34. }
  35. private void GenerateReport()
  36. {
  37. startDate.Text = StartDate();
  38. endDate.Text = EndDate();
  39. lblToday.Text = DateTime.Now.ToString("yyyy-MM-dd");
  40. idNumber.Text = IdNumber();
  41. var dt = _obj.GetCustomerTxnStatement(IdNumber(), StartDate(), EndDate(), GetStatic.GetUser());
  42. if (dt == null || dt.Rows.Count == 0)
  43. {
  44. return;
  45. }
  46. senderName.Text = dt.Rows[0]["senderName"].ToString();
  47. var sb = new StringBuilder("");
  48. sb.AppendLine(" <div class=\"table-responsive\" style='font-size:11px !important;'><table class=\"table table-striped table-bordered\" >");
  49. sb.AppendLine("<tr>");
  50. sb.AppendLine("<th nowrap='nowrap'>Tran Date</th>");
  51. sb.AppendLine("<th nowrap='nowrap'>JME Number</th>");
  52. sb.AppendLine("<th nowrap='nowrap'>Receiver's Name</th>");
  53. sb.AppendLine("<th nowrap='nowrap'>Sending Amount<br>(JPY)</th>");
  54. sb.AppendLine("<th nowrap='nowrap'>Paying Amount<br>(NPR)</th>");
  55. sb.AppendLine("</tr>");
  56. double sending = 0, paying = 0;
  57. foreach (DataRow item in dt.Rows)
  58. {
  59. rowSpan--;
  60. sending += GetStatic.ParseDouble(item["cAmt"].ToString());
  61. paying += GetStatic.ParseDouble(item["pAmt"].ToString());
  62. sb.AppendLine("<tr>");
  63. sb.AppendLine("<td nowrap='nowrap'>" + item["createdDate"].ToString() + "</td>");
  64. sb.AppendLine("<td nowrap='nowrap'>" + item["controlNo"].ToString() + "</td>");
  65. sb.AppendLine("<td nowrap='nowrap'>" + item["receiverName"].ToString() + "</td>");
  66. sb.AppendLine("<td nowrap='nowrap' align='right'>" + GetStatic.GetNegativeFigureOnBrac(item["cAmt"].ToString()) + "</td>");
  67. sb.AppendLine("<td nowrap='nowrap' align='right'>" + GetStatic.GetNegativeFigureOnBrac(item["pAmt"].ToString()) + "</td>");
  68. sb.AppendLine("</tr>");
  69. }
  70. string br = "";
  71. for (int i = 0; i < rowSpan; i++)
  72. {
  73. br += "<br/>";
  74. }
  75. rowSpanDiv.InnerHtml = br;
  76. sb.AppendLine("<tr>");
  77. sb.AppendLine("<td colspan='3' align='right'><strong>Total : </td>");
  78. sb.AppendLine("<td align='right'>" + GetStatic.GetNegativeFigureOnBrac(sending.ToString()) + "</td>");
  79. sb.AppendLine("<td align='right'>" + GetStatic.GetNegativeFigureOnBrac(paying.ToString()) + "</td>");
  80. sb.AppendLine("</tr>");
  81. sb.AppendLine("</table></div>");
  82. divStmt.InnerHtml = sb.ToString();
  83. }
  84. }
  85. }