Esempio n. 1
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     if (GridView1.Rows.Count == 1)
     {
         Gr_leitourgikwn.Delete();
         GridView5.DataBind();
         CheckBox2.Checked = false;
         TextBox28.Text    = "0";
         CheckBox2.Enabled = true;
         Check_Leit.DataBind();
         Check_Leit_LC.DataBind();
         GridView3.DataBind();
         GridView4.DataBind();
         DropDownList5.SelectedValue = "10000";
     }
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Session["New_ypologo_MultyBanks"] = DropDownList9.SelectedValue;

            if (CheckBox1.Checked)
            {
                TextBox15.Text = DropDownList4.Text;
            }
            else
            {
                TextBox15.Text = TextBox14.Text;
            }

            Esoda_Arxis.DataBind();



            if (DropDownList8.SelectedValue == "0" || DropDownList9.SelectedValue == "0" ||
                (TextBox25.Text == "0" && TextBox7.Text.Length == 0 && FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Xrisi_USD() == 0) || (TextBox25.Text == "1" && (TextBox24.Text.Length == 0 && TextBox7.Text.Length == 0) && FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Xrisi_USD() == 0) ||
                DropDownList5.SelectedValue == "0" || TextBox15.Text == "0" || TextBox8.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('Δεν έχει συμπληρωθεί το Έτος ή το Είδος Εσόδου ή το Ποσό ή Δεν έχει επιλεγεί Μήνας Εσόδου !!!!');", true);
            }
            else
            {
                TextBox18.Text = "28/" + DropDownList5.Text + "/" + DropDownList8.Text;
                DateTime dateTime = Convert.ToDateTime(this.TextBox18.Text.Trim(), new CultureInfo("en-GB"));
                this.TextBox18.Text = dateTime.AddDays(30).ToString("dd/MM/yyyy");

                if (Convert.ToDateTime(TextBox8.Text) < Convert.ToDateTime(TextBox18.Text))
                {
                    if (DropDownList9.SelectedValue == "12")
                    {
                        Proig_Diax_Met_GR.Delete();
                        Proig_Diax_Met_GR.Update();
                        Proig_Diax_Met_GR.Insert();

                        if (TextBox16.Text == "1")
                        {
                            TextBox19.Text = "1";
                        }
                        else
                        {
                            TextBox19.Text = (Convert.ToInt16(TextBox19.Text) + 1).ToString();
                        }

                        Session["Ypo_GR_Etos"] = DropDownList8.Text;
                        Session["Ypol_GR"]     = TextBox5.Text;
                        Session["Ypol_Xrisi"]  = TextBox19.Text;

                        if (TextBox20.Text == "1")
                        {
                            Gr_leitourgikwn.Insert();
                            Gr_leitourgikwn.Delete();
                        }
                        if (TextBox21.Text == "1")
                        {
                            Gr_DimosiesS.Insert();
                        }

                        Nea_Xrisi.Delete();
                        Nea_Xrisi.Update();
                        Nea_Xrisi.Insert();
                    }
                    else
                    {
                        if (FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isotimia() == 1)
                        {
                            decimal isot;
                            if (DropDownList9.SelectedValue == "11")
                            {
                                isot = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Mera_Theti(TextBox27.Text);
                            }
                            else
                            {
                                isot = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Mera(TextBox27.Text);
                            }

                            if (TextBox7.Text.Length == 0 && TextBox30.Text.Length == 0)
                            {
                                TextBox7.Text = Math.Round((Convert.ToDecimal(TextBox24.Text) / isot), 2).ToString();
                            }
                            if (TextBox24.Text.Length == 0 && TextBox30.Text.Length == 0)
                            {
                                TextBox24.Text = Math.Round((Convert.ToDecimal(TextBox7.Text) * isot), 2).ToString();
                            }
                        }
                    }

                    if (DropDownList9.SelectedValue == "20")
                    {
                        Tokoi.Insert();
                    }
                    else
                    {
                        Esoda_Arxis.Insert();
                    }

                    //        if (DropDownList9.SelectedValue != "12")
                    //         {
                    if (!CheckBox2.Checked)
                    {
                        Kin_Logariasmon.Insert();
                        if (DropDownList9.SelectedValue != "20")
                        {
                            Del_Esoda_log.Insert();
                        }
                    }
                    else
                    {
                        Session["Etos"]       = DropDownList8.Text;
                        Session["Month"]      = DropDownList5.Text;
                        Session["Xrisi"]      = TextBox19.Text;
                        Session["Desc"]       = TextBox6.Text;
                        Session["GR_eisp"]    = TextBox5.Text;
                        Session["Poso"]       = TextBox7.Text;
                        Session["Poso_LC"]    = TextBox24.Text;
                        Session["Date_Apost"] = TextBox8.Text;
                        Session["Date_Entry"] = TextBox10.Text;
                        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(730/2);var Mtop = (screen.height/2)-(600/2);window.open( '../Esoda/Multy_Logariasmoi.aspx', null, 'height=550,width=660,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no, left=\'+Mleft+\'' );", true);
                    }
                    //         }
                    // Logariasmoi.Update();

                    if (DropDownList9.SelectedValue == "12")
                    {
                        //  Session["Ypo_GR_Etos"] = DropDownList8.Text;
                        //  Session["Ypol_GR"] = TextBox5.Text;
                        //  Session["Ypol_Xrisi"] = TextBox19.Text;
                        //     Server.Transfer("~/Esoda/Delete_Last_GR.aspx");
                        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "var Mleft = (screen.width/2)-(760/2);var Mtop = (screen.height/2)-(700/2);window.open( 'Neos_Ypologos_Alagi_Xrisi.aspx', null, 'height=800,width=793,status=no,toolbar=no,scrollbars=yes,menubar=no,location=no, left=\'+Mleft+\'' );", true);
                    }
                    else
                    {
                        if (!CheckBox2.Checked)
                        {
                            Response.Redirect("Esoda.aspx");
                        }
                    }



                    Button1.Enabled = false;
                    Button3.Enabled = false;
                    Button4.Visible = false;
                }


                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                            "alertMessage",
                                                            "alert('Λανθασμένη επιλογή Ημερομηνίας - Δεν μπορεί να επιλεγεί μήνας προγενέστερος του τελευταίου καταχωρημένου Γραμματείου  !!!');", true);
                }
            }


            Esoda_Arxis.DataBind();
            Esoda_Arxis_Tokoi.DataBind();
        }