Show a monthly fee job's billed periods on a page of its own
The new billing::job-months page lists the months that created billing materials have billed for a monthly fee job, with links to the materials and the total, and the months still to bill up to the current month, counted the same way as a new material counts them. The job page links to it next to the payment basis for those who manage billing. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Billing\Application\DTOs;
|
||||
|
||||
/**
|
||||
* The billing periods of a monthly fee job: the months billed on created
|
||||
* materials and the months still to bill up to the current month.
|
||||
*/
|
||||
final readonly class MonthlyBillingView
|
||||
{
|
||||
/**
|
||||
* @param list<BilledMonth> $billed Oldest first.
|
||||
* @param list<string> $unbilled Y-m, oldest first, up to the current month.
|
||||
* @param string|null $billingEndsOn Y-m-d: the job's last day or completion day, after which nothing is billed.
|
||||
*/
|
||||
public function __construct(
|
||||
public BillableJob $job,
|
||||
public array $billed,
|
||||
public array $unbilled,
|
||||
public string $currentMonth,
|
||||
public ?string $billingEndsOn,
|
||||
) {}
|
||||
|
||||
public function billedNetCents(): int
|
||||
{
|
||||
return array_sum(array_map(fn (BilledMonth $month): int => $month->netCents, $this->billed));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user