Add subcontract jobs section to work order PDF

Loads subcontractJobs.subcontractor relation and renders a new table
in the PDF after parts: description, subcontractor, category, client price.
Adds ru/en translations for the new section labels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-06 12:24:59 +00:00
parent 4c7cacc765
commit 2caac4ae8e
4 changed files with 38 additions and 4 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ class WorkOrderPdfService
{ {
public function generate(WorkOrder $wo): \Barryvdh\DomPDF\PDF public function generate(WorkOrder $wo): \Barryvdh\DomPDF\PDF
{ {
$wo->load(['client', 'vehicle', 'master', 'works.master', 'parts', 'payments']); $wo->load(['client', 'vehicle', 'master', 'works.master', 'parts', 'payments', 'subcontractJobs.subcontractor']);
$company = $wo->company ?: \App\Models\Central\Company::find($wo->company_id); $company = $wo->company ?: \App\Models\Central\Company::find($wo->company_id);
$themeColor = $company?->settings['theme_color'] ?? '#3B82F6'; $themeColor = $company?->settings['theme_color'] ?? '#3B82F6';
+3 -1
View File
@@ -931,7 +931,7 @@
"GPL": "LPG", "GPL": "LPG",
"GRANT — adaugă dreptul": "GRANT — add permission", "GRANT — adaugă dreptul": "GRANT — add permission",
"Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Gallery of up to 8 images. First is shown in the catalog. Max 2 MB / image.", "Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Gallery of up to 8 images. First is shown in the catalog. Max 2 MB / image.",
"Gata": "Ready", "Gata": "Done",
"Gata de ridicare": "Ready for pickup", "Gata de ridicare": "Ready for pickup",
"Gata estimat (ETA)": "Gata estimat (ETA)", "Gata estimat (ETA)": "Gata estimat (ETA)",
"Gearbox": "Gearbox", "Gearbox": "Gearbox",
@@ -1119,6 +1119,7 @@
"Lucrare blocată": "Work blocked", "Lucrare blocată": "Work blocked",
"Lucrări": "Tasks", "Lucrări": "Tasks",
"Lucrări la terți": "Subcontracted work", "Lucrări la terți": "Subcontracted work",
"Lucrări terțe": "Subcontract jobs",
"Lucrări terți": "Outsourced jobs", "Lucrări terți": "Outsourced jobs",
"Luna aceasta": "This month", "Luna aceasta": "This month",
"Luna curentă": "Current month", "Luna curentă": "Current month",
@@ -1959,6 +1960,7 @@
"Subtotal": "Subtotal", "Subtotal": "Subtotal",
"Subtotal manopere:": "Labor subtotal:", "Subtotal manopere:": "Labor subtotal:",
"Subtotal piese:": "Parts subtotal:", "Subtotal piese:": "Parts subtotal:",
"Subtotal terțe:": "Subcontract subtotal:",
"Subtotal:": "Subtotal:", "Subtotal:": "Subtotal:",
"Succes": "Success", "Succes": "Success",
"Sugerează revizie / piese de uzură.": "Suggest service / wear parts.", "Sugerează revizie / piese de uzură.": "Suggest service / wear parts.",
+4 -2
View File
@@ -931,7 +931,7 @@
"GPL": "LPG", "GPL": "LPG",
"GRANT — adaugă dreptul": "GRANT — добавить право", "GRANT — adaugă dreptul": "GRANT — добавить право",
"Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Галерея до 8 изображений. Первое отображается в каталоге. Максимум 2 МБ / изображение.", "Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Галерея до 8 изображений. Первое отображается в каталоге. Максимум 2 МБ / изображение.",
"Gata": "Готов", "Gata": "Готово",
"Gata de ridicare": "Готово к выдаче", "Gata de ridicare": "Готово к выдаче",
"Gata estimat (ETA)": "Gata estimat (ETA)", "Gata estimat (ETA)": "Gata estimat (ETA)",
"Gearbox": "КПП", "Gearbox": "КПП",
@@ -1119,6 +1119,7 @@
"Lucrare blocată": "Работа заблокирована", "Lucrare blocată": "Работа заблокирована",
"Lucrări": "Работы", "Lucrări": "Работы",
"Lucrări la terți": "Работы у субподрядчиков", "Lucrări la terți": "Работы у субподрядчиков",
"Lucrări terțe": "Сторонние работы",
"Lucrări terți": "Работы у третьих лиц", "Lucrări terți": "Работы у третьих лиц",
"Luna aceasta": "В этом месяце", "Luna aceasta": "В этом месяце",
"Luna curentă": "Текущий месяц", "Luna curentă": "Текущий месяц",
@@ -1589,7 +1590,7 @@
"Preț": "Цена", "Preț": "Цена",
"Preț achiziție": "Цена закупки", "Preț achiziție": "Цена закупки",
"Preț anual": "Годовая цена", "Preț anual": "Годовая цена",
"Preț client": "Цена клиенту", "Preț client": "Цена клиента",
"Preț contextual": "Preț contextual", "Preț contextual": "Preț contextual",
"Preț de bază (markup)": "Preț de bază (markup)", "Preț de bază (markup)": "Preț de bază (markup)",
"Preț fix": "Фикс. цена", "Preț fix": "Фикс. цена",
@@ -1959,6 +1960,7 @@
"Subtotal": "Промежуточный итог", "Subtotal": "Промежуточный итог",
"Subtotal manopere:": "Итого работы:", "Subtotal manopere:": "Итого работы:",
"Subtotal piese:": "Итого запчасти:", "Subtotal piese:": "Итого запчасти:",
"Subtotal terțe:": "Итого сторонние:",
"Subtotal:": "Подытог:", "Subtotal:": "Подытог:",
"Succes": "Успех", "Succes": "Успех",
"Sugerează revizie / piese de uzură.": "Предложите ТО / расходники.", "Sugerează revizie / piese de uzură.": "Предложите ТО / расходники.",
+30
View File
@@ -252,6 +252,36 @@
</table> </table>
@endif @endif
@if ($wo->subcontractJobs->isNotEmpty())
<h3 style="font-size: 12px; margin: 12px 0 4px; text-transform: uppercase; color: {{ $themeColor }};">{{ __('Lucrări terțe') }}</h3>
<table class="items">
<thead>
<tr>
<th style="width: 40%;">{{ __('Denumire') }}</th>
<th style="width: 20%;">{{ __('Terț') }}</th>
<th style="width: 15%;">{{ __('Categorie') }}</th>
<th class="r" style="width: 25%;">{{ __('Preț client') }}</th>
</tr>
</thead>
<tbody>
@foreach ($wo->subcontractJobs as $sj)
<tr>
<td>{{ $sj->description ?? '—' }}</td>
<td>{{ $sj->subcontractor?->name ?? '—' }}</td>
<td>{{ $sj->category ? __($sj->category) : '—' }}</td>
<td class="r"><b>{{ number_format((float) $sj->client_price, 2, '.', ' ') }}</b></td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td colspan="3" class="r">{{ __('Subtotal terțe:') }}</td>
<td class="r">{{ number_format((float) $wo->subcontractJobs->sum('client_price'), 2, '.', ' ') }} {{ $currency }}</td>
</tr>
</tfoot>
</table>
@endif
<div class="total-box"> <div class="total-box">
@if ($wo->discount_pct > 0) @if ($wo->discount_pct > 0)
<div class="total-line">{{ __('Subtotal:') }} {{ number_format((float) ($worksTotal + $partsTotal), 2, '.', ' ') }} {{ $currency }}</div> <div class="total-line">{{ __('Subtotal:') }} {{ number_format((float) ($worksTotal + $partsTotal), 2, '.', ' ') }} {{ $currency }}</div>