public DepreciationPlanList CalculatePlan(int startMonth, int startYear, int endMonth, int endYear, Dictionary <int, string> monthNames)
        {
            DepreciationCalculations depreciationCalculations = new DepreciationCalculations();
            DepreciationPlanList     depreciationPlanList     = new DepreciationPlanList();

            depreciationPlanList.StartMonth = startMonth;
            depreciationPlanList.StartYear  = startYear;
            depreciationPlanList.EndMonth   = endMonth;
            depreciationPlanList.EndYear    = endYear;

            int no = 1;

            for (int y = startYear; y < endYear + 1; y++)
            {
                if (startYear == endYear)
                {
                    for (int m = startMonth; m <= endMonth; m++)
                    {
                        DepreciationPlan depreciationPlan = preparedepreciationPeriod(no, y, m, monthNames);
                        depreciationPlanList.DepreciationPlans.Add(depreciationPlan);
                        no++;
                    }
                }
                else
                {
                    if (startYear == y)
                    {
                        for (int m = startMonth; m <= 12; m++)
                        {
                            DepreciationPlan depreciationPlan = preparedepreciationPeriod(no, y, m, monthNames);
                            depreciationPlanList.DepreciationPlans.Add(depreciationPlan);
                            no++;
                        }
                    }
                    if (endYear == y)
                    {
                        for (int m = 1; m <= endMonth; m++)
                        {
                            DepreciationPlan depreciationPlan = preparedepreciationPeriod(no, y, m, monthNames);
                            depreciationPlanList.DepreciationPlans.Add(depreciationPlan);
                            no++;
                        }
                    }
                    if (startYear < y && y < endYear)
                    {
                        for (int m = 1; m <= 12; m++)
                        {
                            DepreciationPlan depreciationPlan = preparedepreciationPeriod(no, y, m, monthNames);
                            depreciationPlanList.DepreciationPlans.Add(depreciationPlan);
                            no++;
                        }
                    }
                }
            }
            return(depreciationPlanList);
        }
        private DepreciationPlan preparedepreciationPeriod(int no, int y, int m, Dictionary <int, string> monthNames)
        {
            DepreciationPlan depreciationPlan = new DepreciationPlan();

            depreciationPlan.No        = no;
            depreciationPlan.Year      = y;
            depreciationPlan.Month     = m;
            depreciationPlan.MonthYear = monthNames[m] + " " + y.ToString();

            return(depreciationPlan);
        }