{% extends "base.html" %} {% block content %}

Guest portfolio: {{ g.get('canonical_name') or g.get('name') }} (#{{ g.get('id') }})

360° view: profile, trips/reservations, POS/activity, payments, invoices, and totals — all grounded in real app data.

How to use this portfolio
{% set s = p.stats or {} %}
Stays / Trips
{{ s.stays_total or 0 }}
{{ s.completed_stays or 0 }} completed · {{ s.total_nights or 0 }} nights
Total charges
{{ '%.2f'|format(s.total_charges or 0) }}
POS total {{ '%.2f'|format(s.pos_gross_total or 0) }}
Total paid
{{ '%.2f'|format(s.total_paid or 0) }}
Across all reservations
Outstanding
{{ '%.2f'|format(s.total_outstanding or 0) }}
Due on active/checked-out stays

Profile & contact

Name{{ g.get('canonical_name') or g.get('name') }}
Phone{{ g.get('phone') or '—' }}
Email{{ g.get('email') or '—' }}
First visit{{ s.first_visit or '—' }}
Last visit{{ s.last_visit or '—' }}
Favorite room{{ s.favorite_room or '—' }}
Notes{{ g.get('notes') or '—' }}
{% if p.top_items_overall %}

Top items overall (POS)

{% endif %}

Edit guest (requires unlock + super password)

Trips / Reservations ({{ p.trips|length }})

All stays with room, dates, status, charges/balance, POS orders, payments, and invoices.

{% for t in p.trips %}
Res #{{t.id}} · {{ t.room_number or '—' }} {{ '(' ~ t.room_type ~ ')' if t.room_type else '' }} · {{ t.check_in_date }} → {{ t.check_out_date }} ({{ t.nights }} nights) · {{ t.status }} · charges {{ '%.2f'|format((t.balance.total_charges if t.balance else 0) or 0) }}, paid {{ '%.2f'|format((t.balance.total_paid if t.balance else 0) or 0) }}, due {{ '%.2f'|format((t.balance.balance_due if t.balance else 0) or 0) }}
Source: {{ t.source or '—' }} · Plan: {{ t.rate_plan or '—' }} · Rate: {{ '%.2f'|format(t.agreed_nightly_rate or 0) }} · Tax: {{ '%.2f'|format(t.tax_amount or 0) }}{% if t.notes %} · Notes: {{ t.notes }}{% endif %}

Folio

Total charges{{ '%.2f'|format((t.balance.total_charges if t.balance else 0) or 0) }}
Accommodation{{ '%.2f'|format((t.balance.accommodation_gross if t.balance else 0) or 0) }}
POS/Extras{{ '%.2f'|format((t.balance.pos_gross if t.balance else 0) or 0) }}
Total paid{{ '%.2f'|format((t.balance.total_paid if t.balance else 0) or 0) }}
Balance due{{ '%.2f'|format((t.balance.balance_due if t.balance else 0) or 0) }}

POS / Activity ({{ (t.pos_active or [])|length }} active)

{% for i in (t.pos_items or []) %} {% else %}{% endfor %}
ItemBatch / Lot traceQtyPriceTax
{{ i.item_description }} {{ i.get('lot_code') or i.get('batch_lot_code') or ('#' ~ i.get('batch_id') if i.get('batch_id') else '—') }} {% if i.get('batch_id') %}batch #{{ i.get('batch_id') }}{% endif %} {% if i.get('received_at') or i.get('batch_received_at') %}Received: {{ i.get('received_at') or i.get('batch_received_at') }}{% endif %} {% if i.get('expiry_date') or i.get('batch_expiry_date') %}Expiry: {{ i.get('expiry_date') or i.get('batch_expiry_date') }} {% if (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expired' %}EXPIRED{% elif (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expiring' %}EXPIRING{% endif %} {% endif %} {{ i.quantity }}{{ '%.2f'|format(i.unit_price or 0) }}{{ '%.2f'|format(i.tax_amount or 0) }}
No POS items

Payments

{% for pay in (t.payments or []) %} {% else %}{% endfor %}
WhenMethodTypeAmount
{{ pay.at }}{{ pay.method }}{{ pay.payment_type }}{{ '%.2f'|format(pay.amount or 0) }}
No payments

Invoices

{% if t.invoices %}
    {% for inv in t.invoices %}
  • {{ inv.name }} ({{ inv.modified or '' }})
  • {% endfor %}
{% else %}
No invoice files saved for this reservation.
{% endif %}
{% else %}
No trips/reservations for this guest yet.
{% endfor %}

All POS / activity ({{ p.all_pos|length }})

{% for i in p.all_pos[:80] %} {% else %}{% endfor %}
WhenResRoomItemBatch / Lot traceQtyPrice
{{ i.created_at }}#{{ i.reservation_id }}{{ i.room_number or '' }}{{ i.item_description }} {{ i.get('lot_code') or i.get('batch_lot_code') or ('#' ~ i.get('batch_id') if i.get('batch_id') else '—') }} {% if i.get('batch_id') %}batch #{{ i.get('batch_id') }}{% endif %} {% if i.get('received_at') or i.get('batch_received_at') %}Received: {{ i.get('received_at') or i.get('batch_received_at') }}{% endif %} {% if i.get('expiry_date') or i.get('batch_expiry_date') %}Expiry: {{ i.get('expiry_date') or i.get('batch_expiry_date') }} {% if (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expired' %}EXPIRED{% elif (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expiring' %}EXPIRING{% endif %} {% endif %} {{ i.quantity }}{{ '%.2f'|format(i.unit_price or 0) }}
No POS activity
{% if p.all_pos|length > 80 %}
Showing latest 80 of {{ p.all_pos|length }}.
{% endif %}

All payments ({{ p.all_payments|length }})

{% for pay in p.all_payments[:80] %} {% else %}{% endfor %}
WhenResRoomMethodTypeAmount
{{ pay.at }}#{{ pay.reservation_id }}{{ pay.room_number or '' }}{{ pay.method }}{{ pay.payment_type }}{{ '%.2f'|format(pay.amount or 0) }}
No payments
{% if p.all_payments|length > 80 %}
Showing latest 80 of {{ p.all_payments|length }}.
{% endif %}
{% endblock %}