use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class UpcomingController method update.
private void update() {
final int lookAheadDays = SettingsManager.getInstance().getUpcomingLookAhead();
this.box.getChildren().clear();
for (int i = 0; i < lookAheadDays; i++) {
final LocalDate date = LocalDate.now().plusDays(i);
final List<BookingEntry> upcomingBookings = manager.getBookingEntries().stream().filter(b -> b.getDate().equals(date)).collect(Collectors.toList());
final List<CleaningEntry> upcomingCleanings = manager.getCleaningEntries().stream().filter(c -> c.getDate().equals(date)).collect(Collectors.toList());
addEvents(date, upcomingBookings, upcomingCleanings);
if (i != lookAheadDays - 1) {
this.box.getChildren().add(new Separator());
}
}
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class DefaultNetEarningsCalculatorTest method test.
@Test
public void test() {
final DefaultNetEarningsCalculator c = new DefaultNetEarningsCalculator();
final BookingBean b = TestUtils.getTestBooking(LocalDate.now(), LocalDate.now().plusDays(4));
b.setGrossEarningsExpression("360");
b.setServiceFee(0);
b.setServiceFeesPercent(12f);
b.setCleaningFees(60);
final CleaningEntry ce = new CleaningEntry(LocalDate.now(), b, new Cleaning("testCleaning"), null);
ce.setCleaningCosts(40);
b.setCleaning(ce);
assertEquals(360 - ((360 - 60) * 0.12), c.apply(b).doubleValue(), 0.001);
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class MainManagerTest method testAddCleaning01.
@Test
public void testAddCleaning01() {
mm = new MainManager();
final CleaningEntry ce = new CleaningEntry(LocalDate.now(), TestUtils.getTestBooking("tt"), new Cleaning("testCleaning"), null);
mm.addCleaning(LocalDate.now(), "testCleaning", TestUtils.getTestBooking("tt"));
assertTrue(mm.getCleaningEntries().contains(ce));
}
use of com.github.drbookings.ui.CleaningEntry in project drbookings by DrBookings.
the class MainManager method addCleaning.
public synchronized CleaningEntry addCleaning(final LocalDate date, final String cleaningName, final BookingBean booking) {
Objects.requireNonNull(date, "Date must not be null");
Objects.requireNonNull(booking, "BookingBean must not be null");
if (cleaningName == null || cleaningName.trim().length() == 0) {
throw new IllegalArgumentException();
}
final Cleaning cleaning = cleaningProvider.getOrCreateElement(cleaningName);
final CleaningEntry cleaningEntry = new CleaningEntry(date, booking, cleaning, this);
cleaningEntry.setCleaningCosts(SettingsManager.getInstance().getCleaningCosts());
if (containsCleaningByNameDateRoom(cleaningEntry)) {
if (logger.isWarnEnabled()) {
logger.warn("Skip cleaning " + cleaning);
}
} else {
cleaningEntries.put(date, cleaningEntry);
cleaningEntriesList.add(cleaningEntry);
addUiDataCleaning(cleaningEntry);
return cleaningEntry;
}
return null;
}
Aggregations