DevTreks.Extensions/AgBudgetingCalculators/InputsCapital/Machinery1Calculator.cs
/// <summary>
/// Set the final totals attributes in the capital service element
/// </summary>
Set the final totals attributes in the capital service element
Set the final totals attributes in the capital service element
private static void SetServiceCostTotals(AgBudgetingHelpers.CALCULATOR_TYPES calculatorType,
            int iCostVariable, double amortizedAvgCostperPeriod, double capRecoverCostPeriod,
            double marketValue, ref CapitalService1Input capitalServicesInput,
            ref double ocPrice, ref double aohPrice)
        {
            double dbAnnuityPerServiceUnit = 0;
            switch (iCostVariable)
            {
                case 1:
                    dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod;
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        capitalServicesInput.FuelCost = dbAnnuityPerServiceUnit;
                    }
                    else if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.capitalservices)
                    {
                        capitalServicesInput.OC1Cost = dbAnnuityPerServiceUnit;
                    }
                    ocPrice = dbAnnuityPerServiceUnit;
                    break;
                case 2:
                    dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod;
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        capitalServicesInput.LubeOilCost = dbAnnuityPerServiceUnit;
                    }
                    else if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.capitalservices)
                    {
                        capitalServicesInput.OC2Cost = dbAnnuityPerServiceUnit;
                    }
                    ocPrice = dbAnnuityPerServiceUnit + ocPrice;
                    break;
                case 3:
                    dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod;
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        capitalServicesInput.RepairCost = dbAnnuityPerServiceUnit;
                    }
                    else if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.capitalservices)
                    {
                        capitalServicesInput.OC3Cost = dbAnnuityPerServiceUnit;
                    }
                    ocPrice = dbAnnuityPerServiceUnit + ocPrice;
                    break;
                case 4:
                    dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod;
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        capitalServicesInput.LaborCost = dbAnnuityPerServiceUnit;
                    }
                    else if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.capitalservices)
                    {
                        capitalServicesInput.OC4Cost = dbAnnuityPerServiceUnit;
                    }
                    ocPrice = dbAnnuityPerServiceUnit + ocPrice;
                    break;
                case 5:
                    if (marketValue > 0)
                    {
                        dbAnnuityPerServiceUnit = capRecoverCostPeriod;
                    }
                    else
                    {
                        dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod;
                    }
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        capitalServicesInput.CapitalRecoveryCost = dbAnnuityPerServiceUnit;
                    }
                    else if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.capitalservices)
                    {
                        capitalServicesInput.AOH1Cost = dbAnnuityPerServiceUnit;
                    }
                    aohPrice = dbAnnuityPerServiceUnit;
                    break;
                case 6:
                    dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod;
                    if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.agmachinery)
                    {
                        capitalServicesInput.TaxesHousingInsuranceCost = dbAnnuityPerServiceUnit;
                    }
                    else if (calculatorType == AgBudgetingHelpers.CALCULATOR_TYPES.capitalservices)
                    {
                        capitalServicesInput.AOH2Cost = dbAnnuityPerServiceUnit;
                    }
                    aohPrice = dbAnnuityPerServiceUnit + aohPrice;
                    break;
                default:
                    break;
            }
        }
private static void SetServiceCostTotals ( AgBudgetingHelpers . CALCULATOR_TYPES calculatorType , int iCostVariable , double amortizedAvgCostperPeriod , double capRecoverCostPeriod , double marketValue , ref CapitalService1Input capitalServicesInput , ref double ocPrice , ref double aohPrice ) { double dbAnnuityPerServiceUnit = 0 ; switch ( iCostVariable ) { case 1 : dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod ; if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . agmachinery ) { capitalServicesInput . FuelCost = dbAnnuityPerServiceUnit ; } else if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . capitalservices ) { capitalServicesInput . OC1Cost = dbAnnuityPerServiceUnit ; } ocPrice = dbAnnuityPerServiceUnit ; break ; case 2 : dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod ; if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . agmachinery ) { capitalServicesInput . LubeOilCost = dbAnnuityPerServiceUnit ; } else if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . capitalservices ) { capitalServicesInput . OC2Cost = dbAnnuityPerServiceUnit ; } ocPrice = dbAnnuityPerServiceUnit + ocPrice ; break ; case 3 : dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod ; if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . agmachinery ) { capitalServicesInput . RepairCost = dbAnnuityPerServiceUnit ; } else if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . capitalservices ) { capitalServicesInput . OC3Cost = dbAnnuityPerServiceUnit ; } ocPrice = dbAnnuityPerServiceUnit + ocPrice ; break ; case 4 : dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod ; if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . agmachinery ) { capitalServicesInput . LaborCost = dbAnnuityPerServiceUnit ; } else if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . capitalservices ) { capitalServicesInput . OC4Cost = dbAnnuityPerServiceUnit ; } ocPrice = dbAnnuityPerServiceUnit + ocPrice ; break ; case 5 : if ( marketValue > 0 ) { dbAnnuityPerServiceUnit = capRecoverCostPeriod ; } else { dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod ; } if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . agmachinery ) { capitalServicesInput . CapitalRecoveryCost = dbAnnuityPerServiceUnit ; } else if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . capitalservices ) { capitalServicesInput . AOH1Cost = dbAnnuityPerServiceUnit ; } aohPrice = dbAnnuityPerServiceUnit ; break ; case 6 : dbAnnuityPerServiceUnit = amortizedAvgCostperPeriod ; if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . agmachinery ) { capitalServicesInput . TaxesHousingInsuranceCost = dbAnnuityPerServiceUnit ; } else if ( calculatorType == AgBudgetingHelpers . CALCULATOR_TYPES . capitalservices ) { capitalServicesInput . AOH2Cost = dbAnnuityPerServiceUnit ; } aohPrice = dbAnnuityPerServiceUnit + aohPrice ; break ; default : break ; } }
Set the final totals attributes in the capital service element
Set the final totals attributes in the capital service element
//set final calculator variables
calculatorType
AgBudgetingHelpers.CALCULATOR_TYPES
iCostVariable
int
amortizedAvgCostperPeriod
double
capRecoverCostPeriod
double
marketValue
double
CapitalService1Input
ref
double
ref