Update interface for 'compute_duration_for_daily_ticket()
This commit is contained in:
parent
3bf71f84d5
commit
3097819c01
@ -135,8 +135,8 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
||||
|
||||
CalcState CALCULATE_LIBRARY_API compute_duration_for_daily_ticket(
|
||||
parking_tariff_t *tariff,
|
||||
QString const &start_parking_time,
|
||||
uint8_t paymentMethod);
|
||||
QDateTime const &start_parking_time,
|
||||
QDateTime &ticketEndTime);
|
||||
//#ifdef __cplusplus
|
||||
//} // extern "C"
|
||||
//#endif
|
||||
|
@ -249,7 +249,8 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
||||
parking_tariff_t *tariff,
|
||||
QDateTime const &start_parking_time,
|
||||
double price,
|
||||
QDateTime &ticketEndTime) {
|
||||
QDateTime &ticketEndTime)
|
||||
{
|
||||
CalcState calcState;
|
||||
if (start_parking_time.isValid()) {
|
||||
QString cs = start_parking_time.toString(Qt::ISODate);
|
||||
@ -275,11 +276,31 @@ CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
||||
return calcState.set(CalcState::State::SUCCESS);
|
||||
}
|
||||
|
||||
CalcState CALCULATE_LIBRARY_API compute_duration_for_daily_ticket(parking_tariff_t *tariff, QString const &start_parking_time,uint8_t paymentMethod)
|
||||
CalcState CALCULATE_LIBRARY_API compute_duration_for_daily_ticket(parking_tariff_t *tariff, QDateTime const &start_parking_time, QDateTime &ticketEndTime)
|
||||
{
|
||||
CalcState calcState;
|
||||
QString result = calculator.GetDailyTicketDuration(tariff, start_parking_time, PaymentOption::Option1,false);
|
||||
qDebug() << "DailyTicket() => " + result;
|
||||
if (start_parking_time.isValid()) {
|
||||
QString cs = start_parking_time.toString(Qt::ISODate);
|
||||
|
||||
QString endTime = calculator.GetDailyTicketDuration(tariff,
|
||||
cs.toLocal8Bit().constData(),
|
||||
PaymentOption::Option1,
|
||||
false); // carry over
|
||||
ticketEndTime = QDateTime::fromString(endTime,Qt::ISODate);
|
||||
|
||||
// DEBUG
|
||||
qCritical() << "compute_duration_for_daily_ticket(): ";
|
||||
qCritical() << " endTime: " << endTime;
|
||||
qCritical() << " ticketEndTime: " << ticketEndTime;
|
||||
|
||||
if (!ticketEndTime.isValid()) {
|
||||
calcState.setDesc(QString("ticketEndTime=%1").arg(endTime));
|
||||
return calcState.set(CalcState::State::WRONG_ISO_TIME_FORMAT);
|
||||
}
|
||||
|
||||
} else {
|
||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||
}
|
||||
|
||||
return calcState.set(CalcState::State::SUCCESS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user