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:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Expenses\Infrastructure;
|
||||
|
||||
use App\Modules\Expenses\Application\Contracts\ExpenseJobs;
|
||||
use App\Modules\Expenses\Application\DTOs\ExpenseJob;
|
||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||
use App\Modules\Jobs\Application\DTOs\CustomerJobSummary;
|
||||
|
||||
/**
|
||||
* Customer jobs for expenses, read through the Jobs module's queries.
|
||||
*/
|
||||
class JobsForExpenses implements ExpenseJobs
|
||||
{
|
||||
public function __construct(private CustomerJobQueries $jobs) {}
|
||||
|
||||
public function find(int $jobId): ?ExpenseJob
|
||||
{
|
||||
return $this->findMany([$jobId])[$jobId] ?? null;
|
||||
}
|
||||
|
||||
public function findMany(array $jobIds): array
|
||||
{
|
||||
return array_map(
|
||||
fn (CustomerJobSummary $job): ExpenseJob => new ExpenseJob($job->id, $job->number, $job->name, $job->status->locksTime()),
|
||||
$this->jobs->summariesByIds($jobIds),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user