{% extends 'base.html' %} {% load static %} {% load format_tags %} {% block title %}Payroll Report | FoxFitt{% endblock %} {% block content %}

Payroll Report

{{ start_date|date:"d M Y" }} — {{ end_date|date:"d M Y" }}  |  {{ project_name }}  |  {{ team_name }}

{# "New Report" removed — the inline filter pills below ARE the #} {# new-report interface now. Date/project/team pills edit in-place. #} Download PDF Dashboard
{# === FILTER PILLS (interactive — pill-as-dropdown) === #} {# Each pill is a clickable button that opens an inline popover with the #} {# relevant editor. The Apply button appears only when at least one pill #} {# has uncommitted changes. See the JS module lower in this file. #}
{# --- Date pill --- #}
{# --- Projects pill --- #}
{% if selected_project_ids %} × {% endif %}
{# --- Teams pill --- #}
{% if selected_team_ids %} × {% endif %}
{# No global Apply button — each popover's OK commits + reloads directly. #}
{# --- Cross-filter data for the JS module --- #} {{ project_team_pairs_json|json_script:"projectTeamPairs" }} {# --- Expose current URL filter state so the cross-filter can disable #} {# dropdown options that are invalid given the OTHER pill's selection. #} {{ selected_project_ids|json_script:"urlSelectedProjectIds" }} {{ selected_team_ids|json_script:"urlSelectedTeamIds" }}

FoxFitt Construction — Payroll Report

{{ start_date|date:"d M Y" }} — {{ end_date|date:"d M Y" }}  |  {{ project_name }}  |  {{ team_name }}

{# === HERO KPI BAND === #}
Paid This Period
R {{ total_paid_out|money }}
{{ start_date|date:"d M Y" }} – {{ end_date|date:"d M Y" }}
Outstanding Now
R {{ current_outstanding.total|money }}
as of {{ current_as_of|date:"H:i" }}
FoxFitt Avg / Day
R {{ company_avg_daily|money }}
lifetime avg · {{ company_working_days }} working days
FoxFitt Avg / Month
R {{ company_avg_monthly|money }}
lifetime avg · ~30.44 days/month
{# === CHAPTER I — Lifetime Context === #}
ILifetime Context
All Time — Projects
{% if alltime_projects %}
{% for item in alltime_projects %} {% endfor %}
Project Start Last Activity Working Days Total Cost Avg R / Working Day
{{ item.project }} {% if item.start_date %}{{ item.start_date|date:"d M Y" }}{% else %}{% endif %} {% if item.last_activity %}{{ item.last_activity|date:"d M Y" }}{% else %}{% endif %} {{ item.working_days|default:"—" }} R {{ item.total|money }} {% if item.working_days %}R {{ item.avg_per_working_day|money }}{% else %}{% endif %}
{% else %}

No lifetime project data.

{% endif %}
All Time — Teams
{% if alltime_teams %}
{% for item in alltime_teams %} {% endfor %}
TeamTotal Cost
{{ item.team }}R {{ item.total|money }}
{% else %}

No lifetime team data.

{% endif %}
IISelected Period: {{ start_date|date:"d M Y" }} – {{ end_date|date:"d M Y" }}
Total Paid Out
R {{ total_paid_out|money }}
Worker-Days
{{ total_worker_days }}
Loans Issued
R {{ loans_issued|money }}
Loans Outstanding
R {{ loans_outstanding|money }}
Advances Issued
R {{ advances_issued|money }}
Advances Outstanding
R {{ advances_outstanding|money }}
Payments by Date
{% if payments_by_date %}
{% for item in payments_by_date %} {% endfor %}
DateAmount Paid
{{ item.date|date:"d M Y" }}R {{ item.total|money }}
{% else %}

No payments in this period.

{% endif %}
Adjustment Summary
{% if adjustment_totals %}
{% for item in adjustment_totals %} {% endfor %}
CategoryTotal
{{ item.label }}R {{ item.total|money }}
{% else %}

No adjustments in this period.

{% endif %}
Labour Cost by Project
{% if cost_per_project %}
{% for item in cost_per_project %} {% endfor %}
ProjectWorker-DaysTotal Cost
{{ item.project }}{{ item.worker_days }}R {{ item.total|money }}
{% else %}

No project cost data.

{% endif %}
Labour Cost by Team
{% if cost_per_team %}
{% for item in cost_per_team %} {% endfor %}
TeamWorker-DaysTotal Cost
{{ item.team }}{{ item.worker_days }}R {{ item.total|money }}
{% else %}

No team cost data.

{% endif %}
{# === CHAPTER III — Worker Breakdown === #}
IIIWorker Breakdown
Worker Breakdown
{% if worker_breakdown %}
{% for label in active_adj_labels %} {% endfor %} {% for w in worker_breakdown %} {% for val in w.adj_values %} {% endfor %} {% endfor %}
Worker Days Total Paid{{ label }}
{{ w.name }} {{ w.days }} R {{ w.total_paid|money }}{% if val %}R {{ val|money }}{% else %}-{% endif %}
{% else %}

No worker payment data for this period.

{% endif %}
{# === CHAPTER IV — Team × Project Activity === #}
IVTeam × Project Activity
Distinct Work Days per Team × Project
{% if team_project_activity.rows %}
{% for col in team_project_activity.columns %} {% endfor %} {% for row in team_project_activity.rows %} {% for col in team_project_activity.columns %} {% endfor %} {% endfor %} {% for col in team_project_activity.columns %} {% endfor %}
Team{{ col.name }}Total
{{ row.team_name }} {% with days=row.cells_by_project_id|dictlookup:col.id %} {% if days %}{{ days }}{% else %}{% endif %} {% endwith %} {{ row.row_total }}
Total{{ team_project_activity.col_totals|dictlookup:col.id }}{{ team_project_activity.grand_total }}
{% else %}

No team × project activity in this period.

{% endif %}
Back to Dashboard
{# === CHOICES.JS CDN — admin-only === #} {# The pill popovers enhance their