Fix timesheetLevel cost field — use t.total_cost not t.cost
The timesheets/on/{date} response has total_cost at the timesheet level,
not cost or cost_with_oncosts. Previous code was reading undefined and
summing zeros.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
241524c9ce
commit
be1ef7f99e
1 changed files with 3 additions and 2 deletions
|
|
@ -367,8 +367,9 @@ async function fetchTimesheetsByDay(from, to, locationDeptIds) {
|
|||
return locationDeptIds.has(String(sh.department_id ?? 'unknown'))
|
||||
})
|
||||
if (hasLocationShift) {
|
||||
const tCost = parseFloat(t.cost ?? 0)
|
||||
const tOncost = parseFloat(t.cost_with_oncosts ?? t.cost ?? 0)
|
||||
// Timesheet-level cost field is `total_cost` (not `cost` or `cost_with_oncosts`)
|
||||
const tCost = parseFloat(t.total_cost ?? t.cost ?? 0)
|
||||
const tOncost = parseFloat(t.cost_with_oncosts ?? t.total_cost ?? t.cost ?? 0)
|
||||
const isLeaveTs = t.leave_request_id != null
|
||||
if (isLeaveTs) { tsLeaveBaseCost += tCost; tsLeaveOncostTotal += tOncost }
|
||||
else { tsBaseCost += tCost; tsOncostTotal += tOncost }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue