Ejemplo n.º 1
0
        internal static void Calculate_OLD(MainForm form, int idEmployee, DateTime date)
        {
            Employees.EmployeeManager employeeManager = new Employees.EmployeeManager();
            Employees.Employee        employee        = employeeManager.GetEmployee(idEmployee, TableView.view, ConnectionToDB.disconnect);
            int hoursToWork   = Salary.GetHoursToWork(date);
            int sumAllMinutes = 0;

            SalaryDayOff salatyDayOff = new SalaryDayOff(idEmployee, date);

            form.LblGodzinyUrlopowePlatne    = salatyDayOff.NumberOfMinutesDayOffPaid.ToString();
            form.LblGodzinyUrlopoweBezplatne = salatyDayOff.NumberOfMinutesDayOffFree.ToString();
            sumAllMinutes          += (salatyDayOff.NumberOfMinutesDayOffFree + salatyDayOff.NumberOfMinutesDayOffPaid);
            form.LblPozostaloUrlopu = employee.NumberDaysOffLeft;
            form.LblZaUrlopowe      = salatyDayOff.CalculateSalaryDayOff(employee.RateRegular, hoursToWork);

            SalaryIllness salaryIllness = new SalaryIllness(idEmployee, date);

            form.LblGodzinyChorobowe80  = salaryIllness.NumberOfMinutesIllness80.ToString();
            form.LblGodzinyChorobowe100 = salaryIllness.NumberOfMinutesIllness100.ToString();
            sumAllMinutes         += (salaryIllness.NumberOfMinutesIllness80 + salaryIllness.NumberOfMinutesIllness100);
            form.LblZaChorobowe80  = salaryIllness.CalculateSalaryIllness80(employee.RateRegular, hoursToWork);
            form.LblZaChorobowe100 = salaryIllness.CalculateSalaryIllness100(employee.RateRegular, hoursToWork);


            SalaryAddition salaryAddition = new SalaryAddition(idEmployee, date);

            form.LblZaDodatek = salaryAddition.ForAdditions;

            SalaryAdvance salaryAdvance = new SalaryAdvance(idEmployee, date);

            form.LblZaZaliczke = salaryAdvance.ForAdvances;

            SalaryWorkOLD salaryWork = new SalaryWorkOLD(idEmployee, date);

            form.LblIloscGodzinDoPrzepracowania = hoursToWork.ToString();
            form.LblStawka                 = employee.RateRegular.RateValue;
            form.LblStawkaNadgodzinowa     = employee.RateOvertime.RateValue;
            salaryWork.NumberOfMinutesOver = sumAllMinutes;//musi być przed obliczeniami
            sumAllMinutes += salaryWork.NumberOfMinutesAll;
            form.LblGodzinyNadliczbowe = salaryWork.NumberOfMinutesOver.ToString();


            SalaryLoanInstallment salaryLoanInstallment = new SalaryLoanInstallment();

            form.LblPozostaloPozyczki = salaryLoanInstallment.LoansRemianedToPay(employee.IdEmployee);
            form.LblZaPozyczke        = salaryLoanInstallment.AmountForPaidOffInstallmentInMonth(employee.IdEmployee, date);

            form.LblSumaGodzin = sumAllMinutes.ToString();
            form.LblIloscGodzinDoPrzepracowania = hoursToWork.ToString();


            form.LblZaGodziny          = salaryWork.CalculateSalaryRegular(employee.RateRegular, hoursToWork);
            form.LblZaNadgodziny       = salaryWork.CalculateSalaryOvertime_OLD(employee.RateOvertime);
            form.LblZaWszystko         = salaryWork.ForAll + salaryIllness.ForAll + salatyDayOff.ForDayOff;
            form.LblDoWyplaty          = salaryWork.ForAll + salaryIllness.ForAll + salatyDayOff.ForDayOff - salaryAdvance.ForAdvances + salaryAddition.ForAdditions - salaryLoanInstallment.ForInstallment;
            form.LblStawka             = employee.RateRegular.RateValue;
            form.LblStawkaNadgodzinowa = employee.RateOvertime.RateValue;
        }
Ejemplo n.º 2
0
        public void CalculateSalaryDayOffMonthlyTest()
        {
            //Arange
            RateRegular  rateRegular = new RateRegular(DateTime.Now, 3333f, RateType.monthly);
            SalaryDayOff salary      = new SalaryDayOff(employee.IdEmployee, date);

            salary.NumberOfMinutesDayOffPaid = 960;//16

            double should = 317.43d;

            //Act
            var result = salary.CalculateSalaryDayOff(rateRegular, hoursToWork);

            //Arrange
            Assert.AreEqual(should, result);
        }
Ejemplo n.º 3
0
        private bool FillPage(int x, int y, Employee employee, PrintPageEventArgs e)
        {
            // utworzenie fonta
            Font font10     = new Font("Arial", 10, FontStyle.Regular, GraphicsUnit.Point);
            Font font10Bold = new Font("Arial", 10, FontStyle.Bold, GraphicsUnit.Point);
            Font font8      = new Font("Arial", 8, FontStyle.Regular, GraphicsUnit.Point);
            Font font8Bold  = new Font("Arial", 8, FontStyle.Bold, GraphicsUnit.Point);

            //kolor pióra czarny
            Pen penBlack = new Pen(Brushes.Black);

            SalaryDayOff          salaryDayOff          = new SalaryDayOff(employee.IdEmployee, date);
            SalaryIllness         salaryIllness         = new SalaryIllness(employee.IdEmployee, date);
            SalaryWork            salaryWork            = new SalaryWork(employee.IdEmployee, date);
            SalaryLoanInstallment salaryLoanInstallment = new SalaryLoanInstallment();
            SalaryAdvance         salaryAdvance         = new SalaryAdvance(employee.IdEmployee, date);
            SalaryAddition        salaryAddition        = new SalaryAddition(employee.IdEmployee, date);

            StringFormat sf = new StringFormat();

            //ustawienie tekstu w prostokątach
            sf.Alignment = StringAlignment.Center;//środek

            //pierwszy prostokąt LEWA strona tabeli
            SizeF     sF_Left;
            Rectangle r_Left = new Rectangle();

            //drugi prostokąt Kwota
            SizeF     sF_right;
            Rectangle r_Right = new Rectangle();

            //PIERWSZA LINIA
            e.Graphics.DrawLine(penBlack, x, y, e.PageBounds.Right - 25, y);
            Rectangle rect = new Rectangle(x, y + 10, e.PageBounds.Right - 25, (int)Math.Ceiling(font10.GetHeight(e.Graphics)));

            e.Graphics.DrawString(string.Format("ROZLICZENIE CZASU PRACY - {0} {1}, {2}.{3}",
                                                employee.FirstName, employee.LastName, date.Month, date.Year), font10Bold, Brushes.Black, rect, sf);

            ///////////////////////////////////////////
            ///////////////////////////////////////////     LEFT COLUMN
            //////////////////////////////////////////////
            sf.Alignment = StringAlignment.Near;//do lewej

            //godziny przepracowane
            sF_Left       = e.Graphics.MeasureString("Godziny przepracowane:", font8);
            r_Left.X      = x + space;
            r_Left.Y      = rect.Bottom;
            r_Left.Width  = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Height = (int)Math.Ceiling(sF_Left.Height);
            r_Left.Y     += r_Left.Height;
            e.Graphics.DrawString("Godziny przepracowane:", font8, Brushes.Black, r_Left, sf);

            sF_right       = e.Graphics.MeasureString("999:999", font8Bold);
            r_Right.X      = r_Left.Right;
            r_Right.Y      = r_Left.Y;
            r_Right.Width  = (int)Math.Ceiling(sF_right.Width);
            r_Right.Height = (int)Math.Ceiling(sF_right.Height);
            int tempWork = salaryWork.NumberOfMinutesRegular;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempWork / 60), (tempWork % 60)), font8Bold, Brushes.Black, r_Right, sf);


            //ilość godzin nadliczbowych 50%
            sF_Left      = e.Graphics.MeasureString("Godziny przepracowane 50%:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Godziny przepracowane (50%):", font8, Brushes.Black, r_Left, sf);


            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int tempWork50 = salaryWork.NumberOfMinutes50;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempWork50 / 60), (tempWork50 % 60)), font8Bold, Brushes.Black, r_Right, sf);


            //ilość godzin nadliczbowych 100%
            sF_Left      = e.Graphics.MeasureString("Godziny przepracowane (100%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Godziny przepracowane (100%):", font8, Brushes.Black, r_Left, sf);


            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int tempWork100 = salaryWork.NumberOfMinutes100;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempWork100 / 60), (tempWork100 % 60)), font8Bold, Brushes.Black, r_Right, sf);


            //godziny urlopowe (płatne)
            sF_Left      = e.Graphics.MeasureString("Godziny urlopowe (płatne):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Godziny urlopowe (płatne):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int temp = salaryDayOff.NumberOfMinutesDayOffPaid;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (temp / 60), (temp % 60)), font8Bold, Brushes.Black, r_Right, sf);

            // godziny urlopowe (bezpłatne)
            sF_Left      = e.Graphics.MeasureString("Godziny urlopowe (bezpłatne):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Godziny urlopowe (bezpłatne):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int tempFree = salaryDayOff.NumberOfMinutesDayOffFree;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempFree / 60), (tempFree % 60)), font8Bold, Brushes.Black, r_Right, sf);

            //godziny chorobowe 80%
            sF_Left      = e.Graphics.MeasureString("Godziny chorobowe (80%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Godziny chorobowe (80%):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int tempIlness80 = salaryIllness.NumberOfMinutesIllness80;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempIlness80 / 60), (tempIlness80 % 60)), font8Bold, Brushes.Black, r_Right, sf);

            //godziny chorobowe 100%
            sF_Left      = e.Graphics.MeasureString("Godziny chorobowe (100%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Godziny chorobowe (100%):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int tempIlness100 = salaryIllness.NumberOfMinutesIllness100;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempIlness100 / 60), (tempIlness100 % 60)), font8Bold, Brushes.Black, r_Right, sf);

            //pogrubienie SUMA GODZIN
            sF_Left      = e.Graphics.MeasureString("Suma godzin:", font8Bold);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Suma godzin:", font8Bold, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            int tempWorkAll = salaryWork.NumberOfMinutesAll + salaryDayOff.NumberOfMinutesDayOffFree + salaryDayOff.NumberOfMinutesDayOffPaid +
                              salaryIllness.NumberOfMinutesIllness80 + salaryIllness.NumberOfMinutesIllness100;

            e.Graphics.DrawString(string.Format("{0}:{1:00}", (tempWorkAll / 60), (tempWorkAll % 60)), font8Bold, Brushes.Black, r_Right, sf);

            //normatywny czas pracy
            sF_Left      = e.Graphics.MeasureString("Normatywny czas pracy:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height * 2;
            e.Graphics.DrawString("Normatywny czas pracy:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0}", hoursToWork), font8, Brushes.Black, r_Right, sf);

            ////////////////////////////////
            ///////////////////////////////MIDDLE COLUMN
            ///////////////////////////////
            //za godziny
            sF_Left      = e.Graphics.MeasureString("Za przepracowane:", font8);
            r_Left.X     = r_Right.Right + space * 2;
            r_Left.Y     = rect.Bottom + r_Left.Height;
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            e.Graphics.DrawString("Za przepracowane:", font8, Brushes.Black, r_Left, sf);

            sF_right     = e.Graphics.MeasureString("300.524,00 zł", font8Bold);
            r_Right.X    = r_Left.Right;
            r_Right.Y    = r_Left.Y;
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            e.Graphics.DrawString(string.Format("{0:C}", salaryWork.CalculateSalaryRegular(employee.RateRegular, hoursToWork)), font8Bold, Brushes.Black, r_Right, sf);

            // za nadgodziny 50%
            sF_Left      = e.Graphics.MeasureString("Za nadgodziny (50%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Za nadgodziny (50%):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryWork.CalculateSalaryOvertime50(employee.RateOvertime)), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - za nadgodziny 100%
            sF_Left      = e.Graphics.MeasureString("Za nadgodziny (100%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Za nadgodziny (100%):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryWork.CalculateSalaryOvertime100(employee.RateOvertime)), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - za urlop
            sF_Left      = e.Graphics.MeasureString("Za urlop:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Za urlop:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryDayOff.CalculateSalaryDayOff(employee.RateRegular, hoursToWork)), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - za chorobowe 80%
            sF_Left      = e.Graphics.MeasureString("Za chorobowe (80%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Za chorobowe (80%):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryIllness.CalculateSalaryIllness80(employee.RateRegular, hoursToWork)), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - za chorobowe 100%
            sF_Left      = e.Graphics.MeasureString("Za chorobowe (100%):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Za chorobowe (100%):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.Right;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryIllness.CalculateSalaryIllness100(employee.RateRegular, hoursToWork)), font8Bold, Brushes.Black, r_Right, sf);


            //następna linia - za wszystko
            sF_Left      = e.Graphics.MeasureString("Razem:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Razem:", font8Bold, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;//obok lewego
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryWork.ForAll + salaryIllness.ForAll + salaryDayOff.ForDayOff), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - pozostało urlopu
            sF_Left      = e.Graphics.MeasureString("Pozostało urlopu:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height * 2;
            e.Graphics.DrawString("Pozostało urlopu:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0}", employee.NumberDaysOffLeft), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - pozostało pożyczki
            sF_Left      = e.Graphics.MeasureString("Pozostało do oddania (pożyczka):", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Pozostało do oddania (pożyczka):", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryLoanInstallment.LoansRemianedToPay(employee.IdEmployee)), font8Bold, Brushes.Black, r_Right, sf);

            /////////////////////////////////////
            ////////////////////////////////////    RIGHT COLUMN
            ////////////////////////////////////
            //zaliczki
            sF_Left      = e.Graphics.MeasureString("Zailczki:", font8);
            r_Left.X     = r_Right.Right + space;
            r_Left.Y     = rect.Bottom + r_Left.Height;
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            e.Graphics.DrawString("Zailczki:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;//obok lewego
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryAdvance.ForAdvances), font8Bold, Brushes.Black, r_Right, sf);

            // pożyczki
            sF_Left      = e.Graphics.MeasureString("Pożyczki:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Pożyczki:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;//obok lewego
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryLoanInstallment.AmountForPaidOffInstallmentInMonth(employee.IdEmployee, date)), font8Bold, Brushes.Black, r_Right, sf);

            // dodatki
            sF_Left      = e.Graphics.MeasureString("Dodatki:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Dodatki:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;//obok lewego
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0:C}", salaryAddition.ForAdditions), font8Bold, Brushes.Black, r_Right, sf);

            // (większy odstęp) - stawka
            sF_Left      = e.Graphics.MeasureString("Stawka:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += (r_Left.Height * 2);
            e.Graphics.DrawString("Stawka:", font8, Brushes.Black, r_Left, sf);

            sF_right      = e.Graphics.MeasureString("9.999,999 zł/mc", font8Bold);
            r_Right.Width = (int)Math.Ceiling(sF_right.Width);
            r_Right.X     = r_Left.X + r_Left.Width;
            r_Right.Y     = r_Left.Y;
            if (employee.RateRegular.IsMonthlyOrHourly == RateType.hourly)//zł/h
            {
                e.Graphics.DrawString(string.Format("{0} zł/h", employee.RateRegular.RateValue), font8Bold, Brushes.Black, r_Right, sf);
            }
            else
            {
                e.Graphics.DrawString(string.Format("{0} zł/mc", employee.RateRegular.RateValue), font8Bold, Brushes.Black, r_Right, sf);
            }


            // stawka nadodziny
            sF_Left      = e.Graphics.MeasureString("Stawka nadgodzinowa:", font8);
            r_Left.Width = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Y    += r_Left.Height;
            e.Graphics.DrawString("Stawka nadgodzinowa:", font8, Brushes.Black, r_Left, sf);

            r_Right.X = r_Left.X + r_Left.Width;
            r_Right.Y = r_Left.Y;
            e.Graphics.DrawString(string.Format("{0} zł/h", employee.RateOvertime.RateValue), font8Bold, Brushes.Black, r_Right, sf);

            //następna linia - do wypłaty
            sF_Left       = e.Graphics.MeasureString("Do wypłaty:", font10Bold);
            r_Left.Width  = (int)Math.Ceiling(sF_Left.Width);
            r_Left.Height = (int)Math.Ceiling(sF_Left.Height);
            r_Left.Y     += r_Left.Height * 2;
            e.Graphics.DrawString("Do wypłaty:", font10, Brushes.Black, r_Left, sf);

            sF_right       = e.Graphics.MeasureString("30.524,00 zł", font10Bold);
            r_Right.X      = r_Left.X + r_Left.Width;            //obok lewego
            r_Right.Y      = r_Left.Y;
            r_Right.Width  = (int)Math.Ceiling(sF_right.Width);  //szerokość prostokąta wg SizeF zaokraglone
            r_Right.Height = (int)Math.Ceiling(sF_right.Height); //wysokość prostokąta wg SizeF
            e.Graphics.DrawString(string.Format("{0:C}", salaryWork.ForAll + salaryIllness.ForAll + salaryDayOff.ForDayOff - salaryAdvance.ForAdvances + salaryAddition.ForAdditions - salaryLoanInstallment.ForInstallment), font10Bold, Brushes.Black, r_Right, sf);

            //przypisanie zmiennych dla nowego pracownika
            this.y = r_Right.Bottom + r_Right.Height * 2;

            if (employeeCounter == sumEmployeesPerPage)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public static void DisplayChart(MainForm form)
        {
            //zmienne
            DateTime date       = new DateTime(form.dtpStatystykiWyborDaty.Value.Date.Year, 1, 1);
            int      idEmployee = Convert.ToInt32(form.cbStatisticSelectEmployee.SelectedValue);

            Employees.EmployeeManager employeeManager = new Employees.EmployeeManager();
            Employees.Employee        employee        = employeeManager.GetEmployee(idEmployee, TableView.view, ConnectionToDB.disconnect);
            int    hoursToWork;// = Salary.GetHoursToWork(date);
            double salaryYearly = 0;
            double salaryMonthy = 0;

            //zerowanie punktów żeby przy wyświetlaniu kolejnego roku się nie dodawały
            foreach (Series s in form.chart1.Series)
            {
                s.Points.Clear();
            }

            form.lblStatystykiWyplatyRazem.Text   = "...";
            form.lblStatystykiWyplatySrednio.Text = "...";
            MainForm.progressLoading = 0;

            //pętla wyświetlająca miesiące
            for (int i = 1; i < 13; i++)
            {
                hoursToWork = Salary.GetHoursToWork(date);
                try
                {
                    SalaryWork salaryWork = new SalaryWork(idEmployee, date);
                    salaryWork.CalculateAll(employee.RateRegular, hoursToWork, employee.RateOvertime);
                    form.chart1.Series["godziny"].Points.AddXY(i, salaryWork.ForAll);
                    salaryMonthy += salaryWork.ForAll;
                }
                catch (NoNullException)
                {
                    form.chart1.Series["godziny"].Points.AddXY(i, 0);
                }

                SalaryDayOff salaryDayOff = new SalaryDayOff(idEmployee, date);
                form.chart1.Series["urlop"].Points.AddXY(i, salaryDayOff.CalculateSalaryDayOff(employee.RateRegular, hoursToWork));

                SalaryIllness salaryIllness = new SalaryIllness(idEmployee, date);
                salaryIllness.CalculateAll(employee.RateRegular, hoursToWork);
                form.chart1.Series["choroba"].Points.AddXY(i, salaryIllness.ForAll);

                SalaryAddition salaryAddition = new SalaryAddition(idEmployee, date);
                form.chart1.Series["dodatki"].Points.AddXY(i, salaryAddition.ForAdditions);

                salaryMonthy += (salaryIllness.ForAll + salaryDayOff.ForDayOff + salaryAddition.ForAdditions);
                form.chart1.Series["godziny"].Points[i - 1].ToolTip = string.Format("{0:C}", salaryMonthy);
                form.chart1.Series["urlop"].Points[i - 1].ToolTip   = string.Format("{0:C}", salaryMonthy);
                form.chart1.Series["choroba"].Points[i - 1].ToolTip = string.Format("{0:C}", salaryMonthy);
                form.chart1.Series["dodatki"].Points[i - 1].ToolTip = string.Format("{0:C}", salaryMonthy);

                //dodanie do podsumowania
                salaryYearly += salaryMonthy;

                date = date.AddMonths(1);
                //dodaje do paska postępu
                MainForm.progressLoading += 8;
                salaryMonthy              = 0;
            }

            //wyświetlenie podliczeń
            form.lblStatystykiWyplatySrednio.Text = string.Format("{0:C}", salaryYearly / 12);
            form.lblStatystykiWyplatyRazem.Text   = string.Format("{0:C}", salaryYearly);

            foreach (Series s in form.chart1.Series)
            {
                s.Enabled = true;
            }

            //nie wyświetla kwoty gdy =0.00
            foreach (Series s in form.chart1.Series)
            {
                for (int i = 0; i < 12; i++)
                {
                    if (s.Points[i].YValues[0] == 0)
                    {
                        s.Points[i].Label = string.Format(" ");
                    }
                    else
                    {
                        s.Points[i].Label = string.Format("{0:C}", s.Points[i].YValues[0]);
                    }
                }
            }
        }