Add monthly fee billing lines to the billing material
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]>
This commit is contained in:
@@ -8,7 +8,7 @@ use App\Modules\Billing\Domain\Enums\LineKind;
|
||||
|
||||
/**
|
||||
* A line of an invoice, without VAT: a work type's billable hours at its
|
||||
* hourly rate, a job's fixed price, or an expense. Prices and descriptions
|
||||
* hourly rate, a job's fixed price, a month's fee, or an expense. Prices and descriptions
|
||||
* are snapshots taken when the material is formed.
|
||||
*/
|
||||
final readonly class InvoiceLine
|
||||
@@ -24,6 +24,7 @@ final readonly class InvoiceLine
|
||||
public int $unitPriceCents,
|
||||
public int $vatBasisPoints,
|
||||
public int $netCents,
|
||||
public ?string $period = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -51,6 +52,14 @@ final readonly class InvoiceLine
|
||||
return new self($jobId, LineKind::FixedPrice, null, null, $description, null, null, $amountCents, $vatBasisPoints, $amountCents);
|
||||
}
|
||||
|
||||
/**
|
||||
* The fee of one month (Y-m).
|
||||
*/
|
||||
public static function monthlyFee(int $jobId, string $period, string $description, int $amountCents, int $vatBasisPoints): self
|
||||
{
|
||||
return new self($jobId, LineKind::MonthlyFee, null, null, $description, null, null, $amountCents, $vatBasisPoints, $amountCents, $period);
|
||||
}
|
||||
|
||||
public static function expense(int $jobId, int $expenseId, string $description, int $amountCents, int $vatBasisPoints): self
|
||||
{
|
||||
return new self($jobId, LineKind::Expense, null, $expenseId, $description, null, null, $amountCents, $vatBasisPoints, $amountCents);
|
||||
|
||||
Reference in New Issue
Block a user