List of usage examples for org.joda.time LocalDate equals
public boolean equals(Object partial)
From source file:org.fenixedu.treasury.domain.tariff.FixedTariff.java
License:Open Source License
public static Stream<FixedTariff> findByFixedDueDate(final FinantialInstitution institution, final org.joda.time.LocalDate fixedDueDate) { return findAll(institution).filter(i -> fixedDueDate.equals(i.getFixedDueDate())); }
From source file:org.fenixedu.treasury.ui.administration.payments.sibs.managesibsinputfile.SibsInputFileController.java
License:Open Source License
private List<SibsInputFile> filterSearchSibsInputFile(org.joda.time.LocalDate whenProcessedBySibs) { return getSearchUniverseSearchSibsInputFileDataSet() .filter(sibsInputFile -> whenProcessedBySibs == null || whenProcessedBySibs.equals(sibsInputFile.getWhenProcessedBySibs())) .collect(Collectors.toList()); }
From source file:org.fenixedu.treasury.ui.administration.payments.sibs.managesibsoutputfile.SibsOutputFileController.java
License:Open Source License
private List<SibsOutputFile> filterSearchSibsOutputFile(org.joda.time.LocalDate whencreated) { return getSearchUniverseSearchSibsOutputFileDataSet() .filter(sibsOutputFile -> whencreated == null || whencreated.equals(sibsOutputFile.getVersioningCreationDate().toLocalDate())) .collect(Collectors.toList()); }
From source file:org.fenixedu.treasury.ui.administration.payments.sibs.managesibsreportfile.SibsReportFileController.java
License:Open Source License
private List<SibsReportFile> filterSearchSibsReportFile(org.joda.time.LocalDate whenProcessedBySibs, java.math.BigDecimal transactionsTotalAmount, java.math.BigDecimal totalCost) { return getSearchUniverseSearchSibsReportFileDataSet() .filter(sibsReportFile -> whenProcessedBySibs == null || whenProcessedBySibs.equals(sibsReportFile.getWhenProcessedBySibs())) .filter(sibsReportFile -> transactionsTotalAmount == null || transactionsTotalAmount.equals(sibsReportFile.getTransactionsTotalAmount())) .filter(sibsReportFile -> totalCost == null || totalCost.equals(sibsReportFile.getTotalCost())) .collect(Collectors.toList()); }
From source file:org.fenixedu.treasury.ui.document.manageinvoice.DebitNoteController.java
License:Open Source License
private List<DebitNote> filterSearchDebitNote(DebtAccount payorDebtAccount, FinantialDocumentType finantialDocumentType, DebtAccount debtAccount, DocumentNumberSeries documentNumberSeries, Currency currency, java.lang.String documentNumber, LocalDate documentDateFrom, LocalDate documentDateTo, LocalDate documentDueDate, String originDocumentNumber, FinantialDocumentStateType state) { return getSearchUniverseSearchDebitNoteDataSet().stream() .filter(debitNote -> payorDebtAccount == null || payorDebtAccount == debitNote.getPayorDebtAccount()) .filter(debitNote -> finantialDocumentType == null || finantialDocumentType == debitNote.getFinantialDocumentType()) .filter(debitNote -> debtAccount == null || debtAccount == debitNote.getDebtAccount()) .filter(debitNote -> documentNumberSeries == null || documentNumberSeries == debitNote.getDocumentNumberSeries()) .filter(debitNote -> currency == null || currency == debitNote.getCurrency()) .filter(debitNote -> documentNumber == null || documentNumber.length() == 0 || debitNote.getDocumentNumber() != null && debitNote.getDocumentNumber().length() > 0 && debitNote.getUiDocumentNumber().toLowerCase() .contains(documentNumber.toLowerCase())) .filter(debitNote -> documentDateFrom == null || debitNote.getDocumentDate().toLocalDate().isEqual(documentDateFrom) || debitNote.getDocumentDate().toLocalDate().isAfter(documentDateFrom)) .filter(debitNote -> documentDateTo == null || debitNote.getDocumentDate().toLocalDate().isEqual(documentDateTo) || debitNote.getDocumentDate().toLocalDate().isBefore(documentDateTo)) .filter(debitNote -> documentDueDate == null || documentDueDate.equals(debitNote.getDocumentDueDate())) .filter(debitNote -> originDocumentNumber == null || originDocumentNumber.length() == 0 || debitNote.getOriginDocumentNumber() != null && debitNote.getOriginDocumentNumber().length() > 0 && debitNote.getOriginDocumentNumber().toLowerCase() .contains(originDocumentNumber.toLowerCase())) .filter(debitNote -> state == null || state.equals(debitNote.getState())) .collect(Collectors.toList()); }
From source file:org.killbill.billing.invoice.model.InAdvanceBillingMode.java
License:Apache License
@Override public List<RecurringInvoiceItemData> generateInvoiceItemData(final LocalDate startDate, @Nullable final LocalDate endDate, final LocalDate targetDate, final int billingCycleDayLocal, final BillingPeriod billingPeriod) throws InvalidDateSequenceException { if (endDate != null && endDate.isBefore(startDate)) { throw new InvalidDateSequenceException(); }/*from w w w.j a v a2 s. co m*/ if (targetDate.isBefore(startDate)) { throw new InvalidDateSequenceException(); } final List<RecurringInvoiceItemData> results = new ArrayList<RecurringInvoiceItemData>(); final BillingIntervalDetail billingIntervalDetail = new BillingIntervalDetail(startDate, endDate, targetDate, billingCycleDayLocal, billingPeriod); // We are not billing for less than a day (we could...) if (endDate != null && endDate.equals(startDate)) { return results; } // // If there is an endDate and that endDate is before our first coming firstBillingCycleDate, all we have to do // is to charge for that period // if (endDate != null && !endDate.isAfter(billingIntervalDetail.getFirstBillingCycleDate())) { final BigDecimal leadingProRationPeriods = calculateProRationBeforeFirstBillingPeriod(startDate, endDate, billingPeriod); final RecurringInvoiceItemData itemData = new RecurringInvoiceItemData(startDate, endDate, leadingProRationPeriods); results.add(itemData); return results; } // // Leading proration if // i) The first firstBillingCycleDate is strictly after our start date AND // ii) The endDate is is not null and is strictly after our firstBillingCycleDate (previous check) // if (billingIntervalDetail.getFirstBillingCycleDate().isAfter(startDate)) { final BigDecimal leadingProRationPeriods = calculateProRationBeforeFirstBillingPeriod(startDate, billingIntervalDetail.getFirstBillingCycleDate(), billingPeriod); if (leadingProRationPeriods != null && leadingProRationPeriods.compareTo(BigDecimal.ZERO) > 0) { // Not common - add info in the logs for debugging purposes final RecurringInvoiceItemData itemData = new RecurringInvoiceItemData(startDate, billingIntervalDetail.getFirstBillingCycleDate(), leadingProRationPeriods); log.info("Adding pro-ration: {}", itemData); results.add(itemData); } } // // Calculate the effectiveEndDate from the firstBillingCycleDate: // - If endDate != null and targetDate is after endDate => this is the endDate and will lead to a trailing pro-ration // - If not, this is the last billingCycleDate calculation right after the targetDate // final LocalDate effectiveEndDate = billingIntervalDetail.getEffectiveEndDate(); // // Based on what we calculated previously, code recompute one more time the numberOfWholeBillingPeriods // final LocalDate lastBillingCycleDate = billingIntervalDetail.getLastBillingCycleDate(); final int numberOfWholeBillingPeriods = calculateNumberOfWholeBillingPeriods( billingIntervalDetail.getFirstBillingCycleDate(), lastBillingCycleDate, billingPeriod); for (int i = 0; i < numberOfWholeBillingPeriods; i++) { final LocalDate servicePeriodStartDate; if (results.size() > 0) { // Make sure the periods align, especially with the pro-ration calculations above servicePeriodStartDate = results.get(results.size() - 1).getEndDate(); } else if (i == 0) { // Use the specified start date servicePeriodStartDate = startDate; } else { throw new IllegalStateException("We should at least have one invoice item!"); } // Make sure to align the end date with the BCD final LocalDate servicePeriodEndDate = billingIntervalDetail.getFutureBillingDateFor(i + 1); results.add(new RecurringInvoiceItemData(servicePeriodStartDate, servicePeriodEndDate, BigDecimal.ONE)); } // // Now we check if indeed we need a trailing proration and add that incomplete item // if (effectiveEndDate.isAfter(lastBillingCycleDate)) { final BigDecimal trailingProRationPeriods = calculateProRationAfterLastBillingCycleDate( effectiveEndDate, lastBillingCycleDate, billingPeriod); if (trailingProRationPeriods.compareTo(BigDecimal.ZERO) > 0) { // Not common - add info in the logs for debugging purposes final RecurringInvoiceItemData itemData = new RecurringInvoiceItemData(lastBillingCycleDate, effectiveEndDate, trailingProRationPeriods); log.info("Adding trailing pro-ration: {}", itemData); results.add(itemData); } } return results; }
From source file:org.kuali.kpme.core.leaveplan.service.LeavePlanServiceImpl.java
License:Educational Community License
@Override public DateTime getRolloverDayOfLeavePlan(String leavePlan, LocalDate asOfDate) { LeavePlan lp = getLeavePlan(leavePlan, asOfDate); int priorYearCutOffMonth = Integer.parseInt(lp.getCalendarYearStartMonth()); int priorYearCutOffDay = Integer.parseInt(lp.getCalendarYearStartDayOfMonth()); LocalDate cutOffDate = asOfDate.withMonthOfYear(priorYearCutOffMonth).withDayOfMonth(priorYearCutOffDay); if (asOfDate.isAfter(cutOffDate) || asOfDate.equals(cutOffDate)) { cutOffDate = cutOffDate.plusYears(1); }//from ww w. j a v a 2s. co m return cutOffDate.toDateTimeAtStartOfDay(); }
From source file:org.kuali.kpme.tklm.leave.block.LeaveBlockAggregate.java
License:Educational Community License
/** * Provides the option to refer to the time zone adjusted time for the current * user./*from www.j a v a 2s.c o m*/ * @param LeaveBlocks * @param leaveCalendarEntry * @param leaveCalendar */ public LeaveBlockAggregate(List<LeaveBlock> leaveBlocks, CalendarEntry leaveCalendarEntry, LeaveCalendar leaveCalendar) { this.leaveCalendarEntry = leaveCalendarEntry; this.leaveCalendar = leaveCalendar; List<Interval> dayIntervals = TKUtils.getDaySpanForCalendarEntry(leaveCalendarEntry); for (Interval dayInt : dayIntervals) { List<LeaveBlock> dayLeaveBlocks = new ArrayList<LeaveBlock>(); for (LeaveBlock leaveBlock : leaveBlocks) { LocalDate localDate = leaveBlock.getLeaveLocalDate(); LocalDate dayIntBegin = dayInt.getStart().toLocalDate(); if (localDate.equals(dayIntBegin)) { dayLeaveBlocks.add(leaveBlock); } } dayLeaveBlockList.add(dayLeaveBlocks); } }
From source file:org.kuali.kpme.tklm.leave.block.LeaveBlockAggregate.java
License:Educational Community License
public LeaveBlockAggregate(List<LeaveBlock> leaveBlocks, CalendarEntry leaveCalendarEntry) { this.leaveCalendarEntry = leaveCalendarEntry; List<Interval> dayIntervals = TKUtils.getDaySpanForCalendarEntry(leaveCalendarEntry); for (Interval dayInt : dayIntervals) { List<LeaveBlock> dayLeaveBlocks = new ArrayList<LeaveBlock>(); for (LeaveBlock leaveBlock : leaveBlocks) { LocalDate localDate = leaveBlock.getLeaveLocalDate(); LocalDate dayIntBegin = dayInt.getStart().toLocalDate(); if (localDate.equals(dayIntBegin)) { dayLeaveBlocks.add(leaveBlock); }//from ww w . j a va2s. c o m } dayLeaveBlockList.add(dayLeaveBlocks); } }
From source file:org.kuali.kpme.tklm.leave.block.LeaveBlockAggregate.java
License:Educational Community License
/** * build leaveBlockAggregate with given leaveBlocks, calendarEntry and dayIntervals * dayIntervals with full week span is for Time Calendar * @param LeaveBlocks// w w w. j a v a 2s . c o m * @param leaveCalendarEntry * @param dayIntervals */ public LeaveBlockAggregate(List<LeaveBlock> leaveBlocks, CalendarEntry leaveCalendarEntry, List<Interval> dayIntervals) { this.leaveCalendarEntry = leaveCalendarEntry; for (Interval dayInt : dayIntervals) { List<LeaveBlock> dayLeaveBlocks = new ArrayList<LeaveBlock>(); DateTime localTime = dayInt.getStart().toLocalDateTime().toDateTime(); String intervalStartDateString = localTime.toLocalDate().toString(); for (LeaveBlock leaveBlock : leaveBlocks) { // if the interval end time is 0, ie the beginning of a day, use the date string of the interval start time // to check if the leave block should go into this interval. Leave blocks only have leaveDate, there's no leave time if (dayInt.getEnd().getHourOfDay() == 0) { String lbDateString = leaveBlock.getLeaveLocalDate().toString(); if (intervalStartDateString.equals(lbDateString)) { dayLeaveBlocks.add(leaveBlock); } } else { LocalDate localDate = leaveBlock.getLeaveLocalDate(); LocalDate dayIntBegin = dayInt.getStart().toLocalDate(); if (localDate.equals(dayIntBegin)) { dayLeaveBlocks.add(leaveBlock); } } } dayLeaveBlockList.add(dayLeaveBlocks); } }