List of usage examples for org.joda.time YearMonth isEqual
public boolean isEqual(ReadablePartial partial)
From source file:com.court.handler.FxUtilsHandler.java
public static Predicate<MemberLoan> checkIfNotYetPaid(Function<MemberLoan, Date> check_date) { DateTimeZone zone = DateTimeZone.forID("Asia/Colombo"); YearMonth ym_now = YearMonth.now(zone); return t -> { YearMonth ym_last = YearMonth.fromDateFields(new DateTime(check_date.apply(t), zone).toDate()); // if (t.getId() == 206) { // YearMonth lastPaid = YearMonth.fromDateFields(new DateTime(check_date.apply(t), zone).toDate()); // System.out.println(ym_now.isAfter(lastPaid) || ym_now.isEqual(lastPaid)); // System.exit(0); // } boolean flag = check_date.apply(t) != null ? (t.isContinuousPay() ? true : (ym_now.isAfter(ym_last) || ym_now.isEqual(ym_last))) : true;//from www .ja v a2s . c o m // boolean flag = check_date.apply(t) != null ? (ym_now.isAfter(ym_last) || ym_now.isEqual(ym_last)) : true; return flag; }; }
From source file:org.alexlg.bankit.controllers.AccountController.java
License:Open Source License
/** * Build categories summary for each month from startDate * to previous nbPrevMonth/* ww w . j a v a 2 s. c o m*/ * @param startDate Start the summary for this month * @param endDate Stop the summary for this month * @return Map with the date of the month and a Map with Category * and amount for this category for this month */ protected Map<Date, Map<Category, BigDecimal>> buildCategories(LocalDate startDate, LocalDate endDate) { Map<Date, Map<Category, BigDecimal>> categories = new LinkedHashMap<Date, Map<Category, BigDecimal>>(); YearMonth curMonth = null; //month we start to retrieve YearMonth endMonth = null; //last month we have to retrieve if (startDate.isBefore(endDate)) { curMonth = new YearMonth(startDate.getYear(), startDate.getMonthOfYear()); endMonth = new YearMonth(endDate.getYear(), endDate.getMonthOfYear()); } else { curMonth = new YearMonth(endDate.getYear(), endDate.getMonthOfYear()); endMonth = new YearMonth(startDate.getYear(), startDate.getMonthOfYear()); } do { Map<Category, BigDecimal> monthSummary = categoryDao.getMonthSummary(curMonth); if (monthSummary.size() > 0) { categories.put(curMonth.toLocalDate(1).toDate(), monthSummary); } curMonth = curMonth.plusMonths(1); } while (curMonth.isBefore(endMonth) || curMonth.isEqual(endMonth)); return categories; }