Compare commits

..

No commits in common. "4c268e669366dda794e651411f371df15549eb67" and "7a5d797ae01f54d30e2db24b84bd516ad3664abb" have entirely different histories.

6 changed files with 598 additions and 1066 deletions

View File

@ -55,18 +55,17 @@ private:
PaymentMethod getPaymentMethodId(Configuration const *cfg); PaymentMethod getPaymentMethodId(Configuration const *cfg);
int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId); int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId);
int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId); int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId);
uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId);
Ticket private_GetCostFromDuration(Configuration const* cfg, Ticket private_GetCostFromDuration(Configuration const* cfg,
QDateTime const &start, QDateTime const &start,
int durationMinutes, QDateTime &end,
bool prepaid = false); int &durationMinutes,
Ticket private_GetDurationFromCost(Configuration *cfg, bool nextDay = false,
QDateTime const &start, bool prepaid = false,
uint32_t price, bool overtime = false);
bool prepaid = false);
bool checkDurationMinutes(int minParkingTime, int maxParkingTime, bool checkDurationMinutes(bool overTime,
int minParkingTime, int maxParkingTime,
int durationMinutes); int durationMinutes);
// //
@ -79,9 +78,6 @@ private:
int findNextWorkTimeRange(QDateTime const &dt, int findNextWorkTimeRange(QDateTime const &dt,
QScopedArrayPointer<TariffTimeRange> const &worktime, QScopedArrayPointer<TariffTimeRange> const &worktime,
size_t size); size_t size);
uint32_t computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id) const;
double computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id) const;
}; };
#endif // CALCULATOR_FUNCTIONS_H_INCLUDED #endif // CALCULATOR_FUNCTIONS_H_INCLUDED

View File

@ -13,8 +13,7 @@
#define VALID (1) #define VALID (1)
#define INVALID_FROM_DATETIME (2) #define INVALID_FROM_DATETIME (2)
#define INVALID_UNTIL_DATETIME (3) #define INVALID_UNTIL_DATETIME (3)
#define INVALID_PRICE (4) #define STATUS_END (4)
#define STATUS_END (5)
class Ticket { class Ticket {
enum {CODE=0, CODE_STR=1, CODE_DESC=3}; enum {CODE=0, CODE_STR=1, CODE_DESC=3};
@ -45,8 +44,7 @@ public:
{NOT_INITIALIZED , "NOT_INITIALIZED" , "Ticket not initialized" }, {NOT_INITIALIZED , "NOT_INITIALIZED" , "Ticket not initialized" },
{VALID , "VALID" , "Ticket is valid" }, {VALID , "VALID" , "Ticket is valid" },
{INVALID_FROM_DATETIME , "INVALID_FROM_DATETIME" , "Ticket has invalid start datetime"}, {INVALID_FROM_DATETIME , "INVALID_FROM_DATETIME" , "Ticket has invalid start datetime"},
{INVALID_UNTIL_DATETIME, "INVALID_UNTIL_DATETIME", "Ticket has invalid end datetime" }, {INVALID_UNTIL_DATETIME, "INVALID_UNTIL_DATETIME", "Ticket has invalid end datetime" }
{INVALID_PRICE , "INVALID_PRICE" , "PARKING NOT ALLOWED: Ticket has invalid price" }
}; };
private: private:

View File

@ -408,15 +408,15 @@ double Calculator::GetCostFromDuration(Configuration* cfg,
QDateTime start = start_datetime; QDateTime start = start_datetime;
Ticket t = private_GetCostFromDuration(cfg, start, Ticket t = private_GetCostFromDuration(cfg, start,
durationMinutes, end_datetime, durationMinutes,
prepaid); nextDay, prepaid);
if (t) { if (t) {
qCritical().noquote() << t; qCritical().noquote() << t;
return t.getPrice();
} }
end_datetime = t.getValidUntil(); return -1;
return t.getPrice();
} }
int Calculator::getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId) { int Calculator::getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId) {
@ -427,22 +427,20 @@ int Calculator::getMaximalParkingTime(Configuration const *cfg, PaymentMethod me
return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_max_time, 0); return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_max_time, 0);
} }
uint32_t Calculator::getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId) { bool Calculator::checkDurationMinutes(bool overtime,
return std::max((int)cfg->PaymentOption.find(methodId)->second.pop_min_price, 0); int minParkingTime,
}
bool Calculator::checkDurationMinutes(int minParkingTime,
int maxParkingTime, int maxParkingTime,
int durationMinutes) { int durationMinutes) {
if (durationMinutes > maxParkingTime) { if (!overtime) {
qWarning() << QString("Total duration >= max_min (%1 >= %2)").arg(durationMinutes).arg(maxParkingTime); if (durationMinutes > maxParkingTime) {
return false; qWarning() << QString("Total duration >= max_min (%1 >= %2)").arg(durationMinutes).arg(maxParkingTime);
return false;
}
if (durationMinutes < minParkingTime) {
qWarning() << QString("Total duration <= minMin (%1 <= %2)").arg(durationMinutes).arg(minParkingTime);
return false;
}
} }
if (durationMinutes < minParkingTime) {
qWarning() << QString("Total duration <= minMin (%1 <= %2)").arg(durationMinutes).arg(minParkingTime);
return false;
}
return true; return true;
} }
@ -461,8 +459,8 @@ int Calculator::findWorkTimeRange(QDateTime const &dt,
} }
int Calculator::findNextWorkTimeRange(QDateTime const &dt, int Calculator::findNextWorkTimeRange(QDateTime const &dt,
QScopedArrayPointer<TariffTimeRange> const &worktime, QScopedArrayPointer<TariffTimeRange> const &worktime,
size_t size) { size_t size) {
int nextWorkTimeRange = -1; int nextWorkTimeRange = -1;
for (size_t w = 0; w < size; ++w) { for (size_t w = 0; w < size; ++w) {
QTime const &worktime_from = worktime[w].getTimeFrom(); QTime const &worktime_from = worktime[w].getTimeFrom();
@ -475,33 +473,24 @@ int Calculator::findNextWorkTimeRange(QDateTime const &dt,
return nextWorkTimeRange; return nextWorkTimeRange;
} }
uint32_t Calculator::computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id) const {
int pop_id = cfg->PaymentOption.find(id)->second.pop_id;
return cfg->PaymentRate.find(pop_id)->second.pra_price;
}
double Calculator::computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id) const {
int pop_id = cfg->PaymentOption.find(id)->second.pop_id;
int durationId = cfg->PaymentRate.find(pop_id)->second.pra_payment_unit_id;
return (double)(cfg->Duration.find(durationId)->second.pun_duration);
}
using namespace Utilities; using namespace Utilities;
Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg, Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
QDateTime const &start, QDateTime const &start,
int durationMinutes, // Netto QDateTime &end,
bool prepaid) { int &durationMinutes,
bool nextDay,
bool prepaid,
bool overtime) {
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg); static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
static const bool carryOverNotSet = isCarryOverNotSet(cfg, paymentMethodId); static const bool carryOverNotSet = isCarryOverNotSet(cfg, paymentMethodId);
static const int minParkingTimeMinutes = getMinimalParkingTime(cfg, paymentMethodId); static int const minParkingTimeMinutes = getMinimalParkingTime(cfg, paymentMethodId);
static const int maxParkingTimeMinutes = getMaximalParkingTime(cfg, paymentMethodId); static int const maxParkingTimeMinutes = getMaximalParkingTime(cfg, paymentMethodId);
static const bool checkMinMaxMinutes = (minParkingTimeMinutes < maxParkingTimeMinutes);
static bool const checkMinMaxMinutes = (minParkingTimeMinutes < maxParkingTimeMinutes);
static const int durationMinutesNetto = durationMinutes; static const int durationMinutesNetto = durationMinutes;
static const uint32_t weekDaysPrice = computeWeekDaysPrice(cfg, paymentMethodId);
static const double weekDaysDurationUnit = computeWeekDaysDurationUnit(cfg, paymentMethodId);
static const double specialDaysDurationUnit = 60.0;
if (!checkMinMaxMinutes) { if (!checkMinMaxMinutes) {
qCritical() << QString( qCritical() << QString(
@ -510,369 +499,208 @@ Ticket Calculator::private_GetCostFromDuration(Configuration const* cfg,
return Ticket(); return Ticket();
} }
if (!checkDurationMinutes(minParkingTimeMinutes, if (!checkDurationMinutes(overtime, minParkingTimeMinutes,
maxParkingTimeMinutes, durationMinutes)) { maxParkingTimeMinutes, durationMinutes)) {
return Ticket(); return Ticket();
} }
QDateTime inputDate = start;
int const weekdayId = inputDate.date().dayOfWeek();
uint32_t price = 0; uint32_t price = 0;
double durationUnit = 60.0;
int current_special_day_id = -1;
// there might be more than 1 worktime ranges per day
int const timeRanges = std::max((int)cfg->WeekDaysWorktime.count(weekdayId), 1);
QScopedArrayPointer<TariffTimeRange> worktime(new TariffTimeRange[timeRanges]);
int ranges = 0;
if(Utilities::CheckSpecialDay(cfg, inputDate, &current_special_day_id, &price)) {
// Set special day price:
durationUnit = 60.0;
worktime[ranges].setTimeRange(SpecialDaysWorkTimeFrom(cfg, current_special_day_id),
SpecialDaysWorkTimeUntil(cfg, current_special_day_id));
ranges = 1;
} else {
// Set new price for the normal day: do not use a floating-point type
// for the price, rather compute with integers. Only at the very end of
// the computation the price is divided by durationUnit.
int pop_id = cfg->PaymentOption.find(paymentMethodId)->second.pop_id;
price = cfg->PaymentRate.find(pop_id)->second.pra_price;
int durationId = cfg->PaymentRate.find(pop_id)->second.pra_payment_unit_id;
durationUnit = cfg->Duration.find(durationId)->second.pun_duration;
// If no working day found, skip it (recursively call method again)
if (cfg->WeekDaysWorktime.count(weekdayId) <= 0) {
// When no workday found, go to next available day
qDebug() << "No workday found, trying to find next available day";
inputDate = inputDate.addDays(1);
return private_GetCostFromDuration(cfg, inputDate, end, durationMinutes, true, prepaid, overtime);
}
using WTIterator = std::multimap<int, ATBWeekDaysWorktime>::const_iterator;
std::pair<WTIterator, WTIterator> p = cfg->WeekDaysWorktime.equal_range(weekdayId);
for (WTIterator itr = p.first; itr != p.second; ++itr) {
worktime[ranges].setTimeRange(WeekDaysWorkTimeFrom(itr),
WeekDaysWorkTimeUntil(itr));
ranges += 1;
}
}
uint32_t costFromDuration = 0; uint32_t costFromDuration = 0;
double durationUnit = 0.0; QTime const &lastWorktimeTo = worktime[ranges-1].getTimeUntil();
int specialDayId = -1; int currentRange = -1;
bool isSpecialDay = false;
Ticket ticket;
QDateTime end = start;
QDateTime current;
int totalTimeRanges = 0;
for (current = start; durationMinutes > 0; current = current.addDays(1)) { if (nextDay) { // this means the function has been called recursively
int const weekdayId = current.date().dayOfWeek(); currentRange = 0;
inputDate.setTime(worktime[currentRange].getTimeFrom());
} else {
// check if inputDate is located inside a valid worktime-range...
currentRange = findWorkTimeRange(inputDate, worktime, ranges);
if (currentRange == -1) { // no...
if (!prepaid) { // parking is not allowed
return Ticket(start, end, durationMinutesNetto, 0,
0, Ticket::s[INVALID_FROM_DATETIME]);
}
// find the next worktime-range (on the same day), and start from there
currentRange = findNextWorkTimeRange(inputDate, worktime, ranges);
inputDate.setTime(worktime[currentRange].getTimeFrom());
}
}
specialDayId = -1; for (int w = currentRange; w < ranges; ++w) {
if (durationMinutes > 0) {
QTime const &worktime_from = worktime[w].getTimeFrom();
QTime const &worktime_to = worktime[w].getTimeUntil();
// find worktime ranges for the current day qCritical() << "from" << worktime_from;
int const timeRanges = std::max((int)cfg->WeekDaysWorktime.count(weekdayId), 1); qCritical() << "until" << worktime_to;
QScopedArrayPointer<TariffTimeRange> worktime(new TariffTimeRange[timeRanges]);
int ranges = 0;
if((isSpecialDay = Utilities::CheckSpecialDay(cfg, current, &specialDayId, &price))) { //if (w > 0) { // durationMinutes are always meant as netto time and
// Set special day price: // // the time between worktime-ranges are free.
durationUnit = specialDaysDurationUnit; // inputDate.setTime(worktime_from);
worktime[ranges].setTimeRange(SpecialDaysWorkTimeFrom(cfg, specialDayId), //}
SpecialDaysWorkTimeUntil(cfg, specialDayId));
ranges = 1;
} else {
// Set new price for the normal day: do not use a floating-point type
// for the price, rather compute with integers. Only at the very end of
// the computation the price is divided by durationUnit.
price = weekDaysPrice;
durationUnit = weekDaysDurationUnit;
// If no working day found, skip it (epsecially Sundays!) // TODO: hier muss dann der preis hin
if (cfg->WeekDaysWorktime.count(weekdayId) <= 0) { if (price == 0) {
qDebug() << "No workday found, trying to find next available day"; inputDate = inputDate.addDays(1);
end = current; inputDate.setTime(worktime_from);
current.setTime(QTime()); // start at midnight on the next day Ticket t = private_GetCostFromDuration(
cfg, // TODO: erklaerung
inputDate,
end, durationMinutes,
true, prepaid);
if (!t.isValid()) {
return t;
}
costFromDuration += t.getPrice();
continue; continue;
} }
using WTIterator = std::multimap<int, ATBWeekDaysWorktime>::const_iterator; // If overtime flag is set
std::pair<WTIterator, WTIterator> p = cfg->WeekDaysWorktime.equal_range(weekdayId); // TODO: ueberpruefen, kann man wohl nach oben ziehen
//if (overtime || nextDay) {
// inputDate.setTime(worktime_from);
// overtime = false;
//}
for (WTIterator itr = p.first; itr != p.second; ++itr) { qCritical() << "inputDate.time()=" << inputDate.time();
worktime[ranges].setTimeRange(WeekDaysWorkTimeFrom(itr),
WeekDaysWorkTimeUntil(itr));
ranges += 1;
}
}
QTime const &lastWorktimeTo = worktime[ranges-1].getTimeUntil(); // Check prepaid
if (!prepaid) {
// find worktime range to start with if ((inputDate.time() < worktime_from) || (inputDate.time() > worktime_to)) {
qDebug() << "[STOP] * Ticket is not valid * ";
int currentRange = 0; return Ticket();
if (!isSpecialDay) { }
if (start != current) { // on next day
current.setTime(worktime[currentRange].getTimeFrom());
} else { } else {
// check if inputDate is located inside a valid worktime-range... qDebug() << "* PREPAID MODE ACTIVE *";
currentRange = findWorkTimeRange(current, worktime, ranges); if (inputDate.time() < worktime_from) {
if (currentRange == -1) { // no... inputDate.setTime(worktime_from);
if (!prepaid) { // parking is not allowed //} else if(inputDate.time() > worktime_to) {
return Ticket(start, QDateTime(), durationMinutesNetto, 0, } else if(inputDate.time() > lastWorktimeTo) {
0, Ticket::s[INVALID_FROM_DATETIME]); qDebug() << " *** PREPAID *** Current time is past the time range end, searching for next available day";
// wieso ist hier overtime nicht gesetzt
inputDate = inputDate.addDays(1);
Ticket t = private_GetCostFromDuration(
cfg, inputDate, end,
durationMinutes, true, prepaid);
if (!t.isValid()) {
return t;
} }
// find the next worktime-range (on the same day), and start from there costFromDuration += t.getPrice();
currentRange = findNextWorkTimeRange(current, worktime, ranges); continue;
current.setTime(worktime[currentRange].getTimeFrom()); }
}
while(durationMinutes > 0) {
// Check for active year period
if (!IsYearPeriodActive(cfg, inputDate)) {
return Ticket();
}
qDebug() << "inputDate" << inputDate.toString(Qt::ISODate);
if(inputDate.time() >= lastWorktimeTo) {
// Go to next day if minutes not spent
if (carryOverNotSet) {
// no carry_over, so stop computation
break;
}
qDebug() << "Reached end of worktime, searching for the next working day";
inputDate = inputDate.addDays(1);
inputDate.setTime(QTime());
overtime = true;
Ticket t = private_GetCostFromDuration(
cfg, inputDate, end,
durationMinutes, true, prepaid, overtime);
if (!t.isValid()) {
return t;
}
costFromDuration += t.getPrice();
break; // stop while, and continue in outer loop
} else {
if(inputDate.time() < worktime_to) {
// Increment input date minutes for each monetary unit
inputDate = inputDate.addSecs(60);
qDebug() << "inputDate" << inputDate.toString(Qt::ISODate);
durationMinutes -= 1;
//costFromDuration += price_per_unit;
costFromDuration += price;
} else break;
} }
} }
} }
}
for (int w = currentRange; w < ranges; ++w, ++totalTimeRanges) {
if (durationMinutes > 0) {
QTime const &worktime_from = worktime[w].getTimeFrom();
QTime const &worktime_to = worktime[w].getTimeUntil();
if (totalTimeRanges) { if (inputDate >= end) {
// durationMinutes are always meant as netto time and end = inputDate;
// the time between worktime-ranges are free. }
current.setTime(worktime_from);
}
if (price == 0) { if (nextDay == false) {
// inputDate = inputDate.addDays(1); qDebug() << "GetCostFromDuration(): Valid until:" << end.toString(Qt::ISODate);
// inputDate.setTime(worktime_from); }
end = current;
current.setTime(QTime());
continue;
}
if (current.time() == worktime_to) {
end = current;
current.setTime(QTime());
continue;
}
// Check prepaid
if (!prepaid) {
if ((current.time() < worktime_from) || (current.time() > worktime_to)) {
qDebug() << "[STOP] * Ticket is not valid * ";
return Ticket();
}
} else {
qDebug() << "* PREPAID MODE ACTIVE *";
if (current.time() < worktime_from) {
current.setTime(worktime_from);
end = current;
} else if(current.time() > lastWorktimeTo) {
qDebug() << " *** PREPAID *** Current time is past the time range end, searching for next available day";
end = current;
current.setTime(QTime());
continue;
}
}
while(durationMinutes > 0) {
// Check for active year period
if (!IsYearPeriodActive(cfg, current)) {
return Ticket();
}
if(current.time() >= lastWorktimeTo) {
// Go to next day if minutes not spent
if (carryOverNotSet) {
// no carry_over, so stop computation
break;
}
current.setTime(QTime());
break; // stop while, and continue in outer loop
} else {
if(current.time() < worktime_to) {
// Increment input date minutes for each monetary unit
current = current.addSecs(60);
end = current;
durationMinutes -= 1;
//costFromDuration += price_per_unit;
costFromDuration += price;
} else break;
}
} // while(durationMinutes > 0) {
} // if (durationMinutes > 0) {
} // for (int w = currentRange; w < ranges; ++w, ++totalTimeRanges) {
} // for (current = start; durationMinutes > 0; current = current.addDays(1)) {
int durationMinutesBrutto = start.secsTo(end) / 60;
return return
Ticket(start, end, durationMinutesNetto, durationMinutesBrutto, Ticket(start, end,
llround(Utilities::CalculatePricePerUnit(costFromDuration, durationUnit)), durationMinutesNetto,
start.secsTo(end) / 60,
nextDay ?
costFromDuration :
llround(Utilities::CalculatePricePerUnit(costFromDuration, durationUnit)),
Ticket::s[VALID]); Ticket::s[VALID]);
} }
Ticket Calculator::private_GetDurationFromCost(Configuration *cfg,
QDateTime const &start,
uint32_t price,
bool prepaid) {
// Get input date
QDateTime current = start;
// use tariff with structure as for instance Schnau, Koenigsee:
// without given YearPeriod, SpecialDays and SpecialDaysWorktime
if (cfg->YearPeriod.size() == 0
&& cfg->SpecialDays.size() == 0
&& cfg->SpecialDaysWorktime.size() == 0)
{
uint64_t const durationMinutes = GetDurationForPrice(cfg, price);
uint64_t const durationSeconds = durationMinutes * 60;
current = current.addSecs(durationSeconds);
return
Ticket(start, current, durationMinutes, durationMinutes,
price, Ticket::s[VALID]);
}
static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
static const bool carryOverNotSet = isCarryOverNotSet(cfg, paymentMethodId);
static const uint32_t minParkingTimeMinutes = std::max(getMinimalParkingTime(cfg, paymentMethodId), 0);
static const uint32_t maxParkingTimeMinutes = std::max(getMaximalParkingTime(cfg, paymentMethodId), 0);
static const uint32_t minParkingPrice = getMinimalParkingPrice(cfg, paymentMethodId);
static const bool checkMinMaxMinutes = (minParkingTimeMinutes < maxParkingTimeMinutes);
static const uint32_t weekDaysPrice = computeWeekDaysPrice(cfg, paymentMethodId);
static const double weekDaysDurationUnit = computeWeekDaysDurationUnit(cfg, paymentMethodId);
static const double specialDaysDurationUnit = 60.0;
if(price < minParkingPrice) {
uint64_t const durationMinutes = GetDurationForPrice(cfg, price);
return Ticket(start, current, durationMinutes, durationMinutes,
price, Ticket::s[INVALID_PRICE]);
}
if (minParkingTimeMinutes >= maxParkingTimeMinutes) {
// TODO
return Ticket();
}
if (maxParkingTimeMinutes <= minParkingTimeMinutes) {
// TODO
return Ticket();
}
uint32_t durationMinutesNetto = 0;
int moneyLeft = price;
//double durationUnit = 0.0;
int specialDayId = -1;
bool isSpecialDay = false;
QDateTime end = start;
int totalTimeRanges = 0;
for (current = start; moneyLeft > 0; current = current.addDays(1)) {
int const weekdayId = current.date().dayOfWeek();
specialDayId = -1;
// find worktime ranges for the current day
int const timeRanges = std::max((int)cfg->WeekDaysWorktime.count(weekdayId), 1);
QScopedArrayPointer<TariffTimeRange> worktime(new TariffTimeRange[timeRanges]);
int ranges = 0;
if((isSpecialDay = Utilities::CheckSpecialDay(cfg, current, &specialDayId, &price))) {
// Set special day price:
// durationUnit = specialDaysDurationUnit;
worktime[ranges].setTimeRange(SpecialDaysWorkTimeFrom(cfg, specialDayId),
SpecialDaysWorkTimeUntil(cfg, specialDayId));
ranges = 1;
} else {
// Set new price for the normal day: do not use a floating-point type
// for the price, rather compute with integers. Only at the very end of
// the computation the price is divided by durationUnit.
price = weekDaysPrice;
// durationUnit = weekDaysDurationUnit;
// If no working day found, skip it (epsecially Sundays!)
if (cfg->WeekDaysWorktime.count(weekdayId) <= 0) {
qDebug() << "No workday found, trying to find next available day";
end = current;
current.setTime(QTime()); // start at midnight on the next day
continue;
}
using WTIterator = std::multimap<int, ATBWeekDaysWorktime>::const_iterator;
std::pair<WTIterator, WTIterator> p = cfg->WeekDaysWorktime.equal_range(weekdayId);
for (WTIterator itr = p.first; itr != p.second; ++itr) {
worktime[ranges].setTimeRange(WeekDaysWorkTimeFrom(itr),
WeekDaysWorkTimeUntil(itr));
ranges += 1;
}
}
QTime const &lastWorktimeTo = worktime[ranges-1].getTimeUntil();
// find worktime range to start with
int currentRange = 0;
if (!isSpecialDay) {
if (start != current) { // on next day
current.setTime(worktime[currentRange].getTimeFrom());
} else {
// check if inputDate is located inside a valid worktime-range...
currentRange = findWorkTimeRange(current, worktime, ranges);
if (currentRange == -1) { // no...
if (!prepaid) { // parking is not allowed
return Ticket(start, QDateTime(), durationMinutesNetto, 0,
0, Ticket::s[INVALID_FROM_DATETIME]);
}
// find the next worktime-range (on the same day), and start from there
currentRange = findNextWorkTimeRange(current, worktime, ranges);
current.setTime(worktime[currentRange].getTimeFrom());
}
}
}
for (int w = currentRange; w < ranges; ++w, ++totalTimeRanges) {
if (moneyLeft > 0) {
QTime const &worktime_from = worktime[w].getTimeFrom();
QTime const &worktime_to = worktime[w].getTimeUntil();
if (totalTimeRanges) {
// durationMinutes are always meant as netto time and
// the time between worktime-ranges are free.
current.setTime(worktime_from);
}
if (price == 0) {
// inputDate = inputDate.addDays(1);
// inputDate.setTime(worktime_from);
end = current;
current.setTime(QTime());
continue;
}
if (current.time() == worktime_to) {
end = current;
current.setTime(QTime());
continue;
}
// Check prepaid
if (!prepaid) {
if ((current.time() < worktime_from) || (current.time() > worktime_to)) {
qDebug() << "[STOP] * Ticket is not valid * ";
return Ticket();
}
} else {
qDebug() << "* PREPAID MODE ACTIVE *";
if (current.time() < worktime_from) {
current.setTime(worktime_from);
end = current;
} else if(current.time() > lastWorktimeTo) {
qDebug() << " *** PREPAID *** Current time is past the time range end, searching for next available day";
end = current;
current.setTime(QTime());
continue;
}
}
while(moneyLeft > 0) {
// Check for active year period
if (!IsYearPeriodActive(cfg, current)) {
return Ticket();
}
if(durationMinutesNetto > maxParkingTimeMinutes) {
durationMinutesNetto = maxParkingTimeMinutes;
break;
}
if(current.time() >= lastWorktimeTo) {
// Go to next day if minutes not spent
if (carryOverNotSet) {
// no carry_over, so stop computation
break;
}
current.setTime(QTime());
break; // stop while, and continue in outer loop
} else {
if(current.time() < worktime_to) {
// Increment input date minutes for each monetary unit
if(moneyLeft > 1) {
current = current.addSecs(60);
}
end = current;
if(price > 0) {
durationMinutesNetto +=1;
}
moneyLeft -= price;
} else break;
}
} // while(durationMinutes > 0) {
} // if (durationMinutes > 0) {
} // for (int w = currentRange; w < ranges; ++w, ++totalTimeRanges) {
} // for (current = start; durationMinutes > 0; current = current.addDays(1)) {
int durationMinutesBrutto = start.secsTo(end) / 60;
return
Ticket(start, end, durationMinutesNetto, durationMinutesBrutto,
price, Ticket::s[VALID]);
}
QList<int> Calculator::GetTimeSteps(Configuration *cfg) const { QList<int> Calculator::GetTimeSteps(Configuration *cfg) const {
QList<int> timeSteps; QList<int> timeSteps;

View File

@ -7,6 +7,9 @@ Ticket::Ticket()
, m_durationMinutesNetto(0) , m_durationMinutesNetto(0)
, m_durationMinutesBrutto(0) , m_durationMinutesBrutto(0)
, m_price() { , m_price() {
qDebug() << *this;
qDebug() << m_status;
} }
Ticket::Ticket(QDateTime const &s, QDateTime const &e, Ticket::Ticket(QDateTime const &s, QDateTime const &e,

View File

@ -1,12 +1,9 @@
{ {
"Project" : "Korneuburg",
"Version" : "1.0.0",
"Info" : "",
"Currency": [ "Currency": [
{ {
"pcu_id": 2, "pcu_id": 2,
"pcu_sign": "", "pcu_sign": "Ft",
"pcu_major": "EUR", "pcu_major": "HUF",
"pcu_minor": "", "pcu_minor": "",
"pcu_active": true "pcu_active": true
} }
@ -32,30 +29,30 @@
"PaymentOption": [ "PaymentOption": [
{ {
"pop_id": 1049, "pop_id": 1049,
"pop_label": "Zone 1", "pop_label": "Zone Lila",
"pop_payment_method_id": 3, "pop_payment_method_id": 3,
"pop_day_end_time": "00:00:00", "pop_day_end_time": "16:25:00",
"pop_day_night_end_time": "00:00:00", "pop_day_night_end_time": "16:25:00",
"pop_price_night": 0, "pop_price_night": 0,
"pop_min_time": 30, "pop_min_time": 15,
"pop_max_time": 180, "pop_max_time": 300,
"pop_min_price": 60, "pop_min_price": 0,
"pop_carry_over": 1, "pop_carry_over": 1,
"pop_daily_card_price": 0 "pop_daily_card_price": 900
} }
], ],
"PaymentRate": [ "PaymentRate": [
{ {
"pra_payment_option_id": 1049, "pra_payment_option_id": 1049,
"pra_payment_unit_id": 1, "pra_payment_unit_id": 1,
"pra_price": 10 "pra_price": 150
} }
], ],
"Duration": [ "Duration": [
{ {
"pun_id": 1, "pun_id": 1,
"pun_label": "5 min", "pun_label": "1h",
"pun_duration": 5 "pun_duration": 60
}, },
{ {
"pun_id": 3, "pun_id": 3,
@ -74,13 +71,6 @@
"pwd_period_week_day_id": 36, "pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 1, "pwd_period_day_in_week_id": 1,
"pwd_time_from": "08:00:00", "pwd_time_from": "08:00:00",
"pwd_time_to": "12:00:00"
},
{
"pwd_id": 621,
"pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 1,
"pwd_time_from": "14:00:00",
"pwd_time_to": "18:00:00" "pwd_time_to": "18:00:00"
}, },
{ {
@ -88,13 +78,6 @@
"pwd_period_week_day_id": 36, "pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 2, "pwd_period_day_in_week_id": 2,
"pwd_time_from": "08:00:00", "pwd_time_from": "08:00:00",
"pwd_time_to": "12:00:00"
},
{
"pwd_id": 622,
"pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 2,
"pwd_time_from": "14:00:00",
"pwd_time_to": "18:00:00" "pwd_time_to": "18:00:00"
}, },
{ {
@ -102,13 +85,6 @@
"pwd_period_week_day_id": 36, "pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 3, "pwd_period_day_in_week_id": 3,
"pwd_time_from": "08:00:00", "pwd_time_from": "08:00:00",
"pwd_time_to": "12:00:00"
},
{
"pwd_id": 623,
"pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 3,
"pwd_time_from": "14:00:00",
"pwd_time_to": "18:00:00" "pwd_time_to": "18:00:00"
}, },
{ {
@ -116,13 +92,6 @@
"pwd_period_week_day_id": 36, "pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 4, "pwd_period_day_in_week_id": 4,
"pwd_time_from": "08:00:00", "pwd_time_from": "08:00:00",
"pwd_time_to": "12:00:00"
},
{
"pwd_id": 624,
"pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 4,
"pwd_time_from": "14:00:00",
"pwd_time_to": "18:00:00" "pwd_time_to": "18:00:00"
}, },
{ {
@ -130,21 +99,73 @@
"pwd_period_week_day_id": 36, "pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 5, "pwd_period_day_in_week_id": 5,
"pwd_time_from": "08:00:00", "pwd_time_from": "08:00:00",
"pwd_time_to": "12:00:00"
},
{
"pwd_id": 625,
"pwd_period_week_day_id": 36,
"pwd_period_day_in_week_id": 5,
"pwd_time_from": "14:00:00",
"pwd_time_to": "18:00:00" "pwd_time_to": "18:00:00"
}
],
"PeriodYear": [
{
"pye_id": 8,
"pye_label": "Whole year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
}, },
{ {
"pwd_id": 626, "pye_id": 9,
"pwd_period_week_day_id": 36, "pye_label": "Whole year",
"pwd_period_day_in_week_id": 6, "pye_start_month": 1,
"pwd_time_from": "08:00:00", "pye_start_day": 1,
"pwd_time_to": "12:00:00" "pye_end_month": 12,
"pye_end_day": 31
},
{
"pye_id": 10,
"pye_label": "Whole year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
},
{
"pye_id": 11,
"pye_label": "Whole Year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
},
{
"pye_id": 12,
"pye_label": "Whole Year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
},
{
"pye_id": 13,
"pye_label": "Whole Year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
},
{
"pye_id": 14,
"pye_label": "Whole Year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
},
{
"pye_id": 15,
"pye_label": "Whole year",
"pye_start_month": 1,
"pye_start_day": 1,
"pye_end_month": 12,
"pye_end_day": 31
} }
], ],
"SpecialDaysWorktime": [ "SpecialDaysWorktime": [
@ -364,266 +385,421 @@
"pedwt_time_from": "00:00:00", "pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00", "pedwt_time_to": "00:00:00",
"pedwt_price": 0 "pedwt_price": 0
},
{
"pedwt_id": 2260,
"pedwt_period_exc_day_id": 2061,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2261,
"pedwt_period_exc_day_id": 2062,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2262,
"pedwt_period_exc_day_id": 2063,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2263,
"pedwt_period_exc_day_id": 2064,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2264,
"pedwt_period_exc_day_id": 2065,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2265,
"pedwt_period_exc_day_id": 2066,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2266,
"pedwt_period_exc_day_id": 2067,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2267,
"pedwt_period_exc_day_id": 2068,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2268,
"pedwt_period_exc_day_id": 2069,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2269,
"pedwt_period_exc_day_id": 2070,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2270,
"pedwt_period_exc_day_id": 2071,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
} }
], ],
"SpecialDays": [ "SpecialDays": [
{ {
"ped_id": 11, "ped_id": 11,
"ped_label": "Mariae Empfaengnis", "ped_label": "Christmas 1st day",
"ped_date_start": "2023-12-08", "ped_date_start": "2022-12-25",
"ped_date_end": "2023-12-08", "ped_date_end": "2022-12-25",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 13, "ped_id": 13,
"ped_label": "Christtag", "ped_label": "Christmas 2nd day",
"ped_date_start": "2023-12-25", "ped_date_start": "2022-12-26",
"ped_date_end": "2023-12-25", "ped_date_end": "2022-12-26",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 14, "ped_id": 14,
"ped_label": "Stefanitag", "ped_label": "Republic Day (Hungary)",
"ped_date_start": "2023-12-26", "ped_date_start": "2022-10-23",
"ped_date_end": "2023-12-26", "ped_date_end": "2022-10-23",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2016, "ped_id": 2016,
"ped_label": "Neujahr", "ped_label": "Christmas (Sunday)",
"ped_date_start": "2024-01-01", "ped_date_start": "2022-12-24",
"ped_date_end": "2024-01-01", "ped_date_end": "2022-12-24",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2021, "ped_id": 2021,
"ped_label": "Heilig Drei Koenige", "ped_label": "Holiday (Hungary)",
"ped_date_start": "2024-01-06", "ped_date_start": "2022-12-31",
"ped_date_end": "2024-01-06", "ped_date_end": "2022-12-31",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 1,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2022, "ped_id": 2022,
"ped_label": "Ostermontag", "ped_label": "NewYear",
"ped_date_start": "2024-01-04", "ped_date_start": "2023-01-01",
"ped_date_end": "2024-01-04", "ped_date_end": "2023-01-01",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 2024 "ped_year": 0
}, },
{ {
"ped_id": 2024, "ped_id": 2024,
"ped_label": "Staatsfeiertag", "ped_label": "Good Friday",
"ped_date_start": "2024-05-01", "ped_date_start": "2023-04-07",
"ped_date_end": "2024-05-01", "ped_date_end": "2023-04-07",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2023
}, },
{ {
"ped_id": 2025, "ped_id": 2025,
"ped_label": "Christi Himmelfahrt", "ped_label": "Easter Sunday",
"ped_date_start": "2024-05-09", "ped_date_start": "2023-04-09",
"ped_date_end": "2024-05-09", "ped_date_end": "2023-04-09",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 2024 "ped_year": 2023
}, },
{ {
"ped_id": 2026, "ped_id": 2026,
"ped_label": "Pfingst Montag", "ped_label": "Easter Monday",
"ped_date_start": "2024-05-20", "ped_date_start": "2023-04-10",
"ped_date_end": "2024-05-20", "ped_date_end": "2023-04-10",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 2024 "ped_year": 2023
}, },
{ {
"ped_id": 2027, "ped_id": 2027,
"ped_label": "Fronleichnam", "ped_label": "Whit Sunday",
"ped_date_start": "2024-05-30", "ped_date_start": "2023-05-28",
"ped_date_end": "2024-05-30", "ped_date_end": "2023-05-28",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 2024 "ped_year": 2023
}, },
{ {
"ped_id": 2028, "ped_id": 2028,
"ped_label": "Maria Himmelfahrt", "ped_label": "Whit Monday",
"ped_date_start": "2024-08-15", "ped_date_start": "2023-05-29",
"ped_date_end": "2024-08-15", "ped_date_end": "2023-05-29",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2023
}, },
{ {
"ped_id": 2029, "ped_id": 2029,
"ped_label": "Nationalfeiertag", "ped_label": "Revolution Day (Hungary)",
"ped_date_start": "2024-10-26", "ped_date_start": "2023-03-15",
"ped_date_end": "2024-10-26", "ped_date_end": "2023-03-15",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2030, "ped_id": 2030,
"ped_label": "Allerheiligen", "ped_label": "Labour Day",
"ped_date_start": "2024-11-01", "ped_date_start": "2023-05-01",
"ped_date_end": "2024-11-01", "ped_date_end": "2023-05-01",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2031, "ped_id": 2031,
"ped_label": "Mariae Empfaengnis", "ped_label": "Saint Stephens Day (Hungary)",
"ped_date_start": "2024-08-12", "ped_date_start": "2023-08-20",
"ped_date_end": "2024-08-12", "ped_date_end": "2023-08-20",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2032, "ped_id": 2032,
"ped_label": "Christtag", "ped_label": "All Saints Day",
"ped_date_start": "2024-12-25", "ped_date_start": "2023-11-01",
"ped_date_end": "2024-12-25", "ped_date_end": "2023-11-01",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2034, "ped_id": 2034,
"ped_label": "Stefanitag", "ped_label": "Good Friday",
"ped_date_start": "2024-12-26", "ped_date_start": "2024-03-29",
"ped_date_end": "2024-12-26", "ped_date_end": "2024-03-29",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2024
}, },
{ {
"ped_id": 2035, "ped_id": 2035,
"ped_label": "Neujahr", "ped_label": "Easter",
"ped_date_start": "2025-01-01", "ped_date_start": "2024-03-31",
"ped_date_end": "2025-01-01", "ped_date_end": "2024-03-31",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2024
}, },
{ {
"ped_id": 2036, "ped_id": 2036,
"ped_label": "Heilig Drei Koenige", "ped_label": "Easter Monday",
"ped_date_start": "2025-06-01", "ped_date_start": "2024-04-01",
"ped_date_end": "2025-06-01", "ped_date_end": "2024-04-01",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2037,
"ped_label": "Whit Monday",
"ped_date_start": "2024-05-20",
"ped_date_end": "2024-05-20",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2038,
"ped_label": "Whit Sunday",
"ped_date_start": "2024-05-19",
"ped_date_end": "2024-05-19",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2050,
"ped_label": "Uskrs",
"ped_date_start": "2023-04-16",
"ped_date_end": "2023-04-16",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 1,
"ped_year": 0 "ped_year": 0
}, },
{
"ped_id": 2037,
"ped_label": "Ostermontag",
"ped_date_start": "2025-04-21",
"ped_date_end": "2025-04-21",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2038,
"ped_label": "Staatsfeiertag",
"ped_date_start": "2025-05-01",
"ped_date_end": "2025-05-01",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2050,
"ped_label": "Christi Himmelfahrt",
"ped_date_start": "2025-05-29",
"ped_date_end": "2025-05-29",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{ {
"ped_id": 2051, "ped_id": 2051,
"ped_label": "Pfingstmontag", "ped_label": "Uskrs",
"ped_date_start": "2025-06-09", "ped_date_start": "2023-04-16",
"ped_date_end": "2025-06-09", "ped_date_end": "2023-04-16",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 1,
"ped_year": 2025 "ped_year": 0
}, },
{ {
"ped_id": 2052, "ped_id": 2052,
"ped_label": "Fronlaeichnam", "ped_label": "Christmas 1st day",
"ped_date_start": "2025-06-19", "ped_date_start": "2022-12-25",
"ped_date_end": "2025-06-19", "ped_date_end": "2022-12-25",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 2025 "ped_year": 0
}, },
{ {
"ped_id": 2053, "ped_id": 2053,
"ped_label": "Mariae Himmelfahrt", "ped_label": "Christmas 2nd day",
"ped_date_start": "2025-08-15", "ped_date_start": "2022-12-26",
"ped_date_end": "2025-08-15", "ped_date_end": "2022-12-26",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2054, "ped_id": 2054,
"ped_label": "Nationalfeiertag", "ped_label": "Republic Day (Hungary)",
"ped_date_start": "2025-10-26", "ped_date_start": "2022-10-23",
"ped_date_end": "2025-10-26", "ped_date_end": "2022-10-23",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2055, "ped_id": 2055,
"ped_label": "Allerheiligen", "ped_label": "Christmas (Sunday)",
"ped_date_start": "2025-11-01", "ped_date_start": "2022-12-24",
"ped_date_end": "2025-11-01", "ped_date_end": "2022-12-24",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2056, "ped_id": 2056,
"ped_label": "Mariae Empfaengnis", "ped_label": "Holiday (Hungary)",
"ped_date_start": "2025-12-08", "ped_date_start": "2022-12-31",
"ped_date_end": "2025-12-08", "ped_date_end": "2022-12-31",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 1,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2057, "ped_id": 2057,
"ped_label": "Christtag", "ped_label": "NewYear",
"ped_date_start": "2025-12-25", "ped_date_start": "2023-01-01",
"ped_date_end": "2025-12-25", "ped_date_end": "2023-01-01",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 0
}, },
{ {
"ped_id": 2058, "ped_id": 2058,
"ped_label": "Stefanitag", "ped_label": "Good Friday",
"ped_date_start": "2025-12-26", "ped_date_start": "2023-04-07",
"ped_date_end": "2025-12-26", "ped_date_end": "2023-04-07",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2023
}, },
{ {
"ped_id": 2059, "ped_id": 2059,
"ped_label": "Neujahr", "ped_label": "Easter Sunday",
"ped_date_start": "2026-01-01", "ped_date_start": "2023-04-09",
"ped_date_end": "2026-01-01", "ped_date_end": "2023-04-09",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2023
}, },
{ {
"ped_id": 2060, "ped_id": 2060,
"ped_label": "Heilige Drei Koenige", "ped_label": "Easter Monday",
"ped_date_start": "2026-01-06", "ped_date_start": "2023-04-10",
"ped_date_end": "2026-01-06", "ped_date_end": "2023-04-10",
"ped_period_special_day_id": 1, "ped_period_special_day_id": 2,
"ped_year": 0 "ped_year": 2023
} },
],
"PeriodYear": [
{ {
"pye_id": 8, "ped_id": 2061,
"pye_label": "Whole year", "ped_label": "Whit Sunday",
"pye_start_month": 1, "ped_date_start": "2023-05-28",
"pye_start_day": 1, "ped_date_end": "2023-05-28",
"pye_end_month": 12, "ped_period_special_day_id": 2,
"pye_end_day": 31 "ped_year": 2023
},
{
"ped_id": 2062,
"ped_label": "Whit Monday",
"ped_date_start": "2023-05-29",
"ped_date_end": "2023-05-29",
"ped_period_special_day_id": 2,
"ped_year": 2023
},
{
"ped_id": 2063,
"ped_label": "Revolution Day (Hungary)",
"ped_date_start": "2023-03-15",
"ped_date_end": "2023-03-15",
"ped_period_special_day_id": 2,
"ped_year": 0
},
{
"ped_id": 2064,
"ped_label": "Labour Day",
"ped_date_start": "2023-05-01",
"ped_date_end": "2023-05-01",
"ped_period_special_day_id": 2,
"ped_year": 0
},
{
"ped_id": 2065,
"ped_label": "Saint Stephens Day (Hungary)",
"ped_date_start": "2023-08-20",
"ped_date_end": "2023-08-20",
"ped_period_special_day_id": 2,
"ped_year": 0
},
{
"ped_id": 2066,
"ped_label": "All Saints Day",
"ped_date_start": "2023-11-01",
"ped_date_end": "2023-11-01",
"ped_period_special_day_id": 2,
"ped_year": 0
},
{
"ped_id": 2067,
"ped_label": "Good Friday",
"ped_date_start": "2024-03-29",
"ped_date_end": "2024-03-29",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2068,
"ped_label": "Easter",
"ped_date_start": "2024-03-31",
"ped_date_end": "2024-03-31",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2069,
"ped_label": "Easter Monday",
"ped_date_start": "2024-04-01",
"ped_date_end": "2024-04-01",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2070,
"ped_label": "Whit Monday",
"ped_date_start": "2024-05-20",
"ped_date_end": "2024-05-20",
"ped_period_special_day_id": 2,
"ped_year": 2024
},
{
"ped_id": 2071,
"ped_label": "Whit Sunday",
"ped_date_start": "2024-05-19",
"ped_date_end": "2024-05-19",
"ped_period_special_day_id": 2,
"ped_year": 2024
} }
] ]
} }

View File

@ -40,7 +40,7 @@
"pop_min_time": 30, "pop_min_time": 30,
"pop_max_time": 180, "pop_max_time": 180,
"pop_min_price": 60, "pop_min_price": 60,
"pop_carry_over": 1, "pop_carry_over": 0,
"pop_daily_card_price": 0 "pop_daily_card_price": 0
} }
], ],
@ -147,475 +147,6 @@
"pwd_time_to": "12:00:00" "pwd_time_to": "12:00:00"
} }
], ],
"SpecialDaysWorktime": [
{
"pedwt_id": 2156,
"pedwt_period_exc_day_id": 2024,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2158,
"pedwt_period_exc_day_id": 2025,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2160,
"pedwt_period_exc_day_id": 2026,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2162,
"pedwt_period_exc_day_id": 2027,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2164,
"pedwt_period_exc_day_id": 2028,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2170,
"pedwt_period_exc_day_id": 2030,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2172,
"pedwt_period_exc_day_id": 2032,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2174,
"pedwt_period_exc_day_id": 11,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2175,
"pedwt_period_exc_day_id": 13,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2178,
"pedwt_period_exc_day_id": 2022,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2179,
"pedwt_period_exc_day_id": 14,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2184,
"pedwt_period_exc_day_id": 2021,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2188,
"pedwt_period_exc_day_id": 2031,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2189,
"pedwt_period_exc_day_id": 2029,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2194,
"pedwt_period_exc_day_id": 2034,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2200,
"pedwt_period_exc_day_id": 2037,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2202,
"pedwt_period_exc_day_id": 2038,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2226,
"pedwt_period_exc_day_id": 2016,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2245,
"pedwt_period_exc_day_id": 2035,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2246,
"pedwt_period_exc_day_id": 2036,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2249,
"pedwt_period_exc_day_id": 2050,
"pedwt_time_from": "08:00:00",
"pedwt_time_to": "16:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2250,
"pedwt_period_exc_day_id": 2051,
"pedwt_time_from": "08:00:00",
"pedwt_time_to": "16:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2251,
"pedwt_period_exc_day_id": 2052,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2252,
"pedwt_period_exc_day_id": 2053,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2253,
"pedwt_period_exc_day_id": 2054,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2254,
"pedwt_period_exc_day_id": 2055,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2255,
"pedwt_period_exc_day_id": 2056,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2256,
"pedwt_period_exc_day_id": 2057,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2257,
"pedwt_period_exc_day_id": 2058,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2258,
"pedwt_period_exc_day_id": 2059,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
},
{
"pedwt_id": 2259,
"pedwt_period_exc_day_id": 2060,
"pedwt_time_from": "00:00:00",
"pedwt_time_to": "00:00:00",
"pedwt_price": 0
}
],
"SpecialDays": [
{
"ped_id": 11,
"ped_label": "Mariae Empfaengnis",
"ped_date_start": "2023-12-08",
"ped_date_end": "2023-12-08",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 13,
"ped_label": "Christtag",
"ped_date_start": "2023-12-25",
"ped_date_end": "2023-12-25",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 14,
"ped_label": "Stefanitag",
"ped_date_start": "2023-12-26",
"ped_date_end": "2023-12-26",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2016,
"ped_label": "Neujahr",
"ped_date_start": "2024-01-01",
"ped_date_end": "2024-01-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2021,
"ped_label": "Heilig Drei Koenige",
"ped_date_start": "2024-01-06",
"ped_date_end": "2024-01-06",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2022,
"ped_label": "Ostermontag",
"ped_date_start": "2024-01-04",
"ped_date_end": "2024-01-04",
"ped_period_special_day_id": 1,
"ped_year": 2024
},
{
"ped_id": 2024,
"ped_label": "Staatsfeiertag",
"ped_date_start": "2024-05-01",
"ped_date_end": "2024-05-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2025,
"ped_label": "Christi Himmelfahrt",
"ped_date_start": "2024-05-09",
"ped_date_end": "2024-05-09",
"ped_period_special_day_id": 1,
"ped_year": 2024
},
{
"ped_id": 2026,
"ped_label": "Pfingst Montag",
"ped_date_start": "2024-05-20",
"ped_date_end": "2024-05-20",
"ped_period_special_day_id": 1,
"ped_year": 2024
},
{
"ped_id": 2027,
"ped_label": "Fronleichnam",
"ped_date_start": "2024-05-30",
"ped_date_end": "2024-05-30",
"ped_period_special_day_id": 1,
"ped_year": 2024
},
{
"ped_id": 2028,
"ped_label": "Maria Himmelfahrt",
"ped_date_start": "2024-08-15",
"ped_date_end": "2024-08-15",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2029,
"ped_label": "Nationalfeiertag",
"ped_date_start": "2024-10-26",
"ped_date_end": "2024-10-26",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2030,
"ped_label": "Allerheiligen",
"ped_date_start": "2024-11-01",
"ped_date_end": "2024-11-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2031,
"ped_label": "Mariae Empfaengnis",
"ped_date_start": "2024-08-12",
"ped_date_end": "2024-08-12",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2032,
"ped_label": "Christtag",
"ped_date_start": "2024-12-25",
"ped_date_end": "2024-12-25",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2034,
"ped_label": "Stefanitag",
"ped_date_start": "2024-12-26",
"ped_date_end": "2024-12-26",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2035,
"ped_label": "Neujahr",
"ped_date_start": "2025-01-01",
"ped_date_end": "2025-01-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2036,
"ped_label": "Heilig Drei Koenige",
"ped_date_start": "2025-06-01",
"ped_date_end": "2025-06-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2037,
"ped_label": "Ostermontag",
"ped_date_start": "2025-04-21",
"ped_date_end": "2025-04-21",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2038,
"ped_label": "Staatsfeiertag",
"ped_date_start": "2025-05-01",
"ped_date_end": "2025-05-01",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2050,
"ped_label": "Christi Himmelfahrt",
"ped_date_start": "2025-05-29",
"ped_date_end": "2025-05-29",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2051,
"ped_label": "Pfingstmontag",
"ped_date_start": "2025-06-09",
"ped_date_end": "2025-06-09",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2052,
"ped_label": "Fronlaeichnam",
"ped_date_start": "2025-06-19",
"ped_date_end": "2025-06-19",
"ped_period_special_day_id": 1,
"ped_year": 2025
},
{
"ped_id": 2053,
"ped_label": "Mariae Himmelfahrt",
"ped_date_start": "2025-08-15",
"ped_date_end": "2025-08-15",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2054,
"ped_label": "Nationalfeiertag",
"ped_date_start": "2025-10-26",
"ped_date_end": "2025-10-26",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2055,
"ped_label": "Allerheiligen",
"ped_date_start": "2025-11-01",
"ped_date_end": "2025-11-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2056,
"ped_label": "Mariae Empfaengnis",
"ped_date_start": "2025-12-08",
"ped_date_end": "2025-12-08",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2057,
"ped_label": "Christtag",
"ped_date_start": "2025-12-25",
"ped_date_end": "2025-12-25",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2058,
"ped_label": "Stefanitag",
"ped_date_start": "2025-12-26",
"ped_date_end": "2025-12-26",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2059,
"ped_label": "Neujahr",
"ped_date_start": "2026-01-01",
"ped_date_end": "2026-01-01",
"ped_period_special_day_id": 1,
"ped_year": 0
},
{
"ped_id": 2060,
"ped_label": "Heilige Drei Koenige",
"ped_date_start": "2026-01-06",
"ped_date_end": "2026-01-06",
"ped_period_special_day_id": 1,
"ped_year": 0
}
],
"PeriodYear": [ "PeriodYear": [
{ {
"pye_id": 8, "pye_id": 8,