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.

121 lines
5.7 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  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.Remit.CustomerSOA
  7. {
  8. public partial class CustomerSoaReceipt : System.Web.UI.Page
  9. {
  10. private readonly SwiftLibrary sl = new SwiftLibrary();
  11. private readonly CustomersDao obj = new CustomersDao();
  12. public const string GridName = "CustomerSoa";
  13. private const string ViewFunctionId = "20192000";
  14. private string[] transactionIds;
  15. private string toDate;
  16. private string fromDate;
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. Authenticate();
  20. if (!IsPostBack)
  21. {
  22. GetStatic.PrintMessage(Page);
  23. }
  24. FetchData();
  25. }
  26. private void Authenticate()
  27. {
  28. sl.CheckAuthentication(ViewFunctionId);
  29. }
  30. public void FetchData()
  31. {
  32. string tranId = GetStatic.ReadSession("tranIds", "");
  33. string customerId = GetStatic.ReadQueryString("customerId", "");
  34. string isFor = GetStatic.ReadQueryString("rptFor", "");
  35. //if (string.IsNullOrEmpty(tranId))
  36. //{
  37. // DbResult dbRes = new DbResult
  38. // {
  39. // ErrorCode = "1",
  40. // Msg = "No transaction selected"
  41. // };
  42. // GetStatic.SetMessage(dbRes);
  43. // Response.Redirect("");
  44. //}
  45. DataTable tranData = obj.GetCustomerSoaData(GetStatic.GetUser(), tranId, (isFor == "disabled" ? customerId : ""), isFor);
  46. PrepareHtml(tranData);
  47. }
  48. public void PrepareHtml(DataTable tranData)
  49. {
  50. var sb = new StringBuilder("");
  51. if (tranData.Rows.Count <= 0 || tranData.Rows == null)
  52. {
  53. sb.AppendLine("<tr>");
  54. sb.AppendLine("<td colspan='6' align='center'>");
  55. sb.AppendLine("No Data To Display ");
  56. sb.AppendLine("</td>");
  57. sb.AppendLine("</tr>");
  58. // tblMain.InnerHtml = sb.ToString();
  59. return;
  60. }
  61. sb.AppendLine((GenerateReceipt(tranData)));
  62. //foreach (DataRow dr in tranData.Rows)
  63. //{
  64. // sb.AppendLine((GenerateReceipt(dr)));
  65. //}
  66. rpt_grid.InnerHtml = sb.ToString();
  67. }
  68. public string GenerateReceipt(DataTable dt)
  69. {
  70. DataRow firstRow = dt.Rows[0];
  71. //Int64 TotalAmount;
  72. var sb = new StringBuilder("");
  73. txtperiod.InnerText = GetStatic.ReadQueryString("fromDate", "-") + " TO " + GetStatic.ReadQueryString("toDate", "-");
  74. txtPrintDate.InnerText = firstRow["PrintTime"].ToString();
  75. txtName.InnerText = firstRow["senderName"].ToString();
  76. txtCustomerId.InnerText = firstRow["sCustomerId"].ToString();
  77. txtAddress.InnerText = firstRow["sAddress"].ToString();
  78. txtDob.InnerText = firstRow["sdob"].ToString();
  79. int sNo = 1;
  80. double totalAmt = 0;
  81. double collectedAmount = 0;
  82. string sc = "";
  83. foreach (DataRow dr in dt.Rows)
  84. {
  85. totalAmt += Convert.ToDouble(dr["tAmt"].ToString());
  86. collectedAmount += Convert.ToDouble(dr["cAmt"].ToString());
  87. sc = GetStatic.ShowTwoDecimal(dr["serviceCharge"].ToString());
  88. DateTime date = DateTime.Parse(dr["approvedDate"].ToString());
  89. string approvedDate = date.ToString("yyyy-MM-dd");
  90. sb.AppendLine("<tr class=\"table-info\">");
  91. sb.AppendLine("<td style=\"white-space:nowrap; text-align: center;\">" + sNo + "</td>");
  92. sb.AppendLine("<td style=\"white-space:nowrap; text-align: center;\">" + approvedDate + "</td>");
  93. sb.AppendLine("<td style=\"white-space:nowrap; text-align: center;\">" + dr["receiverName"].ToString() + "</td>");
  94. sb.AppendLine("<td style=\"white-space:nowrap; text-align: center;\">" + dr["controlNo"].ToString() + "</td>");
  95. sb.AppendLine("<td style=\"white-space:nowrap; text-align: center;\">" + dr["paymentMethod"].ToString() + "</td>");
  96. sb.AppendLine("<td class=\"tright\" style=\"white-space:nowrap; text-align: center;\">" + GetStatic.ShowTwoDecimal(dr["serviceCharge"].ToString()) + " " + dr["collCurr"].ToString() + "</td>");
  97. sb.AppendLine("<td class=\"tright\" style=\"white-space:nowrap; text-align: center;\">" + GetStatic.ShowDecimal(dr["tAmt"].ToString()) + " " + dr["collCurr"].ToString() + "</td>");
  98. sb.AppendLine("<td class=\"tright\" style=\"white-space:nowrap; text-align: center;\">" + GetStatic.ShowDecimal(dr["cAmt"].ToString()) + " " + dr["collCurr"].ToString() + " </td>");
  99. sb.AppendLine("</tr>");
  100. sNo++;
  101. }
  102. sb.AppendLine("<tr>");
  103. sb.AppendLine("<td>&nbsp;</td>");
  104. sb.AppendLine("<td colspan=\"4\" style=\"text-align: center;\" class=\"tright\">TOTAL</td>");
  105. sb.AppendLine(" <td style=\"text-align: center;\" class=\"tright\">" + sc + " " + firstRow["collCurr"].ToString() + "</td>");
  106. sb.AppendLine(" <td style=\"text-align: center;\" class=\"tright\">" + GetStatic.ShowDecimal(totalAmt.ToString()) + " " + firstRow["collCurr"].ToString() + "</td>");
  107. sb.AppendLine(" <td style=\"text-align: center;\" class=\"tright\">" + GetStatic.ShowDecimal(collectedAmount.ToString()) + " " + firstRow["collCurr"].ToString() + "</td>");
  108. return sb.ToString();
  109. }
  110. }
  111. }