protected void Button1_Click(object sender, EventArgs e)
        {
            Proig_Xrisis.DataBind();
            Calc_Sum_Poig_Metaf.DataBind();

            TextBox2.Text = GridView2.Rows[0].Cells[0].Text;
            TextBox5.Text = GridView2.Rows[0].Cells[1].Text;
            Session["Calc_SUM_GR_Etos"] = TextBox2.Text;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // if (!string.IsNullOrEmpty((string)Session["Del_GR_Etos"]))
            //   {
            //   TextBox1.Text = (string)Session["Del_GR_Etos"];
            //    }
            TextBox4.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isotimia().ToString();
            if (FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isotimia() == 1)
            {
                TextBox5.Visible = true;
            }
            else
            {
                TextBox5.Visible = false;
            }
            if (!string.IsNullOrEmpty((string)Session["Last_GR_Etos"]))
            {
                Int32 ConLast;

                ConLast       = Convert.ToInt32((string)Session["Last_GR_Etos"]);
                TextBox1.Text = Convert.ToString(ConLast - 1);

                string Xrisi = TextBox1.Text;
                string strConn1;

                strConn1 = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
                SqlConnection Conn = new SqlConnection(strConn1);
                Conn.Open();

                string sqltitle1;
                sqltitle1  = "SELECT ISNULL(MAX(Int1),1) FROM Xrisi";
                sqltitle1 += " WHERE (Etos ='" + Xrisi + "')";


                SqlCommand com = new SqlCommand(sqltitle1, Conn);

                Int32 CurrentQty2;
                CurrentQty2 = Convert.ToInt32(com.ExecuteScalar());

                TextBox3.Text = Convert.ToString(CurrentQty2);

                Proig_Xrisis.DataBind();
                Calc_Sum_Poig_Metaf.DataBind();
            }
        }
        protected void DropDownList8_SelectedIndexChanged(object sender, EventArgs e)
        {
            int etos = Convert.ToInt16(DropDownList8.SelectedValue);



            TextBox19.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.XrisiTR(etos).ToString();



            //------------------
            if (DropDownList8.SelectedValue != "0")
            {
                TextBox23.Text = FINANCIAL_MANAGEMENT.App_Code.xrisi.XrisiPL(etos).ToString();
            }
            //-------------------


            Esoda_Arxis.DataBind();
            TextBox16.Text              = "";
            Button4.Visible             = false;
            TextBox7.Text               = "";
            TextBox24.Text              = "";
            TextBox5.Text               = "";
            DropDownList9.SelectedIndex = 0;
            DropDownList5.Items.Clear();
            DropDownList5.Items.Add(new ListItem(" Επιλογή Μηνός ...", "0"));
            DropDownList5.DataBind();

            //MAX number of Gramm. Eisprajeis
            if (DropDownList8.SelectedValue != "0")
            {
                string Etos_Y = DropDownList8.Text;
                string strConn;

                strConn = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
                SqlConnection Conn = new SqlConnection(strConn);
                Conn.Open();

                string sqltitle;
                sqltitle  = "SELECT (ISNULL(MAX(GR_Eiprajeis),0))+1 FROM Esoda";
                sqltitle += " WHERE (Etos ='" + Etos_Y + "')";


                // sqltitle += " AND (edition ='" + edition + "')";
                SqlCommand com = new SqlCommand(sqltitle, Conn);

                Int32 CurrentQty;
                CurrentQty = Convert.ToInt32(com.ExecuteScalar());
                if (CurrentQty != 0)
                {
                    //  TextBox5.Text = Convert.ToString(CurrentQty);
                    TextBox16.Text = Convert.ToString(CurrentQty);
                    TextBox1.Text  = Convert.ToString(CurrentQty);
                    // I WANT TO SHOW HERE THE TEXTBOX3 FROM THE DATABASE QTY
                    if (Convert.ToString(CurrentQty) == "1")
                    {
                        Calc_Sum_Poig_Metaf.DataBind();
                        Session["Last_GR_Etos"] = DropDownList8.Text;
                        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( '../Parametroi/New_Year_Metafora.aspx', null, 'height=800,width=800,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no, left=\'+Mleft+\'' );", true);
                        DropDownList9.SelectedValue = "12";
                        //TextBox7.Text = (string)Session["Calc_SUM_GR_Etos"];
                    }
                }

                Conn.Close();
            }



            Button3.Enabled = true;
            Button6.Enabled = true;
            TextBox22.Text  = DropDownList8.SelectedValue;
            DropDownList12.SelectedValue = "7";
            if (FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Xrisi_mina_Tokon() == 0)
            {
                DropDownList9.Items.Remove(DropDownList9.Items.FindByValue("20"));
            }
        }