protected void btngetset_Click(object sender, EventArgs e)
    {
        if (ViewState["srate"].ToString() == "")
        {
            MessageBox("Kindly select Employee");
            //txtsalemanCode.Focus();
            ViewState["srate"] = "";
        }
        else
        {
            setStateGridview();
            Qty = Convert.ToString(txtsetqty.Text.Trim());
            if (Qty == "" || Qty == "0")
            {
                Qty  = "1";
                rqty = "1";
            }
            if (txtsetqty.Text != "")
            {
                rqty = Convert.ToString(txtsetqty.Text);
                Qty  = Convert.ToString(txtsetqty.Text);
            }
            if (txtGCN.Text != "")
            {
                grdBookDetails.Columns[7].Visible = true;
                grdBookDetails.Columns[8].Visible = true;
                // grdBookDetails.Columns[10].Visible = false;
            }
            else
            {
                grdBookDetails.Columns[7].Visible = false;
                grdBookDetails.Columns[8].Visible = false;
                //  grdBookDetails.Columns[10].Visible = true;
            }
            if (DDLSelectSet.SelectedValue == "0")
            {
                loder("Kindly select bookset");
                DDLSelectSet.Focus();
            }
            else
            {
                try
                {
                    DataTable bookdescription = new DataTable();
                    bookdescription = BookSetDetails.GetDescription_Of_bookset((Convert.ToInt32(DDLSelectSet.SelectedItem.Value)), "Specimen").Tables[0];
                    Description     = bookdescription.Rows[0]["Description"].ToString();


                    DataTable dt1 = new DataTable();
                    if (Session["tempBookData"] != null)
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    else
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    foreach (GridViewRow row in grdBookDetails.Rows)
                    {
                        ((Label)row.FindControl("lblavailable")).Visible = false;
                    }
                    grdBookDetails.DataSource = dt1;
                    grdBookDetails.DataBind();
                    loder(DDLSelectSet.SelectedItem.Text + "(bookset) added successfully");
                    string jv1 = "clearBookset()";
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "as", jv1, true);
                }
                catch
                {
                }
            }
        }
    }
    protected void btngetset_Click(object sender, EventArgs e)
    {
        //Validate Bookset
        if (DDLSelectSet.SelectedValue != "0")
        {
            Qty = Convert.ToString(txtsetqty.Text.Trim());
            if (Qty != "" && Qty != "0")
            {
                DataTable dt = Other_Z.OtherBAL.GetValidate_Speciman(Convert.ToInt32(DDLSelectSet.SelectedItem.Value), Qty, txtsalemanCode.Text.Trim(), Convert.ToInt32(strFY), "", "").Tables[0];

                if (dt.Rows.Count > 0)
                {
                    if (Convert.ToInt32(dt.Rows[0][0]) >= 0)
                    {
                    }
                    else
                    {
                        //MessageBox("Out of Limit Book Set " + DDLSelectSet.SelectedItem);
                        MessageBox("Out of Limit Book Set" + DDLSelectSet.SelectedItem + "  " + " Total Limit(" + dt.Rows[0][1] + ")" + "  " + " Remaining Limit(" + dt.Rows[0][2] + ")");
                        txtsetqty.Text = "";
                        txtsetqty.Focus();
                        return;
                    }
                }
                else
                {
                    MessageBox("Please Set BookSet Limit " + DDLSelectSet.SelectedItem);
                    txtsetqty.Text = "";
                    txtsetqty.Focus();
                    return;
                }
            }
            else
            {
                MessageBox("Please Enter Quntity");
                txtsetqty.Focus();
                return;
            }
        }
        else
        {
            MessageBox("Please Select Book Set");
            DDLSelectSet.Focus();
            return;
        }

        if (ViewState["srate"].ToString() == "")
        {
            MessageBox("Kindly select Employee");
            txtsalemanCode.Focus();
            ViewState["srate"] = "";
        }
        else
        {
            setStateGridview();
            Qty = Convert.ToString(txtsetqty.Text.Trim());
            if (Qty == "" || Qty == "0")
            {
                Qty  = "1";
                rqty = "1";
            }
            if (txtsetqty.Text != "")
            {
                rqty = Convert.ToString(txtsetqty.Text);
                Qty  = Convert.ToString(txtsetqty.Text);
            }
            if (txtdoc.Text != "")
            {
                grdBookDetails.Columns[7].Visible = true;
                grdBookDetails.Columns[8].Visible = true;
                // grdBookDetails.Columns[10].Visible = false;
            }
            else
            {
                grdBookDetails.Columns[7].Visible = false;
                grdBookDetails.Columns[8].Visible = false;
                //  grdBookDetails.Columns[10].Visible = true;
            }
            if (DDLSelectSet.SelectedValue == "0")
            {
                loder("Kindly select bookset");
                DDLSelectSet.Focus();
            }
            else
            {
                try
                {
                    DataTable bookdescription = new DataTable();
                    bookdescription = BookSetDetails.GetDescription_Of_bookset((Convert.ToInt32(DDLSelectSet.SelectedItem.Value)), "Specimen").Tables[0];
                    Description     = bookdescription.Rows[0]["Description"].ToString();


                    DataTable dt1 = new DataTable();
                    if (Session["tempBookData"] != null)
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    else
                    {
                        Session["tempBookData"] = fillTempBookData("", "set");
                        dt1 = (DataTable)Session["tempBookData"];
                    }
                    foreach (GridViewRow row in grdBookDetails.Rows)
                    {
                        ((Label)row.FindControl("lblavailable")).Visible = false;
                    }
                    grdBookDetails.DataSource = dt1;
                    grdBookDetails.DataBind();
                    loder(DDLSelectSet.SelectedItem.Text + "(bookset) added successfully");
                    string jv1 = "clearBookset()";
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "as", jv1, true);
                }
                catch
                {
                }
            }
        }
    }