DevTreks.Extensions/NPVCalculators/BIs/BICalculator.cs
/// <summary>
/// Add child nodes to an annual equivalent node to clean up time period nodes
/// </summary>
Add child nodes to an annual equivalent node to clean up time period nodes
Add child nodes to an annual equivalent node to clean up time period nodes
public void AddAnnualEquivalentsChildren(CalculatorParameters calcParameters,
            string subApplicationType, OperationComponent opcomp, string seriesType,
            string compName, int timeId, DateTime endOfGrowthPeriodDate, double aePrincipal,
            double aeInterest, double aeDiscPrincipal, double aeDiscPrincipal2, int annCounter, double annuityCount,
            double salvValue, double aohAmount, bool insertAllAEs)
        {
            OperationComponent OC = new OperationComponent(calcParameters, opcomp);
            Input input = new Input();
            OC.TimePeriodId = timeId;
            OC.AnnuityType = TimePeriod.ANNUITY_TYPES.regular;
            OC.Id = CalculatorHelpers.GetRandomInteger(calcParameters);
            OC.Name = compName;
            OC.Label = BudgetInvestment.ANNUITY;
            OC.EffectiveLife = annuityCount;
            OC.SalvageValue = salvValue;
            OC.Unit = BudgetInvestment.ANNUITY;
            OC.TotalAMAOH = aeDiscPrincipal;
            OC.TotalAMINCENT = aeDiscPrincipal2;
            OC.TotalAMOC = 0;
            OC.TotalAMCAP = 0;
            OC.TotalAMAOH_INT = aeInterest;
            OC.TotalAMOC_INT = 0;
            OC.TotalAMCAP_INT = 0;
            OC.TotalOC = 0;
            OC.TotalAOH = 0;
            OC.TotalCAP = 0;
            OC.TotalOC_INT = 0;
            OC.TotalAOH_INT = 0;
            OC.TotalCAP_INT = 0;
            OC.Amount = 1;
            OC.Date = endOfGrowthPeriodDate;
            OC.IncentiveRate = 0;
            OC.IncentiveAmount = 0;
            input.Id = CalculatorHelpers.GetRandomInteger(calcParameters);
            input.OpCompId = OC.Id;
            input.AnnuityType = OC.AnnuityType;
            if ((annCounter == 1)
                && (OC.AnnuityType == TimePeriod.ANNUITY_TYPES.regular))
            {
                input.Name = CAP_RECOVERY_I_ONLY;
            }
            else
            {
                input.Name = CAP_RECOVERY_PANDI;
            }
            input.Label = BudgetInvestment.ANNUITY;
            input.AOHAmount = aohAmount;
            input.AOHPrice = aePrincipal;
            input.AOHUnit = BudgetInvestment.ANNUITY;
            input.Date = endOfGrowthPeriodDate;
            input.TotalOC = 0;
            input.TotalAOH = 0;
            input.TotalCAP = 0;
            input.TotalOC_INT = 0;
            input.TotalAOH_INT = 0;
            input.TotalCAP_INT = 0;
            input.TotalAMOC_INT = 0;
            input.TotalAMAOH_INT = aeInterest;
            input.TotalAMCAP_INT = 0;
            input.TotalAMOC = 0;
            input.TotalAMAOH = aeDiscPrincipal;
            input.TotalAMCAP = 0;
            input.CAPAmount = 0;
            input.CAPPrice = 0;
            input.OCAmount = 0;
            input.OCPrice = 0;
            input.OCUnit = BudgetInvestment.ANNUITY;
            input.CAPUnit = BudgetInvestment.ANNUITY;
            input.UseAOH = false;
            input.Times = 0;
            input.InputGroupId = (int) TimePeriod.ANNUITY_TYPES.regular;
            input.InputGroupName = seriesType;
            input.TypeId = (int) TimePeriod.ANNUITY_TYPES.regular;
            input.Name = BudgetInvestment.ANNUITY;
            if (OC.Inputs == null)
                OC.Inputs = new List<Input>();
            OC.Inputs.Add(input);
            if (calcParameters.ParentTimePeriod.OperationComponents == null)
                calcParameters.ParentTimePeriod.OperationComponents = new List<OperationComponent>();
            calcParameters.ParentTimePeriod.OperationComponents.Add(OC);
        }
public void AddAnnualEquivalentsChildren ( CalculatorParameters calcParameters , string subApplicationType , OperationComponent opcomp , string seriesType , string compName , int timeId , DateTime endOfGrowthPeriodDate , double aePrincipal , double aeInterest , double aeDiscPrincipal , double aeDiscPrincipal2 , int annCounter , double annuityCount , double salvValue , double aohAmount , bool insertAllAEs ) { OperationComponent OC = new OperationComponent ( calcParameters , opcomp ) ; Input input = new Input ( ) ; OC . TimePeriodId = timeId ; OC . AnnuityType = TimePeriod . ANNUITY_TYPES . regular ; OC . Id = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; OC . Name = compName ; OC . Label = BudgetInvestment . ANNUITY ; OC . EffectiveLife = annuityCount ; OC . SalvageValue = salvValue ; OC . Unit = BudgetInvestment . ANNUITY ; OC . TotalAMAOH = aeDiscPrincipal ; OC . TotalAMINCENT = aeDiscPrincipal2 ; OC . TotalAMOC = 0 ; OC . TotalAMCAP = 0 ; OC . TotalAMAOH_INT = aeInterest ; OC . TotalAMOC_INT = 0 ; OC . TotalAMCAP_INT = 0 ; OC . TotalOC = 0 ; OC . TotalAOH = 0 ; OC . TotalCAP = 0 ; OC . TotalOC_INT = 0 ; OC . TotalAOH_INT = 0 ; OC . TotalCAP_INT = 0 ; OC . Amount = 1 ; OC . Date = endOfGrowthPeriodDate ; OC . IncentiveRate = 0 ; OC . IncentiveAmount = 0 ; input . Id = CalculatorHelpers . GetRandomInteger ( calcParameters ) ; input . OpCompId = OC . Id ; input . AnnuityType = OC . AnnuityType ; if ( ( annCounter == 1 ) && ( OC . AnnuityType == TimePeriod . ANNUITY_TYPES . regular ) ) { input . Name = CAP_RECOVERY_I_ONLY ; } else { input . Name = CAP_RECOVERY_PANDI ; } input . Label = BudgetInvestment . ANNUITY ; input . AOHAmount = aohAmount ; input . AOHPrice = aePrincipal ; input . AOHUnit = BudgetInvestment . ANNUITY ; input . Date = endOfGrowthPeriodDate ; input . TotalOC = 0 ; input . TotalAOH = 0 ; input . TotalCAP = 0 ; input . TotalOC_INT = 0 ; input . TotalAOH_INT = 0 ; input . TotalCAP_INT = 0 ; input . TotalAMOC_INT = 0 ; input . TotalAMAOH_INT = aeInterest ; input . TotalAMCAP_INT = 0 ; input . TotalAMOC = 0 ; input . TotalAMAOH = aeDiscPrincipal ; input . TotalAMCAP = 0 ; input . CAPAmount = 0 ; input . CAPPrice = 0 ; input . OCAmount = 0 ; input . OCPrice = 0 ; input . OCUnit = BudgetInvestment . ANNUITY ; input . CAPUnit = BudgetInvestment . ANNUITY ; input . UseAOH = false ; input . Times = 0 ; input . InputGroupId = ( int ) TimePeriod . ANNUITY_TYPES . regular ; input . InputGroupName = seriesType ; input . TypeId = ( int ) TimePeriod . ANNUITY_TYPES . regular ; input . Name = BudgetInvestment . ANNUITY ; if ( OC . Inputs == null ) OC . Inputs = new List < Input > ( ) ; OC . Inputs . Add ( input ) ; if ( calcParameters . ParentTimePeriod . OperationComponents == null ) calcParameters . ParentTimePeriod . OperationComponents = new List < OperationComponent > ( ) ; calcParameters . ParentTimePeriod . OperationComponents . Add ( OC ) ; }
Add child nodes to an annual equivalent node to clean up time period nodes
Add child nodes to an annual equivalent node to clean up time period nodes
//better to do the annual column here //annuities never added to regular totals columns rule enforced //don't change this DateTime when it gets added to tps, needed in calcinputprice //set the input properties //displays the preproduction sum being amortized //the sum being amortized - for display only //it will get summed correctly from input on up through tree //note that the calculations get serialized to xml using  //the TimePeriod.OpComps collection (not the AnnEquiv collection) //cumulative totals are added using AddAnnuitiesToTimePeriodTotals
calcParameters
CalculatorParameters
subApplicationType
string
opcomp
OperationComponent
seriesType
string
compName
string
timeId
int
endOfGrowthPeriodDate
DateTime
aePrincipal
double
aeInterest
double
aeDiscPrincipal
double
aeDiscPrincipal2
double
annCounter
int
annuityCount
double
salvValue
double
aohAmount
double
insertAllAEs
bool