From a27da90c5847bd0cf996e1706e317480fbb629d6 Mon Sep 17 00:00:00 2001 From: Konrad du Plessis Date: Thu, 23 Apr 2026 00:12:56 +0200 Subject: [PATCH] Report PDF: mirror the executive redesign (hero band + 4 chapters) PDF template updated to match the new HTML structure: cover block with static filter labels, hero KPI band (4 stacked 2x2), Chapter I lifetime (Projects + Teams full-width, Projects now with Start / Working Days / Avg-R-per-Working-Day columns), Chapter II selected period (existing Total Paid Out hero + Loans/Advances pairs + Labour Cost + Payments/Adjustments), Chapter III worker breakdown (heading renamed), Chapter IV team x project pivot (new). THIS YEAR section dropped per design doc section 3 (redundant with All Time + Selected Period). Same _build_report_context helper so HTML and PDF cannot drift in data. All numbers identical. WeasyPrint-friendly: absolute units, single-column body, no Font Awesome. Co-Authored-By: Claude Opus 4.7 (1M context) --- core/templates/core/pdf/report_pdf.html | 701 +++++++++++++++--------- 1 file changed, 447 insertions(+), 254 deletions(-) diff --git a/core/templates/core/pdf/report_pdf.html b/core/templates/core/pdf/report_pdf.html index 7671b00..28cbf61 100644 --- a/core/templates/core/pdf/report_pdf.html +++ b/core/templates/core/pdf/report_pdf.html @@ -5,17 +5,14 @@ @@ -331,6 +496,11 @@
FOXFITT CONSTRUCTION
@@ -339,168 +509,141 @@
{{ start_date|date:"d F Y" }} – {{ end_date|date:"d F Y" }}
-
{{ project_name }}  •  {{ team_name }}
- - - -
-
LIFETIME PERFORMANCE
-

All Time — Labour Cost

- - - - - - - -
-

BY PROJECT

- {% if alltime_projects %} - - {% for item in alltime_projects %} - - - - - - - {% endfor %} -
{{ forloop.counter }}{{ item.project }}R{{ item.total|money }}
- {% else %}

No project data yet.

{% endif %} -
-

BY TEAM

- {% if alltime_teams %} - - {% for item in alltime_teams %} - - - - - - - {% endfor %} -
{{ forloop.counter }}{{ item.team }}R{{ item.total|money }}
- {% else %}

No team data yet.

{% endif %} -
+
+ {{ start_date|date:"d M Y" }} – {{ end_date|date:"d M Y" }} +  ·  {{ project_name }} +  ·  {{ team_name }}
-
-
YEAR-TO-DATE
-

{{ current_year }} — Labour Cost

- - +
- - - + + -
-

BY PROJECT

- {% if year_projects %} - - {% for item in year_projects %} - - - - - - - {% endfor %} -
{{ forloop.counter }}{{ item.project }}R{{ item.total|money }}
- {% else %}

No project data for {{ current_year }}.

{% endif %} -
-

BY TEAM

- {% if year_teams %} - - {% for item in year_teams %} - - - - - - - {% endfor %} -
{{ forloop.counter }}{{ item.team }}R{{ item.total|money }}
- {% else %}

No team data for {{ current_year }}.

{% endif %} -
+
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:"d M Y 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
+ + + -
-
SELECTED PERIOD
-

Period Breakdown

+
+ ILifetime Context +
- - +

All Time — Projects

+{% if alltime_projects %} +
+ + + + + + + + {% for item in alltime_projects %} + + + + + + + + {% endfor %} +
ProjectStartWorking DaysTotal CostAvg R / Working Day
{{ item.project }}{% if item.start_date %}{{ item.start_date|date:"d M Y" }}{% else %}{% endif %}{% if item.working_days %}{{ item.working_days }}{% else %}{% endif %}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 }}
-
across {{ total_worker_days }} worker-days in this period
+
+
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 }}
- - - - - - - - -
-

LOANS

- - - - - - - - - - - -
Loans issuedR{{ loans_issued|money }}
Loans outstandingR{{ loans_outstanding|money }}
-
-

ADVANCES

- - - - - - - - - - - -
Advances issuedR{{ advances_issued|money }}
Advances outstandingR{{ advances_outstanding|money }}
-
- - +
@@ -537,7 +680,7 @@
- +
@@ -574,13 +717,14 @@
-
PER-WORKER DETAIL
-

Worker Breakdown

+
+ IIIWorker Breakdown +
{% if worker_breakdown %} @@ -612,10 +756,59 @@ {% endif %} + +
+
+ IVTeam × Project Activity +
+ + {% 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 %} + {% with days=row.cells_by_project_id|dictlookup:col.id %} + {% if days %} + + {% else %} + + {% endif %} + {% endwith %} + {% endfor %} + + + {% endfor %} + + + {% for col in team_project_activity.columns %} + + {% endfor %} + + +
Team{{ col.name }}Total
{{ row.team_name }}{{ days }}{{ 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 %} +
+ -
+