private void BindWME(string textSearch, string dropDown) { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); BusinessLogic bl = new BusinessLogic(sDataSource); string connection = Request.Cookies["Company"].Value; string Username = Request.Cookies["LoggedUserName"].Value; string branch = Request.Cookies["Branch"].Value; DataSet ds = bl.GetUserTaskList(connection, textSearch, dropDown, Username, branch); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { GrdWME.DataSource = ds; GrdWME.DataBind(); } } else { GrdWME.DataSource = null; GrdWME.DataBind(); } }
private void BindWME() { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); BusinessLogic bl = new BusinessLogic(sDataSource); int WorkId = 0; int empNo = 0; string dExpStrdate = string.Empty; string dExpEnddate = string.Empty; string dCreatdate = string.Empty; string status = string.Empty; if (txtSworkId.Text.Trim() != string.Empty) { WorkId = Convert.ToInt32(txtSworkId.Text.Trim()); } if (drpsIncharge.Text.Trim() != string.Empty) { empNo = Convert.ToInt32(drpsIncharge.Text.Trim()); } if (txtStartDate.Text.Trim() != string.Empty) { dExpStrdate = txtStartDate.Text.Trim(); } if (txtEndDate.Text.Trim() != string.Empty) { dExpEnddate = txtEndDate.Text.Trim(); } if (txtsCreationDate.Text.Trim() != string.Empty) { dCreatdate = txtsCreationDate.Text.Trim(); } if (drpsIncharge.Text.Trim() != string.Empty) { status = drpsStatus.Text.Trim(); } DataSet ds = bl.SearchWME(WorkId, empNo, dExpStrdate, dExpEnddate, dCreatdate, status); GrdWME.DataSource = ds; GrdWME.DataBind(); }
private void BindWME(string textSearch, string dropDown) { BusinessLogic bl = new BusinessLogic(sDataSource); string branch = string.Empty; string total = string.Empty; string connection = Request.Cookies["Company"].Value; string sMonth = DateTime.Now.ToString("MM"); DateTime now = DateTime.Now; var startDate = new DateTime(now.Year, now.Month, 1); var start = startDate.ToString("yyyy-MM-dd"); var endDate = startDate.AddMonths(1).AddDays(-1); var end = endDate.ToString("yyyy-MM-dd"); string usernam = Request.Cookies["LoggedUserName"].Value; double Tottot = 0.00; double Totgp = 0.00; double totgpmon = 0.00; double dailysalestot = 0.00; int dailyqty = 0; int monthlyqty = 0; string sCustomer = string.Empty; connection = Request.Cookies["Company"].Value; usernam = Request.Cookies["LoggedUserName"].Value; // BusinessLogic bl = new BusinessLogic(); DataSet dsd = bl.GetBranch(connection, usernam); DataSet ds = new DataSet(); sCustomer = Convert.ToString(dsd.Tables[0].Rows[0]["DefaultBranchCode"]); // drpBranch.ClearSelection(); // ListItem li = drpBranch.Items.FindByValue(System.Web.HttpUtility.HtmlDecode(sCustomer)); // if (li != null) li.Selected = true; if (dsd.Tables[0].Rows[0]["BranchCheck"].ToString() == "True") { ds = bl.ListBranch(connection, usernam); } else { //dpshow.Visible = false; ds = bl.ListBranch1(connection, usernam, sCustomer); } // DataSet ds = bl.getdashboardreport(connection); // DataSet ds = bl.ListBranch(connection, usernam); // DataSet ds; DataTable dt; DataRow drNew; DataSet dstt = new DataSet(); DataColumn dc; DataSet dst = new DataSet(); dt = new DataTable(); dt.Columns.Add(new DataColumn("BranchCode")); dt.Columns.Add(new DataColumn("Branchname")); dt.Columns.Add(new DataColumn("DailySales")); dt.Columns.Add(new DataColumn("MonthlySales")); dt.Columns.Add(new DataColumn("Todaysalesquantity")); dt.Columns.Add(new DataColumn("monthlysalesquantity")); // dt.Columns.Add(new DataColumn("DailySalesforgp")); // dt.Columns.Add(new DataColumn("montlySalesforgp")); dt.Columns.Add(new DataColumn("Amount")); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { DataRow dr_final113 = dt.NewRow(); dr_final113["BranchCode"] = dr["BranchCode"].ToString(); dr_final113["Branchname"] = dr["Branchname"].ToString(); string branch1 = dr["BranchCode"].ToString(); //BusinessLogic bl = new BusinessLogic(sDataSource); DataSet db = bl.getdailysalesreport1(connection, dr["BranchCode"].ToString()); if (db != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow drd in db.Tables[0].Rows) { dr_final113["DailySales"] = (Convert.ToDecimal(drd["DailySales"])).ToString("#0.00"); // dr_final113["DailySalesforgp"] = (Convert.ToDecimal(drd["DailySales"])) - (Convert.ToDecimal(drd["DailySalesforgp"])); dr_final113["Todaysalesquantity"] = drd["Todaysalesquantity"].ToString(); } } else { dr_final113["DailySales"] = 0; // dr_final113["DailySalesforgp"] = 0; dr_final113["Todaysalesquantity"] = 0; } } else { dr_final113["DailySales"] = 0; // dr_final113["DailySalesforgp"] = 0; dr_final113["Todaysalesquantity"] = 0; } DataSet dm = bl.getmonthlysalesreport1(connection, dr["BranchCode"].ToString()); if (dm != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow drm in dm.Tables[0].Rows) { dr_final113["MonthlySales"] = (Convert.ToDecimal(drm["MonthlySales"])).ToString("#0.00"); // dr_final113["montlySalesforgp"] = (Convert.ToDecimal(drm["MonthlySales"])) - (Convert.ToDecimal(drm["montlySalesforgp"])); dr_final113["monthlysalesquantity"] = drm["monthlysalesquantity"].ToString(); } } else { dr_final113["MonthlySales"] = 0; // dr_final113["montlySalesforgp"] = 0; dr_final113["monthlysalesquantity"] = 0; } } else { dr_final113["MonthlySales"] = 0; // dr_final113["montlySalesforgp"] = 0; dr_final113["monthlysalesquantity"] = 0; } //if (ds.Tables[0].Rows[0]["totalsales"] != null) // total = (ds.Tables[0].Rows[0]["totalsales"]).ToString(); // GrdWME.DataSource = ds; //GrdWME.DataBind(); Tottot = Tottot + Convert.ToDouble(dr_final113["MonthlySales"]); dailysalestot = dailysalestot + Convert.ToDouble(dr_final113["DailySales"]); dailyqty = dailyqty + Convert.ToInt32(dr_final113["Todaysalesquantity"]); monthlyqty = monthlyqty + Convert.ToInt32(dr_final113["monthlysalesquantity"]); // Totgp = Totgp + (Convert.ToDouble(dr_final113["DailySalesforgp"])); // totgpmon = totgpmon + (Convert.ToDouble(dr_final113["montlySalesforgp"])); dt.Rows.Add(dr_final113); } DataRow dr_final11 = dt.NewRow(); dt.Rows.Add(dr_final11); DataRow dr_final88 = dt.NewRow(); dr_final88["Branchname"] = "Total"; dr_final88["MonthlySales"] = Tottot.ToString("#0.00"); // dr_final88["DailySalesforgp"] = Totgp.ToString("#0.00"); // dr_final88["montlySalesforgp"] = totgpmon.ToString("#0.00"); dr_final88["DailySales"] = dailysalestot.ToString("#0.00"); dr_final88["Todaysalesquantity"] = dailyqty.ToString("#0"); dr_final88["monthlysalesquantity"] = monthlyqty.ToString("#0"); dt.Rows.Add(dr_final88); dst.Tables.Add(dt); GrdWME.DataSource = dst; GrdWME.DataBind(); } else { GrdWME.DataSource = null; GrdWME.DataBind(); } } else { GrdWME.DataSource = null; GrdWME.DataBind(); } }