protected void agentname_txtchg(object sender, EventArgs e)
 {
     Result = OP.GetAgentexit(agent_no.Text, Session["BRCD"].ToString());
     if (Result == 0)
     {
         WebMsgBox.Show("Sorry Account Number Not Exist......!!", this.Page);
         agent_no.Text   = "";
         Agent_name.Text = "";
         agent_no.Focus();
         return;
     }
     Agent_name.Text = OP.GetAgentName(agent_no.Text, Session["BRCD"].ToString());
     Start_date.Focus();
 }
    protected void collection_txtchg(object sender, EventArgs e)
    {
        string sdate = Start_date.Text;
        string fdate = last_date.Text;

        // double sd=Convert.ToDouble(sdate.Split('-')[0].ToString());
        //double ld=Convert.ToDouble(fdate.Split('-')[0].ToString());
        string[] arraydt = Session["EntryDAte"].ToString().Split('/');

        if (agent_no.Text == "")
        {
            agent_no.Focus();
            WebMsgBox.Show("Please Enter the Agent no", this.Page);
            return;
        }
        else
        if (Start_date.Text == "" || last_date.Text == "")
        {
            WebMsgBox.Show("Please ENTER the DATE OR TOTAL COLLECTION IS ZERO", this.Page);
        }
        else
        if (Convert.ToDouble(sdate.Split('-')[0].ToString()) > Convert.ToDouble(fdate.Split('-')[0].ToString()) || Convert.ToDouble(sdate.Split('-')[1].ToString()) > Convert.ToDouble(fdate.Split('-')[1].ToString()) || Convert.ToDouble(arraydt[2]) < Convert.ToDouble(fdate.Split('-')[0].ToString()) || Convert.ToDouble(arraydt[1]) < Convert.ToDouble(fdate.Split('-')[1].ToString()))
        {
            WebMsgBox.Show("Please ENTER the DATE OR TOTAL COLLECTION IS ZERO", this.Page);
            Start_date.Text = "";
            Start_date.Focus();
        }
        else
        {
            // SA_name.Text = fdate.Split('-')[0].ToString();
            //SA_no.Text = fdate.Split('-')[1].ToString();
            //string ldate = Convert.ToDateTime(last_date.Text).ToString();

            double RC = OP.GetOpenClose("OPENING", fdate.Split('-')[0].ToString(), fdate.Split('-')[1].ToString(), "0", agent_no.Text, Session["BRCD"].ToString(), Session["EntryDate"].ToString(), "6");
            Total_coll.Text = RC.ToString();
            //public double GetOpenClose(string Flag, string Fyear, string FMonth, string PT, string ACC, string BRCD, string EDT)
            //double RC = OP.GetOpenClose("OPENING", fdate.Split('-')[0].ToString(), fdate.Split('-')[1].ToString(), agent_no.Text, "20031", Session["BRCD"].ToString(), ldate.Split(' ')[0].ToString()Session["EntryDate"].ToString());
            //Total_coll.Text = RC.ToString();

            commission.Text     = "";
            com_amt.Text        = "";
            td_ded.Text         = "";
            TDamt.Text          = "";
            net_commission.Text = "";
            commission.Focus();
        }
    }