Пример #1
0
        private decimal CalculateMonthSuggestion(decimal dSuggestion, BudgetSectionIndex section, bool projectHasFixedPart, int iMonthKey, IEnumerable <MonthDegreeDayIndex> monthDegreeDayIndex)
        {
            decimal result = 0;

            if (!section.bSpatie && !section.bSubtotaal)
            {
                if (section.bVariable)
                {
                    if (section.bFixedPart && projectHasFixedPart)
                    {
                        result =
                            section.dFixedPart *
                            dSuggestion /
                            12 +
                            (1 - section.dFixedPart) *
                            dSuggestion /
                            monthDegreeDayIndex.Sum(sm => sm.dDegreeDayIndex) *
                            monthDegreeDayIndex.Where(w => w.iMonthKey == iMonthKey).Sum(sm => sm.dDegreeDayIndex);
                    }
                    else
                    {
                        result =
                            (dSuggestion / monthDegreeDayIndex.Sum(sm => sm.dDegreeDayIndex)) *
                            monthDegreeDayIndex.Where(w => w.iMonthKey == iMonthKey).Sum(sm => sm.dDegreeDayIndex);
                    }
                }
                else
                {
                    result = dSuggestion / 12;
                }
            }

            return(result);
        }
Пример #2
0
        private decimal?CalculateYearSuggestion(decimal?dTotal, BudgetSectionIndex section, bool projectHasFixedPart, int previewYear, int realisedYear)
        {
            decimal?result = 0;

            //if (!section.bSpatie && !section.bSubtotaal)
            if (!section.bSpatie)
            {
                if (section.bVariable)
                {
                    decimal?previewYearIndex = section.BudgetSetting.YearDegreeDayIndex.FirstOrDefault(f => f.iYear == previewYear).dDegreeDayIndex;

                    decimal?realisedYearIndex = section.BudgetSetting.YearDegreeDayIndex.FirstOrDefault(f => f.iYear == realisedYear).dDegreeDayIndex;

                    if (section.bFixedPart && projectHasFixedPart)
                    {
                        dTotal = ((1 - section.dFixedPart) * dTotal / previewYearIndex) * realisedYearIndex + section.dFixedPart * dTotal;
                    }
                    else
                    {
                        dTotal = (dTotal / previewYearIndex) * realisedYearIndex;
                    }
                }

                result = dTotal * section.dSectionIndex;
            }

            return(result);
        }