Jobs billed by a fixed monthly fee get a monthly fee field, kept behind the quotes permission like the quoted amount. A billing material now has a billing month: a new draft adds every monthly fee job with something to bill, each on an invoice of its own, and bills one line for every unbilled month from the job's start up to the billing month (or its end or completion), so skipped months are caught up and no month is billed twice. Their expenses are billed alongside, their hours are covered by the fee and marked billed, and the job keeps running. Co-Authored-By: Claude Opus 5.5 <[email protected]>
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
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;
|
|
|
|
/**
|
|
* The months (Y-m) whose monthly fee is on a created material, by job.
|
|
*
|
|
* @param list<int> $jobIds
|
|
* @return array<int, list<string>>
|
|
*/
|
|
public function billedMonths(array $jobIds): array;
|
|
}
|