{% extends "base.html" %} {% block title %}Subscription • {{ customer.company_name }}{% endblock %} {% block content %}

Subscription

{{ customer.company_name }}
Back
{% set bc = sub.billing_cycle if sub else 'Monthly' %}
If users changed mid-cycle, use Mid-cycle User Change below (so additions can be prorated in next invoice).
Users × Customer cost per user
Users × Vendor cost per user
{% if sub and sub.prorata_consumed %}
Prorata already applied once.
{% else %}
First invoice: Start Date → Cycle end (month/quarter/half-year/year end)
{% endif %}
Period: — Prorata
{% set st = sub.status if sub else 'Active' %}
{% set cs = sub.confirmation_status if sub else 'Pending' %}
Invoice will be raised only if Confirmed / Not Required.
Cancel
Mid-cycle User Change
Option 2
Use this when users are added/removed mid-cycle.
• Additions are prorated and billed in the next invoice. • Removals apply from the next cycle (no credit note in current cycle).
{% if sub and sub.user_changes and sub.user_changes.count() > 0 %}
Change History
Latest first
{% for ch in sub.user_changes.order_by(SubscriptionUserChange.created_at.desc()).all() %} {% endfor %}
Date Old New Δ Note Billed
{{ ch.effective_date }} {{ ch.old_user_count }} {{ ch.new_user_count }} {% if ch.delta_users > 0 %} +{{ ch.delta_users }} {% elif ch.delta_users < 0 %} {{ ch.delta_users }} {% else %} 0 {% endif %} {{ ch.note or '-' }} {% if ch.delta_users > 0 %} {% if ch.billed_invoice_id %} Yes {% else %} No {% endif %} {% else %} N/A {% endif %}
{% endif %}
Invoice Rule
• Invoice generation depends on Subscription Type.
• Invoice will be created only if Renewal Confirmation is Confirmed (or Not Required).
• Next Renewal Date is calendar cycle end (month/quarter/half-year/year).
• Prorata applies only to the first invoice (if enabled).
• Mid-cycle user additions are prorated in next invoice (Option 2).
Billing Snapshot
{% if sub %}
Base users (this cycle)
{{ sub.cycle_base_user_count or 0 }}
Current users
{{ sub.user_count or 0 }}
Last billed date
{{ sub.last_billed_date or "—" }}
Next renewal
{{ sub.next_renewal_date or "—" }}

{% set pending_add = sub.user_changes.filter(SubscriptionUserChange.delta_users > 0,SubscriptionUserChange.billed_invoice_id.is_(None)).count()%}
Pending additions to bill
{% if pending_add > 0 %} {{ pending_add }} {% else %} 0 {% endif %}
Base users are locked for the current cycle. Additions are prorated in the next invoice; removals apply next cycle.
{% else %}
Save the subscription once to see billing snapshot.
{% endif %}
{% endblock %}