Java Code Examples for org.joda.time.LocalDate#minusMonths()
The following examples show how to use
org.joda.time.LocalDate#minusMonths() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncomingInvoiceRepository_IntegTest.java From estatio with Apache License 2.0 | 6 votes |
private IncomingInvoice createIncomingInvoice() { seller = OrganisationAndComms_enum.TopModelGb.findUsing(serviceRegistry); buyer = OrganisationAndComms_enum.HelloWorldGb.findUsing(serviceRegistry); property = Property_enum.OxfGb.findUsing(serviceRegistry); invoiceNumber = "123"; invoiceDate = new LocalDate(2017, 1, 1); dueDate = invoiceDate.minusMonths(1); final LocalDate vatRegistrationDate = null; paymentMethod = PaymentMethod.BANK_TRANSFER; invoiceStatus = InvoiceStatus.NEW; atPath = "/GBR"; approvalStateIfAny = IncomingInvoiceApprovalState.PAID; final LocalDate dateReceived = null; final BankAccount bankAccount = null; final boolean postedToCodaBooks = false; final LocalDate paidDate = null; return incomingInvoiceRepository.create(IncomingInvoiceType.CAPEX, invoiceNumber, property, atPath, buyer, seller, invoiceDate, dueDate, vatRegistrationDate, paymentMethod, invoiceStatus, dateReceived, bankAccount, approvalStateIfAny, postedToCodaBooks, paidDate); }
Example 2
Source File: IncomingInvoiceQueryHelperRepository_IntegTest.java From estatio with Apache License 2.0 | 6 votes |
private IncomingInvoice createIncomingInvoice() { seller = OrganisationAndComms_enum.TopModelGb.findUsing(serviceRegistry); buyer = OrganisationAndComms_enum.HelloWorldGb.findUsing(serviceRegistry); property = Property_enum.OxfGb.findUsing(serviceRegistry); invoiceNumber = "123"; invoiceDate = new LocalDate(2017, 1, 1); dueDate = invoiceDate.minusMonths(1); final LocalDate vatRegistrationDate = null; paymentMethod = PaymentMethod.BANK_TRANSFER; invoiceStatus = InvoiceStatus.NEW; atPath = "/GBR"; approvalStateIfAny = IncomingInvoiceApprovalState.PAID; final LocalDate dateReceived = null; final BankAccount bankAccount = null; final boolean postedToCodaBooks = false; final LocalDate paidDate = null; return incomingInvoiceRepository.create(IncomingInvoiceType.CAPEX, invoiceNumber, property, atPath, buyer, seller, invoiceDate, dueDate, vatRegistrationDate, paymentMethod, invoiceStatus, dateReceived, bankAccount, approvalStateIfAny, postedToCodaBooks, paidDate); }
Example 3
Source File: LocalDateIMMDateCalculator.java From objectlabkit with Apache License 2.0 | 5 votes |
private LocalDate calculateIMMMonth(final boolean requestNextIMM, final LocalDate startDate, final int month) { int monthOffset; LocalDate date = startDate; switch (month) { case MARCH: case JUNE: case SEPTEMBER: case DECEMBER: final LocalDate immDate = calculate3rdWednesday(date); if (requestNextIMM && !date.isBefore(immDate)) { date = date.plusMonths(MONTHS_IN_QUARTER); } else if (!requestNextIMM && !date.isAfter(immDate)) { date = date.minusMonths(MONTHS_IN_QUARTER); } break; default: if (requestNextIMM) { monthOffset = (MONTH_IN_YEAR - month) % MONTHS_IN_QUARTER; date = date.plusMonths(monthOffset); } else { monthOffset = month % MONTHS_IN_QUARTER; date = date.minusMonths(monthOffset); } break; } return date; }
Example 4
Source File: IncomingInvoiceItemRepository_IntegTest.java From estatio with Apache License 2.0 | 5 votes |
private IncomingInvoice createIncomingInvoiceAndTwoItemsWithSameCharge(){ seller = OrganisationAndComms_enum.TopModelGb.findUsing(serviceRegistry); buyer = OrganisationAndComms_enum.HelloWorldGb.findUsing(serviceRegistry); property = propertyRepository.findPropertyByReference(Property_enum.OxfGb.getRef()); invoiceNumber = "123"; invoiceDate = new LocalDate(2017,1,1); dueDate = invoiceDate.minusMonths(1); final LocalDate vatRegistrationDate = null; paymentMethod = PaymentMethod.BANK_TRANSFER; invoiceStatus = InvoiceStatus.NEW; atPath = "/GBR"; final LocalDate dateReceived = null; final boolean postedToCodaBooks = false; final LocalDate paidDate = null; final BankAccount bankAccount = null; IncomingInvoice invoice = incomingInvoiceRepository.create(IncomingInvoiceType.CAPEX, invoiceNumber, property, atPath, buyer, seller, invoiceDate, dueDate, vatRegistrationDate, paymentMethod, invoiceStatus, dateReceived, bankAccount, IncomingInvoiceApprovalState.PAID, postedToCodaBooks, paidDate); charge = chargeRepository.findByReference("WORKS"); description = "some description"; tax = taxRepository.findByReference("FRF"); invoice.addItem( invoice.getType(), charge, description, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, tax, dueDate, null, null, null, null); invoice.addItem( invoice.getType(), charge, description, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, tax, dueDate, null, null, null, null); return invoice; }
Example 5
Source File: TurnoverAggregationService_Test.java From estatio with Apache License 2.0 | 4 votes |
@Test public void getTurnoversForAggregationPeriod_works() throws Exception { // given TurnoverAggregationService service = new TurnoverAggregationService(); final LocalDate aggregationDate = new LocalDate(2020, 1, 1); final AggregationPeriod aggregationPeriod = AggregationPeriod.P_2M; List<Turnover> turnovers = new ArrayList<>(); // when final Turnover turnoverThisYear = new Turnover(null, aggregationDate, null, null, null, null); final Turnover turnoverPlus1Month = new Turnover(null, aggregationDate.plusMonths(1), null, null, null, null); final Turnover turnoverMinus1Month = new Turnover(null, aggregationDate.minusMonths(1), null, null, null, null); turnovers.add(turnoverThisYear); turnovers.add(turnoverPlus1Month); turnovers.add(turnoverMinus1Month); // then Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).hasSize(2); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).contains(turnoverThisYear); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).contains(turnoverMinus1Month); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).doesNotContain(turnoverPlus1Month); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, true)).isEmpty(); // and when final Turnover turnoverPreviousYear = new Turnover(null, aggregationDate.minusYears(1), null, null, null, null); final Turnover turnoverPYPlus1Month = new Turnover(null, aggregationDate.minusYears(1).plusMonths(1), null, null, null, null); final Turnover turnoverPYMinus1Month = new Turnover(null, aggregationDate.minusYears(1).minusMonths(1), null, null, null, null); turnovers.add(turnoverPreviousYear); turnovers.add(turnoverPYPlus1Month); turnovers.add(turnoverPYMinus1Month); // then Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).hasSize(2); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).contains(turnoverThisYear); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).contains(turnoverMinus1Month); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, false)).doesNotContain(turnoverPlus1Month); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, true)).hasSize(2); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, true)).contains(turnoverPreviousYear); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, true)).contains(turnoverPYMinus1Month); Assertions.assertThat(service.getTurnoversForAggregationPeriod(aggregationPeriod, aggregationDate, turnovers, true)).doesNotContain(turnoverPYPlus1Month); }
Example 6
Source File: DateUtil.java From activiti6-boot2 with Apache License 2.0 | 3 votes |
public static Date subtractDate(Date startDate, Integer years, Integer months, Integer days) { LocalDate currentDate = new LocalDate(startDate); currentDate = currentDate.minusYears(years); currentDate = currentDate.minusMonths(months); currentDate = currentDate.minusDays(days); return currentDate.toDate(); }
Example 7
Source File: DateUtil.java From flowable-engine with Apache License 2.0 | 3 votes |
public static Date subtractDate(Object startDate, Object years, Object months, Object days) { LocalDate currentDate = new LocalDate(startDate); currentDate = currentDate.minusYears(intValue(years)); currentDate = currentDate.minusMonths(intValue(months)); currentDate = currentDate.minusDays(intValue(days)); return currentDate.toDate(); }