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.

151 lines
6.3 KiB

  1. using Swift.DAL.AccountReportOld;
  2. using Swift.web.Library;
  3. using System;
  4. using System.Data;
  5. using System.Text;
  6. namespace Swift.web.AccountReportOld.AccountStatementOld
  7. {
  8. public partial class userreportResultSingleOld : System.Web.UI.Page
  9. {
  10. private SwiftLibrary _sl = new SwiftLibrary();
  11. private AccountStatementOldDAO st = new AccountStatementOldDAO();
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14. _sl.CheckSession();
  15. if (GetStatic.ReadQueryString("r", "") == "Y")
  16. {
  17. divReverse.Visible = _sl.HasRight("");
  18. }
  19. GenerateReport();
  20. }
  21. protected string TransactionNumber()
  22. {
  23. return GetStatic.ReadQueryString("tran_num", "");
  24. }
  25. protected string TransactionDate()
  26. {
  27. return GetStatic.ReadQueryString("trn_date", "");
  28. }
  29. protected string VoucherType()
  30. {
  31. return GetStatic.ReadQueryString("vouchertype", "");
  32. }
  33. private void GenerateReport()
  34. {
  35. string tranNum = TransactionNumber();
  36. string tranactionDate = TransactionDate();
  37. string vType = VoucherType();
  38. tranNumber.Text = tranNum;
  39. tranDate.Text = tranactionDate;
  40. voucherType.Text = GetStatic.GetVoucherType(vType, "");
  41. letterHead.InnerHtml = GetStatic.getCompanyHead();
  42. var dt = st.GetUserReportResultSingle(tranNum, tranactionDate, vType);
  43. var sb = new StringBuilder("");
  44. sb.AppendLine("<div class=\"table-responsive\"><table class=\"table table-striped table-bordered\" width=\"100%\" cellspacing=\"0\" class=\"TBLReport\">");
  45. sb.AppendLine("<tr>");
  46. sb.AppendLine("<th nowrap='nowrap' width='4%' >SN </th>");
  47. sb.AppendLine("<th nowrap='nowrap' width='10%'> AC No </th>");
  48. sb.AppendLine("<th nowrap='nowrap' > Name </th>");
  49. string fcyCurr = dt.Rows[0]["fcy_Curr"].ToString();
  50. int totalSpan = 3;
  51. if (!string.IsNullOrWhiteSpace(fcyCurr))
  52. {
  53. sb.AppendLine("<th nowrap='nowrap' width='10%'>FCY</th>");
  54. sb.AppendLine("<th nowrap='nowrap' width='10%'>Rate </th>");
  55. sb.AppendLine("<th nowrap='nowrap' width='10%'>FCY Amount </th>");
  56. totalSpan = 6;
  57. }
  58. sb.AppendLine("<th nowrap='nowrap' width='10%'> Dr Amount </th>");
  59. sb.AppendLine("<th nowrap='nowrap' width='10%'> Cr Amount </th>");
  60. sb.AppendLine("</tr>");
  61. int sno = 0;
  62. double drTotal = 0, crTotal = 0;
  63. foreach (DataRow item in dt.Rows)
  64. {
  65. sno++;
  66. drTotal = drTotal + GetStatic.ParseDouble(item["DRTotal"].ToString());
  67. crTotal = crTotal + GetStatic.ParseDouble(item["cRTotal"].ToString());
  68. sb.AppendLine("<tr>");
  69. sb.AppendLine("<td nowrap='nowrap'> " + sno.ToString() + " </td>");
  70. sb.AppendLine("<td nowrap='nowrap'> " + item["acc_num"].ToString() + " </td>");
  71. sb.AppendLine("<td nowrap='nowrap'> " + item["acct_name"].ToString() + "</td>");
  72. if (!string.IsNullOrWhiteSpace(fcyCurr))
  73. {
  74. sb.AppendLine("<td nowrap='nowrap'>" + item["fcy_Curr"].ToString() + "</td>");
  75. sb.AppendLine("<td nowrap='nowrap'>" + item["usd_rate"].ToString() + "</td>");
  76. sb.AppendLine("<td nowrap='nowrap' align='right'>" + GetStatic.ShowDecimal(item["usd_amt"].ToString()) + "</td>");
  77. }
  78. sb.AppendLine("<td nowrap='nowrap' align='right'> " + GetStatic.ShowDecimal(item["DRTotal"].ToString()) + " </td>");
  79. sb.AppendLine("<td nowrap='nowrap' align='right'> " + GetStatic.ShowDecimal(item["cRTotal"].ToString()) + " </td>");
  80. sb.AppendLine("</tr>");
  81. }
  82. sb.AppendLine("<tr>");
  83. sb.AppendLine("<td colspan='" + totalSpan + "' width='70%' nowrap='nowrap'><div align='right'><strong>Total&nbsp;&nbsp;</strong> </div> </td>");
  84. sb.AppendLine("<td nowrap='nowrap' width='15%' align='right'> <strong>" + GetStatic.ShowDecimal(drTotal.ToString()) + " </strong> </td>");
  85. sb.AppendLine("<td nowrap='nowrap' width='15%' align='right'> <strong>" + GetStatic.ShowDecimal(crTotal.ToString()) + "</strong> </td>");
  86. sb.AppendLine("</tr>");
  87. sb.AppendLine("<tr>");
  88. sb.AppendLine("<td nowrap='nowrap' colspan='" + (totalSpan + 3) + "'><strong>Narration:&nbsp;&nbsp;</strong> " + dt.Rows[0]["tran_particular"].ToString() + " </td>");
  89. sb.AppendLine("</tr>");
  90. sb.AppendLine("</table></div>");
  91. if (!string.IsNullOrWhiteSpace(dt.Rows[0]["voucher_image"].ToString()))
  92. {
  93. voucherImg.Visible = true;
  94. voucherImg.ImageUrl = "~/doc/VoucherDoc/" + dt.Rows[0]["voucher_image"].ToString();
  95. }
  96. userId.Text = dt.Rows[0]["entry_user_id"].ToString();
  97. reportTable.InnerHtml = sb.ToString();
  98. }
  99. protected void pdf_Click(object sender, EventArgs e)
  100. {
  101. //GetStatic.GetPDF(HttpUtility.UrlDecode(hidden.Value));
  102. }
  103. protected void btnReversal_Click(object sender, EventArgs e)
  104. {
  105. var vouchertype = GetStatic.ReadQueryString("vouchertype", "");
  106. var tran_num = GetStatic.ReadQueryString("tran_num", "");
  107. if (string.IsNullOrWhiteSpace(date.Text))
  108. {
  109. GetStatic.AlertMessage(this, "Please Choose Reversal Date");
  110. return;
  111. }
  112. if (!string.IsNullOrWhiteSpace(vouchertype) && !string.IsNullOrWhiteSpace(tran_num))
  113. {
  114. var dbResult = st.GetVoucherReverse(tran_num, vouchertype, GetStatic.GetUser(), date.Text, Narration.Text);
  115. if (dbResult.ErrorCode == "0")
  116. {
  117. btnReversal.Visible = false;
  118. }
  119. reportTable.InnerHtml = dbResult.Msg;
  120. }
  121. else
  122. {
  123. GetStatic.AlertMessage(this, "Voucher Detail not found! Go back to Statement and try again");
  124. return;
  125. }
  126. }
  127. }
  128. }