{% extends "base.html" %} {% from "partials/ui.html" import page_header, subtabs, subtab_help, stat_card %} {% block content %} {{ page_header('Accounting', 'Operational accounting grounded in real ledger data.') }} {{ subtabs([ {'key':'overview','href':'/accounting?tab=overview','label':'Overview'}, {'key':'expenses','href':'/accounting?tab=expenses','label':'Expenses'}, {'key':'payments','href':'/accounting?tab=payments','label':'Payments & Refunds'}, {'key':'shifts','href':'/accounting?tab=shifts','label':'Cash Shifts'}, {'key':'night_audit','href':'/accounting?tab=night_audit','label':'Night Audit'}, {'key':'ledger','href':'/accounting?tab=ledger','label':'Ledger'} ], active_tab, 'Accounting sections') }} {% if active_tab == 'overview' %} {{ subtab_help('High-level financial summary and quick guidance.') }}
How to use Accounting
{{ stat_card('Billed revenue', "%.2f"|format(summary.billed_revenue|default(summary.revenue|default(0)))) }} {{ stat_card('Expenses+COGS', "%.2f"|format(summary.expenses|default(0))) }} {{ stat_card('Net profit', "%.2f"|format(summary.net_profit|default(0))) }} {{ stat_card('A/R', "%.2f"|format(summary.ar_balance|default(summary.accounts_receivable|default(0)))) }}

Quick actions

Record / review expenses Record payment or refund View recent ledger Reports & Analytics

{% elif active_tab == 'expenses' %} {{ subtab_help('Record operational expenses and review/void recent expense entries.') }}

Record expense

Recent expenses

{% for e in expenses %} {% else %}{% endfor %}
IDDateCatParamNet
{{e['id']}}{{e['at']}}{{e['category_name']}}{{e['parameter_name']}}{{e['net_amount']}}
None
{% elif active_tab == 'payments' %} {{ subtab_help('Record payments (reservation or walk-in) and process refunds (password protected).') }}

Record payment

Allocation (optional, advanced)

Refund (password)

Allocation (optional, advanced)

Refunds require unlock and super password and are audited.

{% elif active_tab == 'shifts' %} {{ subtab_help('Cash shift/register controls (advisory foundation): open/close shifts and record cash movements.') }}

Open / current shift

{% if open_shift %}

Open shift #{{ open_shift.id }} — {{ open_shift.name or '' }}

Opened {{ open_shift.opened_at }} · Float {{ "%.2f"|format(open_shift.opening_float or 0) }} · Expected (base) {{ "%.2f"|format(open_shift.expected_cash or 0) }}

{% if open_shift_recon %}

Linked cash payments net {{ "%.2f"|format(open_shift_recon.linked_net or 0) }} (in {{ "%.2f"|format(open_shift_recon.linked_cash_in or 0) }}, out {{ "%.2f"|format(open_shift_recon.linked_cash_out or 0) }}) · Reconciled expected {{ "%.2f"|format(open_shift_recon.reconciled_expected_cash or 0) }}

View open shift reconciliation details

{% endif %}
Close shift

Recent movements

{% for m in shift_movements %}{% else %}{% endfor %}
IDTypeAmountMethodRefAt
{{m.id}}{{m.movement_type}}{{"%.2f"|format(m.amount or 0)}}{{m.method}}{{m.reference}}{{m.at}}
No movements
{% else %}

No open shift. Open a shift to track cash movements.

{% endif %}

Recent shifts

{% for s in cash_shifts %}{% else %}{% endfor %}
IDNameStatusOpenedClosedExpectedCountedVariance
{{s.id}}{{s.name}}{{s.status}}{{s.opened_at}}{{s.closed_at or ''}}{{"%.2f"|format(s.expected_cash or 0)}}{% if s.counted_cash is not none %}{{"%.2f"|format(s.counted_cash or 0)}}{% endif %}{% if s.variance is not none %}{{"%.2f"|format(s.variance or 0)}}{% endif %}Reconcile
No shifts
{% if selected_shift_recon %}

Shift reconciliation details — #{{ selected_shift_recon.id }} {{ selected_shift_recon.name or '' }} ({{ selected_shift_recon.status }})

Opened {{ selected_shift_recon.opened_at }}{% if selected_shift_recon.closed_at %} · Closed {{ selected_shift_recon.closed_at }}{% endif %} · Float {{ "%.2f"|format(selected_shift_recon.opening_float or 0) }} · Base expected {{ "%.2f"|format(selected_shift_recon.expected_cash or 0) }}

Movements total {{ "%.2f"|format(selected_shift_recon.movements_total or 0) }} · Linked cash in {{ "%.2f"|format(selected_shift_recon.linked_cash_in or 0) }} · Linked cash out {{ "%.2f"|format(selected_shift_recon.linked_cash_out or 0) }} · Linked net {{ "%.2f"|format(selected_shift_recon.linked_net or 0) }} · Reconciled expected {{ "%.2f"|format(selected_shift_recon.reconciled_expected_cash or 0) }}

Counted {% if selected_shift_recon.counted_cash is not none %}{{ "%.2f"|format(selected_shift_recon.counted_cash or 0) }}{% else %}—{% endif %} · Variance {% if selected_shift_recon.variance is not none %}{{ "%.2f"|format(selected_shift_recon.variance or 0) }}{% else %}—{% endif %}

Cash movements

{% for m in selected_shift_movements %}{% else %}{% endfor %}
IDTypeAmountMethodRefAt
{{m.id}}{{m.movement_type}}{{"%.2f"|format(m.amount or 0)}}{{m.method}}{{m.reference}}{{m.at}}
No movements

Linked cash payments/refunds

{% for p in selected_shift_recon.linked_payments or [] %}{% else %}{% endfor %}
IDResTypeAmountMethodAtRef/Notes
{{p.id}}{{p.reservation_id or 'walk-in'}}{{p.payment_type}}{{"%.2f"|format(p.amount or 0)}}{{p.method}}{{p.at}}{{p.reference or p.notes or ''}}
No linked cash payments
{% endif %} {% elif active_tab == 'night_audit' %} {{ subtab_help('Advisory night-audit snapshots (no hard locks): capture ops/ledger state and exceptions for a business date.') }}

Run night audit (advisory)

Captures front-desk counts/exceptions and ledger summary for review/reconciliation.

Recent audit runs

{% for a in night_audits %}{% else %}{% endfor %}
IDBusiness dateStatusCompletedRun bySummary
{{a.id}}{{a.business_date}}{{a.status}}{{a.completed_at or a.started_at}}{{a.run_by or ''}}
View
{{a.summary_json}}
{% if a.exceptions_json and a.exceptions_json != '[]' %}Exceptions
{{a.exceptions_json}}
{% endif %}
No audit runs
{% elif active_tab == 'ledger' %} {{ subtab_help('Recent ledger entries (real data).') }}

Recent ledger

{% for r in ledger %} {% else %}{% endfor %}
IDDateTypeCategoryNetVATGrossDescription
{{r['id']}}{{r['at']}}{{r['entry_type']}}{{r['category']}}{{r['net']}}{{r['vat']}}{{r['gross']}}{{r['description']}}
None
{% endif %} {% endblock %}