Add Reports module with the hours by person report

Management's reports (spec 13) get their own module that reads the other
modules through ports. The first report sums hours by person in a period,
narrowed by service unit or customer, with breakdowns, a chart and CSV.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 08:39:19 +02:00
co-authored by Claude Sonnet 5.5
parent f906f9a43f
commit 64f1e7c54a
45 changed files with 1828 additions and 3 deletions
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace App\Modules\TimeTracking\Application\Contracts;
use App\Modules\TimeTracking\Application\DTOs\ReportedHours;
use App\Modules\TimeTracking\Application\DTOs\UnbilledHours;
/**
* Hours summed for management's reports.
*/
interface TimeReportQueries
{
/**
* Hours worked from the first to the last day (Y-m-d, both included),
* summed by user, job and work type.
*
* @return list<ReportedHours>
*/
public function hoursBetween(string $from, string $to): array;
/**
* Hours not yet billed, worked on or before the day (Y-m-d), summed by
* job and work type.
*
* @return list<UnbilledHours>
*/
public function unbilledUntil(string $day): array;
}
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace App\Modules\TimeTracking\Application\DTOs;
/**
* A user's hours on a job's work type in a period, in quarter hours: all
* of them, those still waiting for approval and those already billed.
*/
final readonly class ReportedHours
{
public function __construct(
public int $userId,
public int $jobId,
public int $workTypeId,
public int $quarters,
public int $unapprovedQuarters,
public int $billedQuarters,
) {}
}
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Modules\TimeTracking\Application\DTOs;
/**
* A job's unbilled hours on a work type in quarter hours, approved and
* waiting for approval, with the first day they were worked (Y-m-d).
*/
final readonly class UnbilledHours
{
public function __construct(
public int $jobId,
public int $workTypeId,
public int $approvedQuarters,
public int $unapprovedQuarters,
public string $oldestDay,
) {}
}