Management builds the monthly billing material (laskuaineisto) as a draft: done jobs are added as invoices of their own, combined when the customer, billing unit and reference allow it, and their billable hours are set per work type. Creating the material checks the jobs again, marks the approved hours and billable expenses billed, forms invoice lines with price and VAT snapshots and moves the jobs to "Lasku luotu". Fixed price jobs bill their quoted amount once. Billed hours keep their approval and billed expenses can no longer change. The Fennoa export and monthly fee lines come later. Co-Authored-By: Claude Opus 5.5 <[email protected]>
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\TimeTracking\Domain\Contracts;
|
|
|
|
use App\Modules\TimeTracking\Domain\Entities\TimeEntry;
|
|
use DateTimeImmutable;
|
|
|
|
interface TimeEntryRepository
|
|
{
|
|
public function findForDay(int $userId, int $taskId, DateTimeImmutable $day): ?TimeEntry;
|
|
|
|
/**
|
|
* Null when the entry does not exist or belongs to another user.
|
|
*/
|
|
public function findForUser(int $userId, int $entryId): ?TimeEntry;
|
|
|
|
public function save(TimeEntry $entry): TimeEntry;
|
|
|
|
/**
|
|
* The user's entries from $from to $to, both included.
|
|
*
|
|
* @return list<TimeEntry>
|
|
*/
|
|
public function forUserBetween(int $userId, DateTimeImmutable $from, DateTimeImmutable $to): array;
|
|
|
|
public function delete(TimeEntry $entry): void;
|
|
|
|
/**
|
|
* The job's approved entries that are not billed yet.
|
|
*
|
|
* @return list<TimeEntry>
|
|
*/
|
|
public function approvedUnbilledForJob(int $jobId): array;
|
|
|
|
/**
|
|
* The user's recorded quarters of an hour on the day, all tasks.
|
|
*/
|
|
public function quartersOn(int $userId, DateTimeImmutable $day, ?int $exceptEntryId = null): int;
|
|
}
|