2023-12-12 10:26:13 +01:00
|
|
|
#ifndef TARIFF_BUSINESS_HOURS_H_INCLUDED
|
|
|
|
#define TARIFF_BUSINESS_HOURS_H_INCLUDED
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Business hours (byte represents payment option id)
|
|
|
|
/// </summary>
|
2024-04-12 14:26:03 +02:00
|
|
|
///
|
|
|
|
|
2024-04-19 13:18:02 +02:00
|
|
|
#include <Qt>
|
|
|
|
|
|
|
|
#define _NO_RESTRICTION_24_7_ (uint64_t)(0ULL)
|
|
|
|
#define _MON_ (uint64_t)(1ULL << 8)
|
|
|
|
#define _TUE_ (uint64_t)(1ULL << 9)
|
|
|
|
#define _WED_ (uint64_t)(1ULL << 10)
|
|
|
|
#define _THU_ (uint64_t)(1ULL << 11)
|
|
|
|
#define _FRI_ (uint64_t)(1ULL << 12)
|
|
|
|
#define _SAT_ (uint64_t)(1ULL << 13)
|
|
|
|
#define _SUN_ (uint64_t)(1ULL << 14)
|
2024-04-12 14:26:03 +02:00
|
|
|
#define _WEEK_DAYS_ ((_MON_|_TUE_|_WED_|_THU_|_FRI_))
|
|
|
|
#define _WORKING_DAYS_ ((_MON_|_TUE_|_WED_|_THU_|_FRI_|_SAT_))
|
|
|
|
#define _ALL_DAYS_ ((_MON_|_TUE_|_WED_|_THU_|_FRI_|_SAT_|_SUN_))
|
2024-04-19 13:18:02 +02:00
|
|
|
#define _OFFICIAL_HOLIDAY_ (uint64_t)(1ULL << 15)
|
|
|
|
#define _ONLY_WEEKEND_ ((_SAT_|_SUN_))
|
|
|
|
#define _ONLY_OPEN_FOR_BUSINESS_DAYS_ (uint64_t)(1ULL << 16) /* verkaufsoffen */
|
|
|
|
#define _NOT_DEFINED_ (uint64_t)(~0ULL)
|
2024-04-12 14:26:03 +02:00
|
|
|
|
|
|
|
enum BusinessHours : std::uint64_t
|
2023-12-12 10:26:13 +01:00
|
|
|
{
|
|
|
|
NoRestriction_24_7 = 0,
|
|
|
|
OnlyWorkingDays = 1, // [Monday-Friday]
|
|
|
|
OnlyWeekDays = 2, // [Monday-Saturday]
|
|
|
|
OnlyWeekEnd = 4, // [Saturday+Sunday]
|
|
|
|
OnlyOfficialHolidays = 8,
|
2024-04-12 14:26:03 +02:00
|
|
|
OnlySundaysAndHolidays = 12, // [Sun+Holiday]
|
2023-12-12 10:26:13 +01:00
|
|
|
OnlySpecialDays = 16,
|
|
|
|
OnlySchoolHolidays = 32,
|
|
|
|
SpecialAndSchoolHolidays = 48,
|
|
|
|
OnlyOpenForBusinessDays = 64, // verkaufsoffen
|
2024-01-30 10:16:55 +01:00
|
|
|
AllDaysWithRestrictedHours = 128, // every day, restricted to some time range
|
2024-04-12 14:26:03 +02:00
|
|
|
NoBusinessHoursDefined = 255,
|
|
|
|
|
|
|
|
// new 12.04.2024
|
2024-04-19 13:18:02 +02:00
|
|
|
NO_RESTRICTION_24_7 = _NO_RESTRICTION_24_7_,
|
2024-04-12 14:26:03 +02:00
|
|
|
MON = _MON_,
|
|
|
|
TUE = _TUE_,
|
|
|
|
WED = _WED_,
|
|
|
|
THU = _THU_,
|
|
|
|
FRI = _FRI_,
|
|
|
|
SAT = _SAT_,
|
|
|
|
SUN = _SUN_,
|
|
|
|
WEEK_DAYS = _WEEK_DAYS_,
|
|
|
|
WORKING_DAYS = _WORKING_DAYS_,
|
|
|
|
ALL_DAYS = _ALL_DAYS_,
|
|
|
|
OFFICIAL_HOLIDAY = _OFFICIAL_HOLIDAY_,
|
2024-04-19 13:18:02 +02:00
|
|
|
ONLY_WEEKEND = _ONLY_WEEKEND_,
|
|
|
|
ONLY_OPEN_FOR_BUSINESS_DAYS = _ONLY_OPEN_FOR_BUSINESS_DAYS_,
|
|
|
|
NOT_DEFINED = _NOT_DEFINED_
|
2024-04-12 14:26:03 +02:00
|
|
|
};
|
|
|
|
|
2024-04-19 13:18:02 +02:00
|
|
|
#if 0
|
|
|
|
static bool business(uint64_t businessHours, QDateTime &const dt) {
|
|
|
|
switch (dayOfWeek) {
|
|
|
|
case Qt::Monday:
|
|
|
|
(businessHours & _MON_) == _MON_;
|
|
|
|
case Qt::Tuesday:
|
|
|
|
case Qt::Wednesday:
|
|
|
|
case Qt::Thursday:
|
|
|
|
case Qt::Saturday:
|
|
|
|
case Qt::Sunday:
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2024-04-12 14:26:03 +02:00
|
|
|
struct BusinessHours_struct {
|
|
|
|
BusinessHours bh;
|
2023-12-12 10:26:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TARIFF_BUSINESS_HOURS_H_INCLUDED
|