Exemple #1
0
        public bool IsAFilTotalMoreThanCapValue(int standardCode, int totalStandardsValue, DateTime?startDate)
        {
            if (startDate != null)
            {
                var fundingCap = _larsDataService.GetStandardFundingForCodeOnDate(standardCode, startDate.Value)?.CoreGovContributionCap;

                if (!fundingCap.HasValue)
                {
                    return(false);
                }

                if (((2m / 3m) * totalStandardsValue) > fundingCap)
                {
                    return(true);
                }
            }

            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);
        }