diff options
Diffstat (limited to 'transaction.h')
| -rw-r--r-- | transaction.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/transaction.h b/transaction.h new file mode 100644 index 0000000..8aa0a06 --- /dev/null +++ b/transaction.h @@ -0,0 +1,56 @@ +#ifndef TRANSACTION_H +#define TRANSACTION_H + +#include <QString> +#include <QDate> + +enum class TransactionType { + Estimated, + Actual +}; + +enum class RecurrenceFrequency { + None, + Daily, + Weekly, + BiWeekly, + Monthly, + Yearly +}; + +struct Transaction { + int id; + QDate date; + double amount; + QString account; + QString category; + QString description; + TransactionType type; + int recurringId; // -1 if not part of recurring series + int sortOrder; // For ordering on same date + + Transaction() : id(-1), amount(0.0), type(TransactionType::Estimated), recurringId(-1), sortOrder(0) {} + + double getBalance() const { return amount; } +}; + +struct RecurringRule { + int id; + QString name; + RecurrenceFrequency frequency; + QDate startDate; + QDate endDate; // Can be null for indefinite + double amount; + QString account; + QString category; + QString description; + int dayOfWeek; // 1-7 for weekly (1=Monday), -1 if not applicable + int dayOfMonth; // 1-31 for monthly, -1 if not applicable + int occurrences; // Number of times to repeat, -1 for indefinite + int sortOrder; // For ordering transactions on same date + + RecurringRule() : id(-1), frequency(RecurrenceFrequency::None), + amount(0.0), dayOfWeek(-1), dayOfMonth(-1), occurrences(-1), sortOrder(0) {} +}; + +#endif // TRANSACTION_H |
