protected void TxtTPName_TextChanged(object sender, EventArgs e)
    {
        try
        {
            string   custno = TxtTPName.Text;
            string[] CT     = custno.Split('_');
            if (CT.Length > 0)
            {
                TxtTPName.Text   = CT[0].ToString();
                TxtTProcode.Text = CT[1].ToString();
                //TxtGLCD.Text = CT[2].ToString();
                string[] GLS = BD.GetAccTypeGL(TxtTProcode.Text, Session["BRCD"].ToString()).Split('_');
                ViewState["DRGL"]       = GLS[1].ToString();
                AutoTAccName.ContextKey = Session["BRCD"].ToString() + "_" + TxtTProcode.Text + "_" + ViewState["DRGL"].ToString();

                int GL = 0;
                int.TryParse(ViewState["DRGL"].ToString(), out GL);
                TxtTAccno.Focus();
                if (TxtTPName.Text == "")
                {
                    WebMsgBox.Show("Please enter valid Product code", this.Page);
                    TxtTProcode.Text = "";
                    TxtTProcode.Focus();
                }
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
            //Response.Redirect("FrmLogin.aspx", true);
        }
    }
    protected void TxtTProcode_TextChanged(object sender, EventArgs e)
    {
        try
        {
            if (TxtTProcode.Text == "")
            {
                TxtTPName.Text = "";
                TxtTAccno.Focus();
                goto ext;
            }
            int    result = 0;
            string GlS1;
            string CHK = BD.GetGlDetails(Session["BRCD"].ToString(), TxtTProcode.Text, TxtTAccno.Text, "CHEQUE");
            if (CHK == null && Ddl_type.SelectedIndex == 2)
            {
                WebMsgBox.Show("Product Code is Not in CBB Group!.....", this.Page);
                TxtTProcode.Text = "";
                TxtTPName.Text   = "";
                TxtTProcode.Focus();
                return;
            }

            else
            {
                int.TryParse(TxtTProcode.Text, out result);
                TxtTPName.Text = customcs.GetProductName(result.ToString(), Session["BRCD"].ToString());
                GlS1           = BD.GetAccTypeGL(TxtTProcode.Text, Session["BRCD"].ToString());
                if (GlS1 != null)
                {
                    string[] GLS = GlS1.Split('_');
                    ViewState["DRGL"]       = GLS[1].ToString();
                    AutoTAccName.ContextKey = Session["BRCD"].ToString() + "_" + TxtTProcode.Text + "_" + ViewState["DRGL"].ToString();
                    int GL = 0;
                    int.TryParse(ViewState["DRGL"].ToString(), out GL);
                    TxtTAccno.Focus();
                }
                else
                {
                    WebMsgBox.Show("Enter Valid Product code!....", this.Page);
                    TxtTProcode.Text = "";
                    TxtTPName.Text   = "";
                    TxtTProcode.Focus();
                }
            }
            ext :;
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
            //Response.Redirect("FrmLogin.aspx", true);
        }
    }
    protected void Ddl_type_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (Ddl_type.SelectedValue == "1")
            {
                //Fetch 99 gl to prdcode and Cash in hand glname
                string   NM   = BD.GetGlDetails(Session["BRCD"].ToString(), "", "", "CASH");
                string[] GLNM = NM.Split('_');

                TxtTPName.Text      = GLNM[1].ToString();
                TxtTProcode.Text    = GLNM[0].ToString();
                TxtTProcode.Enabled = false;
                TxtTPName.Enabled   = false;
                DIV_TPRDACC.Visible = true;
                DIV1.Visible        = false;
                DIV_TACC.Visible    = false;
            }
            else if (Ddl_type.SelectedValue == "2")
            {
                //Fecth only CBB glgroup Account
                TxtTProcode.Enabled = true;
                TxtTPName.Enabled   = true;
                DIV_TPRDACC.Visible = true;
                DIV_TACC.Visible    = false;
                TxtTPName.Text      = "";
                TxtTProcode.Text    = "";
                TxtTProcode.Focus();
            }
            else if (Ddl_type.SelectedValue == "3")
            {
                TxtTProcode.Enabled = true;
                TxtTPName.Enabled   = true;
                DIV_TPRDACC.Visible = true;
                DIV_TACC.Visible    = true;
                TxtTPName.Text      = "";
                TxtTProcode.Text    = "";
                TxtTProcode.Focus();
            }
            else
            {
                DIV_TPRDACC.Visible = false;
            }
        }
        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }