Example #1
0
        public void FillGrid(string fdat, string tdat, string acc)
        {
            try
            {
                dt_ = new DataTable();
                //string str = "SELECT * FROM v_incomexp where accno ='" + acc + "' and expensesdat between '" + fdat + "' and '" + tdat + "'  order by expenceid asc";


                ////dt_ = DBConnection.GetQueryData(" SELECT * FROM v_profloss where accno = " + acc + " and Date between '" + fdat + "' and '" + tdat + "'");
                //dt_ = DBConnection.GetQueryData(str);


                using (var cmd = new SqlCommand("sp_incomexp", con))
                    using (var da = new SqlDataAdapter(cmd))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@accno", acc.Trim());
                        cmd.Parameters.AddWithValue("@fdat ", fdat.Trim());
                        cmd.Parameters.AddWithValue("@tdat ", tdat.Trim());
                        cmd.Parameters.AddWithValue("@companyid ", Session["CompanyID"].ToString());
                        cmd.Parameters.AddWithValue("@branchid ", Session["BranchID"].ToString());

                        da.Fill(dt_);
                    }

                if (dt_.Rows.Count > 0)
                {
                    lblfrmdat.Text = FrmDat;
                    lbltodat.Text  = Todat;


                    GVIncomExp.DataSource = dt_;
                    GVIncomExp.DataBind();

                    //For Details
                    float GTotals = 0;
                    for (int j = 0; j < GVIncomExp.Rows.Count; j++)
                    {
                        Label lbl_overallbal = (Label)GVIncomExp.Rows[j].FindControl("lbl_availbal");

                        GTotals += Convert.ToSingle(lbl_overallbal.Text);
                    }

                    lbl_ttl.Text = "Total Balance:";
                    lblttl.Text  = GTotals.ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public void FillGrid(string fdat, string tdat)
        {
            try
            {
                dt_ = new DataTable();

                string query = " SELECT * FROM v_incomexp where expensesdat between '" + fdat + "' and '" + tdat + "'  order by expenceid asc ";
                //where expensesdat between '" + fdat + "' and '" + tdat + "'";

                dt_ = DBConnection.GetQueryData(query);

                if (dt_.Rows.Count > 0)
                {
                    lblfrmdat.Text = FrmDat;
                    lbltodat.Text  = Todat;

                    GVIncomExp.DataSource = dt_;
                    GVIncomExp.DataBind();

                    //For Details
                    //float GTotal = 0;
                    Label total = null;

                    for (int j = 0; j < GVIncomExp.Rows.Count; j++)
                    {
                        total = (Label)GVIncomExp.Rows[j].FindControl("lbl_overallbal");

                        //GTotal += Convert.ToSingle(total.Text);
                    }

                    lblttl.Text = total.Text.Trim();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }