Exemple #1
0
        public bool IsTotalNegotiatedPriceMoreThanCapForStandard(IEnumerable <ILearningDelivery> learningDeliveries, int standardCode)
        {
            if (learningDeliveries == null)
            {
                return(false);
            }

            var filteredLearningDeliveries = learningDeliveries.Where(
                x => x.StdCodeNullable.HasValue &&
                x.StdCodeNullable.Value == standardCode &&
                x.AimType == TypeOfAim.ProgrammeAim &&
                x.ProgTypeNullable == TypeOfFunding.Age16To19ExcludingApprenticeships &&
                x.FundModel == TypeOfFunding.OtherAdult)
                                             .ToList();

            if (filteredLearningDeliveries.Any())
            {
                var standardAfinTotal = _learningDeliveryAppFinRecordQueryService.GetTotalTNPPriceForLatestAppFinRecordsForLearning(filteredLearningDeliveries);

                var applicableDate = GetApplicableDateForCapChecking(filteredLearningDeliveries);

                return(IsAFilTotalMoreThanCapValue(standardCode, standardAfinTotal, applicableDate));
            }

            return(false);
        }
        public bool ConditionMet(int standardCode, int?totalPMRValue, IReadOnlyCollection <ILearningDelivery> learningDeliveries)
        {
            if (!totalPMRValue.HasValue)
            {
                return(false);
            }

            var standardLearningDeliveries = learningDeliveries.Where(x => x.StdCodeNullable == standardCode).ToList();

            if (!_dd17.IsTotalNegotiatedPriceMoreThanCapForStandard(standardLearningDeliveries, standardCode))
            {
                var standardTNPTotal = _learningDeliveryAppFinRecordQueryService.GetTotalTNPPriceForLatestAppFinRecordsForLearning(standardLearningDeliveries);

                return(totalPMRValue > Math.Round((1m / 3m) * standardTNPTotal));
            }

            return(false);
        }
        public bool ConditionMet(int standardCode, int?totalPMRValue, IReadOnlyCollection <ILearningDelivery> learningDeliveries)
        {
            if (!totalPMRValue.HasValue)
            {
                return(false);
            }

            var standardLearningDeliveries = learningDeliveries.Where(x => x.StdCodeNullable == standardCode).ToList();

            if (_dd17.IsTotalNegotiatedPriceMoreThanCapForStandard(standardLearningDeliveries, standardCode))
            {
                var standardTNPTotal     = _learningDeliveryAppFinRecordQueryService.GetTotalTNPPriceForLatestAppFinRecordsForLearning(standardLearningDeliveries);
                var applicableDateForCap = GetApplicableDateForCapChecking(standardLearningDeliveries);

                var fundingCap = _larsDataService.GetStandardFundingForCodeOnDate(standardCode, applicableDateForCap)?.CoreGovContributionCap;
                return(fundingCap.HasValue && totalPMRValue > (standardTNPTotal - fundingCap));
            }

            return(false);
        }
 public int GetTotalTNPPriceFor(IReadOnlyCollection <ILearningDelivery> theDeliveries) =>
 _appFinRecordData.GetTotalTNPPriceForLatestAppFinRecordsForLearning(theDeliveries);