DevTreks.Extensions/AgBudgetingCalculators/InputsCapital/Machinery1Calculator.cs
/// <summary>
/// Make a capital services node, holding calculation params,
/// from an existing Machinery1Input input node 
/// (so that time-dependent costs can be treated uniformly among calculators)
/// </summary>
Make a capital services node, holding calculation params,
from an existing Machinery1Input input node
(so that time-dependent costs can be treated uniformly among calculators)
Make a capital services node holding calculation params from an existing Machinery1Input input node ( so that time - dependent costs can be treated uniformly among calculators )
public static CapitalService1Input InitCapitalServicesObject(CalculatorParameters calcParameters, 
            AgBudgetingHelpers.CALCULATOR_TYPES calculatorType, XElement calculationsElement,
            Machinery1Input machineryInput)
        {
            CapitalService1Input capitalServicesInput = new CapitalService1Input();
            capitalServicesInput.SetCapitalService1InputProperties(calcParameters, 
                machineryInput, calculationsElement);
            if (machineryInput.MarketValue == 0)
            {
                machineryInput.MarketValue = machineryInput.CAPPrice;
            }
            double dbListPrice = machineryInput.MarketValue + (machineryInput.MarketValue * (machineryInput.ListPriceAdj / 100));
            double dbOC1Amount = machineryInput.FuelCost * machineryInput.Constants.PlannedUseHrs;
            double dbOC2Amount = machineryInput.LubeOilCost * machineryInput.Constants.PlannedUseHrs;
            double dbOC4Amount = machineryInput.LaborCost * machineryInput.Constants.PlannedUseHrs;
            double dbAOH2Amount = machineryInput.TaxesHousingInsuranceCost * machineryInput.Constants.PlannedUseHrs;
            capitalServicesInput.OC1Amount = dbOC1Amount;
            capitalServicesInput.OC2Amount = dbOC2Amount;
            capitalServicesInput.OC3Amount = dbListPrice;
            capitalServicesInput.OC4Amount = dbOC4Amount;
            capitalServicesInput.AOH1Amount = 0;
            capitalServicesInput.AOH2Amount = dbAOH2Amount;
            string sUnitType = GeneralRules.GetUnitType(machineryInput.Local.UnitGroupId);
            InitCapitalServicesObject(sUnitType, ref capitalServicesInput);
            return capitalServicesInput;
        }
public static CapitalService1Input InitCapitalServicesObject ( CalculatorParameters calcParameters , AgBudgetingHelpers . CALCULATOR_TYPES calculatorType , XElement calculationsElement , Machinery1Input machineryInput ) { CapitalService1Input capitalServicesInput = new CapitalService1Input ( ) ; capitalServicesInput . SetCapitalService1InputProperties ( calcParameters , machineryInput , calculationsElement ) ; if ( machineryInput . MarketValue == 0 ) { machineryInput . MarketValue = machineryInput . CAPPrice ; } double dbListPrice = machineryInput . MarketValue + ( machineryInput . MarketValue * ( machineryInput . ListPriceAdj / 100 ) ) ; double dbOC1Amount = machineryInput . FuelCost * machineryInput . Constants . PlannedUseHrs ; double dbOC2Amount = machineryInput . LubeOilCost * machineryInput . Constants . PlannedUseHrs ; double dbOC4Amount = machineryInput . LaborCost * machineryInput . Constants . PlannedUseHrs ; double dbAOH2Amount = machineryInput . TaxesHousingInsuranceCost * machineryInput . Constants . PlannedUseHrs ; capitalServicesInput . OC1Amount = dbOC1Amount ; capitalServicesInput . OC2Amount = dbOC2Amount ; capitalServicesInput . OC3Amount = dbListPrice ; capitalServicesInput . OC4Amount = dbOC4Amount ; capitalServicesInput . AOH1Amount = 0 ; capitalServicesInput . AOH2Amount = dbAOH2Amount ; string sUnitType = GeneralRules . GetUnitType ( machineryInput . Local . UnitGroupId ) ; InitCapitalServicesObject ( sUnitType , ref capitalServicesInput ) ; return capitalServicesInput ; }
Make a capital services node, holding calculation params,
from an existing Machinery1Input input node
(so that time-dependent costs can be treated uniformly among calculators)
Make a capital services node holding calculation params from an existing Machinery1Input input node ( so that time - dependent costs can be treated uniformly among calculators )
//1. build a generic capital input //2. add time periods to it and carry out calculations for each time period //3. sum the time period calcs and add the sums to the capital input //note oc3 starts with list price //aoh1 is calculated later
calcParameters
CalculatorParameters
calculatorType
AgBudgetingHelpers.CALCULATOR_TYPES
calculationsElement
XElement
machineryInput
Machinery1Input