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.

147 lines
4.9 KiB

  1. using Swift.DAL.Remittance.BonusManagement;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Library;
  4. using System;
  5. using System.IO;
  6. using System.Text;
  7. using System.Web.UI;
  8. namespace Swift.web.Remit.BonusManagement.RedeemProcess
  9. {
  10. public partial class Receipt : System.Web.UI.Page
  11. {
  12. RemittanceDao sdao = new RemittanceDao();
  13. readonly StaticDataDdl _sdd = new StaticDataDdl();
  14. readonly RedeemProcessDao _objDao = new RedeemProcessDao();
  15. private const string ViewFunctionId = "40132700";
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. HeadMessage();
  19. string tokenNo = GetStatic.ReadQueryString("RefNo", "");
  20. string user = GetStatic.GetUser();
  21. GenerateBonusReceipt(tokenNo, user);
  22. HeadMessage();
  23. }
  24. private void HeadMessage()
  25. {
  26. var message = _objDao.PrintReceiptHead(GetStatic.GetUser(), GetStatic.GetBranch());
  27. if (message == null)
  28. return;
  29. var strMsg = message["headMessage"].ToString();
  30. divHeadMsg.InnerHtml = HeadMessageToHtml(strMsg);
  31. agentName.InnerHtml = GetStatic.GetAgentName();
  32. }
  33. private string HeadMessageToHtml(string headMessage)
  34. {
  35. var list = headMessage.Split('|');
  36. var returnMsg = "<b style=\"font-size:20px;\">" + list[0] + "</b><br />";
  37. for (int i = 1; i < list.Length; i++)
  38. {
  39. returnMsg += list[i] + "<br />";
  40. }
  41. return returnMsg;
  42. }
  43. protected void GenerateBonusReceipt(string tokenId, string user)
  44. {
  45. double balancePoints = 0;
  46. var date = DateTime.Now.ToString();
  47. var dt = _objDao.PrintBonushReceipt(user, tokenId, GetStatic.GetBranch());
  48. if (dt.Rows.Count == 0)
  49. {
  50. var dbResult = new DbResult();
  51. dbResult.Msg = "Token Not Found";
  52. GetStatic.SetMessage(dbResult);
  53. Response.Redirect("Manage.aspx");
  54. }
  55. else
  56. {
  57. var dr = dt.Rows[0];
  58. var html = new StringBuilder("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">");
  59. html.Append("<tr>");
  60. html.Append("<td colspan=\"8\" height=\"20px\">");
  61. html.Append("</td>");
  62. html.Append("</tr>");
  63. html.Append("<tr>");
  64. html.Append("<td colspan=\"8\" height=\"20px\"><center><b> IME Bonus Points Receipt (<span style=\"color:red\">Re-Print</span>)</b></center>");
  65. html.Append("</td>");
  66. html.Append("</tr>");
  67. html.Append("<tr>");
  68. html.Append("<td align=\"Left\" height=\"20px\"><b>Ref No: </b>" + dr["redeemId"]);
  69. html.Append("</td>");
  70. html.Append("</tr>");
  71. html.Append("<tr>");
  72. html.Append("<td height=\"20px\"><b>Branch: </b>" + dr["agentName"]);
  73. html.Append("</td>");
  74. html.Append("</tr>");
  75. html.Append("<tr>");
  76. html.Append("<td colspan=\"8\" height=\"20px\"><b>Date/Time: </b>" + date + "<br/><b>Customer Name: </b>" + dr["customerName"] + "<br/><b>" + dr["idType"] + ": </b>" + dr["idNumber"] + "<br/><b>Membership Id: </b>" + dr["membershipId"] + "<br/>");
  77. html.Append("</td>");
  78. html.Append("</tr>");
  79. html.Append("<tr>");
  80. html.Append("<td>");
  81. html.Append("<table border=\"1\" bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">");
  82. html.Append("<tr>");
  83. html.Append("<th style=\"text-align: right;font-weight:bold;\"><div align=\"left\"><b>Sno</b></div>");
  84. html.Append("</th>");
  85. html.Append("<th style=\"text-align: right;font-weight:bold;\"><div align=\"left\"><b>Desc</b></div>");
  86. html.Append("</th>");
  87. html.Append("<th style=\"text-align: right;font-weight:bold;\"><div align=\"left\"><b>Points</b></div>");
  88. html.Append("</th>");
  89. html.Append("</tr>");
  90. html.Append("<tr>");
  91. html.Append("<td>1");
  92. html.Append("</td>");
  93. html.Append("<td>Available Mileage");
  94. html.Append("</td>");
  95. html.Append("<td><div align=\"right\">" + GetStatic.ShowDecimal(dr["currentMilage"].ToString()) + "</div>");
  96. html.Append("</td>");
  97. html.Append("</tr>");
  98. html.Append("<tr>");
  99. html.Append("<td>2");
  100. html.Append("</td>");
  101. html.Append("<td>Redeem");
  102. html.Append("</td>");
  103. html.Append("<td><div align=\"right\">" + GetStatic.ShowDecimal(dr["DeductMilage"].ToString()) + "</div>");
  104. html.Append("</td>");
  105. html.Append("</tr>");
  106. balancePoints = GetStatic.ParseDouble(dr["currentMilage"].ToString()) - GetStatic.ParseDouble(dr["DeductMilage"].ToString());
  107. html.Append("<tr>");
  108. html.Append("<td colspan=2 style=\"text-align: right;font-weight:bold;\">Redeem Available");
  109. html.Append("</td>");
  110. html.Append("<td><div align=\"right\">" + GetStatic.ShowDecimal(balancePoints.ToString()) + "</div>");
  111. html.Append("</td>");
  112. html.Append("</tr>");
  113. html.Append("</table>");
  114. html.Append("</td>");
  115. html.Append("</tr>");
  116. html.Append("</table>");
  117. rptReport.InnerHtml = html.ToString();
  118. redeemed.Text = dr["detailTitle"].ToString();
  119. red.Visible = true;
  120. prepareBy.InnerHtml = GetStatic.GetUser();
  121. ShowReport();
  122. }
  123. }
  124. protected void ShowReport()
  125. {
  126. var sb = new StringBuilder();
  127. officeReceipt.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
  128. customerReceipt.InnerHtml = sb.ToString();
  129. }
  130. }
  131. }