/// <summary>
        /// Procedura selecteaza datele unei luni
        /// </summary>
        /// <param name="data">Data de inceput a lunii</param>
        /// <param name="angajatorId">Id-ul angajatorului</param>
        /// <returns>Returneaza un obiect care contine datele lunii</returns>
        public LunaData GetDetalii(DateTime data, int angajatorId)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@DataCurenta", SqlDbType.DateTime, 8),
                new SqlParameter("@AngajatorID", SqlDbType.Int, 4)
            };

            parameters[0].Value = data;
            parameters[1].Value = angajatorId;

            using (DataSet detaliiLunaActiva = RunProcedure("GetLunaDetaliiByData", parameters, "InfoLunaByData"))
            {
                LunaData lunaData = new LunaData();

                if (detaliiLunaActiva.Tables["InfoLunaByData"].Rows.Count > 0)
                {
                    DataRow rowDetalii = detaliiLunaActiva.Tables["InfoLunaByData"].Rows[0];

                    lunaData.AngajatorId     = (int)rowDetalii["AngajatorID"];
                    lunaData.LunaId          = (int)rowDetalii["LunaID"];
                    lunaData.Data            = (DateTime)rowDetalii["Data"];
                    lunaData.ProcentInflatie = float.Parse(rowDetalii["ProcentInflatie"].ToString());
                    lunaData.Activ           = (bool)rowDetalii["Activ"];
                }
                else
                {
                    lunaData.LunaId = -1;
                }

                return(lunaData);
            }
        }
        /// <summary>
        /// Procedura genereaza situatia lunara unui angajat care a fost lichidat
        /// </summary>
        public void GenerareSituatieLunaraAngajatLichidat()
        {
            Salaries.Business.Angajat angajat = new Salaries.Business.Angajat();
            angajat.AngajatId = AngajatID;
            angajat.LoadAngajat();

            //este obtinuta prima zi a lunii active
            Salaries.Business.Luni luna       = new Salaries.Business.Luni(angajat.AngajatorId, settings);
            Salaries.Data.LunaData lunaActiva = luna.GetLunaActiva();

            Salaries.Business.PontajAngajat pontajAngajat = new Salaries.Business.PontajAngajat(this.AngajatID, settings);

            DataSet dsIntervaleAngajat = pontajAngajat.GetIntervaleAngajat(lunaActiva.LunaId);

            //daca nu au fost initializate orele unui angajat, se face aceasta initializare
            if (dsIntervaleAngajat.Tables[0].Rows.Count == 0)
            {
                //intervale angajat
                IntervaleAngajat intervAng = new IntervaleAngajat(AngajatID, settings);

                //sunt intializate orele lucrate de catre angajat
                intervAng.InitializeOreLucrateLunaAngajat(lunaActiva.Data, angajat.DataDeLa, angajat.DataLichidare);
            }

            //situatia lunara a unui angajat
            Salaries.Business.SituatieLunaraAngajat situatieLunaraAng = new Salaries.Business.SituatieLunaraAngajat(AngajatID, settings);

            //se genereaza situatia lunara a angajatului
            situatieLunaraAng.GenerareSituatieLunaraAngajatLichidat(lunaActiva.LunaId, angajat.AngajatorId);
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            TransferDateLichidareLaClient();
            if (!IsPostBack)
            {
                BindMotiveDePlecare();
            }

            //Modificat: Oprescu Claudia
            //Descriere: Daca angajatul selectat este lichidat atunci se vizualizeaza datele despre lichidare corespunzatoare
            if (this.txtNrInregistrare.Text.Equals(""))
            {
                try
                {
                    Salaries.Business.Luni l  = new Salaries.Business.Luni(this.GetAngajator());
                    Salaries.Data.LunaData ld = l.GetLunaActiva();
                    int AngajatID             = int.Parse(Session["AngajatID"].ToString());

                    Salaries.Business.Lichidare lichidare = new Salaries.Business.Lichidare();
                    DataSet ds = lichidare.GetLichidareAngajat(AngajatID, ld.Data);

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        lstMotivDePlecare.SelectedValue = ds.Tables[0].Rows[0]["MotivDePlecareId"].ToString();
                        this.txtNrInregistrare.Text     = ds.Tables[0].Rows[0]["NrInregistrare"].ToString();
                        if (DateTime.Parse(ds.Tables[0].Rows[0]["DataInregistrare"].ToString()).ToShortDateString() == "01.01.1753")
                        {
                            this.txtDataInregistrare.Text = "";
                        }
                        else
                        {
                            this.txtDataInregistrare.Text = DateTime.Parse(ds.Tables[0].Rows[0]["DataInregistrare"].ToString()).ToShortDateString();
                        }
                        this.txtDataLichidare.Text = DateTime.Parse(ds.Tables[0].Rows[0]["DataLichidare"].ToString()).ToShortDateString();
                        //this.txtNrArticol.Text = float.Parse(ds.Tables[0].Rows[0]["NrArticol"].ToString()).ToString("N",Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtNrArticol.Text         = ds.Tables[0].Rows[0]["NrArticol"].ToString();
                        this.txtAvansuriDecontare.Text = float.Parse(ds.Tables[0].Rows[0]["AvansuriDecontare"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtAbonamente.Text        = float.Parse(ds.Tables[0].Rows[0]["Abonamente"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtTicheteMasa.Text       = float.Parse(ds.Tables[0].Rows[0]["TicheteMasa"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtEchipamentLucru.Text   = float.Parse(ds.Tables[0].Rows[0]["EchipamentLucru"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtLaptop.Text            = float.Parse(ds.Tables[0].Rows[0]["Laptop"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtTelServiciu.Text       = float.Parse(ds.Tables[0].Rows[0]["telServiciu"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtObiecteInventar.Text   = float.Parse(ds.Tables[0].Rows[0]["ObiecteInventar"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtCarti.Text             = float.Parse(ds.Tables[0].Rows[0]["Carti"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        this.txtCD.Text = float.Parse(ds.Tables[0].Rows[0]["CD"].ToString()).ToString("N", Salaries.Business.VariabileGlobale.numberInfoFormatWithoutDigits);
                        if (DateTime.Parse(ds.Tables[0].Rows[0]["LunaRetinere"].ToString()).ToShortDateString() == "01.01.1753")
                        {
                            this.txtLunaRetinere.Text = "";
                        }
                        else
                        {
                            this.txtLunaRetinere.Text = DateTime.Parse(ds.Tables[0].Rows[0]["LunaRetinere"].ToString()).ToShortDateString();
                        }
                    }
                }
                catch {}
            }
        }
        /// <summary>
        /// Procedura verifica daca o data este in luna activa
        /// </summary>
        /// <param name="dt">Data care se verifica</param>
        /// <returns>Returneaza true daca e in interval si false altfel</returns>
        public bool DataInLunaActiva(DateTime dt)
        {
            AdminAngajator ang         = new AdminAngajator(this.ConnectionString);
            int            angajatorId = int.Parse(ang.LoadInfoAngajatori().Tables[0].Rows[0]["AngajatorId"].ToString());

            Luni     l  = new Luni(ConnectionString);
            LunaData ld = l.GetLunaActiva(angajatorId);

            return((dt.Month == ld.Data.Month && dt.Year == ld.Data.Year) ? true : false);
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            Salaries.Business.Luni luni;
            Salaries.Data.LunaData lunaData;

            if (objAngajat.IsLichidat)
            {
                btnGenerati.Enabled = false;

                lblEroare.Text = "Angajatul selectat este lichidat!";
            }

            // Este aflata luna activa
            luni     = new Salaries.Business.Luni(objAngajat.AngajatorId);
            lunaData = luni.GetLunaActiva();

            // DataSet-ul cu numele tuturor angajatilor.
            objAngajat.CategorieId = -1;


            //header de tabel
            if (Session["Recrutori"].ToString() == "Recrutori")
            {
                Utilities.CreateTableHeader(Table2, "Fisa postului " + " " + lunaData.Data.Month.ToString() + " / " + lunaData.Data.Year.ToString(), "../", "normal");
                Response.Write("<script> var TipUtilizator = 'Recrutor'; </script>");
            }
            else
            {
                Utilities.CreateTableHeader(Table2, "Fisa postului " + " " + lunaData.Data.Month.ToString() + " / " + lunaData.Data.Year.ToString(), "", "normal");
                Response.Write("<script> var TipUtilizator = ''; </script>");
            }

            Salaries.Business.AdminAngajator adminAng = new Salaries.Business.AdminAngajator();
            adminAng.AngajatorId = Int32.Parse(Session["AngajatorId"].ToString());
            DataSet ds = adminAng.GetReprezLegali();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                // Numele managerului general.
                if (dr["NumeFunctie"].ToString().Equals("Manager general"))
                {
                    txtManagerGeneral.Text = dr["NumeReprez"].ToString() + " " + dr["PrenumeReprez"].ToString();
                }
                // Numele directorului economic.
                if (dr["NumeFunctie"].ToString().Equals("Manager HR"))
                {
                    txtManagerHR.Text = dr["NumeReprez"].ToString() + " " + dr["PrenumeReprez"].ToString();
                }
            }
            //Utilities.CreateTableHeader(Table2, "Fisa postului "+" "+lunaData.Data.Month.ToString()+" / "+lunaData.Data.Year.ToString(), "", "normal");
        }
        /// <summary>
        /// Afiseaza butoanele pentru genrearea situatiilor lunare in functie de luna activa
        /// </summary>
        /// <param name="val">Se afiseaza butoanele sau nu</param>
        private void EnableAngajatCurent(bool val)
        {
            this.angajatDDL.Visible         = val;
            this.labelAngajatCurent.Visible = val;
            this.ButtonGenerareSituatieLunaraAngajat.Visible       = val;
            this.ButtonGenerareSituatieLunaraTotiAngajatii.Visible = val;

            Salaries.Business.Luni luni     = new Salaries.Business.Luni(this.GetAngajator());
            Salaries.Data.LunaData lunaData = luni.GetLunaActiva();
            if (lunaData.LunaId != -1 && val)
            {
                this.ButtonGenerareSituatieLunaraAngajat.Visible       = this.GetCurrentMonth() == lunaData.LunaId;
                this.ButtonGenerareSituatieLunaraTotiAngajatii.Visible = this.GetCurrentMonth() == lunaData.LunaId;
            }
        }
Ejemplo n.º 7
0
        private void btnGenerati_Click(object sender, System.EventArgs e)
        {
            Salaries.Data.LunaData lunaAnterioara = luni.GetDetaliiByData(lunaData.Data.AddMonths(-1));

            // Situatia lunara a angajatului.
            Salaries.Business.SituatieLunaraAngajat situatieLunara = new Salaries.Business.SituatieLunaraAngajat(objAngajat.AngajatId);
            // Situatia lunara din luna curenta.
            Salaries.Data.InfoSituatieLunara infoSituatieLunara = situatieLunara.GetSituatieLunaraAngajat(objAngajat.AngajatId, lunaData.LunaId);
            // Situatia lunara de pe luna precedenta.
            Salaries.Data.InfoSituatieLunara infoSituatieLunaraAnt = situatieLunara.GetSituatieLunaraAngajat(objAngajat.AngajatId, lunaAnterioara.LunaId);

            Salaries.Business.Salariu salariu = new Salaries.Business.Salariu();
            salariu.AngajatID = objAngajat.AngajatId;

            // Valoarea indexata a venitului brut.
            float sumaMajorareSalariuBrut = 0;

            sumaMajorareSalariuBrut = float.Parse(objAngajat.SalariuBaza.ToString()) - salariu.CalculVenitBrutIndexat();

            if (infoSituatieLunara.SituatieID != -1 && infoSituatieLunaraAnt.SituatieID != -1)
            {
                // Tipul comunicarii.
                Session["TipComunicare"] = "comunicare majorare.xml";
                // Numarul comunicarii.
                Session["Numar"] = txtNrCom.Text;
                // Data inregistrarii comunicarii.
                Session["DataInregistrarii"] = txtDataInregistrarii.Text;
                // Salariul brut anterior.
                Session["SalariuBrutAnterior"] = infoSituatieLunaraAnt.SalariuBaza.ToString();
                // Indemnizatie conducere anterioara.
                Session["IndemnizatieConducereAnterioara"] = infoSituatieLunaraAnt.IndemnizatieConducere.ToString();
                // Suma cu care a fost majorat salariu de incadrare.
                Session["SumaMajorareSalariuBrut"] = sumaMajorareSalariuBrut.ToString();
                // Numele managerului general.
                Session["ManagerGeneral"] = txtManagerGeneral.Text;
                // Numele directorului economic.
                Session["DirectorEconomic"] = txtDirectorEconomic.Text;

                Response.Redirect("Comunicari/comunicare.aspx?id=" + objAngajat.AngajatId);

                lblEroare.Text = "Comunicarea a fost generata.";
            }
            else
            {
                lblEroare.Text = "Angajatul nu are situatii lunare generate!";
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (objAngajat.IsLichidat)
            {
                btnGenerati.Enabled          = false;
                txtNrCom.Enabled             = false;
                txtDataInregistrarii.Enabled = false;

                lblEroare.Text = "Angajatul selectat este lichidat!";
            }

            // DataSet-ul cu numele tuturor angajatilor.
            objAngajat.CategorieId = -1;

            Salaries.Business.AdminAngajator adminAng = new Salaries.Business.AdminAngajator();
            adminAng.AngajatorId = Int32.Parse(Session["AngajatorId"].ToString());
            DataSet ds = adminAng.GetReprezLegali();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                // Numele managerului general.
                if (dr["NumeFunctie"].ToString().Equals("Manager general"))
                {
                    txtManagerGeneral.Text = dr["NumeReprez"].ToString() + " " + dr["PrenumeReprez"].ToString();
                }
                // Numele directorului economic.
                if (dr["NumeFunctie"].ToString().Equals("Director economic"))
                {
                    txtDirectorEconomic.Text = dr["NumeReprez"].ToString() + " " + dr["PrenumeReprez"].ToString();
                }
            }

            //este aflata luna activa
            Salaries.Business.Luni luni = new Salaries.Business.Luni(objAngajat.AngajatorId);
            lunaData = luni.GetLunaActiva();

            //header de tabel
            Utilities.CreateTableHeader(Table2, "Comunicare prima pentru luna " + " " + lunaData.Data.Month.ToString() + " / " + lunaData.Data.Year.ToString(), "", "normal");
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            GenerareaSituatieiLunare();

            string Option = this.Page.Request.Params["Option"];

            if (Option == null)
            {
                Option = "situatie_lunara";
            }

            switch (Option)
            {
            case "situatie_lunara":
                EnableAngajatCurent(true);
                //Se actualizeaza variabila care specifica modificarea situatiei lunare a unui angajat
                Session["ModificaSituatie"] = "";
                SituatieLunaraAngajati mySituatie = (SituatieLunaraAngajati)LoadControl("SituatieLunaraAngajati.ascx");
                this.Center.Controls.Add(mySituatie);
                break;

            case "initializare_luna":
                //luna activa a angajatorului
                Salaries.Business.Luni luni     = new Salaries.Business.Luni(this.GetAngajator());
                Salaries.Data.LunaData lunaData = luni.GetLunaActiva();

                //daca luna selectata de utilizator este luna activa atunci link-ul este activ, altfel acesta devine inactiv
                if (this.GetCurrentMonth() == lunaData.LunaId)
                {
                    EnableAngajatCurent(false);
                    InitializareLuna myInit = (InitializareLuna)LoadControl("InitializareLuna.ascx");
                    this.Center.Controls.Add(myInit);
                }
                else
                {
                    Response.Write("<script>alert(\"Luna selectata este inactiva! \\nInitializarea se poate face doar in luna activa! \");</script>");

                    EnableAngajatCurent(true);
                    SituatieLunaraAngajati mySituatie1 = (SituatieLunaraAngajati)LoadControl("SituatieLunaraAngajati.ascx");
                    this.Center.Controls.Add(mySituatie1);
                }
                break;

            case "pontaj_individual":
                EnableAngajatCurent(true);
                PontajModule myPontaj = (PontajModule)LoadControl("Pontaj/PontajModule.ascx");
                myPontaj.AngajatorID    = this.GetAngajator();
                myPontaj.CurrentMonthID = this.GetCurrentMonth();
                this.Center.Controls.Add(myPontaj);
                break;

            case "lichidare_angajat":
                try
                {
                    //luna activa a angajatorului
                    Salaries.Business.Luni luna       = new Salaries.Business.Luni(this.GetAngajator());
                    Salaries.Data.LunaData lunaActiva = luna.GetLunaActiva();

                    //daca luna selectata de utilizator este luna activa atunci link-ul este activ, altfel acesta devine inactiv
                    if (this.GetCurrentMonth() == lunaActiva.LunaId)
                    {
                        Salaries.Business.Angajat objAngajat = new Salaries.Business.Angajat();
                        objAngajat.AngajatId = GetAngajat();
                        objAngajat.LoadAngajat();

                        EnableAngajatCurent(true);
                        LichidareAngajat lichidare = (LichidareAngajat)LoadControl("LichidareAngajat.ascx");
                        lichidare.objAngajat = objAngajat;
                        this.Center.Controls.Add(lichidare);
                    }
                    else
                    {
                        Response.Write("<script>alert(\"Luna selectata este inactiva! \\nUn angajat poate fi lichidat numai in luna activa! \");</script>");

                        EnableAngajatCurent(true);
                        SituatieLunaraAngajati mySituatie1 = (SituatieLunaraAngajati)LoadControl("SituatieLunaraAngajati.ascx");
                        this.Center.Controls.Add(mySituatie1);
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("Error loading employee data: <br>");
                    Response.Write(ex.Message);
                    Response.End();
                }
                break;

            case "retineri_recurente_angajat":
                EnableAngajatCurent(true);
                RetineriAngajat myRetineri = (RetineriAngajat)LoadControl("RetineriAngajat.ascx");
                myRetineri.AngajatID = GetAngajat();
                this.Center.Controls.Add(myRetineri);
                break;

            case "import":
                EnableAngajatCurent(false);
                ImportPontaj myImport = (ImportPontaj)LoadControl("ImportPontaj.ascx");
                this.Center.Controls.Add(myImport);
                break;

            case "import_delegatii":
                EnableAngajatCurent(false);
                ImportDelegatii importDel = (ImportDelegatii)LoadControl("ImportDelegatii.ascx");
                this.Center.Controls.Add(importDel);
                break;

            case "trimitere_fluturasi":
                EnableAngajatCurent(false);
                TrimitereFluturasi trimFlut = (TrimitereFluturasi)LoadControl("TrimitereFluturasi.ascx");
                this.Center.Controls.Add(trimFlut);
                break;

            case "sincronizare_date_angajati":
                EnableAngajatCurent(false);
                SincronizareDateAngajati sinc = (SincronizareDateAngajati)LoadControl("SincronizareDateAngajati.ascx");
                //ImportSalarii myImport = (ImportSalarii) LoadControl("ImportSalarii.ascx");
                this.Center.Controls.Add(sinc);
                break;
            }

            //poate strica
            //Modificat:	Oprescu Claudia
            //Descriere:	Se seteaza un angajat numai daca exista in control date
            if (this.angajatDDL.Items.Count > 0)
            {
                this.SetAngajat(long.Parse(angajatDDL.SelectedValue));

                // Se calculeaza valoarea mediei zilnice si se scrie valoarea pe Javascript.
                CalculMedieZilnicaConcediuOdihna();
            }
        }
        public bool ExistaToateDatele()
        {
            bool existaToateDatele = true;

            //este aflata luna activa
            Salaries.Business.Luni luni     = new Salaries.Business.Luni(objAngajat.AngajatorId);
            Salaries.Data.LunaData lunaData = luni.GetLunaActiva();

            //numar de inregistrare contract de munca
            if (objAngajat.NrContractMunca.ToString() == "")
            {
                existaToateDatele = false;
                dateNecesare     += " numar contract de munca:";
            }

            //se verifica nationalitatea angajatului
            //in cazul in care angajatul este cetatean strain se mai verifica niste campuri daca sunt completate
            int nationalitate = objAngajat.Nationalitate;

            int idTaraDeBaza = 0;

            //practic DataSet-ul returneaza un singur rand
            Salaries.Business.AdminTari tari = new Salaries.Business.AdminTari();
            DataSet dsTaraDeBaza             = tari.GetTaraDeBaza();

            foreach (DataRow row in dsTaraDeBaza.Tables[0].Rows)
            {
                idTaraDeBaza = int.Parse(row["TaraID"].ToString());
            }

            //daca este cetatean strain
            if (nationalitate != idTaraDeBaza)
            {
                if (objAngajat.NIF == null)
                {
                    existaToateDatele = false;
                    dateNecesare     += " numarul de inregistrare fiscala:";
                }
            }
            // in cazul in care angajatul este cetatean roman
            else
            {
                //cu domiciliul in strainatate
                if (objAngajat.DTara != nationalitate)
                {
                    if (objAngajat.NIF == null)
                    {
                        existaToateDatele = false;
                        dateNecesare     += " numarul de inregistrare fiscala:";
                    }
                    else
                    {
                        //trebuie verificat si numarul de inregistreare fiscala sau CNP-ul
                        if ((objAngajat.NIF == null) && (objAngajat.CNP.ToString() == "0"))
                        {
                            existaToateDatele = false;
                            dateNecesare     += " numarul de inregistrare fiscala sau CNP-ul angajatului:";
                        }
                    }
                }
            }
            return(existaToateDatele);
        }
 /// <summary>
 /// Procedura adauga o luna
 /// </summary>
 /// <param name="lunaData">Obiectul care se adauga</param>
 /// <returns>Returneaza rezultatul adaugarii</returns>
 public int InsertLuna(LunaData lunaData)
 {
     return(this.InsertLuna(lunaData.Data, lunaData.Activ, lunaData.ProcentInflatie, lunaData.AngajatorId));
 }
 /// <summary>
 /// Procedura sterge o luna
 /// </summary>
 /// <param name="lunaData">Obiectul care contine datele lunii care se sterge</param>
 /// <returns>Returneaza rezultatul stergerii</returns>
 public int DeleteLuna(LunaData lunaData)
 {
     return(this.DeleteLuna(lunaData.LunaId));
 }
 /// <summary>
 /// Procedura actualizeaza o luna
 /// </summary>
 /// <param name="lunaData">Obiectul care contine luna care se va actualiza</param>
 /// <returns>Returneaza rezultatul adaugarii</returns>
 public int UpdateLuna(LunaData lunaData)
 {
     return(this.UpdateLuna(lunaData.LunaId, lunaData.Data, lunaData.Activ, lunaData.ProcentInflatie, lunaData.AngajatorId));
 }
        /// <summary>
        /// Salveaza o lichidate
        /// </summary>
        private void btnSalveaza_Click()
        {
            /*
             * Modified:  Cristina Raluca Muntean
             * Date:      10.09.2005
             * Descriere: Modificarea consta in validarea datelor de intrare, a statusului angajatului(lichidat/nu este lichidat)
             * si a generarii situatiei lunare conform cu noile date corespunzatoare lichidarii.
             */

            //Modificat: Oprescu Claudia
            //Descriere: Se face mai intai validarea datelor introduse si apoi daca angajatul nu este lichidat se face lichidarea lui
            //			 Daca este deja lichidat se face actualizare la datele lichidarii, adica se sterge cea veche si se adauga una noua
            int idAng = GetAngajat();

            ErrHandler.MyErrHandler.WriteError("LichidareAngajat.ascx - start - Salveaza() - idAng: " + idAng.ToString());
            try
            {
                Salaries.Data.LichidareStruct lichidare = new Salaries.Data.LichidareStruct();
                Salaries.Business.Angajat     angajat   = new Salaries.Business.Angajat();
                angajat.AngajatId = GetAngajat();
                angajat.LoadAngajat();

                lichidare.AngajatID = this.GetAngajat();

                //variabila booleana care indica daca au fost completate toate campurile obligatorii
                bool fill = true;
                //variabila booleana care indica daca au fost completate corect campurile
                bool correct = true;

                //se verifica daca au fost completate campurile
                if (txtNrInregistrare.Text == "" || txtDataLichidare.Text == "" || txtDataInregistrare.Text == "")
                {
                    fill = false;
                }
                try
                {
                    lichidare.NrInregistrare   = txtNrInregistrare.Text;
                    lichidare.DataLichidare    = Utilities.ConvertText2DateTime(txtDataLichidare.Text);
                    lichidare.MotivDePlecareId = int.Parse(((System.Web.UI.HtmlControls.HtmlInputHidden)Page.FindControl("txtMotivDePlecareHidden")).Value);

                    lichidare.NrArticol         = txtNrArticol.Text;
                    lichidare.AvansuriDecontare = decimal.Parse(txtAvansuriDecontare.Text);
                    lichidare.Abonamente        = decimal.Parse(txtAbonamente.Text);
                    lichidare.TicheteMasa       = decimal.Parse(txtTicheteMasa.Text);
                    lichidare.EchipamentLucru   = decimal.Parse(txtEchipamentLucru.Text);
                    lichidare.Laptop            = decimal.Parse(txtLaptop.Text);
                    lichidare.TelServiciu       = decimal.Parse(txtTelServiciu.Text);
                    lichidare.ObiecteInventar   = decimal.Parse(txtObiecteInventar.Text);
                    lichidare.Carti             = decimal.Parse(txtCarti.Text);
                    lichidare.CD = decimal.Parse(txtCD.Text);

                    lichidare.DataInregistrare = Utilities.ConvertText2DateTime(txtDataInregistrare.Text);
                    if (txtLunaRetinere.Text == "")
                    {
                        lichidare.LunaRetinere = Utilities.ConvertText2DateTime("1.1.1753");
                    }
                    else
                    {
                        lichidare.LunaRetinere = Utilities.ConvertText2DateTime(txtLunaRetinere.Text);
                    }
                }
                catch (Exception)
                {
                    //in cazul in care apare o eroare la conversie inseamna ca nu au fost completate corect campurile
                    correct = false;
                }

                Salaries.Business.Luni luni     = new Salaries.Business.Luni(this.GetAngajator());
                Salaries.Data.LunaData lunaData = luni.GetLunaActiva();

                //daca au fost completate toate campurile corect si data lichidarii se afla in luna activa se poate realiza efectiv lichidarea
                if (fill && correct)
                {
                    if ((lunaData.Data.Month == DateTime.Parse(txtDataLichidare.Text).Date.Month&& lunaData.Data.Year == DateTime.Parse(txtDataLichidare.Text).Date.Year) ||
                        (DateTime.Parse(txtDataLichidare.Text).Date.Day == 1) && (DateTime.Parse(txtDataLichidare.Text).Date.Month == lunaData.Data.Month + 1) && (lunaData.Data.Year == DateTime.Parse(txtDataLichidare.Text).Date.Year) ||
                        (DateTime.Parse(txtDataLichidare.Text).Date.Day == 1) && (DateTime.Parse(txtDataLichidare.Text).Date.Month == 1) && (lunaData.Data.Month == 12) && (lunaData.Data.Year + 1 == DateTime.Parse(txtDataLichidare.Text).Date.Year))
                    {
                        SiemensTM.Classes.IntervaleAngajat intervaleAngajat = new SiemensTM.Classes.IntervaleAngajat(lichidare.AngajatID);
                        //sterge toate intervalele orare, inclusiv capetele de interval
                        intervaleAngajat.DeleteIntervaleAngajatPerioada(lichidare.DataLichidare, DateTime.MaxValue, true);
                        //initializeaza luna pentru angajatul in cauza
                        intervaleAngajat.InitializeOreLucrateLunaAngajat(lunaData.Data, objAngajat.DataDeLa, lichidare.DataLichidare);

                        //se genereaza situatia lunara a angajatului
                        //Salaries.Business.SituatieLunaraAngajat sla = new Salaries.Business.SituatieLunaraAngajat( lichidare.AngajatID );
                        //sla.GenerareSituatieLunaraAngajat( this.GetCurrentMonth(), this.GetAngajator());

                        //Adaugat:		Oprescu Claudia
                        //Descriere:	Se verifica sa nu existe deja o lichidare pentru luna activa.
                        //				Daca exista atunci se actualizeaza acea inregistrare.
                        //				Daca nu exista se adauga o inregistrare noua.
                        int lichidareID = new Salaries.Business.Lichidare().CheckIfLichidareCanBeAdded(lichidare.AngajatID, lichidare.DataLichidare);
                        if (lichidareID == 0)
                        {
                            new Salaries.Business.Lichidare().AddLichidare(lichidare);
                        }
                        else
                        {
                            lichidare.LichidareID = lichidareID;
                            new Salaries.Business.Lichidare().UpdateLichidare(lichidare);
                        }

                        //Modified: Cristina Raluca Muntean
                        //se genereaza situatia lunara a angajatului
                        SiemensTM.Classes.SituatieAngajat situatieLunaraAng = new SiemensTM.Classes.SituatieAngajat(this.GetAngajat());
                        //Added: Ionel Popa -> daca este lichidat in prima zi a lunii i se sterge situatia lunara
                        Salaries.Business.Luni activeMonth = new Salaries.Business.Luni(this.GetAngajator(), lunaData.LunaId);
                        if (activeMonth.Data == lichidare.DataLichidare)
                        {
                            Salaries.Business.SituatieLunaraAngajat sla = new Salaries.Business.SituatieLunaraAngajat(this.GetAngajat());
                            sla.DeleteSituatieAngajat(GetCurrentMonth(), this.GetAngajat());
                        }
                        else
                        {
                            //Modificat:	Oprescu Claudia
                            //Descriere:	Se apeleaza metoda pentru generarea situatiei lunare a angajatului
                            //				La generarea situatiei se calculeaza numarul de zile de concediu de odihna neefectuat si efectuat in avans
                            situatieLunaraAng.GenerareSituatieLunaraAngajatLichidat();
                        }

                        //javascript
                        StringBuilder jScript = new StringBuilder();
                        jScript.Append("<script language=\"JavaScript\">");
                        jScript.Append("window.open('../Comunicari/comunicare.aspx?id=" + objAngajat.AngajatId + "',null,'status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')");
                        jScript.Append("</script>");

                        AdaugaInSesiune();

                        Response.Write(jScript.ToString());
                    }
                    else
                    {
                        //este afisat mesajul de eroare
                        Response.Write("<script>alert( 'Data lichidarii angajatului trebuie sa faca parte din luna activa!' );</script>");
                    }
                }
                else
                {
                    //in functie de eroare este afisat mesajul corespunzator
                    if (!correct)
                    {
                        Response.Write("<script>alert( 'Datele introduse nu sunt corecte!' );</script>");
                    }
                    if (!fill)
                    {
                        Response.Write("<script>alert( 'Trebuie sa completati toate datele!' );</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
                ErrHandler.MyErrHandler.WriteError("LichidareAngajat.ascx - start - Salveaza() - idAng: " + idAng.ToString() + " - " + ex.Message);
            }
            ErrHandler.MyErrHandler.WriteError("LichidareAngajat.ascx - end - Salveaza() - idAng: " + idAng.ToString());
        }