diff --git a/mac/Sources/Cockpit/PlanEditor.swift b/mac/Sources/Cockpit/PlanEditor.swift
index 58389878..14058345 100644
--- a/mac/Sources/Cockpit/PlanEditor.swift
+++ b/mac/Sources/Cockpit/PlanEditor.swift
@@ -240,6 +240,33 @@ private struct GeldEinstellung: View {
@State private var stakesText = ""
@State private var stakesMaxText = ""
+ /// Abzug: an/aus, Puffer, Mindestbetrag, Boden. Vorgabe aus.
+ private var abzug: some View {
+ @Bindable var c = cockpit
+ let a = c.wahl.geld.abzug
+ return VStack(alignment: .leading, spacing: 6) {
+ Wahl(an: a.an, aus: "nichts", an_: "Überhang melden") {
+ c.wahl.geld.abzug.an = $0
+ }
+ if a.an {
+ HStack(spacing: 6) {
+ Text("Puffer").font(.caption)
+ Stepper(String(format: "%.0f %%", a.puffer * 100),
+ value: Binding(get: { a.puffer * 100 }, set: { c.wahl.geld.abzug.puffer = $0 / 100 }),
+ in: 0...300, step: 10)
+ Text("ab").font(.caption)
+ Stepper(String(format: "%.0f", a.mindest),
+ value: Binding(get: { a.mindest }, set: { c.wahl.geld.abzug.mindest = $0 }),
+ in: 0...100_000, step: 50)
+ Text("Boden").font(.caption)
+ Stepper(String(format: "%.0f", a.boden),
+ value: Binding(get: { a.boden }, set: { c.wahl.geld.abzug.boden = $0 }),
+ in: 0...1_000_000, step: 100)
+ }
+ }
+ }
+ }
+
var body: some View {
@Bindable var c = cockpit
PlanAbschnitt(titel: "Geld", symbol: "banknote") {
diff --git a/mac/Sources/CockpitKern/Zeitplan.swift b/mac/Sources/CockpitKern/Zeitplan.swift
index 3f9cb149..6218ee87 100644
--- a/mac/Sources/CockpitKern/Zeitplan.swift
+++ b/mac/Sources/CockpitKern/Zeitplan.swift
@@ -121,6 +121,7 @@ public struct Geldplan: Equatable, Sendable, Decodable {
public var nachkaufUnterBB: Double
public var aufstehenUnterBB: Double
public var reserveBuyins: Int // Echtgeld: volle Buy-ins Bankroll je Tisch (Best Practice)
+ public var abzug: Abzug = Abzug() // Guthaben-Abzug; Vorgabe AUS
public init(modell: Modell = .leiter, stakesBB: Double? = nil, stakesMaxBB: Double? = nil, kauf: Kauf = .max,
tischVerlustBB: Double = 100,
@@ -135,11 +136,29 @@ public struct Geldplan: Equatable, Sendable, Decodable {
self.reserveBuyins = reserveBuyins
}
+ /// Wann Guthaben-Ueberhang abgezogen wird (betrieb/abzug.py) - Default aus.
+ public struct Abzug: Equatable, Sendable, Decodable {
+ public var an = false
+ public var puffer = 0.5
+ public var mindest = 200.0
+ public var boden = 0.0
+ public init() {}
+ enum CodingKeys: String, CodingKey { case an, puffer, mindest, boden }
+ public init(from d: Decoder) throws {
+ let c = try d.container(keyedBy: CodingKeys.self)
+ an = ((try? c.decodeIfPresent(Bool.self, forKey: .an)) ?? nil) ?? false
+ puffer = c.zahl(.puffer) ?? puffer
+ mindest = c.zahl(.mindest) ?? mindest
+ boden = c.zahl(.boden) ?? boden
+ }
+ var daten: [String: Any] { ["an": an, "puffer": puffer, "mindest": mindest, "boden": boden] }
+ }
+
enum CodingKeys: String, CodingKey {
case modell, kauf, stakesBB = "stakes_bb", stakesMaxBB = "stakes_max_bb", tischVerlustBB = "tisch_verlust_bb"
case sitzungVerlust = "sitzung_verlust", sitzungGewinn = "sitzung_gewinn", tagVerlust = "tag_verlust"
case tagGewinn = "tag_gewinn", nachkaufUnterBB = "nachkauf_unter_bb", aufstehenUnterBB = "aufstehen_unter_bb"
- case reserveBuyins = "reserve_buyins"
+ case reserveBuyins = "reserve_buyins", abzug
}
public init(from d: Decoder) throws {
@@ -169,7 +188,7 @@ public struct Geldplan: Equatable, Sendable, Decodable {
"tisch_verlust_bb": tischVerlustBB, "sitzung_verlust": g(sitzungVerlust),
"sitzung_gewinn": g(sitzungGewinn), "tag_verlust": g(tagVerlust), "tag_gewinn": g(tagGewinn),
"nachkauf_unter_bb": nachkaufUnterBB, "aufstehen_unter_bb": aufstehenUnterBB,
- "reserve_buyins": reserveBuyins]
+ "reserve_buyins": reserveBuyins, "abzug": abzug.daten]
}
}
diff --git a/winui/Kern/Plan.cs b/winui/Kern/Plan.cs
index 238a178b..e88a64e8 100644
--- a/winui/Kern/Plan.cs
+++ b/winui/Kern/Plan.cs
@@ -108,12 +108,34 @@ public readonly record struct Grenze(double Wert, bool Prozent = false)
public enum GeldModell { Leiter, Fest, Band }
/// Welche Stakes, welcher Kauf, wann Schluss - wie betrieb/geldplan.Geldplan (Zeitplan.swift `Geldplan`).
+/// Wann Guthaben-Ueberhang gemeldet wird (betrieb/abzug.py) - Vorgabe AUS.
+public sealed record AbzugRegeln
+{
+ public bool An { get; init; }
+ public double Puffer { get; init; } = 0.5;
+ public double Mindest { get; init; } = 200;
+ public double Boden { get; init; }
+
+ public static AbzugRegeln? Aus(JsonNode? n) => n is JsonObject o
+ ? new AbzugRegeln
+ {
+ An = o.Wahr("an") == true,
+ Puffer = o.Zahl("puffer") ?? 0.5,
+ Mindest = o.Zahl("mindest") ?? 200,
+ Boden = o.Zahl("boden") ?? 0,
+ }
+ : null;
+
+ public JsonObject Daten() => new() { ["an"] = An, ["puffer"] = Puffer, ["mindest"] = Mindest, ["boden"] = Boden };
+}
+
public sealed record Geldplan
{
public GeldModell Modell { get; init; } = GeldModell.Leiter;
public double? StakesBB { get; init; } // fest: die Stufe; Band: die Untergrenze
public double? StakesMaxBB { get; init; } // Band: die Obergrenze
public bool KaufMax { get; init; } = true;
+ public AbzugRegeln Abzug { get; init; } = new(); // Guthaben-Abzug, Vorgabe aus
public double TischVerlustBB { get; init; } = 100;
public Grenze? SitzungVerlust { get; init; } = new Grenze(250);
public Grenze? SitzungGewinn { get; init; }
@@ -145,6 +167,7 @@ public sealed record Geldplan
NachkaufUnterBB = o.Zahl("nachkauf_unter_bb") ?? v.NachkaufUnterBB,
AufstehenUnterBB = o.Zahl("aufstehen_unter_bb") ?? v.AufstehenUnterBB,
ReserveBuyins = o.Zahl("reserve_buyins") is double r ? (int)r : v.ReserveBuyins,
+ Abzug = AbzugRegeln.Aus(o["abzug"]) ?? v.Abzug,
};
}
@@ -166,6 +189,7 @@ public sealed record Geldplan
["nachkauf_unter_bb"] = NachkaufUnterBB,
["aufstehen_unter_bb"] = AufstehenUnterBB,
["reserve_buyins"] = ReserveBuyins,
+ ["abzug"] = Abzug.Daten(),
};
}
diff --git a/winui/Seiten/PlanEditor.cs b/winui/Seiten/PlanEditor.cs
index 0696e2bc..cc58b8f6 100644
--- a/winui/Seiten/PlanEditor.cs
+++ b/winui/Seiten/PlanEditor.cs
@@ -187,6 +187,20 @@ public static class PlanEditor
var kauf = new Segmente(new[] { "Max (tief)", "Min" }, vorgabe: g.KaufMax ? 0 : 1, hoehe: 26);
kauf.Gewaehlt += i => Setzen(x => x with { KaufMax = i == 0 });
+ var ab = g.Abzug;
+ var abAn = new ToggleSwitch { IsOn = ab.An, OnContent = "", OffContent = "", MinWidth = 0 };
+ abAn.Toggled += (_, _) => Setzen(x => x with { Abzug = x.Abzug with { An = abAn.IsOn } });
+ var abZeile = Ui.Spalte(6, Ui.Zeile(8, abAn,
+ Ui.Klein(ab.An ? "Überhang wird gemeldet" : "nichts")));
+ if (ab.An)
+ {
+ var puffer = Zahl(ab.Puffer * 100, 0, 300, 10, n => Setzen(x => x with { Abzug = x.Abzug with { Puffer = n / 100 } }));
+ var mindest = Zahl(ab.Mindest, 0, 100000, 50, n => Setzen(x => x with { Abzug = x.Abzug with { Mindest = n } }));
+ var boden = Zahl(ab.Boden, 0, 1000000, 100, n => Setzen(x => x with { Abzug = x.Abzug with { Boden = n } }));
+ abZeile.Children.Add(Ui.Reihe(6, Ui.Klein("Puffer %"), puffer, Ui.Klein("ab"), mindest,
+ Ui.Klein("Boden"), boden));
+ }
+ s.Children.Add(Frage("Überhang abziehen?", abZeile));
s.Children.Add(Frage("Wie viel kaufen?", kauf));
s.Children.Add(Frage("Wann ist eine Sitzung vorbei?", Ui.Spalte(4,