private string GetAppServiceEmployerName(DASPaymentInfo payment, IDictionary <long, string> legalNameDictionary)
        {
            if (payment.ContractType == 1 && (payment.TransactionType == 4 || payment.TransactionType == 6) && payment.ApprenticeshipId.HasValue)
            {
                return(legalNameDictionary.GetValueOrDefault(payment.ApprenticeshipId.Value));
            }

            return(null);
        }
Esempio n. 2
0
        public async Task <AppsAdditionalPaymentDasPaymentsInfo> GetPaymentsInfoForAppsAdditionalPaymentsReportAsync(int ukPrn, CancellationToken cancellationToken)
        {
            var appsAdditionalPaymentDasPaymentsInfo = new AppsAdditionalPaymentDasPaymentsInfo
            {
                UkPrn    = ukPrn,
                Payments = new List <DASPaymentInfo>()
            };

            cancellationToken.ThrowIfCancellationRequested();

            List <Payment> paymentsList;

            using (var context = _dasPaymentsContextFactory())
            {
                paymentsList = await context.Payments.Where(x => x.Ukprn == ukPrn &&
                                                            x.FundingSource == FundingSource &&
                                                            AppsAdditionalPaymentsTransactionTypes.Contains(x.TransactionType)).ToListAsync(cancellationToken);
            }

            foreach (var payment in paymentsList)
            {
                var paymentInfo = new DASPaymentInfo
                {
                    FundingSource            = payment.FundingSource,
                    TransactionType          = payment.TransactionType,
                    AcademicYear             = payment.AcademicYear,
                    CollectionPeriod         = payment.CollectionPeriod,
                    ContractType             = payment.ContractType,
                    DeliveryPeriod           = payment.DeliveryPeriod,
                    LearnerReferenceNumber   = payment.LearnerReferenceNumber,
                    LearnerUln               = payment.LearnerUln,
                    LearningAimFrameworkCode = payment.LearningAimFrameworkCode,
                    LearningAimPathwayCode   = payment.LearningAimPathwayCode,
                    LearningAimProgrammeType = payment.LearningAimProgrammeType,
                    LearningAimReference     = payment.LearningAimReference,
                    LearningAimStandardCode  = payment.LearningAimStandardCode,
                    Amount = payment.Amount,
                    LearningAimFundingLineType = payment.LearningAimFundingLineType,
                    TypeOfAdditionalPayment    = GetTypeOfAdditionalPayment(payment.TransactionType),
                    EmployerName = string.Empty
                };

                appsAdditionalPaymentDasPaymentsInfo.Payments.Add(paymentInfo);
            }

            return(appsAdditionalPaymentDasPaymentsInfo);
        }
Esempio n. 3
0
        private decimal GetMonthlyEarnings(DASPaymentInfo paymentInfo, List <AECApprenticeshipPriceEpisodePeriodisedValuesInfo> aecApprenticeshipPriceEpisodePeriodisedValuesInfo, int month)
        {
            decimal?result = 0;

            if (paymentInfo.TransactionType == 4 || paymentInfo.TransactionType == 6)
            {
                result = aecApprenticeshipPriceEpisodePeriodisedValuesInfo.SingleOrDefault(x => x.AttributeName.Equals(Constants.Fm36PriceEpisodeFirstEmp1618PayAttributeName))?.Periods[month] ?? 0 +
                         aecApprenticeshipPriceEpisodePeriodisedValuesInfo.SingleOrDefault(x => x.AttributeName.Equals(Constants.Fm36PriceEpisodeSecondEmp1618PayAttributeName))?.Periods[month] ?? 0;
            }

            if (paymentInfo.TransactionType == 5 || paymentInfo.TransactionType == 7)
            {
                result = aecApprenticeshipPriceEpisodePeriodisedValuesInfo.SingleOrDefault(x => x.AttributeName.Equals(Constants.Fm36PriceEpisodeFirstProv1618PayAttributeName))?.Periods[month] ?? 0 +
                         aecApprenticeshipPriceEpisodePeriodisedValuesInfo.SingleOrDefault(x => x.AttributeName.Equals(Constants.Fm36PriceEpisodeSecondProv1618PayAttributeName))?.Periods[month] ?? 0;
            }

            if (paymentInfo.TransactionType == 16)
            {
                result = aecApprenticeshipPriceEpisodePeriodisedValuesInfo.SingleOrDefault(x => x.AttributeName.Equals(Constants.Fm36PriceEpisodeLearnerAdditionalPaymentAttributeName))?.Periods[month] ?? 0;
            }

            return(result.GetValueOrDefault());
        }
Esempio n. 4
0
        private string GetEmployerIdentifier(AECLearningDeliveryInfo aecLearningDeliveryInfo, DASPaymentInfo paymentInfo)
        {
            var identifier = 0;

            if (aecLearningDeliveryInfo != null)
            {
                if (paymentInfo.TransactionType == 4)
                {
                    identifier = aecLearningDeliveryInfo.LearnDelEmpIdFirstAdditionalPaymentThreshold.GetValueOrDefault();
                }

                if (paymentInfo.TransactionType == 6)
                {
                    identifier = aecLearningDeliveryInfo.LearnDelEmpIdSecondAdditionalPaymentThreshold.GetValueOrDefault();
                }
            }

            return(identifier == 0 ? "Not available" : identifier.ToString());
        }
Esempio n. 5
0
 private decimal GetMonthlyPayments(DASPaymentInfo paymentInfo, string collectionPeriodName)
 {
     return(paymentInfo.CollectionPeriod.ToCollectionPeriodName(paymentInfo.AcademicYear.ToString()).Equals(collectionPeriodName) ? paymentInfo.Amount : 0);
 }