diff --git a/library/src/calculator_functions.cpp b/library/src/calculator_functions.cpp
index d9cd1e9..3616b9d 100644
--- a/library/src/calculator_functions.cpp
+++ b/library/src/calculator_functions.cpp
@@ -350,30 +350,28 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg,
///
///
-uint32_t Calculator::GetCostFromDuration(Configuration const* cfg,
+uint32_t Calculator::GetCostFromDuration(Configuration *cfg,
QDateTime const &start,
- quint64 timeStepInMinutes,
- uint8_t paymentMethod) {
+ quint64 timeStepInMinutes) const {
// for instance, a tariff as used in Schoenau, Koenigssee: only steps, no
// special days, nonstop.
- if (paymentMethod == PaymentMethod::Steps
+ if (cfg->YearPeriod.size() == 0
&& cfg->SpecialDays.size() == 0
&& cfg->SpecialDaysWorktime.size() == 0) {
QDateTime const end = start.addSecs(timeStepInMinutes*60);
- return GetCostFromDuration(cfg, start, end, paymentMethod);
+ return GetCostFromDuration(cfg, start, end);
}
return 0;
}
-uint32_t Calculator::GetCostFromDuration(Configuration const* cfg,
+uint32_t Calculator::GetCostFromDuration(Configuration * cfg,
QDateTime const &start,
- QDateTime const &end,
- uint8_t paymentMethod) {
- if (paymentMethod == PaymentMethod::Steps
+ QDateTime const &end) const {
+ if (cfg->YearPeriod.size() == 0
&& cfg->SpecialDays.size() == 0
&& cfg->SpecialDaysWorktime.size() == 0) {
int const timeStepInMinutes = start.secsTo(end) / 60;
- return GetPriceForTimeStep(cfg, paymentMethod, timeStepInMinutes);
+ return GetPriceForTimeStep(cfg, timeStepInMinutes);
}
return 0;
}
@@ -386,12 +384,12 @@ uint32_t Calculator::GetCostFromDuration(Configuration const* cfg,
///
double Calculator::GetCostFromDuration(Configuration* cfg, uint8_t payment_option, const QDateTime start_datetime, QDateTime & end_datetime, double durationMin, bool nextDay, bool prepaid)
{
- // condition for 'PaymentMethod::Steps' (e.g. 332/Schoenau):
- if (cfg->SpecialDays.size() == 0
+ if (cfg->YearPeriod.size() == 0
+ && cfg->SpecialDays.size() == 0
&& cfg->SpecialDaysWorktime.size() == 0)
{
end_datetime = start_datetime.addSecs(durationMin*60);
- return GetCostFromDuration(cfg, start_datetime, end_datetime, PaymentMethod::Steps);
+ return GetCostFromDuration(cfg, start_datetime, end_datetime);
}
// Get input date