Example #1
0
        public ErrorList CalcSickDaysT(SalaryCalcTInfo scti)
        {
            var sr = scti.SRS.TotalRow;

            sr.CheckLinkedRows(sr.Row.IDP);

            var err = new ErrorList();

            scti.TotalSI._SICKDAYS     = 0;
            scti.TotalSI._SICKDAYS_PAY = 0.0M;

            if (sr.IsSingleRow())
            {
                err = CalcSickDaysB(sr, null);
                if (err.HasErrors)
                {
                    return(err);
                }

                scti.TotalSI._SICKDAYS     = TotalRow.DaysCount;
                scti.TotalSI._SICKDAYS_PAY = TotalRow.SickDayPay;

                if (PreparingReport)
                {
                    scti.LinkedSCI[0].SickDayCalc = this;
                }
                return(err);
            }

            TotalSDCI = new SickDayCalcInfo(PreparingReport);
            TotalSDCI.SetAvPayFrom(this);
            err = TotalSDCI.CalcSickDaysA(sr.SalarySheetRowSet);
            if (err.HasErrors)
            {
                return(err);
            }
            SetAvPayFrom(TotalSDCI);

            if (TotalSDCI.TotalRow.DaysCount == 0)
            {
                new ErrorList();
            }


            SickDayCalcInfo[] sdcs      = null;
            string[]          positions = null;

            var srs = sr.SalarySheetRowSet;

            sdcs      = new SickDayCalcInfo[srs.LinkedRows.Length];
            positions = new string[srs.LinkedRows.Length];

            for (int i = 0; i < srs.LinkedRows.Length; i++)
            {
                var lr  = srs.LinkedRows[i];
                var sci = scti.LinkedSCI[i];
                var sdc = new SickDayCalcInfo(PreparingReport);
                positions[i] = lr.GetPositionTitle();
                sdcs[i]      = sdc;
                sdc.SetAvPayFrom(this);

                sci.SI._SICKDAYS     = 0;
                sci.SI._SICKDAYS_PAY = 0.0M;

                err = sdc.CalcSickDaysB(lr, TotalSDCI);
                if (err.HasErrors)
                {
                    return(err);
                }

                sci.SI._SICKDAYS     = sdc.TotalRow.DaysCount;
                sci.SI._SICKDAYS_PAY = sdc.TotalRow.SickDayPay;

                if (PreparingReport)
                {
                    sci.SickDayCalc = sdc;
                }
            }
            SumTotalPay(sdcs, TotalSDCI);

            scti.TotalSI._SICKDAYS     = TotalRow.DaysCount;
            scti.TotalSI._SICKDAYS_PAY = TotalRow.SickDayPay;

            if (PreparingReport)
            {
                PrepareListT(sdcs, positions);
            }

            return(new ErrorList());
        }
Example #2
0
        public ErrorList CalcSickDays(SalarySheetRowInfo sr)
        {
            var err = sr.CheckLinkedRows(sr.Row.IDP);

            if (err.HasErrors)
            {
                return(err);
            }

            if (sr.IsSingleRow())
            {
                err = CalcSickDaysB(sr, null);
                return(err);
            }

            TotalSDCI = new SickDayCalcInfo(PreparingReport);
            err       = TotalSDCI.CalcSickDaysA(sr.SalarySheetRowSet);
            if (err.HasErrors)
            {
                return(err);
            }

            if (TotalSDCI.TotalRow.DaysCount == 0)
            {
                new ErrorList();
            }

            SetAvPayFrom(TotalSDCI);

            SickDayCalcInfo[] sdcs      = null;
            string[]          positions = null;

            if (sr.Row.XType == ESalarySheetRowType.Total)
            {
                var srs = sr.SalarySheetRowSet;

                sdcs      = new SickDayCalcInfo[srs.LinkedRows.Length];
                positions = new string[srs.LinkedRows.Length];

                for (int i = 0; i < srs.LinkedRows.Length; i++)
                {
                    var lr  = srs.LinkedRows[i];
                    var sdc = new SickDayCalcInfo(PreparingReport);
                    positions[i] = lr.GetPositionTitle();
                    sdcs[i]      = sdc;
                    sdc.SetAvPayFrom(this);

                    err = sdc.CalcSickDaysB(lr, TotalSDCI);
                    if (err.HasErrors)
                    {
                        return(err);
                    }
                }
                SumTotalPay(sdcs, TotalSDCI);
                if (PreparingReport)
                {
                    PrepareListT(sdcs, positions);
                }
            }
            else
            {
                if (PreparingReport)
                {
                    PrepareListA(sr.GetPositionTitle());
                }
                err = CalcSickDaysB(sr, TotalSDCI);
                if (err.HasErrors)
                {
                    return(err);
                }
            }

            return(new ErrorList());
        }