From 2543e093875530933905978bd85f1f8230a5c426 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 23 Jul 2026 15:14:17 +0000 Subject: [PATCH] Add include_oncosts=true to timesheets/on/{date} fetch Without this parameter, nested shifts[] only return shift.cost with no cost_with_oncosts field. The FD's PBI uses show_costs=true on timesheets and may also require include_oncosts=true to get employer oncost fields. This is the missing parameter that may explain the B.oncostTotal == baseCost issue. Co-Authored-By: Claude Sonnet 4.6 --- backend/src/lib/workforce.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/lib/workforce.js b/backend/src/lib/workforce.js index 28a87c2..58028d2 100644 --- a/backend/src/lib/workforce.js +++ b/backend/src/lib/workforce.js @@ -94,10 +94,9 @@ function weeklyFetchDates(from, to) { } // Fetch timesheets for a single date — no location param (mirrors PBI pattern). -// Returns the weekly timesheet record(s) containing this date. -// Each record: { id, user_id, shifts: [{ department_id, date, cost, leave_request_id, ... }] } +// include_oncosts=true is required to get cost_with_oncosts on nested shifts[]. async function fetchTimesheetsForDate(dateStr) { - try { return await wfFetchPaged(`/api/v2/timesheets/on/${dateStr}?show_costs=true`) } + try { return await wfFetchPaged(`/api/v2/timesheets/on/${dateStr}?show_costs=true&include_oncosts=true`) } catch { return [] } }