2023-06-25 14:01:19 +02:00
|
|
|
final DateTime now = DateTime.now();
|
2023-06-23 13:03:17 +02:00
|
|
|
|
|
|
|
enum TransaktionArt { monatlBeitrag, aufladung, einkauf, korrektur }
|
|
|
|
|
|
|
|
enum Unit { stueck, menge }
|
|
|
|
|
|
|
|
enum Category {
|
|
|
|
obstUndGemuese,
|
|
|
|
brotCerealienUndAufstriche,
|
|
|
|
getraenke,
|
|
|
|
drogerieUndHaushalt,
|
|
|
|
kochenUndBacken,
|
|
|
|
oeleSossenUndGewuerze,
|
2023-06-25 14:01:19 +02:00
|
|
|
suessesUndKnabbereien,
|
|
|
|
pfand
|
2023-06-23 13:03:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class Transaction {
|
|
|
|
int id = 0;
|
|
|
|
int amount;
|
|
|
|
TransaktionArt type;
|
|
|
|
DateTime date;
|
2023-06-25 12:04:17 +02:00
|
|
|
List<Basket>? basket;
|
2023-06-23 13:03:17 +02:00
|
|
|
String? description;
|
2023-06-25 14:01:19 +02:00
|
|
|
Transaction(
|
|
|
|
{required this.type,
|
|
|
|
required this.amount,
|
|
|
|
required this.date,
|
|
|
|
this.description,
|
|
|
|
this.basket});
|
2023-06-23 13:03:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class Product {
|
|
|
|
final int id = 0;
|
|
|
|
final String name;
|
|
|
|
final Unit unit;
|
|
|
|
final double price; //pro Kilogramm oder Stück
|
|
|
|
final double vat;
|
|
|
|
final Category category;
|
|
|
|
const Product(this.name, this.unit, this.price, this.vat, this.category);
|
|
|
|
}
|
|
|
|
|
|
|
|
class Basket {
|
2023-06-25 12:04:17 +02:00
|
|
|
Product products;
|
|
|
|
int amount;
|
|
|
|
Basket(this.products, this.amount);
|
2023-06-23 13:03:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class SampleData {
|
|
|
|
static const List<Product> products = [
|
|
|
|
Product('Apfel', Unit.stueck, 0.23, 7, Category.obstUndGemuese),
|
|
|
|
Product('Mehl', Unit.menge, 0.003, 19, Category.kochenUndBacken),
|
|
|
|
Product('Brot', Unit.stueck, 1.23, 7, Category.brotCerealienUndAufstriche),
|
|
|
|
Product('Milch', Unit.stueck, 2.23, 3, Category.getraenke),
|
|
|
|
Product('Zahnpasta', Unit.stueck, 0.23, 7, Category.drogerieUndHaushalt),
|
|
|
|
Product('Pfeffer', Unit.stueck, 0.23, 7, Category.oeleSossenUndGewuerze),
|
2023-06-25 14:01:19 +02:00
|
|
|
Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien),
|
|
|
|
Product('Flaschenpfand', Unit.stueck, -0.15, 0, Category.pfand)
|
2023-06-23 13:03:17 +02:00
|
|
|
];
|
|
|
|
|
2023-06-25 12:04:17 +02:00
|
|
|
static List<Basket> basket = [
|
2023-06-25 18:11:26 +02:00
|
|
|
Basket(products[0], 20),
|
|
|
|
Basket(products[1], 2200),
|
|
|
|
Basket(products[2], 2),
|
|
|
|
Basket(products[3], 1),
|
|
|
|
Basket(products[4], 1),
|
|
|
|
Basket(products[5], 2),
|
|
|
|
Basket(products[6], 222),
|
2023-06-25 12:04:17 +02:00
|
|
|
Basket(products[0], 20),
|
|
|
|
Basket(products[1], 2200),
|
|
|
|
Basket(products[2], 2),
|
|
|
|
Basket(products[3], 1),
|
|
|
|
Basket(products[4], 1),
|
|
|
|
Basket(products[5], 2),
|
|
|
|
Basket(products[6], 222)
|
|
|
|
];
|
|
|
|
|
|
|
|
static List<Basket> basket2 = [
|
|
|
|
Basket(products[0], 22),
|
|
|
|
Basket(products[1], 2241),
|
|
|
|
Basket(products[3], 2),
|
|
|
|
Basket(products[4], 4),
|
2023-06-25 14:01:19 +02:00
|
|
|
Basket(products[6], 2),
|
|
|
|
Basket(products[7], 5)
|
2023-06-25 12:04:17 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
static List<Basket> basket3 = [
|
|
|
|
Basket(products[0], -2),
|
|
|
|
Basket(products[1], 21),
|
|
|
|
Basket(products[3], -4),
|
|
|
|
Basket(products[4], 1),
|
|
|
|
Basket(products[6], 5)
|
|
|
|
];
|
|
|
|
|
|
|
|
List<Transaction> transactions = [
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.monatlBeitrag,
|
|
|
|
amount: 0,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.aufladung,
|
|
|
|
amount: 2042,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.einkauf,
|
|
|
|
amount: -2442,
|
|
|
|
date: now.subtract(const Duration(days: 2)),
|
|
|
|
basket: basket),
|
2023-06-25 12:04:17 +02:00
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.korrektur,
|
|
|
|
amount: 2332,
|
|
|
|
date: now.subtract(const Duration(hours: 5)),
|
2023-06-25 12:04:17 +02:00
|
|
|
description: 'Korrektur des Warenkorbs',
|
|
|
|
basket: basket3,
|
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.monatlBeitrag,
|
|
|
|
amount: 0,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.aufladung,
|
|
|
|
amount: 2042,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.einkauf,
|
|
|
|
amount: -2442,
|
|
|
|
date: now.subtract(const Duration(days: 2)),
|
2023-06-25 12:04:17 +02:00
|
|
|
basket: basket2),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.korrektur,
|
|
|
|
amount: 2332,
|
|
|
|
date: now.subtract(const Duration(hours: 5)),
|
|
|
|
description: 'Korrektur des FinanzAK'),
|
2023-06-25 12:04:17 +02:00
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.monatlBeitrag,
|
|
|
|
amount: 0,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.aufladung,
|
|
|
|
amount: 2042,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.einkauf,
|
|
|
|
amount: -2442,
|
|
|
|
date: now.subtract(const Duration(days: 2)),
|
2023-06-25 12:04:17 +02:00
|
|
|
basket: basket,
|
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.korrektur,
|
|
|
|
amount: 2332,
|
|
|
|
date: now.subtract(const Duration(hours: 5)),
|
2023-06-25 12:04:17 +02:00
|
|
|
description: 'Korrektur des Warenkorbs'),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.monatlBeitrag,
|
|
|
|
amount: 0,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.aufladung,
|
|
|
|
amount: 2042,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.einkauf,
|
|
|
|
amount: -2442,
|
|
|
|
date: now.subtract(const Duration(days: 2)),
|
|
|
|
basket: basket),
|
2023-06-25 12:04:17 +02:00
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.korrektur,
|
|
|
|
amount: 2332,
|
|
|
|
date: now.subtract(const Duration(hours: 5)),
|
2023-06-25 12:04:17 +02:00
|
|
|
description: 'Korrektur des Warenkorbs'),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.monatlBeitrag,
|
|
|
|
amount: 0,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.aufladung,
|
|
|
|
amount: 2042,
|
|
|
|
date: now,
|
2023-06-25 12:04:17 +02:00
|
|
|
),
|
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.einkauf,
|
|
|
|
amount: -2442,
|
|
|
|
date: now.subtract(const Duration(days: 2)),
|
|
|
|
basket: basket2),
|
2023-06-25 12:04:17 +02:00
|
|
|
Transaction(
|
2023-06-25 14:01:19 +02:00
|
|
|
type: TransaktionArt.korrektur,
|
|
|
|
amount: 2332,
|
|
|
|
date: now.subtract(const Duration(hours: 5)),
|
2023-06-25 12:04:17 +02:00
|
|
|
description: 'Korrektur des Warenkorbs'),
|
|
|
|
];
|
2023-06-23 13:03:17 +02:00
|
|
|
}
|