use of com.github.drbookings.ui.BookingEntry in project drbookings by DrBookings.
the class RoomBean method hasCheckIn.
public boolean hasCheckIn() {
final List<BookingEntry> filteredBookingEntries = getFilteredBookingEntries();
if (filteredBookingEntries.size() == 1 && filteredBookingEntries.get(0).isCheckIn()) {
return true;
}
boolean check = false;
boolean split = false;
for (final BookingEntry be : filteredBookingEntries) {
if (be.isCheckIn()) {
check = true;
}
if (be.getElement().isSplitBooking()) {
split = true;
}
}
// any booking is check-in and any booking is split booking
return check && !split;
}
use of com.github.drbookings.ui.BookingEntry in project drbookings by DrBookings.
the class MainManager method roomBusy.
private boolean roomBusy(final BookingEntry bookingEntry) {
if (!bookingEntry.isCheckOut()) {
final Room room = bookingEntry.getElement().getRoom();
final LocalDate date = bookingEntry.getDate();
final Collection<BookingEntry> b = bookingEntries.get(date);
if (b != null) {
for (final BookingEntry be : b) {
if (be.isCheckOut()) {
continue;
}
final Room room2 = be.getElement().getRoom();
if (room2.equals(room)) {
if (logger.isWarnEnabled()) {
logger.warn("Room " + room + " busy with " + be);
}
return true;
}
}
}
}
return false;
}
use of com.github.drbookings.ui.BookingEntry in project drbookings by DrBookings.
the class MoneyMonitor method calculateDateToEarnings.
private void calculateDateToEarnings(final ObservableList<? extends RoomBean> list) {
final List<BookingEntry> selectedBookings = list.stream().flatMap(r -> r.getFilteredBookingEntries().stream()).collect(Collectors.toList());
dayToNetEarnings.clear();
for (final BookingEntry rb : selectedBookings) {
fillDayMap(rb);
fillMonthYearMap(rb);
}
setTotalNetEarnings(dayToNetEarnings.values().stream().mapToDouble(d -> d.doubleValue()).sum());
}
use of com.github.drbookings.ui.BookingEntry in project drbookings by DrBookings.
the class BookingEntries method getEarningsAirbnb.
public static float getEarningsAirbnb(final Collection<? extends BookingEntry> bookings, boolean netEarnings, boolean paymentDone) {
final BookingsByOrigin<BookingEntry> bo = new BookingsByOrigin<>(bookings);
AirbnbEarningsCalculator aec = new AirbnbEarningsCalculator().filterForNetEarnings(netEarnings).filterForPaymentDone(paymentDone);
return aec.calculateEarnings(BookingEntries.toBookings(bo.getAirbnbBookings()));
}
Aggregations