private void CalculateTotals() { var allEarnings = allSummaries.Select(x => x.DcEarnings).ToList(); dcEarnings = new ContractTypeAmounts() { ContractType1 = allEarnings.Sum(x => x.ContractType1), ContractType2 = allEarnings.Sum(x => x.ContractType2) }; var allProviderPayments = allSummaries.Select(x => x.Payments).ToList(); payments = new ContractTypeAmounts() { ContractType1 = allProviderPayments.Sum(x => x.ContractType1), ContractType2 = allProviderPayments.Sum(x => x.ContractType2) }; var allYearToDatePayments = allSummaries.Select(x => x.YearToDatePayments).ToList(); yearToDatePayments = new ContractTypeAmounts() { ContractType1 = allYearToDatePayments.Sum(x => x.ContractType1), ContractType2 = allYearToDatePayments.Sum(x => x.ContractType2) }; var allHeldBackCompletionPayments = allSummaries.Select(x => x.HeldBackCompletionPayments).ToList(); heldBackCompletionPayments = new ContractTypeAmounts() { ContractType1 = allHeldBackCompletionPayments.Sum(x => x.ContractType1), ContractType2 = allHeldBackCompletionPayments.Sum(x => x.ContractType2), }; var allNegativeEarnings = allSummaries.Select(x => x.NegativeEarnings).ToList(); negativeEarnings = new NegativeEarningsContractTypeAmounts { ContractType1 = allNegativeEarnings.Sum(x => x.ContractType1), ContractType2 = allNegativeEarnings.Sum(x => x.ContractType2) }; dataLockedEarnings = allSummaries.Select(x => x.TotalDataLockedEarnings).Sum(); dataLockedEarnings16To18 = allSummaries.Select(x => x.TotalDataLockedEarnings16To18).Sum(); dataLockedEarnings19Plus = allSummaries.Select(x => x.TotalDataLockedEarnings19Plus).Sum(); dataLockedAlreadyPaidTotal = allSummaries.Select(x => x.AlreadyPaidDataLockedEarnings).Sum(); dataLockedAlreadyPaidTotal16To18 = allSummaries.Select(x => x.AlreadyPaidDataLockedEarnings16To18).Sum(); dataLockedAlreadyPaidTotal19Plus = allSummaries.Select(x => x.AlreadyPaidDataLockedEarnings19Plus).Sum(); CalculateDataLockTypeCounts(); inLearning = allSummaries.Sum(x => x.InLearning); }
public PeriodEndProviderSummary(long ukprn, long jobId, byte collectionPeriod, short academicYear) { Ukprn = ukprn; JobId = jobId; CollectionPeriod = collectionPeriod; AcademicYear = academicYear; providerDcEarnings = new List <TransactionTypeAmountsByContractType>(); providerTransactionsTypes = new List <TransactionTypeAmountsByContractType>(); providerFundingSourceAmounts = new List <ProviderFundingSourceAmounts>(); providerPaymentsYearToDate = new ProviderContractTypeAmounts(); providerHeldBackCompletionPayments = new ProviderContractTypeAmounts(); periodEndProviderDataLockTypeCounts = new PeriodEndProviderDataLockTypeCounts(); negativeEarnings = new NegativeEarningsContractTypeAmounts(); }