/// <summary>
        /// Calculates each baselineItem burned/actual data point while populating aggregate non cumulative burned/actual data points
        /// </summary>
        /// <returns>Non cumulative earned progress data points</returns>
        public override void BuildBurnedDataPoints()
        {
            ObservableCollection <ProgressInfo> nonCumulative_BurnedDataPoints = new ObservableCollection <ProgressInfo>();
            DateTime firstAlignedDataDate = SummaryObject.FirstAlignedDataDate;
            TimeSpan progressInterval     = SummaryObject.IntervalPeriod;
            DateTime loopDate             = firstAlignedDataDate;

            IEnumerable <WORKPACK> WORKPACKS         = SummaryObject.LiveBASELINE.PROJECT.WORKPACK;
            IEnumerable <string>   qualifiedWorkpack = WORKPACKS == null ? new List <string>() : WORKPACKS.Select(x => x.INTERNAL_NAME1);
            var PrimeroUnitOfWork = PrimeroEntitiesUnitOfWorkSource.GetUnitOfWorkFactory().CreateUnitOfWork();
            var jobTransactions   = from JOBTRANS in PrimeroUnitOfWork.JOB_TRANSACTIONS
                                    join JOBCOST_HDR2 in PrimeroUnitOfWork.JOBCOST_HDR
                                    on JOBTRANS.MASTER_JOBNO equals JOBCOST_HDR2.JOBNO
                                    join JOBCOST_HDR1 in PrimeroUnitOfWork.JOBCOST_HDR
                                    on JOBTRANS.JOBNO equals JOBCOST_HDR1.JOBNO
                                    join JOBCOST_RESOURCE in PrimeroUnitOfWork.JOBCOST_RESOURCE
                                    on JOBTRANS.STAFFNO equals JOBCOST_RESOURCE.SEQNO
                                    where JOBCOST_HDR2.JOBCODE == SummaryObject.LiveBASELINE.PROJECT.NUMBER && JOBTRANS.TRANSTYPE == "T"
                                    select new { JOBCOST_HDR1.JOBCODE, JOBTRANS.QUANTITY, JOBTRANS.LINETOTAL, JOBTRANS.LINECOST, JOBTRANS.TRANSDATE, JOBCOST_RESOURCE.RESOURCENAME };

            var jobTransactionsList = jobTransactions.ToList();

            if (jobTransactionsList.Count == 0)
            {
                return;
            }

            List <DateTime> alignedDataDates = ISupportProgressReportingExtensions.GenerateAlignedDatesCollection(firstAlignedDataDate, jobTransactionsList.Max(x => x.TRANSDATE).Value, progressInterval);

            foreach (var jobTransaction in jobTransactionsList)
            {
                if (qualifiedWorkpack.Contains(jobTransaction.JOBCODE))
                {
                    nonCumulative_BurnedDataPoints.Add(new ProgressInfo()
                    {
                        BudgetedUnits    = 0,
                        BudgetedCosts    = 0,
                        Units            = (decimal)jobTransaction.QUANTITY,
                        Costs            = (decimal)jobTransaction.LINETOTAL * this.CurrencyConversion,
                        Actuals          = (decimal)jobTransaction.LINECOST,
                        ProgressDate     = alignedDataDates.FirstOrDefault(dates => dates.Date >= jobTransaction.TRANSDATE),
                        BaselineItemGuid = Guid.Empty,
                        WorkpackName     = jobTransaction.JOBCODE,
                        ResourceName     = jobTransaction.RESOURCENAME,
                        Quantity         = (decimal)jobTransaction.QUANTITY
                    });
                }
            }

            SummaryObject.NonCumulative_BurnedDataPoints = nonCumulative_BurnedDataPoints;
        }
        public override void BuildRemainingDataPoints()
        {
            BuildProductivity();
            //Establishing aligned week ending dates
            List <DateTime> alignedWeekEndingDates = ISupportProgressReportingExtensions.GenerateAlignedDatesCollection(SummaryObject.FirstAlignedDataDate, SummaryObject.FirstAlignedDataDate.AddYears(1), SummaryObject.IntervalPeriod);

            IQueryable <ProgressInfo> progressItemsEarnedDataPointsBeforeDataDate = SummaryObject.ReportableObjects.SelectMany(progressItem => progressItem.NonCumulative_EarnedDataPoints.Where(dataPoint => dataPoint.ProgressDate.Date <= SummaryObject.ReportingDataDate.Date)).AsQueryable();
            decimal totalEarnedUnits = progressItemsEarnedDataPointsBeforeDataDate.Sum(dataPoint => dataPoint.Units);

            if (totalEarnedUnits == 0)
            {
                return;
            }

            List <Period> exceptionPeriods = new List <Period>();

            exceptionPeriods.AddRange(ISupportProgressReportingExtensions.NonWorkingPeriods);

            foreach (ReportableObject reportableObject in SummaryObject.ReportableObjects)
            {
                //when remaining units is more than 0 continue calculation
                if (reportableObject.FuturePROGRESS_ITEMS_UNITS > 0)
                {
                    List <ProgressInfo> progressItemP6DataPoints;
                    if (reportableObject.isDataPointsGeneratedFromP6 && TryBuildP6DataPoints(this.PROGRESS_PROJECT, this.PROGRESS_TASKS, reportableObject, DataPointsType.Remaining, WorkpackAssignmentLoadType.Modified, out progressItemP6DataPoints))
                    {
                        reportableObject.NonCumulative_RemainingPlannedDataPoints = new ObservableCollection <ProgressInfo>(progressItemP6DataPoints);
                    }
                    else
                    {
                        DateTime startDateToUse;
                        DateTime firstAlignedWeekEndingDataDate;
                        decimal  firstPeriodProRate;

                        if (reportableObject.BASELINE_ITEMJoinRATE.BASELINE_ITEM.WORKPACK.FORECASTSTARTDATE != null)
                        {
                            startDateToUse = (DateTime)reportableObject.BASELINE_ITEMJoinRATE.BASELINE_ITEM.WORKPACK.FORECASTSTARTDATE;
                        }
                        else
                        {
                            startDateToUse = reportableObject.BASELINE_ITEMJoinRATE.BASELINE_ITEM.WORKPACK.STARTDATE;
                        }

                        //when workpack dates are later than data date use workpack dates but have a prorate value ready for first period
                        if (startDateToUse > SummaryObject.LivePROGRESS.DATA_DATE)
                        {
                            firstAlignedWeekEndingDataDate = alignedWeekEndingDates.FirstOrDefault(dates => dates.Date >= startDateToUse);
                            firstPeriodProRate             = Convert.ToDecimal((firstAlignedWeekEndingDataDate.AddSeconds(1) - startDateToUse).TotalDays / SummaryObject.IntervalPeriod.TotalDays);
                        }
                        else
                        {
                            firstAlignedWeekEndingDataDate = SummaryObject.LivePROGRESS.DATA_DATE.AddDays(SummaryObject.IntervalPeriod.Days);
                            firstPeriodProRate             = 1;
                        }

                        decimal maxInefficiency = 0.5M;

                        decimal currentEfficiency = (reportableObject.ActualProductivity / reportableObject.BaselineProductivity);

                        reportableObject.NonCumulative_RemainingPlannedDataPoints = ISupportProgressReportingExtensions.RemainingDataPointsGenerator(SummaryObject, reportableObject, firstAlignedWeekEndingDataDate, exceptionPeriods, reportableObject.FuturePROGRESS_ITEMS_UNITS, reportableObject.BaselineProductivity, this.CurrencyConversion, firstPeriodProRate);

                        //if there's a planned finish date based on baseline productivity, inflate periodic units/costs
                        DateTime?plannedLimitDate = (reportableObject.NonCumulative_RemainingPlannedDataPoints == null || reportableObject.NonCumulative_RemainingPlannedDataPoints.Count == 0) ? (DateTime?)null : reportableObject.NonCumulative_RemainingPlannedDataPoints.Last().ProgressDate;

                        if (currentEfficiency < maxInefficiency)
                        {
                            currentEfficiency = maxInefficiency;
                        }

                        decimal inflatedInefficientUnits = currentEfficiency > 0 ? (reportableObject.FuturePROGRESS_ITEMS_UNITS / currentEfficiency) : reportableObject.FuturePROGRESS_ITEMS_UNITS;

                        reportableObject.NonCumulative_RemainingCurrentDataPoints = ISupportProgressReportingExtensions.RemainingDataPointsGenerator(SummaryObject, reportableObject, firstAlignedWeekEndingDataDate, exceptionPeriods, inflatedInefficientUnits, reportableObject.ActualProductivity, this.CurrencyConversion, firstPeriodProRate, plannedLimitDate);
                    }
                }
            }

            //extract all data points out to be used as an overall summary
            SummaryObject.NonCumulative_RemainingPlannedDataPoints = new ObservableCollection <ProgressInfo>(SummaryObject.ReportableObjects.SelectMany(progressItem => progressItem.NonCumulative_RemainingPlannedDataPoints));
            SummaryObject.NonCumulative_RemainingCurrentDataPoints = new ObservableCollection <ProgressInfo>(SummaryObject.ReportableObjects.SelectMany(progressItem => progressItem.NonCumulative_RemainingCurrentDataPoints));
        }