Compare commits
	
		
			3 Commits
		
	
	
		
			vorkauf-fi
			...
			remotes/or
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 49f016cc98 | |||
| 41a09d882d | |||
| 5cfca87f3e | 
@@ -37,7 +37,7 @@ struct ATBTariffCarryOver {
 | 
				
			|||||||
        if (coif == "always") {
 | 
					        if (coif == "always") {
 | 
				
			||||||
            m_carryOverIf = ApplyCarryOver::ALWAYS;
 | 
					            m_carryOverIf = ApplyCarryOver::ALWAYS;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
           qCritical() << __func__ << ":" << __LINE__ << "ERROR unknown carry over application" << coif;
 | 
					           qCritical() << "ERROR unknown carry over application" << coif;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -65,22 +65,13 @@ struct ATBTariffCarryOver {
 | 
				
			|||||||
        int minutes = 0;
 | 
					        int minutes = 0;
 | 
				
			||||||
        QString end = m_range.m_end.toString(Qt::ISODate);
 | 
					        QString end = m_range.m_end.toString(Qt::ISODate);
 | 
				
			||||||
        if (end == "24:00:00") {
 | 
					        if (end == "24:00:00") {
 | 
				
			||||||
            // note: this did not work
 | 
					            QDateTime t = dt.addDays(1);
 | 
				
			||||||
            // QDateTime t(dt.addDays(1));
 | 
					            t.setTime(QTime(0,0,0));
 | 
				
			||||||
            // t.setTime(QTime(0,0,0));
 | 
					            minutes = dt.secsTo(t) / 60;
 | 
				
			||||||
            // dt: 2024-10-27T00:00:00 EEST, but t: 2024-10-28T00:00:00 EET (!)
 | 
					 | 
				
			||||||
            // so the difference is 1500 instead of 1440
 | 
					 | 
				
			||||||
            // reason: change from summer to winter time
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // compute minutes directly
 | 
					 | 
				
			||||||
            if (dt.time().isValid()) {
 | 
					 | 
				
			||||||
                minutes = 1440 - (dt.time().hour() * 60 + dt.time().minute());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            QTime t(QTime::fromString(end, Qt::ISODate));
 | 
					            QDateTime t(dt);
 | 
				
			||||||
            if (t.isValid() && dt.time().isValid()) {
 | 
					            t.setTime(QTime::fromString(end, Qt::ISODate));
 | 
				
			||||||
                minutes = (t.hour() * 60 + t.minute()) - (dt.time().hour() * 60 + dt.time().minute());
 | 
					            minutes = dt.secsTo(t) / 60;
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (minutes < 0 || minutes > m_range.m_duration) {
 | 
					        if (minutes < 0 || minutes > m_range.m_duration) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								library/include/mobilisis/tariff_comp_state.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								library/include/mobilisis/tariff_comp_state.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					#ifndef TARIFF_COMP_STATE_H_INCLUDED
 | 
				
			||||||
 | 
					#define TARIFF_COMP_STATE_H_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QDateTime>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct TariffCompState {
 | 
				
			||||||
 | 
					    QDateTime const m_start;
 | 
				
			||||||
 | 
					    int m_nettoParkingTimeTotal = 0;
 | 
				
			||||||
 | 
					    int m_bruttoParkingTimeTotal = 0;
 | 
				
			||||||
 | 
					    int m_priceTotal = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    explicit TariffCompState(QDateTime start)
 | 
				
			||||||
 | 
					        : m_start(std::move(start))
 | 
				
			||||||
 | 
					        , m_nettoParkingTimeTotal(0)
 | 
				
			||||||
 | 
					        , m_bruttoParkingTimeTotal(0)
 | 
				
			||||||
 | 
					        , m_priceTotal(0) {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // TARIFF_COMP_STATE_H_INCLUDED
 | 
				
			||||||
							
								
								
									
										29
									
								
								library/include/mobilisis/tariff_comp_step.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								library/include/mobilisis/tariff_comp_step.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					#ifndef TARIFF_COMP_STEP_H_INCLUDED
 | 
				
			||||||
 | 
					#define TARIFF_COMP_STEP_H_INCLUDED
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QDateTime>
 | 
				
			||||||
 | 
					#include "tariff_comp_state.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TariffCompStep {
 | 
				
			||||||
 | 
					    int m_duration;
 | 
				
			||||||
 | 
					    QDateTime const m_start;
 | 
				
			||||||
 | 
					    QDateTime const m_end;
 | 
				
			||||||
 | 
					    uint64_t const m_handle;
 | 
				
			||||||
 | 
					    TariffCompState m_compState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint64_t hash();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    explicit TariffCompStep(int duration, QDateTime start, QDateTime end, TariffCompState &compState)
 | 
				
			||||||
 | 
					        : m_duration(duration)
 | 
				
			||||||
 | 
					        , m_start(std::move(start))
 | 
				
			||||||
 | 
					        , m_end(std::move(end))
 | 
				
			||||||
 | 
					        , m_handle(hash())
 | 
				
			||||||
 | 
					        , m_compState(compState) {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint64_t handle() { return m_handle; }
 | 
				
			||||||
 | 
					    uint64_t handle() const { return m_handle; }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // TARIFF_COMP_STEP_H_INCLUDED
 | 
				
			||||||
@@ -38,7 +38,7 @@ struct ATBTariffPrepaid {
 | 
				
			|||||||
        if (ppif == "always") {
 | 
					        if (ppif == "always") {
 | 
				
			||||||
            m_prepaidIf = ApplyPrepaid::ALWAYS;
 | 
					            m_prepaidIf = ApplyPrepaid::ALWAYS;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
           qCritical() << __func__ << ":" << __LINE__ << "ERROR unknown carry over application" << ppif;
 | 
					           qCritical() << "ERROR unknown carry over application" << ppif;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,8 @@ SOURCES += \
 | 
				
			|||||||
    src/calculate_price.cpp \
 | 
					    src/calculate_price.cpp \
 | 
				
			||||||
    src/ticket.cpp \
 | 
					    src/ticket.cpp \
 | 
				
			||||||
    src/tariff_global_defines.cpp \
 | 
					    src/tariff_global_defines.cpp \
 | 
				
			||||||
    src/atb_time.cpp
 | 
					    src/atb_time.cpp \
 | 
				
			||||||
 | 
					    src/tariff_comp_step.cpp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HEADERS += \
 | 
					HEADERS += \
 | 
				
			||||||
	include/mobilisis/calculator_functions.h \
 | 
						include/mobilisis/calculator_functions.h \
 | 
				
			||||||
@@ -93,7 +94,9 @@ HEADERS += \
 | 
				
			|||||||
    include/mobilisis/tariff_global_defines.h \
 | 
					    include/mobilisis/tariff_global_defines.h \
 | 
				
			||||||
    include/mobilisis/atb_time.h \
 | 
					    include/mobilisis/atb_time.h \
 | 
				
			||||||
    include/mobilisis/tariff_service.h \
 | 
					    include/mobilisis/tariff_service.h \
 | 
				
			||||||
    include/mobilisis/tariff_out_of_service.h
 | 
					    include/mobilisis/tariff_out_of_service.h \
 | 
				
			||||||
 | 
					    include/mobilisis/tariff_comp_state.h \
 | 
				
			||||||
 | 
					    include/mobilisis/tariff_comp_step.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OTHER_FILES += src/main.cpp \
 | 
					OTHER_FILES += src/main.cpp \
 | 
				
			||||||
    ../tariffs/tariff_korneuburg.json \
 | 
					    ../tariffs/tariff_korneuburg.json \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -396,14 +396,16 @@ int CALCULATE_LIBRARY_API get_zone_nr(int zone)
 | 
				
			|||||||
    if(zone > -1) return zone;
 | 
					    if(zone > -1) return zone;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        QFile zone("/mnt/system_data/zone_nr");
 | 
					        QFile zone("/etc/zone_nr");
 | 
				
			||||||
        if (zone.exists()) {
 | 
					        if (zone.exists()) {
 | 
				
			||||||
            QFileInfo finfo(zone);
 | 
					            QFileInfo finfo(zone);
 | 
				
			||||||
 | 
					            if (finfo.size() <= 4) { // decimal 000\n
 | 
				
			||||||
                if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
 | 
					                if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
 | 
				
			||||||
                    QTextStream in(&zone);
 | 
					                    QTextStream in(&zone);
 | 
				
			||||||
                    return in.readLine(100).toInt();
 | 
					                    return in.readLine(100).toInt();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -780,7 +782,7 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
				
			|||||||
    double maxMin = tariff->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
					    double maxMin = tariff->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // DEBUG
 | 
					    // DEBUG
 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << endl
 | 
					    qCritical() << "compute_price_for_parking_ticket() " << endl
 | 
				
			||||||
                << "          paymentOptionIndex: " << paymentOptionIndex << endl
 | 
					                << "          paymentOptionIndex: " << paymentOptionIndex << endl
 | 
				
			||||||
                << "          start_parking_time: " << start_parking_time << endl
 | 
					                << "          start_parking_time: " << start_parking_time << endl
 | 
				
			||||||
                << "          netto_parking_time: " << netto_parking_time << endl
 | 
					                << "          netto_parking_time: " << netto_parking_time << endl
 | 
				
			||||||
@@ -850,8 +852,6 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            QDateTime effectiveStartTime(start_parking_time);
 | 
					            QDateTime effectiveStartTime(start_parking_time);
 | 
				
			||||||
            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
					 | 
				
			||||||
                        << effectiveStartTime.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // handle special days
 | 
					            // handle special days
 | 
				
			||||||
            int const specialDayId = tariff->specialDayId(start_parking_time);
 | 
					            int const specialDayId = tariff->specialDayId(start_parking_time);
 | 
				
			||||||
@@ -882,9 +882,6 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
					 | 
				
			||||||
                        << effectiveStartTime.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // handle prepaid option
 | 
					            // handle prepaid option
 | 
				
			||||||
            int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
 | 
					            int const prepaid_option_id = tariff->getPaymentOptions(paymentOptionIndex).pop_prepaid_option_id;
 | 
				
			||||||
            std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
 | 
					            std::optional<ATBPrepaid> prepaidOption = tariff->getPrepaidType(prepaid_option_id);
 | 
				
			||||||
@@ -899,36 +896,17 @@ 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
 | 
					                    if (start_parking_time.time() < p.prepaid[weekDay].static_end) {     // static_end: e.g. 08:00:00
 | 
				
			||||||
                        effectiveStartTime.setTime(p.prepaid[weekDay].static_end);
 | 
					                        effectiveStartTime.setTime(p.prepaid[weekDay].static_end);
 | 
				
			||||||
                        qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
					 | 
				
			||||||
                                    << effectiveStartTime.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
                    } else
 | 
					                    } else
 | 
				
			||||||
                    if (start_parking_time.time() > p.prepaid[weekDay].static_start) {   // static_start: e.g. 22:00:00
 | 
					                    if (start_parking_time.time() > p.prepaid[weekDay].static_start) {   // static_start: e.g. 22:00:00
 | 
				
			||||||
                        QTime const midnight(23, 59, 59);
 | 
					                        effectiveStartTime.setTime(p.prepaid[weekDay].static_start);
 | 
				
			||||||
                        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.setTime(QTime(effectiveStartTime.time().hour(),
 | 
				
			||||||
                                             effectiveStartTime.time().minute(), 0));
 | 
					                                             effectiveStartTime.time().minute(), 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:"
 | 
					            qCritical() << __func__ << ":" << __LINE__ << "effectiveStartTime:" << effectiveStartTime.toString(Qt::ISODate);
 | 
				
			||||||
                        << effectiveStartTime.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            int const carryOver = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over;
 | 
					            int const carryOver = tariff->getPaymentOptions(paymentOptionIndex).pop_carry_over;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -936,12 +914,10 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if (carryOver == 1) {
 | 
					            if (carryOver == 1) {
 | 
				
			||||||
                QTime carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
 | 
					                QTime carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start;
 | 
				
			||||||
                QTime carryOverEnd = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_end;
 | 
					 | 
				
			||||||
                int carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
 | 
					                int carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                qCritical() << __func__ << ":" << __LINE__ << "   carryOverStart:" << carryOverStart.toString(Qt::ISODate);
 | 
					                qCritical() << __func__ << ":" << __LINE__ << "   carryOverStart" << carryOverStart.toString(Qt::ISODate);
 | 
				
			||||||
                qCritical() << __func__ << ":" << __LINE__ << "     carryOverEnd:" << carryOverEnd.toString(Qt::ISODate);
 | 
					                qCritical() << __func__ << ":" << __LINE__ << "carryOverDuration" << carryOverDuration;
 | 
				
			||||||
                qCritical() << __func__ << ":" << __LINE__ << "carryOverDuration:" << carryOverDuration;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // handle carry over
 | 
					                // handle carry over
 | 
				
			||||||
                int minutesUntilCarryOver = effectiveStartTime.time().secsTo(carryOverStart) / 60;
 | 
					                int minutesUntilCarryOver = effectiveStartTime.time().secsTo(carryOverStart) / 60;
 | 
				
			||||||
@@ -951,12 +927,12 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
				
			|||||||
                    s = s.addSecs(minutesUntilCarryOver * 60);
 | 
					                    s = s.addSecs(minutesUntilCarryOver * 60);
 | 
				
			||||||
                    s = s.addSecs(carryOverDuration * 60);
 | 
					                    s = s.addSecs(carryOverDuration * 60);
 | 
				
			||||||
                    end_parking_time = s.addSecs(rest * 60);
 | 
					                    end_parking_time = s.addSecs(rest * 60);
 | 
				
			||||||
                    qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    end_parking_time = effectiveStartTime.addSecs(netto_parking_time*60);
 | 
					                    end_parking_time = effectiveStartTime.addSecs(netto_parking_time*60);
 | 
				
			||||||
                    qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                weekDay = end_parking_time.date().dayOfWeek();
 | 
					                weekDay = end_parking_time.date().dayOfWeek();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // musste man in einer schleife machen
 | 
					                // musste man in einer schleife machen
 | 
				
			||||||
@@ -967,21 +943,12 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
 | 
				
			|||||||
                    end_parking_time = end_parking_time.addSecs(carryOverDuration * 60);
 | 
					                    end_parking_time = end_parking_time.addSecs(carryOverDuration * 60);
 | 
				
			||||||
                } else
 | 
					                } else
 | 
				
			||||||
                if (end_parking_time.time() == carryOverStart) {
 | 
					                if (end_parking_time.time() == carryOverStart) {
 | 
				
			||||||
                    qCritical() << __func__ << ":" << __LINE__ << "        end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
					                    qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
				
			||||||
                    qCritical() << __func__ << ":" << __LINE__ << "          carryOverStart:" << carryOverStart.toString(Qt::ISODate);
 | 
					                    qCritical() << __func__ << ":" << __LINE__ << "   carryOverStart" << carryOverStart.toString(Qt::ISODate);
 | 
				
			||||||
                    ATBPaymentOption const &po = tariff->getPaymentOptions(paymentOptionIndex);
 | 
					                    ATBPaymentOption const &po = tariff->getPaymentOptions(paymentOptionIndex);
 | 
				
			||||||
                    if (po.pop_apply_carry_over_to_ticket_endtime) {
 | 
					                    if (po.pop_apply_carry_over_to_ticket_endtime) {
 | 
				
			||||||
                        end_parking_time = end_parking_time.addSecs(carryOverDuration * 60);
 | 
					                        end_parking_time = end_parking_time.addSecs(carryOverDuration * 60);
 | 
				
			||||||
                        qCritical() << __func__ << ":" << __LINE__ << "adapted end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
					                        qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                } else
 | 
					 | 
				
			||||||
                if (end_parking_time.time() == carryOverEnd) {
 | 
					 | 
				
			||||||
                    qCritical() << __func__ << ":" << __LINE__ << "        end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
                    qCritical() << __func__ << ":" << __LINE__ << "            carryOverEnd:" << carryOverEnd.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
                    ATBPaymentOption const &po = tariff->getPaymentOptions(paymentOptionIndex);
 | 
					 | 
				
			||||||
                    if (po.pop_apply_carry_over_to_ticket_endtime == false) {
 | 
					 | 
				
			||||||
                        end_parking_time = end_parking_time.addSecs(-carryOverDuration * 60);
 | 
					 | 
				
			||||||
                        qCritical() << __func__ << ":" << __LINE__ << "adapted end-parking-time:" << end_parking_time.toString(Qt::ISODate);
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -379,8 +379,7 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
 | 
					    int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
 | 
				
			||||||
    int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
 | 
					    int const pop_accumulate_prices = cfg->getPaymentOptions(paymentOptionIndex).pop_accumulate_prices;
 | 
				
			||||||
    int const pop_max_price = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price =
 | 
					    int const pop_max_price = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price;
 | 
				
			||||||
                                cfg->getPaymentOptions(paymentOptionIndex).pop_max_price_save;
 | 
					 | 
				
			||||||
    int const pop_max_time = cfg->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
					    int const pop_max_time = cfg->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
				
			||||||
    int const pop_min_price = cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
 | 
					    int const pop_min_price = cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
 | 
				
			||||||
    int const pop_allow_overpay = cfg->getPaymentOptions(paymentOptionIndex).pop_allow_overpay;
 | 
					    int const pop_allow_overpay = cfg->getPaymentOptions(paymentOptionIndex).pop_allow_overpay;
 | 
				
			||||||
@@ -453,50 +452,13 @@ Calculator::ComputeDurationFromCost(Configuration *cfg,
 | 
				
			|||||||
    netto_parking_time_in_minutes = 0;
 | 
					    netto_parking_time_in_minutes = 0;
 | 
				
			||||||
    brutto_parking_time_in_minutes = 0;
 | 
					    brutto_parking_time_in_minutes = 0;
 | 
				
			||||||
    free_parking_time_in_minutes = 0;
 | 
					    free_parking_time_in_minutes = 0;
 | 
				
			||||||
    int nettoParktimeForCost = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (priceNettoParktime.contains(int(cost))) {
 | 
					    int const nettoParktimeForCost = priceNettoParktime[int(cost)];
 | 
				
			||||||
        nettoParktimeForCost = priceNettoParktime[int(cost)];
 | 
					 | 
				
			||||||
    qCritical() << __func__ << ":" << __LINE__ << QString("cost=%1 nettoParkTimeForCost=%2").
 | 
					    qCritical() << __func__ << ":" << __LINE__ << QString("cost=%1 nettoParkTimeForCost=%2").
 | 
				
			||||||
                                                        arg(cost).arg(nettoParktimeForCost);
 | 
					                                                        arg(cost).arg(nettoParktimeForCost);
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // cannot find netto-parking time for cost (=price)
 | 
					 | 
				
			||||||
        // this happens for direct coin input and should not happen otherwise
 | 
					 | 
				
			||||||
        // take the value for the nearest value of cost and mark result as overpaid
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        QList <int> keys = priceNettoParktime.keys();   // keys (=prices) are sorted in ascending order
 | 
					 | 
				
			||||||
        QSet<int> s; // make keys unique
 | 
					 | 
				
			||||||
        for (int k = 0; k < keys.size(); ++k) {
 | 
					 | 
				
			||||||
            if (keys[k] < cost) {
 | 
					 | 
				
			||||||
                s << keys[k];
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        keys = s.values();
 | 
					 | 
				
			||||||
        // sort in descending order
 | 
					 | 
				
			||||||
        std::sort(std::begin(keys), std::end(keys), std::greater<>());
 | 
					 | 
				
			||||||
        // qCritical() << __func__ << ":" << __LINE__ << "keys=" << keys;
 | 
					 | 
				
			||||||
        if (!keys.isEmpty()) {
 | 
					 | 
				
			||||||
            int const maxCost = keys[0];
 | 
					 | 
				
			||||||
            auto const p = priceNettoParktime.equal_range(maxCost);
 | 
					 | 
				
			||||||
            for (auto it = p.first; it != p.second; ++it) {
 | 
					 | 
				
			||||||
                nettoParktimeForCost = std::max(nettoParktimeForCost, it.value());
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            ATBPaymentOption &po = cfg->getPaymentOptions(paymentOptionIndex);
 | 
					 | 
				
			||||||
            po.pop_max_price = maxCost;
 | 
					 | 
				
			||||||
            cfg->getPaymentOptions(paymentOptionIndex).pop_max_price = maxCost;
 | 
					 | 
				
			||||||
            if (pop_allow_overpay) {
 | 
					 | 
				
			||||||
                overPaid = true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            qCritical() << __func__ << ":" << __LINE__ << QString("cost=%1 -> maxCost=%2 nettoParkTimeForCost=%3").
 | 
					 | 
				
			||||||
                                                            arg(cost).arg(maxCost).arg(nettoParktimeForCost);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            qCritical() << __func__ << ":" << __LINE__ << "ERROR empty keys -> check tariff file";
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int cnt = 0;
 | 
					    int cnt = 0;
 | 
				
			||||||
    while (++cnt < 20 && netto_parking_time_in_minutes < nettoParktimeForCost) {
 | 
					    while (++cnt < 10 && netto_parking_time_in_minutes < nettoParktimeForCost) {
 | 
				
			||||||
        // qCritical() << __func__ << ":" << __LINE__ << "cnt [" << cnt;
 | 
					        // qCritical() << __func__ << ":" << __LINE__ << "cnt [" << cnt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
 | 
					        brutto_parking_time_in_minutes = free_parking_time_in_minutes + netto_parking_time_in_minutes;
 | 
				
			||||||
@@ -950,8 +912,7 @@ Calculator::GetDurationFromCost(Configuration* cfg,
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
 | 
					                int const pop_id = cfg->getPaymentOptions(paymentOptionIndex).pop_id;
 | 
				
			||||||
                int const pop_max_price = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price
 | 
					                int const pop_max_price = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price;
 | 
				
			||||||
                                            = cfg->getPaymentOptions(paymentOptionIndex).pop_max_price_save;
 | 
					 | 
				
			||||||
                //int const pop_max_time = cfg->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
					                //int const pop_max_time = cfg->getPaymentOptions(paymentOptionIndex).pop_max_time;
 | 
				
			||||||
                int const pop_min_price = cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
 | 
					                int const pop_min_price = cfg->getPaymentOptions(paymentOptionIndex).pop_min_price;
 | 
				
			||||||
                int const pop_allow_overpay = cfg->getPaymentOptions(paymentOptionIndex).pop_allow_overpay;
 | 
					                int const pop_allow_overpay = cfg->getPaymentOptions(paymentOptionIndex).pop_allow_overpay;
 | 
				
			||||||
@@ -3623,9 +3584,7 @@ uint32_t Calculator::GetPriceForTimeStep(Configuration *cfg, int timeStep, int p
 | 
				
			|||||||
            qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
 | 
					            qCritical() << "(" << __func__ << ":" << __LINE__ << ") timeStep" << timeStep;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // allow some tolerance when searching for [timeStep == pun_duration]:
 | 
					        if (timeStep == pun_duration) {
 | 
				
			||||||
        // this might happen when crossing minute boundaries
 | 
					 | 
				
			||||||
        if (std::abs(timeStep - pun_duration) < 4) {
 | 
					 | 
				
			||||||
            qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
 | 
					            qCritical() << "(" << __func__ << ":" << __LINE__ << ") return price" << price;
 | 
				
			||||||
            return price;
 | 
					            return price;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,9 +171,8 @@ ATBWeekDay parseWeekDay(Configuration &cfg,
 | 
				
			|||||||
                                                                if (!d.isNull() && d.isValid()) {
 | 
					                                                                if (!d.isNull() && d.isValid()) {
 | 
				
			||||||
                                                                    TariffPrepaid.m_date = d;
 | 
					                                                                    TariffPrepaid.m_date = d;
 | 
				
			||||||
                                                                }
 | 
					                                                                }
 | 
				
			||||||
                                                                if (!prepaidIf.isNull() && !prepaidIf.trimmed().isEmpty()) {
 | 
					 | 
				
			||||||
                                                                TariffPrepaid.setPrepaidIf(prepaidIf);
 | 
					                                                                TariffPrepaid.setPrepaidIf(prepaidIf);
 | 
				
			||||||
                                                                }
 | 
					
 | 
				
			||||||
                                                                qCritical() << TariffPrepaid;
 | 
					                                                                qCritical() << TariffPrepaid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                                                cfg.TariffPrepaids.insert(std::pair<int, ATBTariffPrepaid>(weekDay, TariffPrepaid));
 | 
					                                                                cfg.TariffPrepaids.insert(std::pair<int, ATBTariffPrepaid>(weekDay, TariffPrepaid));
 | 
				
			||||||
@@ -259,7 +258,7 @@ ATBWeekDay parseWeekDay(Configuration &cfg,
 | 
				
			|||||||
                                                                if (!d.isNull() && d.isValid()) {
 | 
					                                                                if (!d.isNull() && d.isValid()) {
 | 
				
			||||||
                                                                    TariffCarryOver.m_date = d;
 | 
					                                                                    TariffCarryOver.m_date = d;
 | 
				
			||||||
                                                                }
 | 
					                                                                }
 | 
				
			||||||
                                                                if (!carryOverIf.isNull() && !carryOverIf.trimmed().isEmpty()) {
 | 
					                                                                if (!carryOverIf.isEmpty()) {
 | 
				
			||||||
                                                                    TariffCarryOver.setCarryOverIf(carryOverIf);
 | 
					                                                                    TariffCarryOver.setCarryOverIf(carryOverIf);
 | 
				
			||||||
                                                                }
 | 
					                                                                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								library/src/tariff_comp_step.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								library/src/tariff_comp_step.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					#include "tariff_comp_step.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QByteArray>
 | 
				
			||||||
 | 
					#include <QCryptographicHash>
 | 
				
			||||||
 | 
					#include <QString>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uint64_t TariffCompStep::hash() {
 | 
				
			||||||
 | 
					    QString const str(QString("%1%2%3").arg(m_duration).arg(m_start.toString(Qt::ISODate)).arg(m_end.toString(Qt::ISODate)));
 | 
				
			||||||
 | 
					    QByteArray const hash = QCryptographicHash::hash(
 | 
				
			||||||
 | 
					      QByteArray::fromRawData(reinterpret_cast<char const*>(str.utf16()), str.length()*2),
 | 
				
			||||||
 | 
					      QCryptographicHash::Md5
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    uint64_t const &i = hash.left(8).toULongLong(nullptr, 16);
 | 
				
			||||||
 | 
					    uint64_t const &j = hash.right(8).toULongLong(nullptr, 16);
 | 
				
			||||||
 | 
					    return i ^ j;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -39,10 +39,10 @@ extern "C" char* strptime(const char* s,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define SZEGED                                  (0)
 | 
					#define SZEGED                                  (0)
 | 
				
			||||||
#define SCHOENAU_KOENIGSEE                      (0)
 | 
					#define SCHOENAU_KOENIGSEE                      (0)
 | 
				
			||||||
#define NEUHAUSER_KORNEUBURG                    (1)
 | 
					#define NEUHAUSER_KORNEUBURG                    (0)
 | 
				
			||||||
#define NEUHAUSER_LINSINGER_MASCHINENBAU        (0)
 | 
					#define NEUHAUSER_LINSINGER_MASCHINENBAU        (0)
 | 
				
			||||||
#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
 | 
					#define NEUHAUSER_NORDISCHES_AUSBILDUNGSZENTRUM (0)
 | 
				
			||||||
#define NEUHAUSER_BILEXA_GALTUER                (0)
 | 
					#define NEUHAUSER_BILEXA_GALTUER                (1)
 | 
				
			||||||
#define BAD_NEUENAHR_AHRWEILER                  (0)
 | 
					#define BAD_NEUENAHR_AHRWEILER                  (0)
 | 
				
			||||||
#define NEUHAUSER_CHRISTOPH_REISEN              (0)
 | 
					#define NEUHAUSER_CHRISTOPH_REISEN              (0)
 | 
				
			||||||
#define NEUHAUSER_PERNEGG_AN_DER_MUR            (0)
 | 
					#define NEUHAUSER_PERNEGG_AN_DER_MUR            (0)
 | 
				
			||||||
@@ -53,6 +53,7 @@ extern "C" char* strptime(const char* s,
 | 
				
			|||||||
#define SCHNALS_STAUMAUER                       (SCHNALS_LEITER_KIRCHL)
 | 
					#define SCHNALS_STAUMAUER                       (SCHNALS_LEITER_KIRCHL)
 | 
				
			||||||
#define VALSER_ALM                              (0)
 | 
					#define VALSER_ALM                              (0)
 | 
				
			||||||
#define NEUHAUSER_FORCHACH                      (0)
 | 
					#define NEUHAUSER_FORCHACH                      (0)
 | 
				
			||||||
 | 
					#define STADT_WEIDEN                            (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if NEUHAUSER_KIRCHDORF==1
 | 
					#if NEUHAUSER_KIRCHDORF==1
 | 
				
			||||||
static bool test_neuhauser_kirchdorf(int step, double cost) {
 | 
					static bool test_neuhauser_kirchdorf(int step, double cost) {
 | 
				
			||||||
@@ -221,10 +222,17 @@ int main() {
 | 
				
			|||||||
    //  490         "pra_price":"840"
 | 
					    //  490         "pra_price":"840"
 | 
				
			||||||
    //>>491     }
 | 
					    //>>491     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //for (int i = 1; i < 85; ++i) {
 | 
					    // {
 | 
				
			||||||
    //printf("{\n    \"\pra_payment_option_id\": 1049,\n    \"\pra_payment_unit_id\": %d,\n    \"pra_price\": %d\n},\n",
 | 
					    //      "pun_duration": 0,
 | 
				
			||||||
    //       i, i*10);
 | 
					    //      "pun_id": 0,
 | 
				
			||||||
 | 
					    //      "pun_label": "0 min"
 | 
				
			||||||
 | 
					    // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //for (int i = 0; i <= 140; ++i) {
 | 
				
			||||||
 | 
					    //printf("{\n    \"\pun_duration\": %d,\n    \"\pun_id\": %d,\n    \"pun_label\": \"%d min\"\n},\n",
 | 
				
			||||||
 | 
					    //       i*6, i, i*6);
 | 
				
			||||||
    //}
 | 
					    //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //return 0;
 | 
					    //return 0;
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
    MessageHelper msgHelp;
 | 
					    MessageHelper msgHelp;
 | 
				
			||||||
@@ -2673,7 +2681,7 @@ int main() {
 | 
				
			|||||||
        int Up = 1;
 | 
					        int Up = 1;
 | 
				
			||||||
        //compute_next_timestep(&cfg, )
 | 
					        //compute_next_timestep(&cfg, )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        QDateTime const start = QDateTime::currentDateTime();
 | 
					        QDateTime const start = QDateTime::fromString("2024-10-13T12:00:00");
 | 
				
			||||||
        int paymentOptionIndex = cfg.getPaymentOptionIndex(start);
 | 
					        int paymentOptionIndex = cfg.getPaymentOptionIndex(start);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (paymentOptionIndex < 0) {
 | 
					        if (paymentOptionIndex < 0) {
 | 
				
			||||||
@@ -2685,7 +2693,7 @@ int main() {
 | 
				
			|||||||
        QSet<uint32_t> const prices{700, 1400, 2100, 2800, 3500, 4200, 4900};
 | 
					        QSet<uint32_t> const prices{700, 1400, 2100, 2800, 3500, 4200, 4900};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (int i=0; i<timeSteps.size(); ++i) {
 | 
					        for (int i=0; i<timeSteps.size(); ++i) {
 | 
				
			||||||
            int nextTimeStep = compute_next_timestep(&cfg, timeSteps.at(i), Up);
 | 
					            int nextTimeStep = compute_next_timestep(&cfg, timeSteps.at(i), Up, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
 | 
				
			||||||
            qCritical() << "nextTimeStep" << nextTimeStep;
 | 
					            qCritical() << "nextTimeStep" << nextTimeStep;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            uint32_t price = Calculator::GetInstance().GetPriceForTimeStep(&cfg, timeSteps.at(i), paymentOptionIndex);
 | 
					            uint32_t price = Calculator::GetInstance().GetPriceForTimeStep(&cfg, timeSteps.at(i), paymentOptionIndex);
 | 
				
			||||||
@@ -2785,6 +2793,66 @@ int main() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if STADT_WEIDEN==1
 | 
				
			||||||
 | 
					    std::ifstream input("/opt/ptu5/opt/customer_6/etc/psa_tariff/tariff01.json");
 | 
				
			||||||
 | 
					    int pop_max_time;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    std::stringstream sstr;
 | 
				
			||||||
 | 
					    while(input >> sstr.rdbuf());
 | 
				
			||||||
 | 
					    std::string json(sstr.str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Configuration cfg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool isParsed = cfg.ParseJson(&cfg, json.c_str());
 | 
				
			||||||
 | 
					    cout << endl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (isParsed) {
 | 
				
			||||||
 | 
					        qCritical() << __func__ << ":" << __LINE__ << "parsed";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        QDateTime s(QDate(2024, 10, 14), QTime());
 | 
				
			||||||
 | 
					        QDateTime end;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        static QList<int> const timeSteps = Calculator::GetInstance().GetTimeSteps(&cfg);
 | 
				
			||||||
 | 
					        qCritical() << "TimeSteps" << timeSteps;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        int offset = 1150;
 | 
				
			||||||
 | 
					        QDateTime start = s.addSecs(offset * 60);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        CalcState cs;
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
 | 
					        struct price_t costs;
 | 
				
			||||||
 | 
					        for (int i = 0, j=timeSteps.size() ; i < timeSteps.size(); --j, ++i) {
 | 
				
			||||||
 | 
					            QDateTime end = start.addSecs(timeSteps.at(i)*60);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // if (i != 2) continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            cs = compute_price_for_parking_ticket(&cfg, start, timeSteps.at(i), end, &costs, PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
 | 
				
			||||||
 | 
					            int price1 = costs.netto;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            qCritical() << "compute_price_for_parking_ticket()/GetCostFromDuration() TIME: "
 | 
				
			||||||
 | 
					                        << timeSteps.at(i) << "ZZZZZZZZZZZZZ PRICE=" << price1 << "end=" << end.toString(Qt::ISODate);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        exit(0);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					        double cost = 220;
 | 
				
			||||||
 | 
					        qCritical() << "XXXXXXXX START" << start.toString(Qt::ISODate) << "cost" << cost;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cs = compute_duration_for_parking_ticket(&cfg, start, cost, end,
 | 
				
			||||||
 | 
					                                                 PermitType(PERMIT_TYPE::SHORT_TERM_PARKING));
 | 
				
			||||||
 | 
					            qCritical() << __LINE__ << cs.toString()
 | 
				
			||||||
 | 
					                        << "START" << start.toString(Qt::ISODate)
 | 
				
			||||||
 | 
					                        << "<duration" << start.secsTo(end) / 60
 | 
				
			||||||
 | 
					                        << "cost" << cost
 | 
				
			||||||
 | 
					                        << "> end" << end.toString(Qt::ISODate);
 | 
				
			||||||
 | 
					        //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        exit(0);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif // STADT WEIDEN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if NEUHAUSER_KORNEUBURG==1
 | 
					#if NEUHAUSER_KORNEUBURG==1
 | 
				
			||||||
    std::ifstream input("/opt/ptu5/opt/customer_714/etc/psa_tariff/tariff01.json");
 | 
					    std::ifstream input("/opt/ptu5/opt/customer_714/etc/psa_tariff/tariff01.json");
 | 
				
			||||||
    int pop_max_time;
 | 
					    int pop_max_time;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user