Add the expense reimbursements report

The expenses employees paid themselves in a period, by person with
kilometres and amounts, printable and as CSV for payroll.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-25 08:46:22 +02:00
co-authored by Claude Sonnet 5.5
parent 568871c9dc
commit 8079c272d2
21 changed files with 639 additions and 1 deletions
@@ -2,6 +2,7 @@
namespace App\Modules\Reports\Presentation;
use App\Modules\Reports\Application\DTOs\ReimbursementEntry;
use App\Modules\Reports\Domain\ValueObjects\ReportPeriod;
use App\Modules\Shared\Domain\ValueObjects\Money;
use DateTimeImmutable;
@@ -42,6 +43,28 @@ final class ReportFormat
return number_format($ratio * 100, 1, ',', "\u{00A0}")."\u{00A0}%";
}
/**
* E.g. 125 tenths → "12,5 km".
*/
public static function kilometers(int $tenths): string
{
return number_format($tenths / 10, 1, ',', "\u{00A0}")."\u{00A0}km";
}
public static function csvKilometers(int $tenths): string
{
return number_format($tenths / 10, 1, ',', '');
}
/**
* What an expense was: its description, and for mileage the
* destination and purpose.
*/
public static function expenseText(ReimbursementEntry $expense): string
{
return implode(', ', array_filter([$expense->description, $expense->destination, $expense->purpose], fn (?string $part): bool => $part !== null && $part !== ''));
}
public static function date(string $day): string
{
return (new DateTimeImmutable($day))->format('j.n.Y');