fix(core): show Amounts Owed in the employee's rate currency
Summary
Reports ā Amounts Owed showed every amount in USD under TypeORM, even for employees whose bill rate is in another currency. This PR loads the rate's currency so the grid can show it.
Why
The Amounts Owed grid formats each amount with currency: employeeRow.employee.billRateCurrency. The report's TypeORM read in TimeLogService.getOwedAmountReport selected employee.billRateValue but not employee.billRateCurrency. The currency arrived undefined, so Angular's currency pipe fell back to its default, USD. The MikroORM read loads the whole employee and already showed the right currency.
I found this while working on the weekly report's Spent column in #11575. That PR touches the same service, but it fixes a separate problem, so this one stands alone.
What changed
packages/core/src/lib/time-tracking/time-log/time-log.service.ts:getOwedAmountReport's TypeORM select addsemployee.billRateCurrency: true. Nothing else changes: the same rows, amounts and response shape, plus the currency field the grid already reads.time-log.service.spec.ts: a spec asserts that the select picks the currency with the rate and that the currency reaches the report rows.
Flags / settings and defaults
None. The field comes from the same employee row the report already returns to the same callers (route guards unchanged).
Tests
NODE_OPTIONS=--experimental-vm-modules npx jest -c packages/core/jest.config.ts --rootDir packages/core time-log.service.spec
-> Test Suites: 1 passed; Tests: 67 passed (1 new)
Manual verification still needed
With TypeORM, give an employee a EUR bill rate and open Reports ā Amounts Owed for a range with their time. The amount should show in EUR, where it showed USD before.
Notes (not in this PR)
- An employee whose rate has no currency still shows USD here. The weekly report in #11575 falls back to the organization's currency in that case, and this grid could do the same.
- The report rounds each day's amount to one decimal (
toFixed(1)), so it can be up to 5 cents off per day.
Refs #4735
š¤ Generated with Claude Code
Summary by cubic
Fixes the Amounts Owed report showing USD for every employee under TypeORM; it now displays amounts in the employee's bill rate currency, matching the MikroORM behavior. Refs #4735.
Bug Fixes
- Selects
billRateCurrencyalongsidebillRateValuein the report's TypeORM read so the grid's currency pipe has the right value. - Adds a spec covering the new select and that the currency reaches the report rows.