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:
2026-11-24 13:23:46 +02:00
co-authored by Claude Opus 5.5
parent 97bd23bed5
commit 5f9423a3c3
49 changed files with 799 additions and 82 deletions
@@ -5,11 +5,13 @@ declare(strict_types=1);
namespace App\Modules\Billing\Domain\Enums;
/**
* How a job is billed: its hours per work type at the hourly rates, or its
* quoted fixed price as one line. Expenses are billed separately either way.
* How a job is billed: its hours per work type at the hourly rates, its
* quoted fixed price as one line, or its monthly fee for every month.
* Expenses are billed separately in every case.
*/
enum BillingMode: string
{
case Hours = 'hours';
case FixedPrice = 'fixed_price';
case MonthlyFee = 'monthly_fee';
}
@@ -12,4 +12,5 @@ enum LineKind: string
case Hours = 'hours';
case FixedPrice = 'fixed_price';
case Expense = 'expense';
case MonthlyFee = 'monthly_fee';
}
@@ -12,4 +12,7 @@ enum MergeRefusal: string
case DifferentCustomer = 'different_customer';
case DifferentBillingUnit = 'different_billing_unit';
case DifferentReference = 'different_reference';
/** Monthly fee contracts are billed on invoices of their own (K22). */
case MonthlyFeeAlone = 'monthly_fee_alone';
}
@@ -9,10 +9,10 @@ namespace App\Modules\Billing\Domain\Enums;
*/
enum NotBillableReason: string
{
/** The job is not done. */
/** The job is not done (or for a monthly fee, not running). */
case WrongStatus = 'wrong_status';
/** Not billable, billed monthly, or the internal customer. */
/** Not billable, or the internal customer. */
case NotBillableBasis = 'not_billable_basis';
/** A consumer customer without a personal identity code. */
@@ -24,6 +24,9 @@ enum NotBillableReason: string
/** A fixed price job without a quoted amount. */
case MissingQuotedAmount = 'missing_quoted_amount';
/** No approved hours, expenses or fixed price left to bill. */
/** A monthly fee job without a monthly fee. */
case MissingMonthlyFee = 'missing_monthly_fee';
/** No approved hours, expenses, fixed price or months left to bill. */
case NothingToBill = 'nothing_to_bill';
}