New internal representation for the prepaid option

This commit is contained in:
Gerhard Hoffmann 2024-08-15 21:24:27 +02:00
parent 0a32d60827
commit 80b21ac231

View File

@ -0,0 +1,68 @@
#ifndef TARIFF_PREPAY_H_INCLUDED
#define TARIFF_PREPAY_H_INCLUDED
#include <QTime>
struct ATBPrepay {
struct week {
int day;
bool prepaid; // yes/no
QTime start; // only valid if prepaid == true
QTime end;
int duration;
} prepay[8];
int id;
friend QDebug operator<<(QDebug debug, ATBPrepay const &pp) {
QDebugStateSaver saver(debug);
debug.nospace()
<< " id:" << pp.id << "\n"
<< " **** Monday **** \n"
<< " day: " << pp.prepay[(int)Qt::Monday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Monday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Monday].end.toString(Qt::ISODate) << "\n"
<< " duration: " << pp.prepay[(int)Qt::Monday].duration << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Monday].prepaid << "\n"
<< " **** Tuesday **** \n"
<< " day: " << pp.prepay[(int)Qt::Tuesday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Tuesday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Tuesday].end.toString(Qt::ISODate) << "\n"
<< " duration: " << pp.prepay[(int)Qt::Monday].duration << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Tuesday].prepaid << "\n"
<< " **** Wednesday **** \n"
<< " day: " << pp.prepay[(int)Qt::Wednesday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Wednesday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Wednesday].end.toString(Qt::ISODate) << "\n"
<< " duration: " << pp.prepay[(int)Qt::Monday].duration << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Wednesday].prepaid << "\n"
<< " **** Thursday **** \n"
<< " day: " << pp.prepay[(int)Qt::Thursday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Thursday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Thursday].end.toString(Qt::ISODate) << "\n"
<< " duration: " << pp.prepay[(int)Qt::Monday].duration << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Thursday].prepaid << "\n"
<< " **** Friday **** \n"
<< " day: " << pp.prepay[(int)Qt::Friday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Friday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Friday].end.toString(Qt::ISODate) << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Friday].prepaid << "\n"
<< " **** Saturday **** \n"
<< " day: " << pp.prepay[(int)Qt::Saturday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Saturday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Saturday].end.toString(Qt::ISODate) << "\n"
<< " duration: " << pp.prepay[(int)Qt::Monday].duration << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Saturday].prepaid << "\n"
<< " **** Sunday **** \n"
<< " day: " << pp.prepay[(int)Qt::Sunday].day << "\n"
<< " start: " << pp.prepay[(int)Qt::Sunday].start.toString(Qt::ISODate) << "\n"
<< " end: " << pp.prepay[(int)Qt::Sunday].end.toString(Qt::ISODate) << "\n"
<< " duration: " << pp.prepay[(int)Qt::Monday].duration << "\n"
<< " prepaid: " << pp.prepay[(int)Qt::Sunday].prepaid << "\n";
return debug;
}
};
#endif // TARIFF_CARRYOVER_H_INCLUDED