Add free functions:

previousDayHoliday():
	Check if previous day was a holiday. Check is done relative to
	computed endtime.

isHoliday():
	Check if startDateTime is on a holiday.

getPaymentOptionIndex():
	Compute the index of the payment-options-section inside a tariff-file.
	This is done as workaround (and backward compatibility).

parseWeekDay():
	Parse new structure of tariff-file.
This commit is contained in:
Gerhard Hoffmann 2024-09-02 16:35:25 +02:00
parent a3983ed427
commit bda8914f1a

View File

@ -36,6 +36,7 @@
using namespace std;
using namespace rapidjson;
class Calculator;
class Configuration
{
@ -59,7 +60,7 @@ public:
multimap<int, ATBPaymentRate> PaymentRate;
SpecialDaysWorktimeType SpecialDaysWorktime;
SpecialDaysType SpecialDays;
multimap<int, ATBWeekDays> WeekDays;
multimap<Qt::DayOfWeek, ATBWeekDay> WeekDays;
multimap<int, ATBPeriodYear> YearPeriod;
multimap<int, ATBWeekDaysWorktime> WeekDaysWorktime;
ATBPaymentOptionType PaymentOption;
@ -126,3 +127,15 @@ private:
QVector<ATBPaymentOption> currentPaymentOptions;
};
bool previousDayHoliday(Configuration const &cfg, QDateTime const &t);
bool isHoliday(Configuration const &cfg, QDateTime const &t);
int getPaymentOptionIndex(Configuration const &cfg);
ATBWeekDay parseWeekDay(Configuration &cfg,
rapidjson::GenericMemberIterator<false,
rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> k,
QString const &innerObjName,
Qt::DayOfWeek weekDay,
QString const &weekDayName);