{% extends 'base.html' %} {% load humanize %} {% block title %}Loans Due Report{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Loans Due Report

{% if report_data.summary.today_due_count > 0 %} {% endif %}

{% if filters.today_only %} Loans due today ({{ "now"|date:"M d, Y" }}) {% else %} {% if filters.start_date and filters.end_date %} From {{ filters.start_date|date:"M d, Y" }} to {{ filters.end_date|date:"M d, Y" }} {% else %} All upcoming due loans {% endif %} {% endif %}

⏰ Last updated: {% now "H:i" %} 📅 {{ "now"|date:"l, M d, Y" }}
âŦ‡ī¸ Export PDF

🔍 Advanced Filters

✕

Total Loans Due

{{ report_data.summary.total_loans_due|default:0 }}

{% if report_data.summary.total_loans_due > 0 %} ↑ Active monitoring required {% else %} ✓ All clear {% endif %}

Total Amount Due

KES {{ report_data.summary.total_amount_due|default:0|floatformat:0|intcomma }}

đŸ’ĩ Expected collections
$

Due Today

{{ report_data.summary.today_due_count|default:0 }}

{% if report_data.summary.today_due_count > 0 %} âš ī¸ Immediate attention required {% else %} ✓ No urgent collections {% endif %}

Due This Week

{{ report_data.summary.week_due_count|default:0 }}

Plan collections

Loans Due Details ({{ report_data.loans|length }} loans)

Click on any loan for detailed actions

{% if report_data.loans %}
{% for loan in report_data.loans %} {% endfor %}
Loan Details Borrower Info Financial Info Due Date & Urgency Quick Actions
{{ loan.loan_number }}
{{ loan.application__loan_product__name|default:"Standard Loan" }}
{{ loan.borrower__first_name }} {{ loan.borrower__last_name }}
{% if loan.borrower__email %} {% endif %}
Principal
KES {{ loan.principal_amount|floatformat:0|intcomma }}
Outstanding
KES {{ loan.outstanding_balance|floatformat:0|intcomma }}
{% widthratio loan.outstanding_balance loan.principal_amount 100 as progress %}
{{ loan.due_date|date:"M d, Y" }}
{{ loan.due_date|date:"l, H:i" }}
{% with days_until=loan.days_until_due.days %}
{% if days_until == 0 %} âš ī¸ DUE TODAY {% elif days_until == 1 %} ⏰ Due Tomorrow {% elif days_until <= 7 %} 📅 {{ days_until }} days {% else %} {{ days_until }} days {% endif %}
{% endwith %}
{% else %}
✓

All Clear!

No loans are due in the selected period.

Your portfolio is up to date.

{% endif %}

📊 Due Date Distribution

📊 Amount by Urgency

📈 Loans Due Trend (Last 30 Days)

Collection Priority

{% if report_data.categorized.today or report_data.categorized.tomorrow or report_data.categorized.this_week %}
{% if report_data.categorized.today %}

âš ī¸ Critical: Due Today {{ report_data.categorized.today|length }}

{% for loan in report_data.categorized.today|slice:":8" %}
{{ loan.loan_number }}
{{ loan.borrower__first_name }} {{ loan.borrower__last_name }}
{{ loan.borrower__phone_number }}
KES {{ loan.outstanding_balance|floatformat:0|intcomma }}
{% endfor %} {% if report_data.categorized.today|length > 8 %}
{% endif %}
{% endif %} {% if report_data.categorized.tomorrow %}

⏰ High: Due Tomorrow {{ report_data.categorized.tomorrow|length }}

{% for loan in report_data.categorized.tomorrow|slice:":8" %}
{{ loan.loan_number }}
{{ loan.borrower__first_name }} {{ loan.borrower__last_name }}
{{ loan.borrower__phone_number }}
KES {{ loan.outstanding_balance|floatformat:0|intcomma }}
{% endfor %} {% if report_data.categorized.tomorrow|length > 8 %}
{% endif %}
{% endif %} {% if report_data.categorized.this_week %}

Medium: This Week {{ report_data.categorized.this_week|length }}

{% for loan in report_data.categorized.this_week|slice:":8" %}
{{ loan.loan_number }}
{{ loan.borrower__first_name }} {{ loan.borrower__last_name }}
Due: {{ loan.due_date|date:"M d" }}
KES {{ loan.outstanding_balance|floatformat:0|intcomma }}
{% endfor %} {% if report_data.categorized.this_week|length > 8 %}
{% endif %}
{% endif %}
{% endif %}
{% endblock %} {% block extra_js %} {% endblock %}