diff --git a/library/src/calculate_price.cpp b/library/src/calculate_price.cpp index 24c40a4..0697b9b 100644 --- a/library/src/calculate_price.cpp +++ b/library/src/calculate_price.cpp @@ -858,6 +858,26 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket( 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(); + + // musste man in einer schleife machen + carryOverStart = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].static_start; + carryOverDuration = tariff->TariffCarryOverOptions.find(pop_carry_over_option_id)->second.carryover[weekDay].duration; + + if (end_parking_time.time() > carryOverStart) { + end_parking_time = end_parking_time.addSecs(carryOverDuration * 60); + } else + if (end_parking_time.time() == carryOverStart) { + qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate); + qCritical() << __func__ << ":" << __LINE__ << " carryOverStart" << carryOverStart.toString(Qt::ISODate); + ATBPaymentOption const &po = tariff->getPaymentOptions(paymentOptionIndex); + if (po.pop_apply_carry_over_to_ticket_endtime) { + end_parking_time = end_parking_time.addSecs(carryOverDuration * 60); + qCritical() << __func__ << ":" << __LINE__ << "end-parking-time:" << end_parking_time.toString(Qt::ISODate); + } + } end_parking_time.setTime(QTime(end_parking_time.time().hour(), end_parking_time.time().minute(), 0));