public void FillGrid(string fdat, string tdat) { try { dt_ = new DataTable(); string query = " SELECT * FROM v_expence where expensesdate between '" + fdat + "' and '" + tdat + "'"; dt_ = DBConnection.GetQueryData(query); lblfrmdat.Text = FrmDat; lbltodat.Text = Todat; GVProf.DataSource = dt_; GVProf.DataBind(); //For Details float GTotal = 0; for (int j = 0; j < GVProf.Rows.Count; j++) { Label total = (Label)GVProf.Rows[j].FindControl("lbl_amt"); GTotal += Convert.ToSingle(total.Text); } lblttl.Text = GTotal.ToString(); } catch (Exception ex) { throw ex; } }
public void FillGrid(string fdat, string tdat, string acc) { try { dt_ = new DataTable(); dt_ = DBConnection.GetQueryData(" SELECT * FROM v_expence where accno = '" + acc + "' and expensesdat between '" + fdat + "' and '" + tdat + "' and CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "'"); lblfrmdat.Text = FrmDat; lbltodat.Text = Todat; GVProf.DataSource = dt_; GVProf.DataBind(); //For Details float GTotals = 0; for (int j = 0; j < GVProf.Rows.Count; j++) { Label total = (Label)GVProf.Rows[j].FindControl("lbl_amt"); GTotals += Convert.ToSingle(total.Text); } lblttl.Text = GTotals.ToString(); } catch (Exception ex) { throw ex; } }
public void FillGrid(string fdat, string tdat, string Pronam) { try { dt_ = new DataTable(); query = " select * from Products where ProductName='" + Pronam + "'"; dt_ = DBConnection.GetQueryData(query); if (dt_.Rows.Count > 0) { proid = dt_.Rows[0]["ProductID"].ToString(); } query = " SELECT * FROM v_proft where ProductID='" + proid + "' and MSal_dat between '" + fdat + "' and '" + tdat + "'"; dt_ = DBConnection.GetQueryData(query); lblfrmdat.Text = FrmDat; lbltodat.Text = Todat; if (dt_.Rows.Count > 0) { GVProf.DataSource = dt_; GVProf.DataBind(); } //For Details decimal disc = 0; decimal salrat = 0; decimal discamt = 0; decimal diff = 0; for (int j = 0; j < GVProf.Rows.Count; j++) { Label lblsatrat = (Label)GVProf.Rows[j].FindControl("lbl_satrat"); Label lbdisc = (Label)GVProf.Rows[j].FindControl("lbl_disc"); Label lbdiscamt = (Label)GVProf.Rows[j].FindControl("lb_discamt"); Label lb_diff = (Label)GVProf.Rows[j].FindControl("lbl_diff"); salrat += Convert.ToDecimal(lblsatrat.Text); disc += Convert.ToDecimal(lbdisc.Text); discamt += Convert.ToDecimal(lbdiscamt.Text); diff += Convert.ToDecimal(lb_diff.Text); } lblttl.Text = salrat.ToString(); lbldisc.Text = disc.ToString(); lbl_discamt.Text = discamt.ToString(); lbl_diff.Text = diff.ToString(); } catch (Exception ex) { throw ex; } }
public void FillGrid(string fdat, string tdat) { try { SqlCommand command = new SqlCommand(); command.Connection = con; dt_ = new DataTable(); //dt_ = DBConnection.GetQueryData(" SELECT * FROM v_proft where MSal_dat between '" + fdat + "' and '" + tdat + "' order by MSal_id desc "); SqlDataAdapter adapter = new SqlDataAdapter(); //SqlCommand cmd = new SqlCommand("usp_GetABCD", con); //cmd.CommandType = CommandType.StoredProcedure; //adapter.SelectCommand = cmd; //adapter.Fill(dt_); con.Open(); command.Parameters.Clear(); command.CommandText = "sp_proft"; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddWithValue("@frmdat", fdat); command.Parameters.AddWithValue("@todat", tdat); command.ExecuteNonQuery(); adapter.SelectCommand = command; adapter.Fill(dt_); lblfrmdat.Text = FrmDat; lbltodat.Text = Todat; GVProf.DataSource = dt_; GVProf.DataBind(); //For Details decimal GTotal = 0; // Balance for (int j = 0; j < GVProf.Rows.Count; j++) { Label total = (Label)GVProf.Rows[j].FindControl("lbl_diff"); if (total.Text != "") { GTotal += Convert.ToDecimal(total.Text); } } lbl_diff.Text = GTotal.ToString(); con.Close(); } catch (Exception ex) { throw ex; } }
public void FillGrid(string proid, string msalid) { try { dt_ = new DataTable(); dt_ = DBConnection.GetQueryData(" SELECT * FROM v_proft where ProductID = '" + proid + "' and MSal_id = '" + msalid + "'"); GVProf.DataSource = dt_; GVProf.DataBind(); //For Details decimal disc = 0; decimal salrat = 0; decimal discamt = 0; decimal diff = 0; for (int j = 0; j < GVProf.Rows.Count; j++) { Label lblsatrat = (Label)GVProf.Rows[j].FindControl("lbl_satrat"); Label lbdisc = (Label)GVProf.Rows[j].FindControl("lbl_disc"); Label lbdiscamt = (Label)GVProf.Rows[j].FindControl("lb_discamt"); Label lb_diff = (Label)GVProf.Rows[j].FindControl("lbl_diff"); salrat += Convert.ToDecimal(lblsatrat.Text); disc += Convert.ToDecimal(lbdisc.Text); discamt += Convert.ToDecimal(lbdiscamt.Text); diff += Convert.ToDecimal(lb_diff.Text); } lblttl.Text = salrat.ToString(); lbldisc.Text = disc.ToString(); lbl_discamt.Text = discamt.ToString(); lbl_diff.Text = diff.ToString(); } catch (Exception ex) { throw ex; } }
public void FillDAT(string fdat, string tdat) { try { dt_ = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand("sp_GetNetProtdattDat", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Fdat", fdat.Trim()); cmd.Parameters.AddWithValue("@Ldat", tdat.Trim()); adapter.SelectCommand = cmd; adapter.Fill(dt_); if (dt_.Rows.Count > 0) { GVProf.DataSource = dt_; GVProf.DataBind(); } //For Details decimal diff = 0; for (int j = 0; j < GVProf.Rows.Count; j++) { Label lbl_netprof = (Label)GVProf.Rows[j].FindControl("lbl_netprof"); diff += Convert.ToDecimal(lbl_netprof.Text); } lbl_proff.Text = diff.ToString(); } catch (Exception ex) { throw ex; } }