private ContractTypeAmountsVerbose GetDcEarnings()
        {
            var contractTypes = dcEarnings.GroupBy(earning => earning.ContractType)
                                .Select(g => new { ContractType = g.Key, Amount = g.Sum(x => x.Total) })
                                .ToList();
            var result = new ContractTypeAmountsVerbose
            {
                ContractType1 = contractTypes.FirstOrDefault(x => x.ContractType == ContractType.Act1)?.Amount ?? 0,
                ContractType2 = contractTypes.FirstOrDefault(x => x.ContractType == ContractType.Act2)?.Amount ?? 0
            };

            return(result);
        }
        private ContractTypeAmountsVerbose GetDasEarnings(decimal dcContractTpe1, decimal dcContractTpe2)
        {
            var contractTypes = dasEarnings.GroupBy(earning => earning.ContractType)
                                .Select(g => new { ContractType = g.Key, Amount = g.Sum(x => x.Total) })
                                .ToList()
            ;
            var result = new ContractTypeAmountsVerbose
            {
                ContractType1 = contractTypes.FirstOrDefault(x => x.ContractType == ContractType.Act1)?.Amount ?? 0,
                ContractType2 = contractTypes.FirstOrDefault(x => x.ContractType == ContractType.Act2)?.Amount ?? 0,
            };

            result.DifferenceContractType1 = result.ContractType1 - dcContractTpe1;
            result.DifferenceContractType2 = result.ContractType2 - dcContractTpe2;
            result.PercentageContractType1 = Helpers.GetPercentage(result.ContractType1, dcContractTpe1);
            result.PercentageContractType2 = Helpers.GetPercentage(result.ContractType2, dcContractTpe2);
            result.Percentage = Helpers.GetPercentage(result.Total, dcContractTpe1 + dcContractTpe2);
            return(result);
        }
Example #3
0
        public static ContractTypeAmountsVerbose CreatePaymentMetrics(IPeriodEndSummaryModel summaryModel)
        {
            var paymentMetrics = new ContractTypeAmountsVerbose()
            {
                ContractType1 = summaryModel.YearToDatePayments.ContractType1 +
                                summaryModel.Payments.ContractType1 +
                                summaryModel.AdjustedDataLockedEarnings +
                                summaryModel.HeldBackCompletionPayments.ContractType1,
                ContractType2 = summaryModel.YearToDatePayments.ContractType2 +
                                summaryModel.Payments.ContractType2 +
                                summaryModel.HeldBackCompletionPayments.ContractType2
            };

            paymentMetrics.DifferenceContractType1 =
                paymentMetrics.ContractType1 - summaryModel.DcEarnings.ContractType1;
            paymentMetrics.DifferenceContractType2 =
                paymentMetrics.ContractType2 - summaryModel.DcEarnings.ContractType2;
            paymentMetrics.PercentageContractType1 = Helpers.GetPercentage(paymentMetrics.ContractType1, summaryModel.DcEarnings.ContractType1);
            paymentMetrics.PercentageContractType2 = Helpers.GetPercentage(paymentMetrics.ContractType2, summaryModel.DcEarnings.ContractType2);
            paymentMetrics.Percentage = Helpers.GetPercentage(paymentMetrics.Total, summaryModel.DcEarnings.Total);
            return(paymentMetrics);
        }
        private ContractTypeAmountsVerbose GetSubmissionMetrics(SubmissionSummaryModel submissionSummary)
        {
            var submissionMetrics = new ContractTypeAmountsVerbose
            {
                ContractType1 = submissionSummary.YearToDatePayments.ContractType1 +
                                submissionSummary.RequiredPayments.ContractType1 +
                                submissionSummary.AdjustedDataLockedEarnings +
                                submissionSummary.HeldBackCompletionPayments.ContractType1,
                ContractType2 = submissionSummary.YearToDatePayments.ContractType2 +
                                submissionSummary.RequiredPayments.ContractType2 +
                                submissionSummary.HeldBackCompletionPayments.ContractType2
            };

            submissionMetrics.DifferenceContractType1 =
                submissionMetrics.ContractType1 - submissionSummary.DcEarnings.ContractType1;
            submissionMetrics.DifferenceContractType2 =
                submissionMetrics.ContractType2 - submissionSummary.DcEarnings.ContractType2;
            submissionMetrics.PercentageContractType1 = Helpers.GetPercentage(submissionMetrics.ContractType1,
                                                                              submissionSummary.DcEarnings.ContractType1);
            submissionMetrics.PercentageContractType2 = Helpers.GetPercentage(submissionMetrics.ContractType2,
                                                                              submissionSummary.DcEarnings.ContractType2);
            submissionMetrics.Percentage = Helpers.GetPercentage(submissionMetrics.Total, submissionSummary.DcEarnings.Total);
            return(submissionMetrics);
        }