Add the unbilled hours report

Hours on customers' billable jobs that no billing material has taken,
by job and work type up to a day, valued at the hourly rates for jobs
billed by the hour, with a chart by service unit and CSV.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 08:41:43 +02:00
co-authored by Claude Sonnet 5.5
parent 64f1e7c54a
commit a57b383e4d
17 changed files with 697 additions and 45 deletions
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Modules\Reports\Application\DTOs;
/**
* A job with unbilled hours: approved and waiting for approval in quarter
* hours, their value without VAT (null when a fixed price or monthly fee
* covers them), whether a work type lacks a rate, the first day worked and
* the hours by work type.
*/
final readonly class UnbilledJob
{
/**
* @param list<UnbilledWorkType> $workTypes
*/
public function __construct(
public ReportJob $job,
public int $approvedQuarters,
public int $unapprovedQuarters,
public ?int $valueCents,
public bool $missingRate,
public string $oldestDay,
public array $workTypes,
) {}
}
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Modules\Reports\Application\DTOs;
/**
* Unbilled hours by job, oldest work first, with totals and the value of
* the hours by the work types' service units (most first).
*/
final readonly class UnbilledReport
{
/**
* @param list<UnbilledJob> $jobs
* @param array<string, int> $valueByServiceUnit
* @param array<int, string> $serviceUnits
*/
public function __construct(
public array $jobs,
public int $approvedQuarters,
public int $unapprovedQuarters,
public int $valueCents,
public array $valueByServiceUnit,
public array $serviceUnits,
) {}
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Modules\Reports\Application\DTOs;
/**
* A job's unbilled hours on one work type, in quarter hours, and their
* value without VAT (all hours × the hourly rate) when the job bills its
* hours and the work type has a rate.
*/
final readonly class UnbilledWorkType
{
public function __construct(
public string $name,
public string $serviceUnitName,
public int $approvedQuarters,
public int $unapprovedQuarters,
public ?int $rateCents,
public ?int $valueCents,
) {}
}