using Swift.web.Library; using System; using System.Data; using System.Text; namespace Swift.web.AccountReport.AgentSummary { public partial class AgentSummaryReportDetail : System.Web.UI.Page { private SwiftLibrary _swiftLib = new SwiftLibrary(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PopulateGrid(); } } private void PopulateGrid() { string agentGrp = GetStatic.ReadQueryString("agentGrp", ""); string agentId = GetStatic.ReadQueryString("agentId", ""); string date = GetStatic.ReadQueryString("date", ""); string tranType = GetStatic.ReadQueryString("tranType", ""); string sql = "Exec proc_agentDebitBalance_weekly @FLAG ='RPT',@agentGrp=" + _swiftLib.FilterString(agentGrp) + ",@agentId=" + _swiftLib.FilterString(agentId) + " ,@date=" + _swiftLib.FilterString(date) + " ,@trantype=" + _swiftLib.FilterString(tranType) + ""; StringBuilder sb = new StringBuilder(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); DataTable dt = _swiftLib.ExecuteDataTable(sql); if (dt.Rows.Count == 0 || dt.Rows == null) { sb.AppendLine("
SN.Agent NameAgent Group Type Total"); sb.AppendLine("
No Data to display
"); tblMain.InnerHtml = sb.ToString(); return; } int sNo = 1; double firstSum = 0; double secondSum = 0; double thirdSum = 0; double fourthSum = 0; double fifthSum = 0; double sixthSum = 0; double seventhSum = 0; double totalBal = 0; foreach (DataRow item in dt.Rows) { firstSum += GetStatic.ParseDouble(item["First"].ToString()); secondSum += GetStatic.ParseDouble(item["Second"].ToString()); thirdSum += GetStatic.ParseDouble(item["Third"].ToString()); fourthSum += GetStatic.ParseDouble(item["Fourth"].ToString()); fifthSum += GetStatic.ParseDouble(item["Fifth"].ToString()); sixthSum += GetStatic.ParseDouble(item["Sixth"].ToString()); seventhSum += GetStatic.ParseDouble(item["Seventh"].ToString()); totalBal += GetStatic.ParseDouble(item["Sum Balance"].ToString()); sb.AppendLine(""); sb.AppendLine("" + sNo + ""); sb.AppendLine("" + item["acct_name"].ToString() + ""); sb.AppendLine("" + item["Agent Group"].ToString() + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["First"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Second"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Third"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Fourth"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Fifth"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Sixth"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Seventh"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["Sum Balance"].ToString()) + ""); sb.AppendLine(""); sNo++; } sb.AppendLine(""); sb.AppendLine("Total"); sb.AppendLine("" + GetStatic.ShowDecimal(firstSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(secondSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(thirdSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(fourthSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(fifthSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(sixthSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(seventhSum.ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(totalBal.ToString()) + ""); sb.AppendLine(""); tblMain.InnerHtml = sb.ToString(); } protected void pdf_Click(object sender, EventArgs e) { } } }