using Swift.DAL.AccountReport; using Swift.web.Library; using System; using System.Data; using System.Web; namespace Swift.web.AccountReport.AccountStatement { public partial class StatementResultDollor : System.Web.UI.Page { private SwiftLibrary _sl = new SwiftLibrary(); private AccountStatementDAO st = new AccountStatementDAO(); protected void Page_Load(object sender, EventArgs e) { _sl.CheckSession(); if (!IsPostBack) { //startDate.ReadOnly = true; //endDate.ReadOnly = true; startDate.Text = GetStatic.ReadQueryString("startDate", ""); endDate.Text = GetStatic.ReadQueryString("endDate", ""); acNumber.Text = GetStatic.ReadQueryString("acNum", ""); acName.Text = GetStatic.ReadQueryString("acName", ""); GenerateReport(); } } private void GenerateReport() { var dt = st.GetStatementResultDollor(acNumber.Text, startDate.Text, endDate.Text); if (dt == null || dt.Rows.Count == 0) { return; } var sb = new System.Text.StringBuilder(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); double DRTotal = 0, cRTotal = 0, BAlance = 0, OpenBalnce = 0; int cntDR = 0, cntCR = 0, sn = 0; foreach (DataRow item in dt.Rows) { sb.AppendLine(""); if (sn == 0) { OpenBalnce = GetStatic.ParseDouble(item["end_clr_balance"].ToString()); } sn++; DRTotal += GetStatic.ParseDouble(item["DRTotal"].ToString()); cRTotal += GetStatic.ParseDouble(item["cRTotal"].ToString()); BAlance += GetStatic.ParseDouble(item["end_clr_balance"].ToString()) + GetStatic.ParseDouble(item["cRTotal"].ToString()) - GetStatic.ParseDouble(item["DRTotal"].ToString()); if (GetStatic.ParseDouble(item["DRTotal"].ToString()) > 0) { cntDR++; } if (GetStatic.ParseDouble(item["cRTotal"].ToString()) > 0) { cntCR++; } string amt = (GetStatic.ParseDouble(item["DRTotal"].ToString()) != 0 ? item["DRTotal"].ToString() : ""); string drLink = ""; drLink += amt + ""; string cramt = (GetStatic.ParseDouble(item["cRTotal"].ToString()) != 0 ? item["cRTotal"].ToString() : ""); string crLink = ""; crLink += amt + ""; sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); } sb.AppendLine("
Tran DateDescriptionDr AmountCr AmountBalance
" + (item["TRNDate"].ToString() == "1900.01.01" ? " " : item["TRNDate"]) + " " + item["tran_rmks"] + " " + GetStatic.ShowDecimal(item["DRTotal"].ToString()) + " " + GetStatic.ShowDecimal(item["cRTotal"].ToString()) + " " + GetStatic.ShowDecimal(BAlance.ToString()) + " " + (BAlance < 0 ? "DR" : "CR") + "
"); tableBody.InnerHtml = sb.ToString(); openingBalance.Text = GetStatic.ShowDecimal(OpenBalnce.ToString()); crCount.Text = cntCR.ToString(); drCount.Text = cntDR.ToString(); drAmt.Text = GetStatic.ShowDecimal(DRTotal.ToString()); crAmt.Text = GetStatic.ShowDecimal(cRTotal.ToString()); drOrCr.Text = (BAlance < 0 ? "DR" : "CR"); closingBalanceAmt.Text = GetStatic.ShowDecimal(BAlance.ToString()); } protected void goBtn_Click(object sender, EventArgs e) { GenerateReport(); } protected void pdf_Click(object sender, EventArgs e) { GetStatic.GetPDF(HttpUtility.UrlDecode(hidden.Value)); } } }