Implemented compute_duration_for_parking_ticket().
This commit is contained in:
parent
01f2dc07ce
commit
ceb545b432
@ -124,6 +124,30 @@ CalcState CALCULATE_LIBRARY_API compute_price_for_parking_ticket(
|
||||
}
|
||||
price->units = cost;
|
||||
price->netto = cost;
|
||||
} else {
|
||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||
}
|
||||
|
||||
return calcState.set(CalcState::State::SUCCESS);
|
||||
}
|
||||
|
||||
CalcState CALCULATE_LIBRARY_API compute_duration_for_parking_ticket(
|
||||
parking_tariff_t *tariff,
|
||||
time_t start_parking_time,
|
||||
double price,
|
||||
QString &duration) {
|
||||
CalcState calcState;
|
||||
QDate const d(1970, 1, 1);
|
||||
QTime const t(0, 0, 0);
|
||||
QDateTime start(d, t, Qt::UTC);
|
||||
start = start.toLocalTime().addSecs(start_parking_time * 60);
|
||||
if (start.isValid()) {
|
||||
QString cs = start.toString(Qt::ISODate);
|
||||
duration = calculator.GetDurationFromCost(tariff, PaymentOption::Option1,
|
||||
cs.toLocal8Bit().constData(),
|
||||
price, false, true).c_str();
|
||||
} else {
|
||||
return calcState.set(CalcState::State::INVALID_START_DATE);
|
||||
}
|
||||
|
||||
return calcState.set(CalcState::State::SUCCESS);
|
||||
|
Loading…
Reference in New Issue
Block a user