count overpay as debts when fronted + add debt writeoff

This commit is contained in:
SowinskiBraeden committed 2026-06-11 13:11:04 -07:00
1 parent 2939415f76
commit 7ec95ee24a
8 files changed
+194 -5

No files matched your search

+45 -1
View File
@@ -112,6 +112,39 @@
</form>
</div>
</section>
<form class="panel form-card" method="post" action="{{ url_for('admin_write_off_front') }}">
<p class="eyebrow">Front debt</p>
<h2>Write off debt</h2>
<label>
<span>Outstanding debt</span>
<select name="debt_key" required>
<option value="">Select debt</option>
{% for item in debt_entries %}
{% set session = item.session %}
{% set entry = item.entry %}
<option value="{{ session.session_id }}||{{ entry.player_name }}">
{{ entry.player_name }} · {{ session_label(session) }} · owes {{ entry.player_owes_cents | money }}
</option>
{% endfor %}
</select>
</label>
<label>
<span>Amount to write off</span>
<input type="number" step="0.01" name="amount" placeholder="5.00" required>
</label>
<label>
<span>Note</span>
<textarea name="note" rows="3" placeholder="Won't be collected."></textarea>
</label>
<div class="button-row">
<button class="secondary-button" type="submit">Write off front</button>
</div>
</form>
</section>
</section>
@@ -140,6 +173,13 @@
</strong>
</article>
<article class="panel stat-card">
<span>Written off</span>
<strong class="{{ 'negative' if admin_totals.written_off_cents > 0 else '' }}">
{{ admin_totals.written_off_cents | money }}
</strong>
</article>
<article class="panel stat-card">
<span>Open balance</span>
<strong class="{% if admin_totals.open_balance_cents > 0 %}negative{% elif admin_totals.open_balance_cents < 0 %}positive{% endif %}">
@@ -165,6 +205,7 @@
<th>Paid out</th>
<th>Still owed</th>
<th>Players owe</th>
<th>Written off</th>
<th>Open balance</th>
<th>Status</th>
<th>Action</th>
@@ -187,6 +228,9 @@
<td class="{{ 'negative' if session.total_player_owes_cents > 0 else '' }}">
{{ session.total_player_owes_cents | money }}
</td>
<td class="{{ 'negative' if session.total_front_writeoff_cents > 0 else '' }}">
{{ session.total_front_writeoff_cents | money }}
</td>
<td class="{% if session.total_open_balance_cents > 0 %}negative{% elif session.total_open_balance_cents < 0 %}positive{% endif %}">
{{ session.total_open_balance_cents | money }}
</td>
@@ -208,7 +252,7 @@
</tr>
{% else %}
<tr>
<td colspan="4">No sessions yet.</td>
<td colspan="10">No sessions yet.</td>
</tr>
{% endfor %}
</tbody>
+4
View File
@@ -16,6 +16,8 @@
<article class="panel stat-card"><span>Total invested</span><strong>{{ player.total_invested_cents | money }}</strong></article>
<article class="panel stat-card"><span>Paid Buy-in</span><strong>{{ player.total_buy_in_cents | money }}</strong></article>
<article class="panel stat-card"><span>Fronted</span><strong>{{ player.total_front_cents | money }}</strong></article>
<article class="panel stat-card"><span>Current debt</span><strong class="{{ 'negative' if player.current_player_owes_cents > 0 else '' }}">{{ player.current_player_owes_cents | money }}</strong></article>
<article class="panel stat-card"><span>Written off</span><strong class="{{ 'negative' if player.total_front_writeoff_cents > 0 else '' }}">{{ player.total_front_writeoff_cents | money }}</strong></article>
<!--<article class="panel stat-card"><span>Rolled in</span><strong>{{ player.total_rollover_in_cents | money }}</strong></article>-->
<article class="panel stat-card"><span>Cash-outs</span><strong>{{ player.total_cash_out_cents | money }}</strong></article>
<article class="panel stat-card"><span>Sessions</span><strong>{{ player.sessions_played }}</strong></article>
@@ -87,6 +89,8 @@
<tbody>
<tr><th>Paid Buy-ins</th><td>{{ player.total_buy_in_cents | money }}</td></tr>
<tr><th>Fronted</th><td>{{ player.total_front_cents | money }}</td></tr>
<tr><th>Current Debt</th><td>{{ player.current_player_owes_cents | money }}</td></tr>
<tr><th>Written Off</th><td>{{ player.total_front_writeoff_cents | money }}</td></tr>
<tr><th>Rolled In</th><td>{{ player.total_rollover_in_cents | money }}</td></tr>
<tr><th>Total Invested</th><td>{{ player.total_invested_cents | money }}</td></tr>
<tr><th>Rolled Out</th><td>{{ player.total_rollover_out_cents | money }}</td></tr>
+13 -2
View File
@@ -54,6 +54,13 @@
{{ session.total_player_owes_cents | money }}
</strong>
</article>
<article class="panel stat-card">
<span>Written off</span>
<strong class="{{ 'negative' if session.total_front_writeoff_cents > 0 else '' }}">
{{ session.total_front_writeoff_cents | money }}
</strong>
</article>
</section>
@@ -87,6 +94,7 @@
<th class="detail-col">Gross due</th>
<th class="detail-col">Paid</th>
<th class="detail-col">Rolled out</th>
<th class="detail-col">Written off</th>
<th>Still owed</th>
<th>Status</th>
<th>Notes</th>
@@ -111,7 +119,7 @@
</td>
<td class="detail-col">
{% if entry.player_owes_cents > 0 %}
{% if entry.raw_player_owes_cents > 0 %}
{% else %}
{{ entry.gross_payout_cents | money }}
@@ -120,10 +128,13 @@
<td class="detail-col">{{ entry.paid_cents | money }}</td>
<td class="detail-col">{{ entry.rollover_out_cents | money }}</td>
<td class="detail-col">{{ entry.front_writeoff_applied_cents | money }}</td>
<td class="{% if entry.player_owes_cents > 0 %}negative{% elif entry.current_due_cents > 0 %}negative{% else %}positive{% endif %}">
<td class="{% if entry.player_owes_cents > 0 %}negative{% elif entry.front_writeoff_applied_cents > 0 %}negative{% elif entry.current_due_cents > 0 %}negative{% else %}positive{% endif %}">
{% if entry.player_owes_cents > 0 %}
Owes {{ entry.player_owes_cents | money }}
{% elif entry.front_writeoff_applied_cents > 0 %}
Written off {{ entry.front_writeoff_applied_cents | money }}
{% else %}
{{ entry.current_due_cents | money }}
{% endif %}