#pragma once #include #include #include #include #include "day_of_week.h" #include "configuration.h" #include "time_range.h" #include "payment_method.h" #include "tariff_business_hours.h" #include using namespace std; namespace Utilities { /// /// Get day of week from current date (Zeller's Algorithm), starting day is Sunday /// /// /// DayOfWeek GetDayOfWeek(struct tm* tm); /// /// Date and time parse helper function /// /// Returns time (tm) structure struct tm DateTimeToStructTm(const char* dateTimeStr); /// /// Date parse helper function /// /// Returns time (tm) structure struct tm DateToStructTm(const char* dateStr); /// /// Time parse helper function /// /// Returns time (tm) structure struct tm TimeToStructTm(const char* timeStr, int year, int mon, int mday, int wday); /// /// Get current local time /// /// Returns time_t structure time_t GetCurrentLocalTime(); /// /// Zeller's algorithm for determining day of week /// int ZellersAlgorithm(int day, int month, int year); /// /// Checks if current datetime is in range between start and end month of parking worktime /// /// /// /// bool IsYearPeriodActive(Configuration* cfg, struct tm* currentDateTime); bool IsYearPeriodActive(Configuration const *cfg, QDateTime const ¤tDateTime); /// /// Check permissions /// bool CheckSpecialDay(Configuration* cfg, const char* currentDateTimeStr, int* specialDayId, double* specialDayPrice); bool CheckSpecialDay(Configuration const *cfg, QDateTime const ¤tDateTimeS, int* specialDayId, uint32_t *specialDayPrice); /// /// Calculates price per unit /// /// /// double CalculatePricePerUnit(double pra_price, double durationUnit = -1); QTime SpecialDaysWorkTimeFrom(Configuration const *cfg, int specialDayId); QTime SpecialDaysWorkTimeUntil(Configuration const *cfg, int specialDayId); QTime WeekDaysWorkTimeFrom(std::multimap::const_iterator itr); QTime WeekDaysWorkTimeUntil(std::multimap::const_iterator itr); bool isCarryOverSet(Configuration const *cfg, PaymentMethod paymentMethodId); bool isCarryOverNotSet(Configuration const *cfg, PaymentMethod paymentMethodId); PaymentMethod getPaymentMethodId(Configuration const *cfg); int getMinimalParkingTime(Configuration const *cfg, PaymentMethod methodId); int getMaximalParkingTime(Configuration const *cfg, PaymentMethod methodId); uint32_t getMinimalParkingPrice(Configuration const *cfg, PaymentMethod methodId); uint32_t getFirstDurationStep(Configuration const *cfg, PaymentMethod methodId); BusinessHours getBusinessHours(Configuration const *cfg, PaymentMethod methodId); uint32_t computeWeekDaysPrice(Configuration const *cfg, PaymentMethod id); double computeWeekDaysDurationUnit(Configuration const *cfg, PaymentMethod id); }