示例#1
0
        //need to add the correct subcost price type with the correct parent pricetotal
        private static void SetCostTotals(LCC1Calculator lifeCycleInput)
        {
            //init at zero (these get summed in npv and lcc comp and investment calcors)
            lifeCycleInput.LCCInput.OCPrice  = 0;
            lifeCycleInput.LCCInput.AOHPrice = 0;
            lifeCycleInput.LCCInput.CAPPrice = 0;

            lifeCycleInput.OCTotalCost  = 0;
            lifeCycleInput.AOHTotalCost = 0;
            lifeCycleInput.CAPTotalCost = 0;
            //set the totals
            //ok to use the default order of the subcosts
            foreach (SubPrice1 subprice in lifeCycleInput.SubPrice1s)
            {
                SetInputBasePrice(lifeCycleInput, subprice.SubPType, subprice.SubPTotal);
            }
            //set lcc total
            lifeCycleInput.LCCTotalCost = lifeCycleInput.OCTotalCost + lifeCycleInput.AOHTotalCost + lifeCycleInput.CAPTotalCost;
            //set eaa total
            lifeCycleInput.EAATotalCost = GeneralRules.CalculateEquivalentAnnualAnnuity(lifeCycleInput.LCCTotalCost,
                                                                                        lifeCycleInput.ServiceLifeYears, lifeCycleInput.LCCInput.Local.RealRate, lifeCycleInput.LCCInput.Local.NominalRate);
            //set unit cost
            if (lifeCycleInput.PerUnitAmount == 0)
            {
                lifeCycleInput.PerUnitAmount = 1;
            }
            lifeCycleInput.UnitTotalCost = lifeCycleInput.LCCTotalCost / lifeCycleInput.PerUnitAmount;
        }
示例#2
0
        private void ScanForMovies(List <Movie> movies, string path, CancellationToken ct)
        {
            _logger.LogInformation($"Scan {path} started");

            string hardDrive = GeneralRules.GetHardDrive(path);

            try
            {
                foreach (var filePath in Directory.EnumerateFiles(path))
                {
                    if (TryGetMovie(filePath, hardDrive, out Movie movie))
                    {
                        movies.Add(movie);
                    }
                }

                ct.ThrowIfCancellationRequested();

                foreach (var directoryPath in Directory.EnumerateDirectories(path))
                {
                    ScanForMovies(movies, directoryPath, ct);
                }

                ct.ThrowIfCancellationRequested();
            }
            catch (OperationCanceledException oce)
            {
                _logger.LogError(oce, $"Operation was cancelled while scanning movies in {path}");
            }
            catch (Exception e)
            {
                _logger.LogCritical(e, $"Couldn't scan for movies in {path} due to critical error.");
            }
        }
示例#3
0
        public static double GetDiscountedTotal(string discountType,
                                                double price, double quantity,
                                                double life, double realRate, double nominalRate,
                                                double escalationRate, double times, double planningYear,
                                                double serviceYears, double yearFromBase)
        {
            double dbDiscTotal = price * quantity;

            GeneralRules.GROWTH_SERIES_TYPES eGrowthType = GeneralRules.GetGrowthType(discountType);
            double dbSalvVal = 0;

            if (realRate > 0)
            {
                realRate = realRate / 100;
            }
            if (nominalRate > 0)
            {
                nominalRate = nominalRate / 100;
            }
            dbDiscTotal = GeneralRules.GetGradientRealDiscountValue(dbDiscTotal,
                                                                    realRate, serviceYears, yearFromBase,
                                                                    planningYear, eGrowthType, escalationRate,
                                                                    escalationRate, life, times, dbSalvVal);
            return(dbDiscTotal);
        }
示例#4
0
        //private void CalculateButton_Click(object sender, RoutedEventArgs e)
        private void Calculate()
        {
            string typeOfOperation = PrincipleCombo.Text;

            if (typeOfOperation == "FinancialSettlementApp.Logic.GeneralRules")
            {
                Decimal sumOfTaking = TakeSumOfTaking(1);
                Decimal sumOfCost   = TakeSumOfCost(1);
                bool    discount    = (bool)discountCheck.IsChecked;
                string  type        = "Normal";
                if (discount)
                {
                    type = "Start relief";
                }
                GeneralRules generalRules     = new GeneralRules();
                decimal      incomeTaxAdvance = generalRules.Calculate(type, sumOfCost, sumOfTaking, monthValue);

                ScoreBlock.Text    = incomeTaxAdvance.ToString();
                AmountBox.Text     = incomeTaxAdvance.ToString();
                DecriptionBox.Text = "Zaliczka na podatek dochodowy";

                startAnimation(sumOfTaking, sumOfCost);
                decimal a = (incomeTaxAdvance / sumOfTaking) * 100m;
                AnswerText.Text = "Zaliczka stanowi " + (Math.Round(a, 0)) + " %";
            }
            else if (typeOfOperation == "FinancialSettlementApp.Logic.FlatTax")
            {
                Decimal sumOfTaking = TakeSumOfTaking(1);
                Decimal sumOfCost   = TakeSumOfCost(1);
                bool    discount    = (bool)discountCheck.IsChecked;
                string  type        = "Normal";
                if (discount)
                {
                    type = "Start relief";
                }
                FlatTax flatTax          = new FlatTax();
                decimal incomeTaxAdvance = flatTax.Calculate(type, sumOfCost, sumOfTaking, monthValue);
                ScoreBlock.Text    = incomeTaxAdvance.ToString();
                AmountBox.Text     = incomeTaxAdvance.ToString();
                DecriptionBox.Text = "Zaliczka na podatek dochodowy";

                startAnimation(sumOfTaking, sumOfCost);
                decimal a = (incomeTaxAdvance / sumOfTaking) * 100m;
                AnswerText.Text = "Zaliczka stanowi " + (Math.Round(a, 0)) + " %";
            }
            else if (typeOfOperation == "FinancialSettlementApp.Logic.MonthlyBudgetPlan")
            {
                Decimal           sumOfTaking       = TakeSumOfTaking(1);
                Decimal           sumOfCost         = TakeSumOfCost(2);
                string            type              = "Normal";
                MonthlyBudgetPlan monthlyBudgetPlan = new MonthlyBudgetPlan();
                decimal           incomeTaxAdvance  = monthlyBudgetPlan.Calculate(type, sumOfCost, sumOfTaking, monthValue);
                ScoreBlock.Text = incomeTaxAdvance.ToString();

                startAnimation(sumOfTaking, sumOfCost);
                decimal a = (sumOfCost / sumOfTaking) * 100m;
                AnswerText.Text   = "Wydatki stanowią " + (Math.Round(a, 0)) + " %";
                HowScoreText.Text = "Oszczędności: [zł]";
            }
        }
示例#5
0
        /// <summary>
        /// Purpose     Calculate life cycle costs.
        ///             Calculations come from NIST 135.
        /// </summary>
        public bool RunCostCalculations(LCC1Input lifeCycleInput)
        {
            bool bHasCalcs = false;

            GeneralRules.GROWTH_SERIES_TYPES eGrowthType;
            //one subcost to calculate
            double dbSubPrice1Total = 0;
            //only the real rate and constant dollars are used
            //but keep these for possible future use
            double dbNominalRate   = 0;
            double dbRealRate      = 0;
            double dbInflationRate = 0;

            //the totals have to be discounted and escalated from these initial totals
            //(multiplicative means that price does not have to be used)
            //ok to use the default order of the subcosts
            dbSubPrice1Total = lifeCycleInput.SubPrice1.SubPAmount * lifeCycleInput.SubPrice1.SubPPrice;

            //init calculation parameters
            dbRealRate      = lifeCycleInput.Local.RealRate;
            dbNominalRate   = lifeCycleInput.Local.NominalRate;
            dbInflationRate = 0;
            GeneralRules.MissingRate(ref dbRealRate,
                                     ref dbNominalRate, ref dbInflationRate);
            if (dbRealRate > 0.999)
            {
                dbRealRate = dbRealRate / 100;
            }
            if (dbNominalRate > 0.999)
            {
                dbNominalRate = dbNominalRate / 100;
            }
            if (dbInflationRate > 0.999)
            {
                dbInflationRate = dbInflationRate / 100;
            }
            lifeCycleInput.Local.RealRate      = dbRealRate;
            lifeCycleInput.Local.NominalRate   = dbNominalRate;
            lifeCycleInput.Local.InflationRate = dbInflationRate;
            //get the recurring cost factors
            //ok to use the default order of the subcosts
            eGrowthType = GeneralRules.GetGrowthType(lifeCycleInput.SubPrice1.SubPEscType);
            lifeCycleInput.SubPrice1.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice1Total,
                                                                                           dbRealRate, lifeCycleInput.ServiceLifeYears, lifeCycleInput.YearsFromBaseDate,
                                                                                           lifeCycleInput.PlanningConstructionYears, eGrowthType, lifeCycleInput.SubPrice1.SubPEscRate,
                                                                                           lifeCycleInput.SubPrice1.SubPFactor, lifeCycleInput.SubPrice1.SubPYears,
                                                                                           lifeCycleInput.SubPrice1.SubPYearTimes, lifeCycleInput.SubPrice1.SubPSalvValue);
            lifeCycleInput.SubPrice1.SubPTotalPerUnit = lifeCycleInput.SubPrice1.SubPTotal / lifeCycleInput.PerUnitAmount;

            //set lifeCyleInput's total properties to these values
            SetCostTotals(lifeCycleInput);
            //update the base input's prices (unit costs, not full costs)
            UpdateBaseInputUnitPrices(lifeCycleInput);
            bHasCalcs = true;
            return(bHasCalcs);
        }
        public async Task <List <Movie> > ScanMoviesAndStoreThemAsync(StorageMode storageMode, CancellationToken ct, params string[] paths)
        {
            var movies = new List <Movie>();

            List <string> hardDrives = new List <string>(paths.Length);

            string[] pathsTable = new string[paths.Length];

            for (var i = 0; i < paths.Length; i++)
            {
                var path = paths[i];
                pathsTable[i] = path;
                hardDrives.Add(GeneralRules.GetHardDrive(path));

                _logger.LogInformation($"Request scan movies on {path}");
                movies.AddRange(_movieScanner.ScanForMovies(path, ct));
            }

            hardDrives.Sort(string.Compare);

            string fileStorageName = string.Empty;

            foreach (var hardDrive in hardDrives)
            {
                fileStorageName += hardDrive + "_";
            }

            fileStorageName += "Movies.json";


            string storagePath = paths[0] + $"\\{fileStorageName}";

            ct.ThrowIfCancellationRequested();

            switch (storageMode)
            {
            case StorageMode.Override:
            {
                _logger.LogInformation($"Request store movies on {storagePath}");
                await _movieStorage.OverrideMovieListAsync(movies, storagePath, ct);

                break;
            }
            }

            return(movies);
        }
示例#7
0
        /// <summary>
        /// Calculate amoritized capital service costs
        /// </summary>
        /// <param name="calculatorType"></param>
        /// <param name="i"></param>
        /// <param name="timePeriods"></param>
        /// <param name="plannedUsePeriods"></param>
        /// <param name="usefulLifePeriods"></param>
        /// <param name="realRate"></param>
        /// <param name="timeType"></param>
        /// <param name="sumCosts"></param>
        /// <param name="sumOutputs"></param>
        /// <param name="amortizedAvgCostperPeriod"></param>
        public static void CalcAmortizdServiceCosts(AgBudgetingHelpers.CALCULATOR_TYPES calculatorType,
                                                    int i, int timePeriods, int plannedUsePeriods, int usefulLifePeriods,
                                                    double realRate, GeneralRules.TIME_TYPES timeType, double sumCosts, double sumOutputs,
                                                    out double amortizedAvgCostperPeriod)
        {
            amortizedAvgCostperPeriod = 0;
            double dbAnnuityFactor = 0;

            //new machinery
            if (timePeriods > 1)
            {
                //convert to annuity
                dbAnnuityFactor = GeneralRules.CapRecovFactor(timePeriods, realRate, 0);
                sumCosts        = sumCosts * dbAnnuityFactor;
                if (timeType == GeneralRules.TIME_TYPES.costsvary)
                {
                    amortizedAvgCostperPeriod = sumCosts / plannedUsePeriods;
                }
                else if (timeType == GeneralRules.TIME_TYPES.costsandoutputsvary)
                {
                    if (sumOutputs == 0)
                    {
                        //shouldn't be using outputs
                        amortizedAvgCostperPeriod = sumCosts / plannedUsePeriods;
                    }
                    else
                    {
                        amortizedAvgCostperPeriod = sumCosts / (sumOutputs / timePeriods);
                    }
                }
            }
            else
            {
                if ((i == 3) && (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery))
                {
                    amortizedAvgCostperPeriod = sumCosts / usefulLifePeriods;
                }
                else
                {
                    amortizedAvgCostperPeriod = sumCosts / plannedUsePeriods;
                }
            }
        }
示例#8
0
 public static void ChangeInputByInputMultipliers(LCC1Calculator lccInput,
                                                  double multiplier)
 {
     //total cost already was multiplied by amount now needs to be multiplied by times
     lccInput.OCTotalCost  = lccInput.OCTotalCost * lccInput.LCCInput.OCAmount * multiplier;
     lccInput.AOHTotalCost = lccInput.AOHTotalCost * lccInput.LCCInput.AOHAmount * multiplier;
     lccInput.CAPTotalCost = lccInput.CAPTotalCost * lccInput.LCCInput.CAPAmount * multiplier;
     //recalculate total costs
     lccInput.LCCTotalCost = lccInput.OCTotalCost
                             + lccInput.AOHTotalCost + lccInput.CAPTotalCost;
     lccInput.EAATotalCost = GeneralRules.CalculateEquivalentAnnualAnnuity(lccInput.LCCTotalCost,
                                                                           lccInput.ServiceLifeYears, lccInput.LCCInput.Local.RealRate, lccInput.LCCInput.Local.NominalRate);
     lccInput.UnitTotalCost = lccInput.LCCTotalCost / lccInput.PerUnitAmount;
     //subcosts can use all three price amounts
     foreach (SubPrice1 subprice in lccInput.SubPrice1s)
     {
         subprice.SubPTotal        = GetMultipliedTotal(lccInput, subprice.SubPTotal, subprice.SubPType, multiplier);
         subprice.SubPTotalPerUnit = subprice.SubPTotal / lccInput.PerUnitAmount;
         //display the multiplier-adjusted quantity of each subprice1
         //this number can be used directly in statistical aggregations
         subprice.SubPAmount = GetMultipliedTotal(lccInput, subprice.SubPAmount, subprice.SubPType, multiplier);
     }
 }
示例#9
0
        //need to add the correct subbenefit price type with the correct parent pricetotal
        private static void SetBenefitTotals(LCB1Calculator lifeCycleOutput)
        {
            //init at zero (these get summed in npv and lcc comp and investment calcors)
            lifeCycleOutput.LCBOutput.Price = 0;

            lifeCycleOutput.RTotalBenefit = 0;
            //ok to use the default order of the subcosts
            foreach (SubPrice1 subprice in lifeCycleOutput.SubPrice1s)
            {
                SetOutputBasePrice(lifeCycleOutput, subprice.SubPType, subprice.SubPTotal);
            }
            //set lcc total
            lifeCycleOutput.LCBTotalBenefit = lifeCycleOutput.RTotalBenefit;
            //set eaa total
            lifeCycleOutput.EAATotalBenefit = GeneralRules.CalculateEquivalentAnnualAnnuity(lifeCycleOutput.LCBTotalBenefit,
                                                                                            lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.LCBOutput.Local.RealRate, lifeCycleOutput.LCBOutput.Local.NominalRate);
            //set unit benefit
            if (lifeCycleOutput.PerUnitAmount == 0)
            {
                lifeCycleOutput.PerUnitAmount = 1;
            }
            lifeCycleOutput.UnitTotalBenefit = lifeCycleOutput.LCBTotalBenefit / lifeCycleOutput.PerUnitAmount;
        }
示例#10
0
 public FactorialOperation()
 {
     //[byte.MinValue; 170] it's a posible range for user input value
     _rulesProvider = new GeneralRules(byte.MinValue, 170);
 }
示例#11
0
        /// <summary>
        /// Calculate used machinery repair costs
        /// </summary>
        /// <param name="calculatorType"></param>
        /// <param name="timeUsed"></param>
        /// <param name="timePeriods"></param>
        /// <param name="plannedUsePeriods"></param>
        /// <param name="startingPeriods"></param>
        /// <param name="remainingPeriods"></param>
        /// <param name="realRate"></param>
        /// <param name="inflationRate"></param>
        /// <param name="timeType"></param>
        /// <param name="RF1"></param>
        /// <param name="RF2"></param>
        /// <param name="OC3Amount"></param>
        /// <param name="sumCosts"></param>
        /// <param name="sumOutputs"></param>
        /// <param name="sumUsedCost"></param>
        /// <param name="amortizedAvgCostperPeriod"></param>
        public static void CalcUsedMachineryRepairCosts(AgBudgetingHelpers.CALCULATOR_TYPES calculatorType, int timeUsed, int timePeriods, int plannedUsePeriods,
                                                        int startingPeriods, int remainingPeriods, double realRate, double inflationRate, GeneralRules.TIME_TYPES timeType,
                                                        double RF1, double RF2, double OC3Amount, double sumCosts, double sumOutputs, double sumUsedCost,
                                                        out double amortizedAvgCostperPeriod)
        {
            amortizedAvgCostperPeriod = 0;
            double dbAnnuityFactor = 0;

            //repair costs for used machinery
            if (timePeriods > 1)
            {
                //only difference is the period over which the amortization takes place -note: this is ad hoc
                //sumCosts = sumCosts;
                //amortize this remainder over the remaining service life of the equipment
                dbAnnuityFactor = GeneralRules.CapRecovFactor((timePeriods - timeUsed), realRate, 0);
                sumCosts        = sumCosts * dbAnnuityFactor;
                if (timeType == GeneralRules.TIME_TYPES.costsvary)
                {
                    amortizedAvgCostperPeriod = sumCosts / plannedUsePeriods;
                }
                else if (timeType == GeneralRules.TIME_TYPES.costsandoutputsvary)
                {
                    if (sumOutputs == 0)
                    {
                        //shouldn't be using outputs
                        amortizedAvgCostperPeriod = sumCosts / plannedUsePeriods;
                    }
                    else
                    {
                        //simple avg unit cost - or use a particular year in ui
                        amortizedAvgCostperPeriod = sumCosts / (sumOutputs / timePeriods);
                    }
                }
                else
                {
                    //the used costs will not have been set in for...next loop, set it here
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        sumUsedCost = (((RF1 * OC3Amount) * System.Math.Pow((startingPeriods / 1000.00), RF2))) * (1 + inflationRate);
                        amortizedAvgCostperPeriod = (sumCosts - sumUsedCost) / remainingPeriods;
                    }
                    else
                    {
                        amortizedAvgCostperPeriod = (sumCosts) / plannedUsePeriods;
                    }
                }
            }
            else
            {
                //12/9 : the costsdonotvary sets timeperiod to 1
                //the used costs will not have been set in for...next loop, set it here
                if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                {
                    sumUsedCost = (((RF1 * OC3Amount) * System.Math.Pow((startingPeriods / 1000.00), RF2))) * (1 + inflationRate);
                    amortizedAvgCostperPeriod = (sumCosts - sumUsedCost) / remainingPeriods;
                }
                else
                {
                    amortizedAvgCostperPeriod = (sumCosts) / plannedUsePeriods;
                }
            }
        }
示例#12
0
        public bool RunBenefitCalculations(LCB1Calculator lifeCycleOutput)
        {
            bool bHasCalcs = false;

            GeneralRules.GROWTH_SERIES_TYPES eGrowthType;
            //five subbenefits to calculate
            double dbSubPrice1Total  = 0;
            double dbSubPrice2Total  = 0;
            double dbSubPrice3Total  = 0;
            double dbSubPrice4Total  = 0;
            double dbSubPrice5Total  = 0;
            double dbSubPrice6Total  = 0;
            double dbSubPrice7Total  = 0;
            double dbSubPrice8Total  = 0;
            double dbSubPrice9Total  = 0;
            double dbSubPrice10Total = 0;
            //only the real rate and constant dollars are used
            //but keep these for possible future use
            double dbNominalRate   = 0;
            double dbRealRate      = 0;
            double dbInflationRate = 0;
            //ok to use the default order of the subcosts
            int i = 1;

            foreach (SubPrice1 subprice in lifeCycleOutput.SubPrice1s)
            {
                if (i == 1)
                {
                    dbSubPrice1Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 2)
                {
                    dbSubPrice2Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 3)
                {
                    dbSubPrice3Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 4)
                {
                    dbSubPrice4Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 5)
                {
                    dbSubPrice5Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 6)
                {
                    dbSubPrice6Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 7)
                {
                    dbSubPrice7Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 8)
                {
                    dbSubPrice8Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 9)
                {
                    dbSubPrice9Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                else if (i == 10)
                {
                    dbSubPrice10Total = subprice.SubPAmount * subprice.SubPPrice;
                }
                i++;
            }

            //init calculation parameters
            dbRealRate      = lifeCycleOutput.LCBOutput.Local.RealRate;
            dbNominalRate   = lifeCycleOutput.LCBOutput.Local.NominalRate;
            dbInflationRate = 0;
            GeneralRules.MissingRate(ref dbRealRate,
                                     ref dbNominalRate, ref dbInflationRate);
            if (dbRealRate > 0.999)
            {
                dbRealRate = dbRealRate / 100;
            }
            if (dbNominalRate > 0.999)
            {
                dbNominalRate = dbNominalRate / 100;
            }
            if (dbInflationRate > 0.999)
            {
                dbInflationRate = dbInflationRate / 100;
            }
            lifeCycleOutput.LCBOutput.Local.RealRate      = dbRealRate;
            lifeCycleOutput.LCBOutput.Local.NominalRate   = dbNominalRate;
            lifeCycleOutput.LCBOutput.Local.InflationRate = dbInflationRate;
            //ok to use the default order of the subcosts
            i = 1;
            foreach (SubPrice1 subprice in lifeCycleOutput.SubPrice1s)
            {
                eGrowthType = GeneralRules.GetGrowthType(subprice.SubPEscType);
                if (i == 1)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice1Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 2)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice2Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 3)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice3Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 4)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice4Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 5)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice5Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 6)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice6Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 7)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice7Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 8)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice8Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 9)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice9Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                else if (i == 10)
                {
                    subprice.SubPTotal = GeneralRules.GetGradientRealDiscountValue(dbSubPrice10Total,
                                                                                   dbRealRate, lifeCycleOutput.ServiceLifeYears, lifeCycleOutput.YearsFromBaseDate,
                                                                                   lifeCycleOutput.PlanningConstructionYears, eGrowthType, subprice.SubPEscRate,
                                                                                   subprice.SubPFactor, subprice.SubPYears, subprice.SubPYearTimes, subprice.SubPSalvValue);
                }
                subprice.SubPTotalPerUnit = subprice.SubPTotal / lifeCycleOutput.PerUnitAmount;
                i++;
            }
            //set lifeCyleOutput's total properties to these values
            SetBenefitTotals(lifeCycleOutput);
            //update the base output's prices (unit benefits, not full benefits)
            UpdateBaseOutputUnitPrices(lifeCycleOutput);
            bHasCalcs = true;
            return(bHasCalcs);
        }