Add Reports module with the hours by person report
Management's reports (spec 13) get their own module that reads the other modules through ports. The first report sums hours by person in a period, narrowed by service unit or customer, with breakdowns, a chart and CSV. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Reports\Infrastructure\Adapters;
|
||||
|
||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||
use App\Modules\Jobs\Application\DTOs\JobReportInfo;
|
||||
use App\Modules\Jobs\Domain\Enums\PaymentBasis;
|
||||
use App\Modules\Reports\Application\Contracts\ReportJobs;
|
||||
use App\Modules\Reports\Application\DTOs\ReportJob;
|
||||
|
||||
/**
|
||||
* Customer jobs for reports through the Jobs module. As in billing, a job
|
||||
* without a payment basis is billed by its hours.
|
||||
*/
|
||||
class JobsForReports implements ReportJobs
|
||||
{
|
||||
public function __construct(private CustomerJobQueries $jobs) {}
|
||||
|
||||
public function infoOf(array $ids): array
|
||||
{
|
||||
return array_map(fn (JobReportInfo $job): ReportJob => new ReportJob(
|
||||
$job->id,
|
||||
$job->number,
|
||||
$job->name,
|
||||
$job->customerId,
|
||||
$job->customerName,
|
||||
$job->isInternal,
|
||||
$job->status->value,
|
||||
$job->paymentBasis?->value,
|
||||
! $job->isInternal && $job->paymentBasis !== PaymentBasis::NotBillable,
|
||||
! $job->isInternal && in_array($job->paymentBasis, [null, PaymentBasis::Hourly, PaymentBasis::PriceList], true),
|
||||
$job->quotedAmountCents,
|
||||
$job->serviceUnitIds,
|
||||
), $this->jobs->reportInfoOf($ids));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user