ein paar feature aber datenbank macht probleme wenn man aufträge speichern möchge
This commit is contained in:
2026-04-05 12:47:57 +02:00
parent e1d4bb7edf
commit 9ddce354c0
32 changed files with 3931 additions and 612 deletions

View File

@@ -0,0 +1,29 @@
/// Parst typische deutsche Betragsangaben (z.B. `1.234,56`) für QR / Logik.
class GermanAmountParser {
GermanAmountParser._();
/// Liefert den Betrag in Euro als [double], oder `null` wenn nicht erkennbar.
static double? parseEuro(String raw) {
var s = raw.trim();
if (s.isEmpty) return null;
s = s.replaceAll(RegExp(r'\s'), '');
s = s.replaceAll('', '').replaceAll('EUR', '').trim();
if (s.isEmpty) return null;
if (s.contains(',')) {
s = s.replaceAll('.', '').replaceAll(',', '.');
} else {
final dotCount = '.'.allMatches(s).length;
if (dotCount > 1) {
s = s.replaceAll('.', '');
}
}
return double.tryParse(s);
}
/// Betrag für SEPA-QR: `EUR12.34` (Punkt, zwei Nachkommastellen).
static String? formatForSepaQr(String betragText) {
final v = parseEuro(betragText);
if (v == null || v <= 0) return null;
return 'EUR${v.toStringAsFixed(2)}';
}
}