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]>
37 lines
973 B
PHP
37 lines
973 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Billing\Domain\Contracts;
|
|
|
|
use App\Modules\Billing\Domain\Entities\BillingExport;
|
|
|
|
interface BillingExportRepository
|
|
{
|
|
/**
|
|
* The material with its invoices, jobs, billable hours and lines. With
|
|
* $lock the row stays locked until the transaction ends.
|
|
*/
|
|
public function findById(int $id, bool $lock = false): ?BillingExport;
|
|
|
|
/**
|
|
* The id of the open draft, if there is one.
|
|
*/
|
|
public function openDraftId(): ?int;
|
|
|
|
/**
|
|
* Inserts a new material or replaces a stored one's invoices, and returns it.
|
|
*/
|
|
public function save(BillingExport $export): BillingExport;
|
|
|
|
public function delete(BillingExport $export): void;
|
|
|
|
/**
|
|
* The jobs among the given ones whose fixed price is already on a created material.
|
|
*
|
|
* @param list<int> $jobIds
|
|
* @return list<int>
|
|
*/
|
|
public function fixedPriceBilledJobIds(array $jobIds): array;
|
|
}
|