Package org.internna.ossmoney.model.budget

Examples of org.internna.ossmoney.model.budget.Budget


      return data;
    }

    protected Map<Date, NameValuePair<Date, BigDecimal>> budget(UserDetails user, Subcategory category, Locale locale, Interval interval) {
      Map<Date, NameValuePair<Date, BigDecimal>> budgetData = new HashMap<Date, NameValuePair<Date, BigDecimal>>();
      Budget budget = user.getBudget();
      for (Date date : DateUtils.dates(interval.getNumberOfMonths())) {
        budgetData.put(date, new NameValuePair<Date, BigDecimal>(date, budget.getAlloted(date, locale, category)));
      }
      return budgetData;
    }
View Full Code Here


    dashboard.merge();
    return dashboard;
  }

  protected Budget createBudget(UserDetails user) {
    Budget budget = new Budget();
    budget.setOwner(user);
    budget.persist();
    for (int i = 0; i < 12; i++) {
      MonthlyBudget monthlyBudget = new MonthlyBudget();
      monthlyBudget.setBudget(budget);
      monthlyBudget.setBudgetedMonth(i);
      monthlyBudget.persist();
      budget.getMonthlyBudgets().add(monthlyBudget);
    }
    budget.merge();
    return budget;
  }
View Full Code Here

    @Test
    public void testGetAlloted() {
      Locale locale = Locale.US;
      Calendar calendar = Calendar.getInstance();
      calendar.set(Calendar.MONTH, 6);
      Budget budget = new Budget();
      MonthlyBudget monthlyBudget = new MonthlyBudget();
      monthlyBudget.setBudgetedMonth(6);
      CategoryBudget categoryBudget = new CategoryBudget();
      CategoryBudget categoryBudget2 = new CategoryBudget();
      Subcategory subcategory = Subcategory.findSubcategory(1L);
      Subcategory subcategory2 = Subcategory.findSubcategory(3L);
      categoryBudget.setLocale(locale);
      categoryBudget2.setLocale(locale);
      categoryBudget.setCategory(subcategory);
      categoryBudget2.setCategory(subcategory2);
      categoryBudget.setExpectedAmount(BigDecimal.TEN);
      categoryBudget2.setExpectedAmount(BigDecimal.TEN);
      categoryBudget.setMonthlyBudget(monthlyBudget);
      monthlyBudget.setBudget(budget);
      monthlyBudget.getBudgets().add(categoryBudget);
      monthlyBudget.getBudgets().add(categoryBudget2);
      budget.getMonthlyBudgets().add(monthlyBudget);
      assertEquals("Ten", BigDecimal.TEN, budget.getAlloted(calendar.getTime(), locale, subcategory));
    }
View Full Code Here

TOP

Related Classes of org.internna.ossmoney.model.budget.Budget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.