| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -33,6 +33,101 @@ QString const CalcState::SUCCESS_MAXPRICE = "SUCCESS_MAXPRICE";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				static std::map<PERMIT_TYPE, std::unique_ptr<parking_tariff_t>> tariffs;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				static QDateTime start_ = QDateTime::currentDateTime();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				static Configuration const *current_tariff{nullptr};
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				int CALCULATE_LIBRARY_API isOutOfService(QDateTime const &dt) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (!current_tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "NO CURRENT TARIFF";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return false;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // L201
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (current_tariff->tariffFileName.contains("tariff01")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "NO";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return false;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // L264
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (current_tariff->tariffFileName.contains("tariff02") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        current_tariff->tariffFileName.contains("tariff02_1700_2300") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        current_tariff->tariffFileName.contains("tariff02_1900_2300")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        // feiertage
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QDate const &d = dt.date();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (d.toString(Qt::ISODate) == "2025-06-09"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-06-19"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-08-15"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-10-03"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-11-01"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-12-25"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-12-26") {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        int const day = d.dayOfWeek();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (day == 7) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (dt.time() >= QTime::fromString("23:00:00", Qt::ISODate)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // H242
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (current_tariff->tariffFileName.contains("tariff03") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        current_tariff->tariffFileName.contains("tariff03_H242_sat")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        // feiertage
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QDate const &d = dt.date();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (d.toString(Qt::ISODate) == "2025-06-09"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-06-19"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-08-15"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-10-03"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-11-01"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-12-25"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         || d.toString(Qt::ISODate) == "2025-12-26") {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        int const day = d.dayOfWeek();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (day == 7) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QTime const &t = dt.time();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (day <= 5) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (t < QTime::fromString("18:00:00", Qt::ISODate)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (day == 6) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (t < QTime::fromString("14:00:00", Qt::ISODate)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t >= QTime::fromString("23:00:00", Qt::ISODate)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "YES";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return true;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "NO";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return false;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				int CALCULATE_LIBRARY_API isOutOfService(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                         QDateTime const &dt) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Q_UNUSED(cfg);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return isOutOfService(dt);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return Calculator::GetInstance().GetTimeSteps(cfg);
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -41,16 +136,81 @@ QList<int> CALCULATE_LIBRARY_API get_time_steps(Configuration *cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                  PERMIT_TYPE permitType,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                  int paymentOptionIndex) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    int minTime = 0;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c && c != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (cfg != c1 && cfg != c2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << start_.time() << c1->ValidFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c1->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidForWeekDay == start_.date().dayOfWeek()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c2 && c2->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c2->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    cfg = c2;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = cfg;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    int weekDay = start_.date().dayOfWeek();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << __LINE__ << cfg << "CCCCCC week" << (int)permitType << weekDay;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    for (auto[itr, rangeEnd] = cfg->WeekDays.equal_range((Qt::DayOfWeek)weekDay); itr != rangeEnd; ++itr) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        ATBWeekDay const &wd = itr->second;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        minTime = wd.getTariffSettings().m_min_time;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << __LINE__ << "CCCCCC min_time" << (int)permitType << minTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (minTime < 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return minTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    break;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    paymentOptionIndex = getPaymentOptionIndex(*cfg);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (paymentOptionIndex == -1) {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -82,7 +242,7 @@ int CALCULATE_LIBRARY_API get_minimal_parkingtime(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        minTime = qRound(cfg->getPaymentOptions(paymentOptionIndex).pop_min_time);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << "minTime" << minTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << " minTime" << minTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return minTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -90,14 +250,63 @@ int CALCULATE_LIBRARY_API get_maximal_parkingtime(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                  PERMIT_TYPE permitType,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                  int paymentOptionIndex) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c && c != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (cfg != c1 && cfg != c2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << start_.time() << c1->ValidFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c1->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidForWeekDay == start_.date().dayOfWeek()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c2 && c2->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c2->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    cfg = c2;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = cfg;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    paymentOptionIndex = getPaymentOptionIndex(*cfg);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (paymentOptionIndex == -1) {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -120,6 +329,8 @@ int CALCULATE_LIBRARY_API get_maximal_parkingtime(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        maxTime = cfg->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << " maxTime" << maxTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return maxTime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -127,6 +338,8 @@ int CALCULATE_LIBRARY_API get_minimal_parkingprice(Configuration *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                   PERMIT_TYPE permitType,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                   int paymentOptionIndex,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                   QDateTime const &start) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    int minPrice = -1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -134,9 +347,57 @@ int CALCULATE_LIBRARY_API get_minimal_parkingprice(Configuration *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c && c != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (cfg != c1 && cfg != c2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << start_.time() << c1->ValidFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c1->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidForWeekDay == start_.date().dayOfWeek()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c2 && c2->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c2->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    cfg = c2;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = cfg;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if ((paymentOptionIndex = getPaymentOptionIndex(*cfg, start)) == -1) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        paymentOptionIndex = cfg->getPaymentOptionIndex(permitType);
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -194,6 +455,7 @@ int CALCULATE_LIBRARY_API get_minimal_parkingprice(Configuration *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << " minPrice" << minPrice;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return minPrice;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -202,14 +464,22 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                QDateTime const &start,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                QDateTime *productStart,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                QDateTime *productEnd) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c && c != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (cfg != c1 && cfg != c2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = cfg;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    switch(permitType) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    case PERMIT_TYPE::SHORT_TERM_PARKING: { // e.g. szeged (customer_281)
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -372,6 +642,7 @@ int CALCULATE_LIBRARY_API compute_product_price(Configuration const *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                   PERMIT_TYPE permitType,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                   int paymentOptionIndex) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    int maxPrice = -1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -379,9 +650,57 @@ int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c && c != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Configuration *const c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (cfg != c1 && cfg != c2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << start_.time() << c1->ValidFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c1->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c1 && c1->ValidForWeekDay == start_.date().dayOfWeek()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (c1 && c1 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                cfg = c1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Configuration *c2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (c2 && c2->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= c2->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (c2 && c2 != cfg) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    cfg = c2;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = cfg;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    static const PaymentMethod paymentMethodId = Utilities::getPaymentMethodId(cfg);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -441,6 +760,7 @@ int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    default: ;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << " maxPrice" << maxPrice;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    return maxPrice;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -508,6 +828,9 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << "      ... error parsing tariff";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return calcState.set(CalcState::State::ERROR_PARSING_TARIFF);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QFileInfo fi(confFile);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        (*tariff)->tariffFileName << fi.baseName();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        current_tariff = *tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        delete *tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        *tariff = nullptr;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -520,17 +843,33 @@ CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char cons
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if ((*tariff)->TariffIncludes.size() > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << "init_tariff: TariffIncludes" << (*tariff)->TariffIncludes;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        for (int i = 0 ; i < (*tariff)->TariffIncludes.size(); ++i) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            QFile f(QString("/etc/psa_tariff/%1").arg((*tariff)->TariffIncludes.at(i)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            QPair<QString, QString> const &p = (*tariff)->TariffIncludes.at(i);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            QFile f(QString("/etc/psa_tariff/%1").arg((*tariff)->TariffIncludes.at(i).second));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (f.exists() &&
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                f.open(QIODevice::ReadOnly | QIODevice::Text)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                QString json = f.readAll();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                std::unique_ptr<parking_tariff_t> t = std::make_unique<parking_tariff_t>();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (! t->ParseJson(t.get(), json.toStdString().c_str())) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << "      ... error parsing tariff in" << f.fileName();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << "      ... json" << json;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    QFileInfo fi(p.second.trimmed());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    t->tariffFileName << fi.baseName();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    QTime validFrom(QTime::fromString(p.first, Qt::ISODate));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (validFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        t->ValidFrom = validFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    QString validForWeekDay(p.first);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << "      ... valid for weekday" << validForWeekDay;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (validForWeekDay.contains("Sat")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        t->ValidForWeekDay = (int)Qt::Saturday;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << "      ... valid for weekday" << validForWeekDay;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    PERMIT_TYPE pt = static_cast<PERMIT_TYPE>(t->getPaymentOptions().pop_product_id);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (tariffs.count(pt) == 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        const auto [it, success] = tariffs.insert(std::make_pair(pt, std::move(t)));
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -556,7 +895,64 @@ void CALCULATE_LIBRARY_API free_tariff(parking_tariff_t *tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int currentTimeMinutes,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                int UpDown, PermitType const &permitType)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t1 && t1->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << start_.time() << t1->ValidFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= t1->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                parking_tariff_t *t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (t2 && t2 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (t1 && t1 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        tariff = t1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t1 && t1->ValidForWeekDay == start_.date().dayOfWeek()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (t1 && t1 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t2 && t2->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_.time() >= t2->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (t2 && t2 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    tariff = t2;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()                  start: " << start_.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()             valid from: " << tariff->ValidFrom.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()     currentTimeMinutes: " << currentTimeMinutes;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep() up/down (1=up, 0=down): " << UpDown;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -587,6 +983,7 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()   payment option index: " << paymentOptionIndex;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()             plus steps: " << pop_plus_steps;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()            minus steps: " << pop_minus_steps;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __LINE__ << "compute_next_timestep()             valid from: " << tariff->ValidFrom;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    Configuration const *cfg = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -703,6 +1100,23 @@ int CALCULATE_LIBRARY_API compute_next_timestep(parking_tariff_t *tariff, int cu
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __LINE__ << "compute_next_timestep()       next step index:" << nextStepIndex;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (nextStepIndex >= 0 && nextStepIndex < stepList.size()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << __LINE__ << "compute_next_timestep() return next time step:" << stepList[nextStepIndex];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    // L264
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __LINE__ << "compute_next_timestep()  TTTTTT tariff-files:" << tariff->tariffFileName;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (tariff->tariffFileName.contains("tariff02") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        tariff->tariffFileName.contains("tariff02_1700_2300") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        tariff->tariffFileName.contains("tariff02_1900_2300") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        tariff->tariffFileName.contains("tariff03") ||
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        tariff->tariffFileName.contains("tariff03_H242_sat")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        QDateTime dt = start_.addSecs( stepList[nextStepIndex] * 60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        qCritical() << __LINE__ << "compute_next_timestep() dt:" << dt.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        if (dt.time() > QTime::fromString("23:11:59", Qt::ISODate)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        qCritical() << __LINE__ << "compute_next_timestep() dt:" << currentTimeMinutes;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            return currentTimeMinutes;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    return stepList[nextStepIndex];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -771,14 +1185,31 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start = start.toLocalTime().addSecs(start_parking_time * 60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QDateTime end(start);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    int paymentOptionIndex = getPaymentOptionIndex(*tariff, start);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (paymentOptionIndex == -1) {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -851,6 +1282,8 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        PermitType permitType,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        bool prepaid)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start_parking_time_;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    CalcState calcState;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QDateTime start_parking_time(start_parking_time_);
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -860,9 +1293,49 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_1)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_1";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t1 && t1->ValidFrom.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (start_parking_time_.time() >= t1->ValidFrom) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                parking_tariff_t *t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (t2 && t2 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (t1 && t1 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        tariff = t1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t1 && t1->ValidForWeekDay == start_.date().dayOfWeek()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (t1 && t1 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(PermitType(PERMIT_TYPE::TEST_PRODUCT_2)) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "TEST_PRODUCT_2";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t2 && t2 != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            tariff = t2;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "OUT_OF_SERVICE: "
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << isOutOfService(start_);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    int paymentOptionIndex = getPaymentOptionIndex(*tariff, start_parking_time);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (paymentOptionIndex == -1) {
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -886,24 +1359,32 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << "                     prepaid: " << prepaid
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << "                  permitType: " << permitType.toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (netto_parking_time < 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        calcState.setDesc(QString("end=%1, start=%2")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                          .arg(end_parking_time.toString(Qt::ISODate),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                               start_parking_time.toString(Qt::ISODate)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return calcState.set(CalcState::State::NEGATIVE_PARKING_TIME);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (netto_parking_time > maxMin) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        calcState.setDesc(QString("duration=%1, maxMin=%2").arg(netto_parking_time).arg(maxMin));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return calcState.set(CalcState::State::ABOVE_MAX_PARKING_TIME);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (netto_parking_time < minMin) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        calcState.setDesc(QString("duration=%1, minMin=%2").arg(netto_parking_time).arg(minMin));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return calcState.set(CalcState::State::BELOW_MIN_PARKING_TIME);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (netto_parking_time == 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return calcState.set(CalcState::State::SUCCESS);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        qCritical() << __func__ << ":" << __LINE__ << "CCCCCC" << netto_parking_time;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				   //     return calcState.set(CalcState::State::SUCCESS);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    double cost = -1;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (start_parking_time.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (tariff->getPaymentOptions(paymentOptionIndex).pop_payment_method_id == PaymentMethod::Steps ||
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -946,6 +1427,8 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            QDateTime effectiveStartTime(start_parking_time);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        << effectiveStartTime.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            // handle special days
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            int const specialDayId = tariff->specialDayId(start_parking_time);
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -976,6 +1459,9 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        << effectiveStartTime.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            // handle prepaid option
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -990,17 +1476,36 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (start_parking_time.time() < p.prepaid[weekDay].static_end) {     // static_end: e.g. 08:00:00
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        effectiveStartTime.setTime(p.prepaid[weekDay].static_end);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                    << effectiveStartTime.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    if (start_parking_time.time() > p.prepaid[weekDay].static_start) {   // static_start: e.g. 22:00:00
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        effectiveStartTime.setTime(p.prepaid[weekDay].static_start);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        QTime const midnight(23, 59, 59);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        QTime const midnight24(0, 0, 0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        if ((p.prepaid[weekDay].static_start <= midnight && midnight24 <= p.prepaid[weekDay].static_end)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                         || (p.prepaid[weekDay].static_start == midnight && midnight == p.prepaid[weekDay].static_end)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                         || (p.prepaid[weekDay].static_start == midnight24 && midnight24 == p.prepaid[weekDay].static_end)) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            effectiveStartTime = effectiveStartTime.addDays(1);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            weekDay = effectiveStartTime.date().dayOfWeek();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            qCritical() << __func__ << ":" << __LINE__
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                        << "effectiveStartTime: new week day [" << weekDay << "] (Mon=1, Tue=2, ..., Sun=7)";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        effectiveStartTime.setTime(p.prepaid[weekDay].static_end);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                    << effectiveStartTime.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                qCritical() << __func__ << ":" << __LINE__ << "no prepaid option set";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            // set seconds to 0
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            effectiveStartTime.setTime(QTime(effectiveStartTime.time().hour(),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                             effectiveStartTime.time().minute(), 0));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:" << effectiveStartTime.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        << effectiveStartTime.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            int const carryOver = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1023,11 +1528,11 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    s = s.addSecs(minutesUntilCarryOver * 60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    s = s.addSecs(carryOverDuration * 60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    end_parking_time = s.addSecs(rest * 60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    end_parking_time = effectiveStartTime.addSecs(netto_parking_time*60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                weekDay = end_parking_time.date().dayOfWeek();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1085,6 +1590,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (tariff->getPaymentOptions(0).pop_payment_method_id == PaymentMethod::Unified) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "CCCCCC";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            std::pair<CalcState, std::optional<int>> p =
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Calculator::GetInstance().ComputeCostFromDuration(tariff, start_parking_time, end_parking_time, netto_parking_time);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            CalcState const cs = p.first;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1147,9 +1653,17 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "OUT_OF_SERVICE: "
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << isOutOfService(start_);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    tariff->getPaymentOptions(0).pop_max_price
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        = tariff->getPaymentOptions(0).pop_max_price_save;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1159,6 +1673,9 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QTime const t(0, 0, 0);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    QDateTime start(d, t, Qt::UTC);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start = start.toLocalTime().addSecs(start_parking_time * 60);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (start.isValid()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QString cs = start.toString(Qt::ISODate);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1209,14 +1726,24 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        QDateTime &ticketEndTime,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        PermitType permitType)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start_parking_time;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "OUT_OF_SERVICE: "
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << isOutOfService(start_);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    tariff->getPaymentOptions(0).pop_max_price
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        = tariff->getPaymentOptions(0).pop_max_price_save;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1555,14 +2082,24 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_daily_ticket(parking_tariff
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                                  QDateTime &ticketEndTime,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                                                  PermitType permitType)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = start_parking_time;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "OUT_OF_SERVICE: "
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << isOutOfService(start_);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    tariff->getPaymentOptions(0).pop_max_price
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        = tariff->getPaymentOptions(0).pop_max_price_save;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -1599,14 +2136,24 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_daily_ticket(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                    PERMIT_TYPE permitType,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                    struct price_t *price) {// return value
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    start_ = startDatetime;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // tariffs are only set if there is a Includes-section in the tariff-file,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    // which means the code below will be executed only in such a case.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    if (tariffs.count(permitType) > 0) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        parking_tariff_t *t = tariffs[permitType].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if (t && t != tariff) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t1 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_1)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            parking_tariff_t *const t2 = tariffs[PermitType(PERMIT_TYPE::TEST_PRODUCT_2)].get();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            if (tariff != t1 && tariff != t2) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                tariff = t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    current_tariff = tariff;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    qCritical() << __func__ << ":" << __LINE__ << "OUT_OF_SERVICE: "
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                << isOutOfService(start_);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    tariff->getPaymentOptions(0).pop_max_price
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        = tariff->getPaymentOptions(0).pop_max_price_save;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |