startPeriod($clock, 'this_year'); } #[Computed] public function report(): ?ProfitabilityReport { $period = $this->period(); return $period === null ? null : app(ProfitabilityByJob::class)->execute($period, $this->includeInternal); } public function updated(): void { $this->authorize('reports.view'); unset($this->report); } public function margin(Profit $profit): string { $margin = $profit->marginCents(); return $margin === null ? '–' : $this->money($margin); } public function marginPercent(Profit $profit): string { $ratio = $profit->marginRatio(); return $ratio === null ? '–' : $this->percent($ratio); } public function hourCost(Profit $profit): string { return $profit->hourCostCents === null ? '–' : $this->money($profit->hourCostCents); } public function effectiveRate(Profit $profit): string { $cents = $profit->effectiveHourlyCents(); return $cents === null ? '–' : $this->money($cents); } public function render(): mixed { return $this->view()->title(__('reports.profitability.title')); } }; ?>

{{ __('reports.profitability.title') }}

{{ __('reports.profitability.intro') }}

@php($report = $this->report) @if ($report !== null)

{{ $this->periodLabel() }}

@if ($report->hourlyCostCents === null)
@else

{{ __('reports.profitability.cost_used', ['cost' => $this->money($report->hourlyCostCents)]) }}

@endif @if ($report->jobs === [])

{{ __('reports.profitability.none') }}

@else

{{ __('reports.profitability.by_service_unit') }}

{{ __('reports.profitability.split_note') }}

@foreach ($report->serviceUnits as $unit) @endforeach
{{ __('reports.profitability.units_table', ['period' => $this->periodLabel()]) }}
{{ __('reports.profitability.service_unit') }} {{ __('reports.profitability.jobs') }} {{ __('reports.profitability.hours') }} {{ __('reports.profitability.revenue') }} {{ __('reports.profitability.costs') }} {{ __('reports.profitability.margin') }} {{ __('reports.profitability.margin_percent') }}
{{ $unit->name !== '' ? $unit->name : __('reports.profitability.no_service_unit') }} {{ $unit->jobCount }} {{ $this->hours($unit->profit->quarters) }} {{ $this->money($unit->profit->revenueCents()) }} {{ $this->money($unit->profit->expenseCostCents + $unit->profit->materialCostCents + ($unit->profit->hourCostCents ?? 0)) }} {{ $this->margin($unit->profit) }} {{ $this->marginPercent($unit->profit) }}
@if ($report->hourlyCostCents !== null) @endif

{{ __('reports.profitability.by_job') }}

@foreach ($report->jobs as $row) @endforeach
{{ __('reports.profitability.jobs_table', ['period' => $this->periodLabel()]) }}
{{ __('reports.profitability.job') }} {{ __('reports.profitability.hours') }} {{ __('reports.profitability.billed_hours') }} {{ __('reports.profitability.work_revenue') }} {{ __('reports.profitability.expense_revenue') }} {{ __('reports.profitability.expense_cost') }} {{ __('reports.profitability.material_cost') }} {{ __('reports.profitability.hour_cost') }} {{ __('reports.profitability.margin') }} {{ __('reports.profitability.margin_percent') }} {{ __('reports.profitability.effective_rate') }}
{{ $row->job->number }} {{ $row->job->name }} {{ $row->job->customerName }}@if ($row->job->paymentBasis !== null), {{ __('jobs.payment_bases.'.$row->job->paymentBasis) }}@endif @if ($row->job->quotedAmountCents !== null), {{ __('reports.profitability.quoted', ['amount' => $this->money($row->job->quotedAmountCents)]) }}@endif {{ $this->hours($row->profit->quarters) }} {{ $this->hours($row->profit->billedQuarters) }} {{ $this->money($row->profit->workCents) }} {{ $this->money($row->profit->expenseRevenueCents) }} {{ $this->money($row->profit->expenseCostCents) }} {{ $this->money($row->profit->materialCostCents) }} {{ $this->hourCost($row->profit) }} {{ $this->margin($row->profit) }} {{ $this->marginPercent($row->profit) }} {{ $this->effectiveRate($row->profit) }}
{{ __('reports.total') }} {{ $this->hours($report->total->quarters) }} {{ $this->hours($report->total->billedQuarters) }} {{ $this->money($report->total->workCents) }} {{ $this->money($report->total->expenseRevenueCents) }} {{ $this->money($report->total->expenseCostCents) }} {{ $this->money($report->total->materialCostCents) }} {{ $this->hourCost($report->total) }} {{ $this->margin($report->total) }} {{ $this->marginPercent($report->total) }} {{ $this->effectiveRate($report->total) }}
@endif @endif