protected void BtnGetSpecimanDetails_Click(object sender, EventArgs e)
    {
        btn_Save.Visible        = true;
        Session["tempBookData"] = null;
        int DocNum = Convert.ToInt32(TxtDocNo.Text.ToString());


        DataTable dt = new DataTable();

        // bool condition = false;

        dt = Specimen.Get_SpecimenMasterBy_DocNum(DocNum, "0").Tables[0];

        if (dt.Rows.Count > 0)
        {
            txtGCN.Text = dt.Rows[0]["DocumentNo"].ToString();
            txtSCN.Text = dt.Rows[0]["ChallanNo"].ToString();
            //txtChalDate.Text = dt.Rows[0]["ChallanDate"].ToString();
            //txtorder.Text = dt.Rows[0]["OrderNo"].ToString();
            //txtsalemanCode.Text = dt.Rows[0]["SalesmanCode"].ToString();
            //lblSalesManName.Text = dt.Rows[0]["SalesmanName"].ToString();
            //  txtOrdDate.Text = dt.Rows[0]["OrderDate"].ToString();
            txtCNDate.Text     = dt.Rows[0]["DocumentDate"].ToString();
            txtspInstruct.Text = dt.Rows[0]["SpInstruction"].ToString();
            //DataSet ds = new DataSet();
            //ds = SpecimanDetails.GetSpecimenDatilsByEmpCode(Convert.ToString(DocNum), "documentno");

            DataTable dt1 = new DataTable();
            if (Session["tempBookData"] != null)
            {
                Session["tempBookData"] = fillTempBookData(DocNum.ToString(), "get");
                dt1 = (DataTable)Session["tempBookData"];
            }
            else
            {
                Session["tempBookData"] = fillTempBookData(DocNum.ToString(), "get");
                dt1 = (DataTable)Session["tempBookData"];
            }
            grdBookDetails.DataSource = dt1;
            grdBookDetails.DataBind();
            grdBookDetails.Columns[7].Visible = true;
            grdBookDetails.Columns[8].Visible = true;
            //DataTable dt3 = new DataTable();
            //dt3 = ds.Tables[0];
            //Session["tempBookData"] = dt3;
            grdBookDetails.Visible = true;
            //  btn_Save.Visible = false;
        }
        else
        {
            message("Record not found for document no. " + TxtDocNo.Text);
            TxtDocNo.Text = "";
            TxtDocNo.Focus();
            btn_Save.Visible = false;
        }
    }
    protected void BtnGetSpecimanDetails_Click(object sender, EventArgs e)
    {
        lblIsPartialC.Text      = "false";
        Session["tempBookData"] = null;
        if (TxtDocNo.Text == "")
        {
            message("Please enter Document no.");
            ClearData();
        }
        else
        {
            int       DocNum     = Convert.ToInt32(TxtDocNo.Text.ToString());
            DataTable dt         = new DataTable();
            bool      condition1 = false;

            dt = Specimen.Get_SpecimenMasterBy_DocNum(DocNum, "1").Tables[0];

            if (dt.Rows.Count > 0)
            {
                condition1         = Convert.ToBoolean(dt.Rows[0]["IsConfirm"]);
                condition1         = false;
                lblIsPartialC.Text = dt.Rows[0]["IsPartialConfirmed"].ToString();
            }
            if (condition1 == true)
            {
                // grdBookDetails.Visible = true;
                btncancel.Visible = false;
                message("Record not found for document no. " + TxtDocNo.Text);
                TxtDocNo.Text = "";
                TxtDocNo.Focus();
                ClearData();
            }
            else if (dt.Rows.Count == 0)
            {
                message("Record not found for document no. " + TxtDocNo.Text);
                btncancel.Visible = false;
                TxtDocNo.Text     = "";
                TxtDocNo.Focus();
                ClearData();
            }
            else
            {
                btncancel.Visible = true;

                if (dt.Rows.Count > 0)
                {
                    lbldocno.Text    = dt.Rows[0]["DocumentNo"].ToString();
                    lblchalanno.Text = dt.Rows[0]["ChallanNo"].ToString();
                    lblchaldate.Text = dt.Rows[0]["ChallanDate"].ToString();
                    lblorderno.Text  = dt.Rows[0]["OrderNo"].ToString();
                    //txtsalemanCode.Text = dt.Rows[0]["SalesmanCode"].ToString();
                    lblsalesman.Text  = dt.Rows[0]["SalesmanName"].ToString();
                    lblorderdate.Text = dt.Rows[0]["OrderDate"].ToString();
                    lbldocdate.Text   = dt.Rows[0]["DocumentDate"].ToString();
                    DataTable dt1 = new DataTable();
                    Session["tempBookData"] = fillTempBookData(DocNum.ToString(), "get");
                    dt1 = (DataTable)Session["tempBookData"];
                    grdBookDetails.DataSource = dt1;
                    grdBookDetails.DataBind();
                    grdBookDetails.Visible = true;
                    //btn_Save.Visible = false;
                    //btncancel.Visible = false;
                }
            }
        }
    }