Add expenses on customer jobs

- New Expenses module: purchases (materials, other) with a description
  and cost, and mileage priced with the price list's mileage rate.
- Who paid and whether the expense is billed are separate: an employee's
  own payments are reimbursed elsewhere. A billed expense has a markup
  and a billed amount, cost plus markup unless given.
- A job's expenses page lists, adds, edits and removes them; amounts of
  others' expenses need the expenses permission, own ones always show.
  Done jobs lock their expenses.
- The Kulut menu shows the user's own expenses by month. Management
  records subcontractors' expenses, which they see but cannot change.
- The price list gets a default markup for new purchases.
- Number fields that update a calculation now use wire:model.live.blur:
  in Livewire 4 plain .blur no longer sends the value to the server,
  which also fixes the product form's VAT calculation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 08:11:27 +02:00
co-authored by Claude Opus 5.5
parent bdd8d446d8
commit 54d98d9d2f
64 changed files with 3092 additions and 9 deletions
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Modules\Expenses\Application\Contracts;
use App\Modules\Expenses\Application\DTOs\ExpenseJob;
/**
* The customer jobs expenses are recorded on. Implemented with the Jobs
* module's queries.
*/
interface ExpenseJobs
{
public function find(int $jobId): ?ExpenseJob;
/**
* @param list<int> $jobIds
* @return array<int, ExpenseJob> Keyed by job id.
*/
public function findMany(array $jobIds): array;
}
@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Modules\Expenses\Application\Contracts;
/**
* Prices expenses need from the price list. Implemented with the Catalog
* module's queries.
*/
interface ExpensePricing
{
/**
* Price of a driven kilometre in cents (VAT 0), null when not set.
*/
public function mileageRateCents(): ?int;
/**
* Markup suggested for new purchases, in hundredths of a percent.
*/
public function defaultMarkupBasisPoints(): int;
}
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace App\Modules\Expenses\Application\Contracts;
use App\Modules\Expenses\Application\DTOs\ExpenseSummary;
/**
* Read side of expenses, newest first.
*/
interface ExpenseQueries
{
/**
* @return list<ExpenseSummary>
*/
public function forJob(int $jobId): array;
/**
* A user's own expenses in a month.
*
* @param string $month As Y-m.
* @return list<ExpenseSummary>
*/
public function forUserInMonth(int $userId, string $month): array;
public function find(int $id): ?ExpenseSummary;
}