Exemplo n.º 1
0
        public ErrorList CalcVacationDays()
        {
            VacationCalc = new VacationCalcInfo(PreparingReport, TotalSI._CALC_VER);
            VacationCalc.SetAvPayFrom(this);
            var err = VacationCalc.CalcVacationDaysT(this);

            if (err.HasErrors)
            {
                return(err);
            }
            VacationCalc.SetAvPayTo(this);
            VacationCalc.WriteTo(SRS.TotalPersonPay);
            return(new ErrorList());
        }
Exemplo n.º 2
0
        public ErrorList CalcVacationDaysT(SalaryCalcTInfo scti)
        {
            ErrorList err;
            var       sr = scti.SRS.TotalRow;

            sr.CheckLinkedRows(sr.Row.IDP);
            SetAvPayFrom(scti);

            if (sr.IsSingleRow())
            {
                var lsci = scti.LinkedSCI[0];

                err = CalcVacationDays(lsci);
                if (err.HasErrors)
                {
                    return(err);
                }

                SetAvPayTo(scti);
                SetAvPayTo(lsci);
                WriteTo(lsci.SI);
                WriteTo(scti.TotalSI);
                if (PreparingReport)
                {
                    scti.LinkedSCI[0].VacationCalc = this;
                }
                return(err);
            }

            if (sr.Row.XType != ESalarySheetRowType.Total)
            {
                throw new Exception("Bad call");
            }

            GetAvPayCalc(scti.SRS.TotalRow);

            var vcs = new VacationCalcInfo[scti.LinkedSCI.Length];

            for (int i = 0; i < scti.LinkedSCI.Length; i++)
            {
                var vc = new VacationCalcInfo(PreparingReport, CalcVer);
                vcs[i] = vc;
                vc.SetAvPayFrom(this);
            }

            err = CalcVacationDays2(scti.SRS.TotalRow, vcs, scti.TotalSI._CALC_VER);
            if (err.HasErrors)
            {
                return(err);
            }

            SetAvPayTo(scti);

            EnsureExactSum(vcs);

            for (int i = 0; i < scti.LinkedSCI.Length; i++)
            {
                var lsci = scti.LinkedSCI[i];
                var lr   = scti.SRS.LinkedRows[i];
                var vc   = vcs[i];
                lsci.VacationCalc = vc;
                vc.WriteTo(lsci.SI);
            }

            WriteTo(scti.TotalSI);

            if (PreparingReport)
            {
                var positions = new string[scti.LinkedSCI.Length];
                for (int i = 0; i < scti.LinkedSCI.Length; i++)
                {
                    var lsci = scti.LinkedSCI[i];
                    positions[i] = lsci.PositionTitle;
                }
                PrepareListT(vcs, positions, this);
            }

            return(err);
        }